]> git.sur5r.net Git - bacula/bacula/blob - regress/tests/four-jobs-tape
update
[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 TestName="four-jobs-tape"
8 JobName=fourjobstape
9 . scripts/functions
10
11 require_tape_drive
12
13 scripts/cleanup-tape
14 scripts/copy-tape-confs
15 echo "${cwd}/build" >${cwd}/tmp/file-list
16
17 change_jobname $JobName
18 start_test
19
20 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
21 @$out /dev/null
22 estimate job=$JobName listing
23 estimate job=$JobName
24 estimate job=$JobName
25 messages
26 @$out ${cwd}/tmp/log1.out
27 label storage=DDS-4 volume=TestVolume001 slot=0 pool=Default
28 run job=$JobName yes
29 wait
30 messages
31 quit
32 END_OF_DATA
33 if test "$debug" -eq 1 ; then
34   bin/bacula start
35   cat ${cwd}/tmp/bconcmds | bin/bconsole -c bin/bconsole.conf
36 else
37   bin/bacula start 2>&1 >/dev/null
38   cat ${cwd}/tmp/bconcmds | bin/bconsole -c bin/bconsole.conf  2>&1 >/dev/null
39 fi
40
41 scripts/check_for_zombie_jobs storage=DDS-4
42 echo "Backup 1 done"
43 # make some files for the incremental to pick up
44 touch ${cwd}/build/src/dird/*.c ${cwd}/build/src/dird/*.o
45 touch ${cwd}/build/src/lib/*.c ${cwd}/build/src/lib/*.o
46    
47 #
48 # run a second job
49 #
50 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
51 @$out /dev/null
52 messages
53 @$out ${cwd}/tmp/log1.out
54 run job=$JobName level=Incremental yes
55 wait
56 messages
57 quit
58 END_OF_DATA
59 if test "$debug" -eq 1 ; then
60   bin/bacula start
61   cat ${cwd}/tmp/bconcmds | bin/bconsole -c bin/bconsole.conf
62 else
63   bin/bacula start 2>&1 >/dev/null
64   cat ${cwd}/tmp/bconcmds | bin/bconsole -c bin/bconsole.conf  2>&1 >/dev/null
65 fi
66
67 scripts/check_for_zombie_jobs storage=DDS-4
68 echo "Backup 2 done"
69 touch ${cwd}/build/src/dird/*.c
70 touch ${cwd}/build/src/lib/*.c ${cwd}/build/src/lib/*.o
71 #
72 # run a third job
73 #
74 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
75 @$out /dev/null
76 messages
77 @$out ${cwd}/tmp/log1.out
78 run job=$JobName level=Incremental yes
79 wait
80 messages
81 quit
82 END_OF_DATA
83 if test "$debug" -eq 1 ; then
84   bin/bacula start
85   cat ${cwd}/tmp/bconcmds | bin/bconsole -c bin/bconsole.conf
86 else
87   bin/bacula start 2>&1 >/dev/null
88   cat ${cwd}/tmp/bconcmds | bin/bconsole -c bin/bconsole.conf  2>&1 >/dev/null
89 fi
90
91 scripts/check_for_zombie_jobs storage=DDS-4
92 echo "Backup 3 done"
93 # make some files for the incremental to pick up
94 touch ${cwd}/build/src/lib/*.c ${cwd}/build/src/lib/*.o
95 #
96 # run a fourth job
97 #
98 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
99 @$out /dev/null
100 messages
101 @$out ${cwd}/tmp/log1.out
102 run job=$JobName level=Incremental yes
103 wait
104 messages
105 quit
106 END_OF_DATA
107 if test "$debug" -eq 1 ; then
108   bin/bacula start
109   cat ${cwd}/tmp/bconcmds | bin/bconsole -c bin/bconsole.conf
110 else
111   bin/bacula start 2>&1 >/dev/null
112   cat ${cwd}/tmp/bconcmds | bin/bconsole -c bin/bconsole.conf  2>&1 >/dev/null
113 fi
114
115 scripts/check_for_zombie_jobs storage=DDS-4
116 echo "Backup 4 done"
117
118 # now do several restores to ensure we cleanup between jobs
119 #
120 cat <<END_OF_DATA >${cwd}/tmp/bconcmds
121 @$out /dev/null
122 restore where=${cwd}/tmp/bacula-restores select all done
123 yes
124 wait
125 restore where=${cwd}/tmp/bacula-restores select all done
126 yes
127 wait
128 @$out ${cwd}/tmp/log2.out
129 @#
130 @# now unmount the tape and start two restores
131 @#  at the same time
132 @#
133 unmount storage=DDS-4
134 restore where=${cwd}/tmp/bacula-restores select all done
135 yes
136 restore where=${cwd}/tmp/bacula-restores select
137 unmark *
138 mark *
139 done
140 yes
141 mount storage=DDS-4
142 wait
143 messages
144 @$out
145 quit
146 END_OF_DATA
147
148 run_bacula
149 check_for_zombie_jobs storage=DDS-4
150 stop_bacula
151
152 check_two_logs
153 check_restore_diff
154 end_test