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
120 diff -r build tmp/bacula-restores${cwd}/build 2>&1 >/dev/null
124 check_restore_tmp_build_diff()
126 diff -r tmp/build tmp/bacula-restores${cwd}/tmp/build 2>&1 >/dev/null
132 if [ $dstat != 0 -o $bstat != 0 -o $rstat != 0 ] ; then
135 echo " !!!!! $TestName failed!!! !!!!! "
136 echo " !!!!! $TestName failed!!! !!!!! " >>test.out
137 if [ $bstat != 0 -o $rstat != 0 ] ; then
138 echo " !!!!! Bad Job termination status !!!!! "
139 echo " !!!!! Bad Job termination status !!!!! " >>test.out
140 echo " bstat=$bstat rstat=$rstat dstat=$dstat"
142 echo " !!!!! Restored files differ !!!!! "
143 echo " !!!!! Restored files differ !!!!! " >>test.out
144 echo " bstat=$bstat rstat=$rstat dstat=$dstat"
148 echo " ===== $TestName OK `date +%R:%S` ===== "
149 echo " ===== $TestName OK `date +%R:%S` ===== " >>test.out
150 if test "$debug" -eq 0 ; then
158 scripts/copy-tape-confs
164 scripts/copy-test-confs
170 if test "x${REGRESS_WAIT}" = "x1"; then
171 echo "Start Bacula under debugger and enter anything when ready ..."
176 # Save current directory
178 if test "x${REGRESS_DEBUG}" = "x1"; then
184 # Source the configuration variables