2 # A set of useful functions to be sourced in each test
9 echo "s% mail =%# mail = %g" >${outf}
10 echo "s% operator =%# operator =%g" >>${outf}
11 cp bin/bacula-dir.conf tmp/1
12 sed -f ${outf} tmp/1 >bin/bacula-dir.conf
15 echo " === Starting $TestName at `date +%R:%S` ==="
16 echo " === Starting $TestName at `date +%R:%S` ===" >>working/log
23 MUID=`/usr/bin/id | awk -F= '{print $2}' | awk -F\( '{print $1}'`
24 if [ $MUID != 0 ] ; then
26 echo "You must be root to run this test."
27 echo " ===== !!!! $TestName not run at `date +%R:%S` ==="
28 echo " ===== !!!! $TestName not run at `date +%R:%S` !!!! ===== " >>test.out
36 if test x${TAPE_DRIVE} = x/dev/null ; then
37 echo "$TestName test needs a tape drive, but has none."
42 require_second_drive()
44 if test x${TAPE_DRIVE1} = x/dev/null ; then
45 echo "$JobName needs second drive, but has none."
52 if test x${AUTOCHANGER} = x/dev/null ; then
53 echo "$TestName needs an autochanger, but has none."
59 skip_if_no_autochanger()
61 if test x${AUTOCHANGER} = x/dev/null ; then
62 echo "$TestName test skipped. No autochanger."
70 if test "$debug" -eq 1 ; then
79 if test "$debug" -eq 1 ; then
88 if test "$debug" -eq 1 ; then
89 bin/bacula-ctl-sd start
90 bin/bacula-ctl-fd start
91 bin/bacula-ctl-dir start
92 cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf
94 bin/bacula start 2>&1 >/dev/null
95 cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf 2>&1 >/dev/null
101 if test "$debug" -eq 1 ; then
102 cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf
104 cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf 2>&1 >/dev/null
110 if test "$debug" -eq 1 ; then
111 cat tmp/bconcmds | bin/btape -c bin/bacula-sd.conf DDS-4 | tee tmp/log1.out
113 cat tmp/bconcmds | bin/btape -c bin/bacula-sd.conf DDS-4 2>&1 >tmp/log1.out
119 if test "$debug" -eq 1 ; then
120 bin/bscan $* | tee tmp/log.out
122 bin/bscan $* 2>&1 >/dev/null
128 B=`echo $LIBDBI | sed 's/;//' | sed 's/;//g'`
129 B_D=`echo $B | awk '{print $3}'`
130 B_t=`echo $B | awk '{print $6}'`
131 B_p=`echo $B | awk '{print $9}'`
133 BSCANLIBDBI="${LIBDBI:+1}"
135 if test "$BSCANLIBDBI" = "1" ; then
136 BSCANLIBDBI="-D $B_D -h $B_t -t $B_p"
144 bin/bacula stop 2>&1 >/dev/null
147 check_for_zombie_jobs()
149 scripts/check_for_zombie_jobs $*
154 if test $# -eq 1; then
162 mv bin/bacula-dir.conf bin/1
163 echo "s%${oldname}%${newname}%g" >tmp/1
164 sed -f tmp/1 bin/1 >bin/bacula-dir.conf
165 # echo "Job ${oldname} changed to ${newname}"
170 grep "^ Termination: *Backup OK" tmp/log1.out 2>&1 >/dev/null
172 grep "^ Termination: .*Backup Error" tmp/log1.out 2>&1 >/dev/null
173 if test $? -eq 0; then
176 grep "^ Termination: *Restore OK" tmp/log2.out 2>&1 >/dev/null
178 grep "^ Termination: *Restore OK -- warning file count mismatch" tmp/log2.out 2>&1 >/dev/null
179 if test $? -eq 0; then
182 grep "^ Termination: .*Verify Differences" tmp/log2.out 2>&1 >/dev/null
183 if test $? -eq 0; then
190 diff -r build tmp/bacula-restores${cwd}/build 2>&1 >/dev/null
194 check_restore_tmp_build_diff()
196 diff -r tmp/build tmp/bacula-restores${cwd}/tmp/build 2>&1 >/dev/null
202 if [ $zstat != 0 ] ; then
204 echo " !!!!! $TestName failed!!! `date +%R:%S` !!!!! "
205 echo " !!!!! $TestName failed!!! `date +%R:%S` !!!!! " >>test.out
206 echo " Status: zombie=$zstat backup=$bstat restore=$rstat diff=$dstat" >>test.out
210 if [ $dstat != 0 -o $bstat != 0 -o $rstat != 0 ] ; then
213 echo " !!!!! $TestName failed!!! `date +%R:%S` !!!!! "
214 echo " !!!!! $TestName failed!!! `date +%R:%S` !!!!! " >>test.out
215 if [ $bstat != 0 -o $rstat != 0 ] ; then
216 echo " !!!!! Bad termination status !!!!! "
217 echo " !!!!! Bad termination status !!!!! " >>test.out
219 echo " !!!!! Restored files differ !!!!! "
220 echo " !!!!! Restored files differ !!!!! " >>test.out
222 echo " Status: backup=$bstat restore=$rstat diff=$dstat"
223 echo " Status: backup=$bstat restore=$rstat diff=$dstat" >>test.out
227 echo " ===== $TestName OK `date +%R:%S` ===== "
228 echo " ===== $TestName OK `date +%R:%S` ===== " >>test.out
229 if test "$debug" -eq 0 ; then
237 scripts/copy-tape-confs
243 scripts/copy-test-confs
249 if test "x${REGRESS_WAIT}" = "x1"; then
250 echo "Start Bacula under debugger and enter anything when ready ..."
257 if test a$USE_FAKETAPE = a; then
265 # Save current directory
267 if test "x${REGRESS_DEBUG}" = "x1"; then
273 # Source the configuration variables