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
31 if test "$debug" -eq 1 ; then
41 if test "$debug" -eq 1 ; then
42 bin/bacula-ctl-sd start
43 bin/bacula-ctl-fd start
44 bin/bacula-ctl-dir start
45 cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf
47 bin/bacula start 2>&1 >/dev/null
48 cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf 2>&1 >/dev/null
54 if test "$debug" -eq 1 ; then
55 cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf
57 cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf 2>&1 >/dev/null
63 if test "$debug" -eq 1 ; then
64 cat tmp/bconcmds | bin/btape -c bin/bacula-sd.conf DDS-4 | tee tmp/log1.out
66 cat tmp/bconcmds | bin/btape -c bin/bacula-sd.conf DDS-4 2>&1 >tmp/log1.out
72 if test "$debug" -eq 1 ; then
73 bin/bscan $* | tee tmp/log.out
75 bin/bscan $* 2>&1 >/dev/null
82 bin/bacula stop 2>&1 >/dev/null
85 check_for_zombie_jobs()
87 scripts/check_for_zombie_jobs $1
92 if test $# -eq 1; then
100 mv bin/bacula-dir.conf bin/1
101 echo "s%${oldname}%${newname}%g" >tmp/1
102 sed -f tmp/1 bin/1 >bin/bacula-dir.conf
103 # echo "Job ${oldname} changed to ${newname}"
108 grep "^ Termination: *Backup OK" tmp/log1.out 2>&1 >/dev/null
110 grep "^ Termination: *Restore OK" tmp/log2.out 2>&1 >/dev/null
116 diff -r build tmp/bacula-restores${cwd}/build 2>&1 >/dev/null
120 check_restore_tmp_build_diff()
122 diff -r tmp/build tmp/bacula-restores${cwd}/tmp/build 2>&1 >/dev/null
128 if [ $dstat != 0 -o $bstat != 0 -o $rstat != 0 ] ; then
131 echo " !!!!! $TestName failed!!! !!!!! "
132 echo " !!!!! $TestName failed!!! !!!!! " >>test.out
133 if [ $bstat != 0 -o $rstat != 0 ] ; then
134 echo " !!!!! Bad Job termination status !!!!! "
135 echo " !!!!! Bad Job termination status !!!!! " >>test.out
136 echo " bstat=$bstat rstat=$rstat dstat=$dstat"
138 echo " !!!!! Restored files differ !!!!! "
139 echo " !!!!! Restored files differ !!!!! " >>test.out
140 echo " bstat=$bstat rstat=$rstat dstat=$dstat"
144 echo " ===== $TestName OK `date +%R:%S` ===== "
145 echo " ===== $TestName OK `date +%R:%S` ===== " >>test.out
146 if test "$debug" -eq 0 ; then
154 scripts/copy-tape-confs
160 scripts/copy-test-confs
166 if test "x${REGRESS_WAIT}" = "x1"; then
167 echo "Start Bacula under debugger and enter anything when ready ..."
172 # Save current directory
174 if test "x${REGRESS_DEBUG}" = "x1"; then
180 # Source the second drive variables
181 touch ${cwd}/config.out