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