]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/bscan-test
8de719c964fbcd6ffc8f168eb0685ee1f069272a
[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 messages
25 @output tmp/log1.out
26 label storage=File1
27 TestVolume001
28 label storage=File1
29 TestVolume002
30 update Volume=TestVolume001
31 6
32 3000000
33 10
34 run job=NightlySave storage=File1
35 yes
36 wait
37 messages
38 @output /dev/null
39 @#
40 @# now purge the Volume
41 @#
42 purge volume=TestVolume001
43 purge volume=TestVolume002
44 delete volume=TestVolume001
45 yes
46 delete volume=TestVolume002
47 yes
48 messages
49 quit
50 END_OF_DATA
51 bin/bacula stop 2>&1 >/dev/null
52 echo "volume=TestVolume001|TestVolume002" >tmp/bscan.bsr
53 bin/bscan -w working -m -s -v -b tmp/bscan.bsr -c bin/bacula-sd.conf ${cwd}/tmp 2>&1 >/dev/null
54 bin/bacula start 2>&1 >/dev/null
55 bin/console -c bin/console.conf <<END_OF_DATA
56 messages
57 @output tmp/log2.out
58 @# 
59 @# now do a restore
60 @#
61 restore where=${cwd}/tmp/bacula-restores
62 5
63 done
64 yes
65 wait
66 messages
67 quit
68 END_OF_DATA
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
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    echo " "
81 else
82    echo "  ===== bscan-test Bacula source OK ===== "
83    echo "  ===== bscan-test OK ===== " >>test.out
84    scripts/cleanup
85 fi