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
32 if test "$debug" -eq 1 ; then
43 if test "$debug" -eq 1 ; then
44 bin/bacula-ctl-sd start
45 bin/bacula-ctl-fd start
46 bin/bacula-ctl-dir start
47 cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf
49 bin/bacula start 2>&1 >/dev/null
50 cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf 2>&1 >/dev/null
56 if test "$debug" -eq 1 ; then
57 cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf
59 cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf 2>&1 >/dev/null
65 if test "$debug" -eq 1 ; then
66 cat tmp/bconcmds | bin/btape -c bin/bacula-sd.conf DDS-4 | tee tmp/log1.out
68 cat tmp/bconcmds | bin/btape -c bin/bacula-sd.conf DDS-4 2>&1 >tmp/log1.out
74 if test "$debug" -eq 1 ; then
75 bin/bscan $* | tee tmp/log.out
77 bin/bscan $* 2>&1 >/dev/null
84 bin/bacula stop 2>&1 >/dev/null
87 check_for_zombie_jobs()
89 scripts/check_for_zombie_jobs $*
94 if test $# -eq 1; then
102 mv bin/bacula-dir.conf bin/1
103 echo "s%${oldname}%${newname}%g" >tmp/1
104 sed -f tmp/1 bin/1 >bin/bacula-dir.conf
105 # echo "Job ${oldname} changed to ${newname}"
110 grep "^ Termination: *Backup OK" tmp/log1.out 2>&1 >/dev/null
112 grep "^ Termination: .*Backup Error" tmp/log1.out 2>&1 >/dev/null
113 if test $? -eq 0; then
116 grep "^ Termination: *Restore OK" tmp/log2.out 2>&1 >/dev/null
118 grep "^ Termination: *Restore OK -- warning file count mismatch" tmp/log2.out 2>&1 >/dev/null
119 if test $? -eq 0; then
122 grep "^ Termination: .*Verify Differences" tmp/log2.out 2>&1 >/dev/null
123 if test $? -eq 0; then
130 diff -r build tmp/bacula-restores${cwd}/build 2>&1 >/dev/null
134 check_restore_tmp_build_diff()
136 diff -r tmp/build tmp/bacula-restores${cwd}/tmp/build 2>&1 >/dev/null
142 if [ $zstat != 0 ] ; then
144 echo " !!!!! $TestName failed!!! `date +%R:%S` !!!!! "
145 echo " !!!!! $TestName failed!!! `date +%R:%S` !!!!! " >>test.out
146 echo " Status: zombie=$zstat backup=$bstat restore=$rstat diff=$dstat" >>test.out
150 if [ $dstat != 0 -o $bstat != 0 -o $rstat != 0 ] ; then
153 echo " !!!!! $TestName failed!!! `date +%R:%S` !!!!! "
154 echo " !!!!! $TestName failed!!! `date +%R:%S` !!!!! " >>test.out
155 if [ $bstat != 0 -o $rstat != 0 ] ; then
156 echo " !!!!! Bad termination status !!!!! "
157 echo " !!!!! Bad termination status !!!!! " >>test.out
159 echo " !!!!! Restored files differ !!!!! "
160 echo " !!!!! Restored files differ !!!!! " >>test.out
162 echo " Status: backup=$bstat restore=$rstat diff=$dstat"
163 echo " Status: backup=$bstat restore=$rstat diff=$dstat" >>test.out
167 echo " ===== $TestName OK `date +%R:%S` ===== "
168 echo " ===== $TestName OK `date +%R:%S` ===== " >>test.out
169 if test "$debug" -eq 0 ; then
177 scripts/copy-tape-confs
183 scripts/copy-test-confs
189 if test "x${REGRESS_WAIT}" = "x1"; then
190 echo "Start Bacula under debugger and enter anything when ready ..."
195 # Save current directory
197 if test "x${REGRESS_DEBUG}" = "x1"; then
203 # Source the configuration variables