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