]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/span-vol-test
Final changes
[bacula/bacula] / regress / tests / span-vol-test
1 #!/bin/sh
2 #
3 # Run a simple backup of the Bacula build directory but 
4 #   split the archive into four volumes, two of which are
5 #   totally full. I.e. make sure that bsr selects all tapes 
6 #   including those fully spanned.
7 #
8 debug=0
9 if test "$debug" -eq 1 ; then
10   out="tee"
11 else
12   out="output"
13 fi
14
15 cwd=`pwd`
16 scripts/copy-test-confs
17 scripts/cleanup
18 echo "${cwd}/build" >/tmp/file-list
19
20 echo " "
21 echo " "
22 echo " === Starting span-vol-test at `date +%R:%S` ==="
23 echo " === Starting span-vol-test at `date +%R:%S` ===" >working/log
24 echo " "
25
26 cat <<END_OF_DATA >tmp/bconcmds
27 @$out /dev/null
28 messages
29 @$out tmp/log1.out
30 label storage=File1 volume=TestVolume004
31 label storage=File1 volume=TestVolume003
32 label storage=File1 volume=TestVolume002
33 label storage=File1 volume=TestVolume001
34 update Volume=TestVolume004 MaxVolBytes=3000000
35 update Volume=TestVolume003 MaxVolBytes=3000000
36 update Volume=TestVolume002 MaxVolBytes=3000000
37 run job=NightlySave storage=File1 yes
38 wait
39 list volumes
40 messages
41 @# 
42 @# now do a restore
43 @#
44 @$out tmp/log2.out
45 restore where=${cwd}/tmp/bacula-restores select storage=File1
46 unmark *
47 mark *
48 done
49 yes
50 wait
51 messages
52 @$out
53 quit
54 END_OF_DATA
55
56 if test "$debug" -eq 1 ; then
57   bin/bacula start
58   cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf
59 else
60   bin/bacula start 2>&1 >/dev/null
61   cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf  2>&1 >/dev/null
62 fi
63
64 scripts/check_for_zombie_jobs storage=File1
65 bin/bacula stop 2>&1 >/dev/null
66 grep "^  Termination: *Backup OK" tmp/log1.out 2>&1 >/dev/null
67 bstat=$?
68 grep "^  Termination: *Restore OK" tmp/log2.out 2>&1 >/dev/null
69 rstat=$?
70 diff -r build  tmp/bacula-restores${cwd}/build 2>&1 >/dev/null
71 if [ $? != 0 -o $bstat != 0 -o $rstat != 0 ] ; then
72    echo " "
73    echo " "
74    echo "  !!!!! span-vol-test Bacula source failed!!! !!!!! "
75    echo "  !!!!! span-vol-test failed!!! !!!!! " >>test.out
76    if [ $bstat != 0 -o $rstat != 0 ] ; then
77       echo "  !!!!! Bad Job termination status     !!!!! "
78       echo "  !!!!! Bad Job termination status     !!!!! " >>test.out
79    else
80       echo "  !!!!! Restored files differ          !!!!! "
81       echo "  !!!!! Restored files differ          !!!!! " >>test.out
82    fi
83    echo " "
84 else
85    echo "  ===== span-vol-test Bacula source OK ===== "
86    echo "  ===== span-vol-test OK ===== " >>test.out
87    scripts/cleanup
88 fi