]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/incremental-2disk
regress: tweak prune-migration-test
[bacula/bacula] / regress / tests / incremental-2disk
1 #!/bin/sh
2 #
3 # Run a simple backup of the Bacula build directory then create some           
4 #   new files, do an Incremental and restore those two files.
5 #
6 # This script uses the virtual disk autochanger
7 #
8 TestName="incremental-2disk"
9 JobName=Inc2disk
10 . scripts/functions
11
12 scripts/cleanup
13 scripts/copy-2disk-confs
14 scripts/prepare-disk-changer
15
16 echo "${cwd}/tmp/build" >${cwd}/tmp/file-list
17 if test ! -d ${cwd}/tmp/build ; then
18    mkdir -p ${cwd}/tmp/build
19 fi
20 cp -p ${cwd}/build/src/dird/*.c ${cwd}/tmp/build
21 cd ${cwd}/tmp
22 echo "${cwd}/tmp/build/ficheriro1.txt" >restore-list
23 echo "${cwd}/tmp/build/ficheriro2.txt" >>restore-list
24 cd ${cwd}
25
26 change_jobname $JobName
27 start_test
28
29 # Write out bconsole commands
30 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
31 @$out /dev/null
32 messages
33 @$out ${cwd}/tmp/log1.out
34 label storage=tape volume=TestVolume001 slot=1 Pool=Default drive=0
35 label storage=tape volume=TestVolume002 slot=2 Pool=Default drive=0
36 run job=$JobName yes
37 wait
38 messages
39 quit
40 END_OF_DATA
41
42 run_bacula
43
44 echo "ficheriro1.txt" >${cwd}/tmp/build/ficheriro1.txt
45 echo "ficheriro2.txt" >${cwd}/tmp/build/ficheriro2.txt
46
47
48 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
49 @$out /dev/null
50 messages
51 @$out ${cwd}/tmp/log1.out
52 @# Force Incremental on the second Volume
53 update volume=TestVolume001 VolStatus=Used
54 run level=Incremental job=$JobName yes
55 wait
56 messages
57 @# 
58 @# now do a restore
59 @#
60 @$out ${cwd}/tmp/log2.out
61 restore where=${cwd}/tmp/bacula-restores 
62 7
63 <${cwd}/tmp/restore-list
64
65 yes
66 wait
67 messages
68 quit
69 END_OF_DATA
70
71 run_bconsole
72
73 check_for_zombie_jobs storage=File
74 stop_bacula
75 #
76 # Delete .c files because we will only restored the txt files
77 #
78 rm -f ${cwd}/tmp/build/*.c
79
80 check_two_logs
81 check_restore_tmp_build_diff
82
83 #
84 # This script seems to more or less randomly fail, so we
85 #  add extra code here to produce a "dump" in the event of
86 #  an error.
87 #
88 if [ $dstat != 0 -o $bstat != 0 -o $rstat != 0 ] ; then
89    cat ${cwd}/tmp/log1.out
90    echo "  "
91    cat ${cwd}/tmp/log2.out
92    echo "  "
93    diff -r ${cwd}/tmp/build ${cwd}/tmp/bacula-restores${cwd}/tmp/build
94 fi
95
96 end_test