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