]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/sparse-test
40c84b83b06dfa6b904f0ec1f1f1267652c15e8d
[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 bin/bacula stop 2>&1 >/dev/null
11 cd bin
12 ./drop_bacula_tables >/dev/null 2>&1
13 ./make_bacula_tables >/dev/null 2>&1
14 ./grant_bacula_privileges 2>&1 >/dev/null
15 cd ..
16
17 echo " "
18 echo " "
19 echo " === Starting sparse-test ==="
20 echo " === Starting sparse-test ===" >>working/log
21 echo " "
22
23 bin/bacula start 2>&1 >/dev/null
24 bin/bconsole -c bin/bconsole.conf <<END_OF_DATA
25 @output /dev/null
26 messages
27 @output tmp/log1.out
28 label storage=File volume=TestVolume001
29 run job=SparseTest yes
30 wait
31 messages
32 @# 
33 @# now do a restore
34 @#
35 @output tmp/log2.out
36 restore where=${cwd}/tmp/bacula-restores select storage=File
37 unmark *
38 mark *
39 done
40 yes
41 wait
42 messages
43 @output
44 quit
45 END_OF_DATA
46 scripts/check_for_zombie_jobs storage=File 
47 bin/bacula stop 2>&1 >/dev/null
48 grep "^Termination: *Backup OK" tmp/log1.out 2>&1 >/dev/null
49 bstat=$?
50 grep "^Termination: *Restore OK" tmp/log2.out 2>&1 >/dev/null
51 rstat=$?
52 diff -r build tmp/bacula-restores${cwd}/build 2>&1 >/dev/null
53 if [ $? != 0 -o $bstat != 0 -o $rstat != 0 ] ; then
54    echo " "
55    echo " "
56    echo "  !!!!! sparse-test Bacula source failed!!! !!!!! "
57    echo "  !!!!! sparse-test failed!!! !!!!! " >>test.out
58    echo " "
59 else
60    echo "  ===== sparse-test Bacula source OK ===== "
61    echo "  ===== sparse-test OK ===== " >>test.out
62    scripts/cleanup
63 fi