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