]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/four-jobs-tape
Add bscan-tape test
[bacula/bacula] / regress / tests / four-jobs-tape
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 bin/bacula stop 2>&1 >/dev/null
9 cd bin
10 ./drop_bacula_tables >/dev/null 2>&1
11 ./make_bacula_tables >/dev/null 2>&1
12 ./grant_bacula_privileges 2>&1 >/dev/null
13 cd ..
14
15 scripts/copy-tape-confs
16 scripts/cleanup-tape
17 echo "${cwd}/build" >/tmp/file-list
18
19 echo " "
20 echo " "
21 echo " === Starting four-jobs-tape  ==="
22 echo " === Starting four-jobs-tape  ===" >>working/log
23 echo " "
24
25 bin/bacula start 2>&1 >/dev/null
26 bin/bconsole -c bin/bconsole.conf <<END_OF_DATA
27 @output /dev/null
28 estimate job=NightlySave listing
29 estimate job=NightlySave listing
30 estimate job=NightlySave listing
31 messages
32 @output tmp/log1.out
33 label storage=DDS-4 volume=TestVolume001 slot=0
34 run job=NightlySave yes
35 wait
36 messages
37 quit
38 END_OF_DATA
39 scripts/check_for_zombie_jobs storage=DDS-4
40 echo "Backup 1 done"
41 # make some files for the incremental to pick up
42 touch ${cwd}/build/src/dird/*.c ${cwd}/build/src/dird/*.o
43 touch ${cwd}/build/src/lib/*.c ${cwd}/build/src/lib/*.o
44    
45 #
46 # run a second job
47 #
48 bin/bconsole -c bin/bconsole.conf <<END_OF_DATA
49 @output /dev/null
50 messages
51 @output tmp/log1.out
52 run job=NightlySave level=Incremental yes
53 wait
54 messages
55 quit
56 END_OF_DATA
57 scripts/check_for_zombie_jobs storage=DDS-4
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 run job=NightlySave level=Incremental yes
69 wait
70 messages
71 quit
72 END_OF_DATA
73 scripts/check_for_zombie_jobs storage=DDS-4
74 echo "Backup 3 done"
75 # make some files for the incremental to pick up
76 touch ${cwd}/build/src/lib/*.c ${cwd}/build/src/lib/*.o
77 #
78 # run a fourth job
79 #
80 bin/bconsole -c bin/bconsole.conf <<END_OF_DATA
81 @output /dev/null
82 messages
83 @output tmp/log1.out
84 run job=NightlySave level=Incremental yes
85 wait
86 messages
87 quit
88 END_OF_DATA
89 scripts/check_for_zombie_jobs storage=DDS-4
90 echo "Backup 4 done"
91
92 # now do several restores to ensure we cleanup between jobs
93 #
94 bin/bconsole -c bin/bconsole.conf <<END_OF_DATA
95 @output /dev/null
96 restore where=${cwd}/tmp/bacula-restores select all done
97 yes
98 wait
99 restore where=${cwd}/tmp/bacula-restores select all done
100 yes
101 wait
102 @output tmp/log2.out
103 @#
104 @# now unmount the tape and start two restores
105 @#  at the same time
106 @#
107 unmount storage=DDS-4
108 restore where=${cwd}/tmp/bacula-restores select all done
109 yes
110 restore where=${cwd}/tmp/bacula-restores select
111 unmark *
112 mark *
113 done
114 yes
115 mount storage=DDS-4
116 wait
117 messages
118 @output
119 quit
120 END_OF_DATA
121 bin/bacula stop 2>&1 >/dev/null
122 grep "^Termination: *Backup OK" tmp/log1.out 2>&1 >/dev/null
123 bstat=$?
124 grep "^Termination: *Restore OK" tmp/log2.out 2>&1 >/dev/null
125 rstat=$?
126 diff -r build tmp/bacula-restores${cwd}/build 2>&1 >/dev/null
127 if [ $? != 0 -o $bstat != 0 -o $rstat != 0 ] ; then
128    echo " "
129    echo " "
130    echo "  !!!!! four-jobs-tape Bacula source failed!!! !!!!! "
131    echo "  !!!!! four-jobs-tape failed!!! !!!!! " >>test.out
132    echo " "
133 else
134    echo "  ===== four-jobs-tape Bacula source OK ===== "
135    echo "  ===== four-jobs-tape OK ===== " >>test.out
136    scripts/cleanup
137 fi