]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/bscan-test
Update for new restore
[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 bin/bacula stop 2>&1 >/dev/null
13 cd bin
14 ./drop_bacula_tables >/dev/null 2>&1
15 ./make_bacula_tables >/dev/null 2>&1
16 ./grant_bacula_privileges 2>&1 >/dev/null
17 cd ..
18
19 echo " "
20 echo " "
21 echo " === Starting bscan-test  ==="
22 echo " === Starting bscan-test  ===" >working/log
23 echo " "
24
25 bin/bacula start 2>&1 >/dev/null
26 bin/bconsole -c bin/bconsole.conf <<END_OF_DATA
27 @output /dev/null
28 messages
29 @output tmp/log1.out
30 label storage=File1
31 TestVolume001
32 label storage=File1
33 TestVolume002
34 update Volume=TestVolume001 MaxVolBytes=3000000
35 run job=NightlySave storage=File1
36 yes
37 wait
38 messages
39 @output /dev/null
40 @#
41 @# now purge the Volume
42 @#
43 purge volume=TestVolume001
44 purge volume=TestVolume002
45 delete volume=TestVolume001
46 yes
47 delete volume=TestVolume002
48 yes
49 messages
50 quit
51 END_OF_DATA
52 bin/bacula stop 2>&1 >/dev/null
53 echo "volume=TestVolume001|TestVolume002" >tmp/bscan.bsr
54 bin/bscan -w working -m -s -v -b tmp/bscan.bsr -c bin/bacula-sd.conf ${cwd}/tmp 2>&1 >/dev/null
55 bin/bacula start 2>&1 >/dev/null
56 bin/bconsole -c bin/bconsole.conf <<END_OF_DATA
57 @output /dev/null
58 messages
59 @output tmp/log2.out
60 @# 
61 @# now do a restore
62 @#
63 restore where=${cwd}/tmp/bacula-restores select all storage=File1
64 yes
65 wait
66 messages
67 @output
68 quit
69 END_OF_DATA
70 bin/bacula stop 2>&1 >/dev/null
71 grep "^Termination: *Backup OK" tmp/log1.out 2>&1 >/dev/null
72 bstat=$?
73 grep "^Termination: *Restore OK" tmp/log2.out 2>&1 >/dev/null
74 rstat=$?
75 diff -r build  tmp/bacula-restores${cwd}/build 2>&1 >/dev/null
76 if [ $? != 0 -o $bstat != 0 -o $rstat != 0 ] ; then
77    echo " "
78    echo " "
79    echo "  !!!!! bscan-test Bacula source failed!!! !!!!! "
80    echo "  !!!!! bscan-test failed!!! !!!!! " >>test.out
81    echo " "
82 else
83    echo "  ===== bscan-test Bacula source OK ===== "
84    echo "  ===== bscan-test OK ===== " >>test.out
85    scripts/cleanup
86 fi