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