2 # A set of useful functions to be sourced in each test
9 echo " === Starting $TestName at `date +%R:%S` ==="
10 echo " === Starting $TestName at `date +%R:%S` ===" >>working/log
16 MUID=`/usr/bin/id | awk -F= '{print $2}' | awk -F\( '{print $1}'`
17 if [ $MUID != 0 ] ; then
19 echo "You must be root to run this test."
20 echo " ===== !!!! $TestName not run at `date +%R:%S` ==="
21 echo " ===== !!!! $TestName not run at `date +%R:%S` !!!! ===== " >>test.out
30 if test "$debug" -eq 1 ; then
40 if test "$debug" -eq 1 ; then
41 bin/bacula-ctl-sd start
42 bin/bacula-ctl-fd start
43 bin/bacula-ctl-dir start
44 cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf
46 bin/bacula start 2>&1 >/dev/null
47 cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf 2>&1 >/dev/null
53 if test "$debug" -eq 1 ; then
54 cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf
56 cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf 2>&1 >/dev/null
62 if test "$debug" -eq 1 ; then
63 cat tmp/bconcmds | bin/btape -c bin/bacula-sd.conf DDS-4 | tee tmp/log1.out
65 cat tmp/bconcmds | bin/btape -c bin/bacula-sd.conf DDS-4 2>&1 >tmp/log1.out
71 if test "$debug" -eq 1 ; then
72 bin/bscan $* | tee tmp/log.out
74 bin/bscan $* 2>&1 >/dev/null
81 bin/bacula stop 2>&1 >/dev/null
84 check_for_zombie_jobs()
86 scripts/check_for_zombie_jobs $1
91 if test $# -eq 1; then
99 mv bin/bacula-dir.conf bin/1
100 echo "s%${oldname}%${newname}%g" >tmp/1
101 sed -f tmp/1 bin/1 >bin/bacula-dir.conf
102 # echo "Job ${oldname} changed to ${newname}"
107 grep "^ Termination: *Backup OK" tmp/log1.out 2>&1 >/dev/null
109 grep "^ Termination: *Restore OK" tmp/log2.out 2>&1 >/dev/null
115 diff -r build tmp/bacula-restores${cwd}/build 2>&1 >/dev/null
119 check_restore_tmp_build_diff()
121 diff -r tmp/build tmp/bacula-restores${cwd}/tmp/build 2>&1 >/dev/null
127 if [ $dstat != 0 -o $bstat != 0 -o $rstat != 0 ] ; then
130 echo " !!!!! $TestName failed!!! !!!!! "
131 echo " !!!!! $TestName failed!!! !!!!! " >>test.out
132 if [ $bstat != 0 -o $rstat != 0 ] ; then
133 echo " !!!!! Bad Job termination status !!!!! "
134 echo " !!!!! Bad Job termination status !!!!! " >>test.out
135 echo " bstat=$bstat rstat=$rstat dstat=$dstat"
137 echo " !!!!! Restored files differ !!!!! "
138 echo " !!!!! Restored files differ !!!!! " >>test.out
139 echo " bstat=$bstat rstat=$rstat dstat=$dstat"
143 echo " ===== $TestName OK `date +%R:%S` ===== "
144 echo " ===== $TestName OK `date +%R:%S` ===== " >>test.out
145 if test "$debug" -eq 0 ; then
153 scripts/copy-tape-confs
159 scripts/copy-test-confs
165 if test "x${REGRESS_WAIT}" = "x1"; then
166 echo "Start Bacula under debugger and enter anything when ready ..."
171 # Save current directory
173 if test "x${REGRESS_DEBUG}" = "x1"; then
179 # Source the second drive variables
180 touch ${cwd}/config.out