]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/incremental-2disk
ebl Tweak regress scripts to be able to test distro binaries
[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 ${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=DDS-4 volume=TestVolume001 slot=1 Pool=Default drive=0
35 label storage=DDS-4 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 @$out
69 quit
70 END_OF_DATA
71
72 run_bconsole
73
74 check_for_zombie_jobs storage=File
75 stop_bacula
76 #
77 # Delete .c files because we will only restored the txt files
78 #
79 rm -f ${cwd}/tmp/build/*.c
80
81 check_two_logs
82 check_restore_tmp_build_diff
83
84 #
85 # This script seems to more or less randomly fail, so we
86 #  add extra code here to produce a "dump" in the event of
87 #  an error.
88 #
89 if [ $dstat != 0 -o $bstat != 0 -o $rstat != 0 ] ; then
90    cat ${cwd}/tmp/log1.out
91    echo "  "
92    cat ${cwd}/tmp/log2.out
93    echo "  "
94    diff -r ${cwd}/tmp/build ${cwd}/tmp/bacula-restores${cwd}/tmp/build
95 fi
96
97 end_test