]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/four-jobs-test
Update for all/done restore changes
[bacula/bacula] / regress / tests / four-jobs-test
1 #!/bin/sh
2 #
3 # Run a simple backup of the Bacula build directory using the compressed option
4 #   then backup four times, each with incremental then finally restore.
5 #   It should require at least 4 different bsrs.
6 #
7 cwd=`pwd`
8 scripts/copy-test-confs
9 scripts/cleanup
10 echo "${cwd}/build" >/tmp/file-list
11 bin/bacula stop 2>&1 >/dev/null
12 cd bin
13 ./drop_bacula_tables >/dev/null 2>&1
14 ./make_bacula_tables >/dev/null 2>&1
15 ./grant_bacula_privileges 2>&1 >/dev/null
16 cd ..
17
18 echo " "
19 echo " "
20 echo " === Starting four-jobs-test  ==="
21 echo " === Starting four-jobs-test  ===" >>working/log
22 echo " "
23
24 bin/bacula start 2>&1 >/dev/null
25 bin/bconsole -c bin/bconsole.conf <<END_OF_DATA
26 @output /dev/null
27 estimate job=CompressedTest listing
28 estimate job=CompressedTest listing
29 estimate job=CompressedTest listing
30 messages
31 @output tmp/log1.out
32 label storage=File volume=TestVolume001
33 run job=CompressedTest yes
34 wait
35 messages
36 quit
37 END_OF_DATA
38 scripts/check_for_zombie_jobs storage=File
39 echo "Backup 1 done"
40 # make some files for the incremental to pick up
41 touch ${cwd}/build/src/dird/*.c ${cwd}/build/src/dird/*.o
42 touch ${cwd}/build/src/lib/*.c ${cwd}/build/src/lib/*.o
43    
44 #
45 # run a second job
46 #
47 bin/bconsole -c bin/bconsole.conf <<END_OF_DATA
48 @output /dev/null
49 messages
50 @output tmp/log1.out
51 run job=CompressedTest
52 yes
53 wait
54 messages
55 quit
56 END_OF_DATA
57 scripts/check_for_zombie_jobs storage=File
58 echo "Backup 2 done"
59 touch ${cwd}/build/src/dird/*.c
60 touch ${cwd}/build/src/lib/*.c ${cwd}/build/src/lib/*.o
61 #
62 # run a third job
63 #
64 bin/bconsole -c bin/bconsole.conf <<END_OF_DATA
65 @output /dev/null
66 messages
67 @output tmp/log1.out
68 label storage=File volume=TestVolume001
69 run job=CompressedTest yes
70 wait
71 messages
72 quit
73 END_OF_DATA
74 scripts/check_for_zombie_jobs storage=File
75 echo "Backup 3 done"
76 # make some files for the incremental to pick up
77 touch ${cwd}/build/src/lib/*.c ${cwd}/build/src/lib/*.o
78 #
79 # run a fourth job
80 #
81 bin/bconsole -c bin/bconsole.conf <<END_OF_DATA
82 @output /dev/null
83 messages
84 @output tmp/log1.out
85 label storage=File volume=TestVolume001
86 run job=CompressedTest yes
87 wait
88 messages
89 quit
90 END_OF_DATA
91 scripts/check_for_zombie_jobs storage=File
92 echo "Backup 4 done"
93
94 # now do several restores to ensure we cleanup between jobs
95 #
96 bin/bconsole -c bin/bconsole.conf <<END_OF_DATA
97 @output /dev/null
98 restore where=${cwd}/tmp/bacula-restores select all storage=File done
99 yes
100 wait
101 restore where=${cwd}/tmp/bacula-restores select all storage=File done
102 yes
103 wait
104 @output tmp/log2.out
105 restore where=${cwd}/tmp/bacula-restores select storage=File
106 unmark *
107 mark *
108 done
109 yes
110 wait
111 messages
112 @output
113 quit
114 END_OF_DATA
115 scripts/check_for_zombie_jobs storage=File
116 bin/bacula stop 2>&1 >/dev/null
117 grep "^Termination: *Backup OK" tmp/log1.out 2>&1 >/dev/null
118 bstat=$?
119 grep "^Termination: *Restore OK" tmp/log2.out 2>&1 >/dev/null
120 rstat=$?
121 diff -r build tmp/bacula-restores${cwd}/build 2>&1 >/dev/null
122 if [ $? != 0 -o $bstat != 0 -o $rstat != 0 ] ; then
123    echo " "
124    echo " "
125    echo "  !!!!! four-jobs-test Bacula source failed!!! !!!!! "
126    echo "  !!!!! four-jobs-test failed!!! !!!!! " >>test.out
127    echo " "
128 else
129    echo "  ===== four-jobs-test Bacula source OK ===== "
130    echo "  ===== four-jobs-test OK ===== " >>test.out
131    scripts/cleanup
132 fi