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