]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/two-volume-test
commit changes
[bacula/bacula] / regress / tests / two-volume-test
1 #!/bin/sh
2 #
3 # Run a simple backup of the Bacula build directory 
4 #  to two tapes where the maximum tape file size is set to 1M
5 #  Note, this test simulates the tape filling and writing to
6 #   the next tape.
7 #
8 #  Note we use the viritual disk autochanger
9 #
10 . config.out
11 if test x${AUTOCHANGER} = x/dev/null ; then
12    echo "two-volume-test skipped. No autochanger."
13    exit
14 fi
15 debug=0
16 if test "$debug" -eq 1 ; then
17   out="tee"
18 else
19   out="output"
20 fi
21 cwd=`pwd`
22 scripts/cleanup
23 scripts/copy-2disk-confs
24 scripts/prepare-two-disks
25  
26 echo "${cwd}/build" >/tmp/file-list
27
28 outf="tmp/sed_tmp"
29 echo "s%# Maximum File Size%  Maximum File Size%g" >${outf}
30 cp ${cwd}/bin/bacula-sd.conf ${cwd}/tmp/1
31 sed -f ${outf} ${cwd}/tmp/1 >${cwd}/bin/bacula-sd.conf
32
33 echo " "
34 echo " "
35 echo " === Starting Two Volume Test at `date +%R:%S` ==="
36 echo " === Starting Two Volume Test at `date +%R:%S` ===" >>working/log
37 echo " "
38 # Write out bconsole commands
39 cat <<END_OF_DATA >tmp/bconcmds
40 @$out /dev/null
41 messages
42 @$out tmp/log1.out
43 label storage=DDS-4 volume=TestVolume001 slot=1 pool=Default drive=0
44 label storage=DDS-4 volume=TestVolume002 slot=2 pool=Default drive=0
45 update Volume=TestVolume001 MaxVolBytes=3000000 pool=Default drive=0
46 @#setdebug level=1000 client 
47 run job=NightlySave yes
48 wait
49 messages
50 @# 
51 @# now do a restore
52 @#
53 @$out tmp/log2.out
54 restore where=${cwd}/tmp/bacula-restores select all storage=DDS-4 done
55 yes
56 wait
57 messages
58 @$out
59 quit
60 END_OF_DATA
61
62 if test "$debug" -eq 1 ; then
63   bin/bacula start
64   cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf
65 else
66   bin/bacula start 2>&1 >/dev/null
67   cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf  2>&1 >/dev/null
68 fi
69 scripts/check_for_zombie_jobs storage=DDS-4
70
71 bin/bacula stop 2>&1 >/dev/null
72 grep "^  Termination: *Backup OK" tmp/log1.out 2>&1 >/dev/null
73 bstat=$?
74 grep "^  Termination: *Restore OK" tmp/log2.out 2>&1 >/dev/null
75 rstat=$?
76 diff -r build tmp/bacula-restores${cwd}/build 2>&1 >/dev/null
77 if [ $? != 0 -o $bstat != 0 -o $rstat != 0 ] ; then
78    echo " "
79    echo " "
80    echo "  !!!!! Two Volume Test Bacula source failed!!! !!!!! "
81    echo "  !!!!! Two Volume Test failed!!! !!!!! " >>test.out
82    echo " "
83 else
84    echo "  ===== Two Volume Test Bacula source OK ===== "
85    echo "  ===== Two Volume Test OK ===== " >>test.out
86 #  scripts/cleanup
87 fi