]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/scratch-pool-test
update scratch pool test
[bacula/bacula] / regress / tests / scratch-pool-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. One minor wrinkle: we create the two tapes
7 #   in the Scratch pool, so they should be switched to the Default
8 #   Pool automatically.
9 # We set TestVolume001 to not in the changer, so the algorithm
10 #   should find TestVolume002 and use it rather than blocking.
11 #
12 #  Note we use the viritual disk autochanger
13 #
14 debug=0
15 . config.out
16 if test x${AUTOCHANGER} = x/dev/null ; then
17    echo "two-volume-test skipped. No autochanger."
18    exit
19 fi
20 if test "$debug" -eq 1 ; then
21   out="tee"
22 else
23   out="output"
24 fi
25 cwd=`pwd`
26 scripts/cleanup
27 scripts/copy-2disk-confs
28 scripts/prepare-two-disks
29  
30 echo "${cwd}/build" >/tmp/file-list
31
32 outf="tmp/sed_tmp"
33 echo "s%# Maximum File Size%  Maximum File Size%g" >${outf}
34 cp ${cwd}/bin/bacula-sd.conf ${cwd}/tmp/1
35 sed -f ${outf} ${cwd}/tmp/1 >${cwd}/bin/bacula-sd.conf
36
37 echo " "
38 echo " "
39 echo " === Starting Scratch Pool Test at `date +%R:%S` ==="
40 echo " === Starting Scratch Pool Test at `date +%R:%S` ===" >>working/log
41 echo " "
42 # Write out bconsole commands
43 cat <<END_OF_DATA >tmp/bconcmds
44 @$out /dev/null
45 messages
46 @$out tmp/log1.out
47 label storage=DDS-4 volume=TestVolume001 slot=1 pool=Scratch drive=0
48 label storage=DDS-4 volume=TestVolume002 slot=2 pool=Scratch drive=0
49 update Volume=TestVolume001 MaxVolBytes=2000000 pool=Scratch drive=0
50 update Volume=TestVolume001 inchanger=no pool=Scratch drive=0
51 @#setdebug level=200 storage=DDS-4
52 llist volume=TestVolume001
53 llist volume=TestVolume002
54 run job=NightlySave yes
55 wait
56 messages
57 list volumes
58 llist volume=TestVolume001
59 @# 
60 @# now do a restore
61 @#
62 @$out tmp/log2.out
63 restore where=${cwd}/tmp/bacula-restores select all storage=DDS-4 done
64 yes
65 wait
66 messages
67 @$out
68 quit
69 END_OF_DATA
70
71 if test "$debug" -eq 1 ; then
72   bin/bacula start
73   cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf
74 else
75   bin/bacula start 2>&1 >/dev/null
76   cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf  2>&1 >/dev/null
77 fi
78 scripts/check_for_zombie_jobs storage=DDS-4
79
80 bin/bacula stop 2>&1 >/dev/null
81 grep "^  Termination: *Backup OK" tmp/log1.out 2>&1 >/dev/null
82 bstat=$?
83 grep "^  Termination: *Restore OK" tmp/log2.out 2>&1 >/dev/null
84 rstat=$?
85 diff -r build tmp/bacula-restores${cwd}/build 2>&1 >/dev/null
86 if [ $? != 0 -o $bstat != 0 -o $rstat != 0 ] ; then
87    echo " "
88    echo " "
89    echo "  !!!!! Scratch Pool Test Bacula source failed!!! !!!!! "
90    echo "  !!!!! Scratch Pool Test failed!!! !!!!! " >>test.out
91    echo " "
92 else
93    echo "  ===== Scratch Pool Test Bacula source OK `date +%R:%S` ===== "
94    echo "  ===== Scratch Pool Test OK `date +%R:%S` ===== " >>test.out
95    scripts/cleanup
96 fi