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