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
30 if test x${TAPE_DRIVE} = x/dev/null ; then
31 echo "$TestName test needs a tape drive, but has none."
36 require_second_drive()
38 if test x${TAPE_DRIVE1} = x/dev/null ; then
39 echo "$JobName needs second drive, but has none."
46 if test x${AUTOCHANGER} = x/dev/null ; then
47 echo "$TestName needs an autochanger, but has none."
53 skip_if_no_autochanger()
55 if test x${AUTOCHANGER} = x/dev/null ; then
56 echo "$TestName test skipped. No autochanger."
64 if test "$debug" -eq 1 ; then
73 if test "$debug" -eq 1 ; then
82 if test "$debug" -eq 1 ; then
83 bin/bacula-ctl-sd start
84 bin/bacula-ctl-fd start
85 bin/bacula-ctl-dir start
86 cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf
88 bin/bacula start 2>&1 >/dev/null
89 cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf 2>&1 >/dev/null
95 if test "$debug" -eq 1 ; then
96 cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf
98 cat tmp/bconcmds | bin/bconsole -c bin/bconsole.conf 2>&1 >/dev/null
104 if test "$debug" -eq 1 ; then
105 cat tmp/bconcmds | bin/btape -c bin/bacula-sd.conf DDS-4 | tee tmp/log1.out
107 cat tmp/bconcmds | bin/btape -c bin/bacula-sd.conf DDS-4 2>&1 >tmp/log1.out
113 if test "$debug" -eq 1 ; then
114 bin/bscan $* | tee tmp/log.out
116 bin/bscan $* 2>&1 >/dev/null
123 bin/bacula stop 2>&1 >/dev/null
126 check_for_zombie_jobs()
128 scripts/check_for_zombie_jobs $*
133 if test $# -eq 1; then
141 mv bin/bacula-dir.conf bin/1
142 echo "s%${oldname}%${newname}%g" >tmp/1
143 sed -f tmp/1 bin/1 >bin/bacula-dir.conf
144 # echo "Job ${oldname} changed to ${newname}"
149 grep "^ Termination: *Backup OK" tmp/log1.out 2>&1 >/dev/null
151 grep "^ Termination: .*Backup Error" tmp/log1.out 2>&1 >/dev/null
152 if test $? -eq 0; then
155 grep "^ Termination: *Restore OK" tmp/log2.out 2>&1 >/dev/null
157 grep "^ Termination: *Restore OK -- warning file count mismatch" tmp/log2.out 2>&1 >/dev/null
158 if test $? -eq 0; then
161 grep "^ Termination: .*Verify Differences" tmp/log2.out 2>&1 >/dev/null
162 if test $? -eq 0; then
169 diff -r build tmp/bacula-restores${cwd}/build 2>&1 >/dev/null
173 check_restore_tmp_build_diff()
175 diff -r tmp/build tmp/bacula-restores${cwd}/tmp/build 2>&1 >/dev/null
181 if [ $zstat != 0 ] ; then
183 echo " !!!!! $TestName failed!!! `date +%R:%S` !!!!! "
184 echo " !!!!! $TestName failed!!! `date +%R:%S` !!!!! " >>test.out
185 echo " Status: zombie=$zstat backup=$bstat restore=$rstat diff=$dstat" >>test.out
189 if [ $dstat != 0 -o $bstat != 0 -o $rstat != 0 ] ; then
192 echo " !!!!! $TestName failed!!! `date +%R:%S` !!!!! "
193 echo " !!!!! $TestName failed!!! `date +%R:%S` !!!!! " >>test.out
194 if [ $bstat != 0 -o $rstat != 0 ] ; then
195 echo " !!!!! Bad termination status !!!!! "
196 echo " !!!!! Bad termination status !!!!! " >>test.out
198 echo " !!!!! Restored files differ !!!!! "
199 echo " !!!!! Restored files differ !!!!! " >>test.out
201 echo " Status: backup=$bstat restore=$rstat diff=$dstat"
202 echo " Status: backup=$bstat restore=$rstat diff=$dstat" >>test.out
206 echo " ===== $TestName OK `date +%R:%S` ===== "
207 echo " ===== $TestName OK `date +%R:%S` ===== " >>test.out
208 if test "$debug" -eq 0 ; then
216 scripts/copy-tape-confs
222 scripts/copy-test-confs
228 if test "x${REGRESS_WAIT}" = "x1"; then
229 echo "Start Bacula under debugger and enter anything when ready ..."
234 # Save current directory
236 if test "x${REGRESS_DEBUG}" = "x1"; then
242 # Source the configuration variables