]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/two-jobs-test
Update for new restore
[bacula/bacula] / regress / tests / two-jobs-test
1 #!/bin/sh
2 #
3 # Run a simple backup of the Bacula build directory using the compressed option
4 #   then backup a second time and finally 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 two-jobs-test  ==="
20 echo " === Starting two-jobs-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 estimate job=CompressedTest listing
27 estimate job=CompressedTest listing
28 estimate job=CompressedTest listing
29 messages
30 @output tmp/log1.out
31 label storage=File volume=TestVolume001
32 run job=CompressedTest yes
33 wait
34 messages
35 quit
36 END_OF_DATA
37 echo "Backup 1 done"
38 touch ${cwd}/build/src/dird/*.c
39 #
40 # run a second job
41 #
42 bin/bconsole -c bin/bconsole.conf <<END_OF_DATA
43 @output /dev/null
44 messages
45 @output tmp/log1.out
46 run job=CompressedTest
47 yes
48 wait
49 messages
50 @# 
51 @# now do several restores to ensure we cleanup between jobs
52 @#
53 @output /dev/null
54 restore where=${cwd}/tmp/bacula-restores select all storage=File
55 yes
56 wait
57 restore where=${cwd}/tmp/bacula-restores select all storage=File
58 yes
59 wait
60 @output tmp/log2.out
61 restore where=${cwd}/tmp/bacula-restores select all storage=File
62 yes
63 wait
64 messages
65 @output
66 quit
67 END_OF_DATA
68 bin/bacula stop 2>&1 >/dev/null
69 grep "^Termination: *Backup OK" tmp/log1.out 2>&1 >/dev/null
70 bstat=$?
71 grep "^Termination: *Restore OK" tmp/log2.out 2>&1 >/dev/null
72 rstat=$?
73 diff -r build tmp/bacula-restores${cwd}/build 2>&1 >/dev/null
74 if [ $? != 0 -o $bstat != 0 -o $rstat != 0 ] ; then
75    echo " "
76    echo " "
77    echo "  !!!!! two-jobs-test Bacula source failed!!! !!!!! "
78    echo "  !!!!! two-jobs-test failed!!! !!!!! " >>test.out
79    echo " "
80 else
81    echo "  ===== two-jobs-test Bacula source OK ===== "
82    echo "  ===== two-jobs-test OK ===== " >>test.out
83    scripts/cleanup
84 fi