]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/bscan-test
1db3c0b157b7ef38d2b5f544470cbc35758c1d40
[bacula/bacula] / regress / tests / bscan-test
1 #!/bin/sh
2 #
3 # Run a simple backup of the Bacula build directory but 
4 #   split the archive into two volumes then bscan it
5 #   into the catalog after the backup. It also to a limited
6 #   extent tests the purge volume and delete volume commands.
7 #
8 cwd=`pwd`
9 scripts/copy-test-confs
10 scripts/cleanup
11 echo "${cwd}/build" >/tmp/file-list
12
13 echo " "
14 echo " "
15 echo " === Starting bscan-test at `date +%R:%S` ==="
16 echo " === Starting bscan-test at `date +%R:%S` ===" >working/log
17 echo " "
18
19 bin/bacula start 2>&1 >/dev/null
20 bin/bconsole -c bin/bconsole.conf <<END_OF_DATA 2>&1 >/dev/null
21 #bin/bconsole -c bin/bconsole.conf <<END_OF_DATA
22 @output /dev/null
23 messages
24 @output tmp/log1.out
25 label storage=File1
26 TestVolume001
27 label storage=File1
28 TestVolume002
29 update Volume=TestVolume001 MaxVolBytes=3000000
30 run job=NightlySave storage=File1
31 yes
32 wait
33 messages
34 @output /dev/null
35 @#
36 @# now purge the Volume
37 @#
38 purge volume=TestVolume001
39 purge volume=TestVolume002
40 delete volume=TestVolume001
41 yes
42 delete volume=TestVolume002
43 yes
44 messages
45 quit
46 END_OF_DATA
47 scripts/check_for_zombie_jobs storage=File1
48 bin/bacula stop 2>&1 >/dev/null
49 echo "volume=TestVolume001|TestVolume002" >tmp/bscan.bsr
50 bin/bscan -w working -m -s -v -b tmp/bscan.bsr -c bin/bacula-sd.conf ${cwd}/tmp 2>&1 >/dev/null
51 #bin/bscan -w working -m -s -v -b tmp/bscan.bsr -c bin/bacula-sd.conf ${cwd}/tmp
52 bin/bacula start 2>&1 >/dev/null
53 bin/bconsole -c bin/bconsole.conf <<END_OF_DATA 2>&1 >/dev/null
54 #bin/bconsole -c bin/bconsole.conf <<END_OF_DATA
55 @output /dev/null
56 messages
57 @output tmp/log2.out
58 @# 
59 @# now do a restore
60 @#
61 restore bootstrap=${cwd}/tmp/kern.bsr where=${cwd}/tmp/bacula-restores select all storage=File1 done
62 yes
63 wait
64 messages
65 @output
66 quit
67 END_OF_DATA
68 scripts/check_for_zombie_jobs storage=File1
69 bin/bacula stop 2>&1 >/dev/null
70 grep "^  Termination: *Backup OK" tmp/log1.out 2>&1 >/dev/null
71 bstat=$?
72 grep "^  Termination: *Restore OK" tmp/log2.out 2>&1 >/dev/null
73 rstat=$?
74 diff -r build  tmp/bacula-restores${cwd}/build 2>&1 >/dev/null
75 if [ $? != 0 -o $bstat != 0 -o $rstat != 0 ] ; then
76    echo " "
77    echo " "
78    echo "  !!!!! bscan-test Bacula source failed!!! !!!!! "
79    echo "  !!!!! bscan-test failed!!! !!!!! " >>test.out
80    if [ $bstat != 0 -o $rstat != 0 ] ; then
81       echo "  !!!!! Bad Job termination status     !!!!! "
82       echo "  !!!!! Bad Job termination status     !!!!! " >>test.out
83    else
84       echo "  !!!!! Restored files differ          !!!!! "
85       echo "  !!!!! Restored files differ          !!!!! " >>test.out
86    fi
87    echo " "
88 else
89    echo "  ===== bscan-test Bacula source OK ===== "
90    echo "  ===== bscan-test OK ===== " >>test.out
91 #  scripts/cleanup
92 fi