]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/four-jobs-test
replace references to sqlite scripts with generic bacula scripts.
[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 echo "Backup 1 done"
39 # make some files for the incremental to pick up
40 touch ${cwd}/build/src/dird/*.c ${cwd}/build/src/dird/*.o
41 touch ${cwd}/build/src/lib/*.c ${cwd}/build/src/lib/*.o
42    
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 quit
55 END_OF_DATA
56 echo "Backup 2 done"
57 touch ${cwd}/build/src/dird/*.c
58 touch ${cwd}/build/src/lib/*.c ${cwd}/build/src/lib/*.o
59 #
60 # run a third job
61 #
62 bin/bconsole -c bin/bconsole.conf <<END_OF_DATA
63 @output /dev/null
64 messages
65 @output tmp/log1.out
66 label storage=File volume=TestVolume001
67 run job=CompressedTest yes
68 wait
69 messages
70 quit
71 END_OF_DATA
72 echo "Backup 3 done"
73 # make some files for the incremental to pick up
74 touch ${cwd}/build/src/lib/*.c ${cwd}/build/src/lib/*.o
75 #
76 # run a fourth job
77 #
78 bin/bconsole -c bin/bconsole.conf <<END_OF_DATA
79 @output /dev/null
80 messages
81 @output tmp/log1.out
82 label storage=File volume=TestVolume001
83 run job=CompressedTest yes
84 wait
85 messages
86 quit
87 END_OF_DATA
88 echo "Backup 4 done"
89
90 # now do several restores to ensure we cleanup between jobs
91 #
92 bin/bconsole -c bin/bconsole.conf <<END_OF_DATA
93 @output /dev/null
94 restore where=${cwd}/tmp/bacula-restores select all
95 yes
96 wait
97 restore where=${cwd}/tmp/bacula-restores select all
98 yes
99 wait
100 @output tmp/log2.out
101 restore where=${cwd}/tmp/bacula-restores select all
102 yes
103 wait
104 messages
105 @output
106 quit
107 END_OF_DATA
108 bin/bacula stop 2>&1 >/dev/null
109 grep "^Termination: *Backup OK" tmp/log1.out 2>&1 >/dev/null
110 bstat=$?
111 grep "^Termination: *Restore OK" tmp/log2.out 2>&1 >/dev/null
112 rstat=$?
113 diff -r build tmp/bacula-restores${cwd}/build 2>&1 >/dev/null
114 if [ $? != 0 -o $bstat != 0 -o $rstat != 0 ] ; then
115    echo " "
116    echo " "
117    echo "  !!!!! four-jobs-test Bacula source failed!!! !!!!! "
118    echo "  !!!!! four-jobs-test failed!!! !!!!! " >>test.out
119    echo " "
120 else
121    echo "  ===== four-jobs-test Bacula source OK ===== "
122    echo "  ===== four-jobs-test OK ===== " >>test.out
123    scripts/cleanup
124 fi