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
17 MUID=`/usr/bin/id | awk -F= '{print $2}' | awk -F\( '{print $1}'`
18 if [ $MUID != 0 ] ; then
20 echo "You must be root to run this test."
21 echo " ===== !!!! $TestName not run at `date +%R:%S` ==="
22 echo " ===== !!!! $TestName not run at `date +%R:%S` !!!! ===== " >>test.out
28 skip_if_no_autochanger()
30 if test x${AUTOCHANGER} = x/dev/null ; then
31 echo "$TestName test skipped. No autochanger."
40 if test "$debug" -eq 1 ; then
49 if test "$debug" -eq 1 ; then
58 if test "$debug" -eq 1 ; then
59 bin/bacula-ctl-sd start
60 bin/bacula-ctl-fd start
61 bin/bacula-ctl-dir start
62 cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf
64 bin/bacula start 2>&1 >/dev/null
65 cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf 2>&1 >/dev/null
71 if test "$debug" -eq 1 ; then
72 cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf
74 cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf 2>&1 >/dev/null
80 if test "$debug" -eq 1 ; then
81 cat tmp/bconcmds | bin/btape -c bin/bacula-sd.conf DDS-4 | tee tmp/log1.out
83 cat tmp/bconcmds | bin/btape -c bin/bacula-sd.conf DDS-4 2>&1 >tmp/log1.out
89 if test "$debug" -eq 1 ; then
90 bin/bscan $* | tee tmp/log.out
92 bin/bscan $* 2>&1 >/dev/null
99 bin/bacula stop 2>&1 >/dev/null
102 check_for_zombie_jobs()
104 scripts/check_for_zombie_jobs $*
109 if test $# -eq 1; then
117 mv bin/bacula-dir.conf bin/1
118 echo "s%${oldname}%${newname}%g" >tmp/1
119 sed -f tmp/1 bin/1 >bin/bacula-dir.conf
120 # echo "Job ${oldname} changed to ${newname}"
125 grep "^ Termination: *Backup OK" tmp/log1.out 2>&1 >/dev/null
127 grep "^ Termination: .*Backup Error" tmp/log1.out 2>&1 >/dev/null
128 if test $? -eq 0; then
131 grep "^ Termination: *Restore OK" tmp/log2.out 2>&1 >/dev/null
133 grep "^ Termination: *Restore OK -- warning file count mismatch" tmp/log2.out 2>&1 >/dev/null
134 if test $? -eq 0; then
137 grep "^ Termination: .*Verify Differences" tmp/log2.out 2>&1 >/dev/null
138 if test $? -eq 0; then
145 diff -r build tmp/bacula-restores${cwd}/build 2>&1 >/dev/null
149 check_restore_tmp_build_diff()
151 diff -r tmp/build tmp/bacula-restores${cwd}/tmp/build 2>&1 >/dev/null
157 if [ $zstat != 0 ] ; then
159 echo " !!!!! $TestName failed!!! `date +%R:%S` !!!!! "
160 echo " !!!!! $TestName failed!!! `date +%R:%S` !!!!! " >>test.out
161 echo " Status: zombie=$zstat backup=$bstat restore=$rstat diff=$dstat" >>test.out
165 if [ $dstat != 0 -o $bstat != 0 -o $rstat != 0 ] ; then
168 echo " !!!!! $TestName failed!!! `date +%R:%S` !!!!! "
169 echo " !!!!! $TestName failed!!! `date +%R:%S` !!!!! " >>test.out
170 if [ $bstat != 0 -o $rstat != 0 ] ; then
171 echo " !!!!! Bad termination status !!!!! "
172 echo " !!!!! Bad termination status !!!!! " >>test.out
174 echo " !!!!! Restored files differ !!!!! "
175 echo " !!!!! Restored files differ !!!!! " >>test.out
177 echo " Status: backup=$bstat restore=$rstat diff=$dstat"
178 echo " Status: backup=$bstat restore=$rstat diff=$dstat" >>test.out
182 echo " ===== $TestName OK `date +%R:%S` ===== "
183 echo " ===== $TestName OK `date +%R:%S` ===== " >>test.out
184 if test "$debug" -eq 0 ; then
192 scripts/copy-tape-confs
198 scripts/copy-test-confs
204 if test "x${REGRESS_WAIT}" = "x1"; then
205 echo "Start Bacula under debugger and enter anything when ready ..."
210 # Save current directory
212 if test "x${REGRESS_DEBUG}" = "x1"; then
218 # Source the configuration variables