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