]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/backup-bacula-test
Final changes
[bacula/bacula] / regress / tests / backup-bacula-test
1 #!/bin/sh
2 #
3 # Run a simple backup of the Bacula build directory
4 #   then restore it.
5 #
6 cwd=`pwd`
7 scripts/copy-confs
8 scripts/cleanup
9
10 echo " "
11 echo " "
12 echo " === Starting Backup Bacula Test ==="
13 echo " === Starting Backup Bacula Test ===" >>working/log
14 echo " "
15
16 bin/bacula start 2>&1 >/dev/null
17 bin/bconsole -c bin/bconsole.conf <<END_OF_DATA
18 @output /dev/null
19 messages
20 @output tmp/log1.out
21 label volume=TestVolume001
22 run job=Client1 yes
23 wait
24 messages
25 @# 
26 @# now do a restore
27 @#
28 @output tmp/log2.out  
29 restore where=${cwd}/tmp/bacula-restores select all done
30 yes
31 wait
32 messages
33 @output
34 quit
35 END_OF_DATA
36 scripts/check_for_zombie_jobs storage=File
37 bin/bacula stop 2>&1 >/dev/null
38 grep "^Termination: *Backup OK" tmp/log1.out 2>&1 >/dev/null
39 bstat=$?
40 grep "^Termination: *Restore OK" tmp/log2.out 2>&1 >/dev/null
41 rstat=$?
42 diff -r build tmp/bacula-restores${cwd}/build 2>&1 >/dev/null
43 if [ $? != 0 -o $bstat != 0 -o $rstat != 0 ] ; then
44    echo " "
45    echo " "
46    echo "  !!!!! Backup Bacula Test failed!!! !!!!! "
47    echo "  !!!!! Backup Bacula Test failed!!! !!!!! " >>test.out
48    if [ $bstat != 0 -o $rstat != 0 ] ; then
49       echo "  !!!!! Bad Job termination status     !!!!! "
50       echo "  !!!!! Bad Job termination status     !!!!! " >>test.out
51    else
52       echo "  !!!!! Restored files differ          !!!!! "
53       echo "  !!!!! Restored files differ          !!!!! " >>test.out
54    fi
55    echo " "
56 else
57    echo "  ===== Backup Bacula Test OK ===== "
58    echo "  ===== Backup Bacula Test OK ===== " >>test.out
59    scripts/cleanup
60 fi