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 $*
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
112 grep "^ Termination: *Restore OK -- warning file count mismatch" tmp/log2.out 2>&1 >/dev/null
113 if test $? -eq 0; then
116 grep "^ Termination: *Verify Differences" tmp/log2.out 2>&1 >/dev/null
117 if test $? -eq 0; then
124 diff -r build tmp/bacula-restores${cwd}/build 2>&1 >/dev/null
128 check_restore_tmp_build_diff()
130 diff -r tmp/build tmp/bacula-restores${cwd}/tmp/build 2>&1 >/dev/null
136 if [ $dstat != 0 -o $bstat != 0 -o $rstat != 0 ] ; then
139 echo " !!!!! $TestName failed!!! `date +%R:%S` !!!!! "
140 echo " !!!!! $TestName failed!!! `date +%R:%S` !!!!! " >>test.out
141 if [ $bstat != 0 -o $rstat != 0 ] ; then
142 echo " !!!!! Bad termination status !!!!! "
143 echo " !!!!! Bad termination status !!!!! " >>test.out
144 echo " Status: backup=$bstat restore=$rstat diff=$dstat"
145 echo " Status: backup=$bstat restore=$rstat diff=$dstat" >>test.out
147 echo " !!!!! Restored files differ !!!!! "
148 echo " !!!!! Restored files differ !!!!! " >>test.out
149 echo " Status: backup=$bstat restore=$rstat diff=$dstat"
150 echo " Status: backup=$bstat restore=$rstat diff=$dstat" >>test.out
154 echo " ===== $TestName OK `date +%R:%S` ===== "
155 echo " ===== $TestName OK `date +%R:%S` ===== " >>test.out
156 if test "$debug" -eq 0 ; then
164 scripts/copy-tape-confs
170 scripts/copy-test-confs
176 if test "x${REGRESS_WAIT}" = "x1"; then
177 echo "Start Bacula under debugger and enter anything when ready ..."
182 # Save current directory
184 if test "x${REGRESS_DEBUG}" = "x1"; then
190 # Source the configuration variables