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
51 if test "$debug" -eq 1 ; then
52 bin/bacula-ctl-sd start
53 bin/bacula-ctl-fd start
54 bin/bacula-ctl-dir start
55 cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf
57 bin/bacula start 2>&1 >/dev/null
58 cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf 2>&1 >/dev/null
64 if test "$debug" -eq 1 ; then
65 cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf
67 cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf 2>&1 >/dev/null
73 if test "$debug" -eq 1 ; then
74 cat tmp/bconcmds | bin/btape -c bin/bacula-sd.conf DDS-4 | tee tmp/log1.out
76 cat tmp/bconcmds | bin/btape -c bin/bacula-sd.conf DDS-4 2>&1 >tmp/log1.out
82 if test "$debug" -eq 1 ; then
83 bin/bscan $* | tee tmp/log.out
85 bin/bscan $* 2>&1 >/dev/null
92 bin/bacula stop 2>&1 >/dev/null
95 check_for_zombie_jobs()
97 scripts/check_for_zombie_jobs $*
102 if test $# -eq 1; then
110 mv bin/bacula-dir.conf bin/1
111 echo "s%${oldname}%${newname}%g" >tmp/1
112 sed -f tmp/1 bin/1 >bin/bacula-dir.conf
113 # echo "Job ${oldname} changed to ${newname}"
118 grep "^ Termination: *Backup OK" tmp/log1.out 2>&1 >/dev/null
120 grep "^ Termination: .*Backup Error" tmp/log1.out 2>&1 >/dev/null
121 if test $? -eq 0; then
124 grep "^ Termination: *Restore OK" tmp/log2.out 2>&1 >/dev/null
126 grep "^ Termination: *Restore OK -- warning file count mismatch" tmp/log2.out 2>&1 >/dev/null
127 if test $? -eq 0; then
130 grep "^ Termination: .*Verify Differences" tmp/log2.out 2>&1 >/dev/null
131 if test $? -eq 0; then
138 diff -r build tmp/bacula-restores${cwd}/build 2>&1 >/dev/null
142 check_restore_tmp_build_diff()
144 diff -r tmp/build tmp/bacula-restores${cwd}/tmp/build 2>&1 >/dev/null
150 if [ $zstat != 0 ] ; then
152 echo " !!!!! $TestName failed!!! `date +%R:%S` !!!!! "
153 echo " !!!!! $TestName failed!!! `date +%R:%S` !!!!! " >>test.out
154 echo " Status: zombie=$zstat backup=$bstat restore=$rstat diff=$dstat" >>test.out
158 if [ $dstat != 0 -o $bstat != 0 -o $rstat != 0 ] ; then
161 echo " !!!!! $TestName failed!!! `date +%R:%S` !!!!! "
162 echo " !!!!! $TestName failed!!! `date +%R:%S` !!!!! " >>test.out
163 if [ $bstat != 0 -o $rstat != 0 ] ; then
164 echo " !!!!! Bad termination status !!!!! "
165 echo " !!!!! Bad termination status !!!!! " >>test.out
167 echo " !!!!! Restored files differ !!!!! "
168 echo " !!!!! Restored files differ !!!!! " >>test.out
170 echo " Status: backup=$bstat restore=$rstat diff=$dstat"
171 echo " Status: backup=$bstat restore=$rstat diff=$dstat" >>test.out
175 echo " ===== $TestName OK `date +%R:%S` ===== "
176 echo " ===== $TestName OK `date +%R:%S` ===== " >>test.out
177 if test "$debug" -eq 0 ; then
185 scripts/copy-tape-confs
191 scripts/copy-test-confs
197 if test "x${REGRESS_WAIT}" = "x1"; then
198 echo "Start Bacula under debugger and enter anything when ready ..."
203 # Save current directory
205 if test "x${REGRESS_DEBUG}" = "x1"; then
211 # Source the configuration variables