#!/bin/sh
-# /home/kern/bacula/bin/startmysql
nice make setup
echo " " >test.out
cat build/config.out >>test.out
# Also scan logs for ERROR messages
#
-. ./config
-
# check_for_zombie_jobs storage=STORAGE [client=localhost-fd]
if [ $# = 2 ] ; then
client=${HOST}-fd
fi
-$bin/bconsole -c bin/bconsole.conf <<END_OF_DATA 2>&1 >/dev/null
-@output tmp/dir.out
+${bin}/bconsole -c ${scripts}/bconsole.conf <<END_OF_DATA 2>&1 >/dev/null
+@output ${tmp}/dir.out
status dir
-@output tmp/fd.out
+@output ${tmp}/fd.out
status client=${client}
-@output tmp/sd.out
+@output ${tmp}/sd.out
status $1
@output
quit
END_OF_DATA
export zstat
-grep "No Jobs running." tmp/dir.out 2>&1 >/dev/null
+grep "No Jobs running." ${tmp}/dir.out 2>&1 >/dev/null
if [ $? != 0 ] ; then
echo " "
echo " !!!! Zombie Jobs in Director !!!!"
zstat=1
exit 1
fi
-grep "No Jobs running." tmp/fd.out 2>&1 >/dev/null
+grep "No Jobs running." ${tmp}/fd.out 2>&1 >/dev/null
if [ $? != 0 ] ; then
echo " "
echo " !!!! Zombie Jobs in File daemon !!!!"
zstat=1
exit 1
fi
-grep "No Jobs running." tmp/sd.out 2>&1 >/dev/null
+grep "No Jobs running." ${tmp}/sd.out 2>&1 >/dev/null
if [ $? != 0 ] ; then
echo " "
echo " !!!! Zombie Jobs in Storage daemon !!!!"
zstat=1
exit 1
fi
-grep "ERROR" tmp/log*.out 2>&1 >/dev/null
+grep "ERROR" ${tmp}/log*.out 2>&1 >/dev/null
if [ $? = 0 ] ; then
echo " "
echo " !!!! ERROR in log output !!!!"
echo " !!!! ERROR in log output !!!!" >>test.out
- grep "ERROR" tmp/log*.out
+ grep "ERROR" ${tmp}/log*.out
echo " "
zstat=1
exit 1
fi
-grep "Fatal Error" tmp/log*.out 2>&1 >/dev/null
+grep "Fatal Error" ${tmp}/log*.out 2>&1 >/dev/null
if [ $? = 0 ] ; then
echo " "
echo " !!!! Fatal Error in log output !!!!"
echo " !!!! Fatal Error in log output !!!!" >>test.out
- grep "Fatal Error" tmp/log*.out
+ grep "Fatal Error" ${tmp}/log*.out
echo " "
zstat=1
exit 1
fi
-grep "glibc detected" tmp/log*.out 2>&1 >/dev/null
+grep "glibc detected" ${tmp}/log*.out 2>&1 >/dev/null
if [ $? = 0 ] ; then
echo " "
echo " !!!! glibc detected Error in log output !!!!"
echo " !!!! glibc detected Error in log output !!!!" >>test.out
- grep "glibc detected" tmp/log*.out
+ grep "glibc detected" ${tmp}/log*.out
echo " "
zstat=1
exit 1
check_encoding()
{
- $bin/bacula-dir -d50 -t -c bin/bacula-dir.conf 2>&1 | grep 'Wanted SQL_ASCII, got UTF8' >/dev/null
+ ${bin}/bacula-dir -d50 -t -c ${scripts}/bacula-dir.conf 2>&1 | grep 'Wanted SQL_ASCII, got UTF8' >/dev/null
if [ $? = 0 ]; then
echo "Found database encoding problem, please modify the database encoding (SQL_ASCII)"
exit 1
{
check_encoding
# Turn off email
- outf="tmp/sed_tmp"
+ outf="${tmp}/sed_tmp"
echo "s% mail =%# mail = %g" >${outf}
echo "s% operator =%# operator =%g" >>${outf}
- cp bin/bacula-dir.conf tmp/1
- sed -f ${outf} tmp/1 > bin/bacula-dir.conf
+ cp ${scripts}/bacula-dir.conf ${tmp}/1
+ sed -f ${outf} ${tmp}/1 > ${scripts}/bacula-dir.conf
echo " "
echo " "
echo " === Starting $TestName at `date +%R:%S` ==="
debug_wait
zstat=0
if test "$debug" -eq 1 ; then
- bin/bacula-ctl-sd start
- bin/bacula-ctl-fd start $1
- bin/bacula-ctl-dir start
- cat tmp/bconcmds | $bin/bconsole -c bin/bconsole.conf
+ ${scripts}/bacula-ctl-sd start
+ ${scripts}/bacula-ctl-fd start $1
+ ${scripts}/bacula-ctl-dir start
+ cat ${tmp}/bconcmds | ${bin}/bconsole -c ${scripts}/bconsole.conf
return $?
else
- bin/bacula start >/dev/null 2>&1
- cat tmp/bconcmds | $bin/bconsole -c bin/bconsole.conf >/dev/null 2>&1
+ ${bin}/bacula start >/dev/null 2>&1
+ cat ${tmp}/bconcmds | ${bin}/bconsole -c ${scripts}/bconsole.conf >/dev/null 2>&1
return $?
fi
}
run_bconsole()
{
- bconsole_file=${1:-tmp/bconcmds}
+ bconsole_file=${1:-${tmp}/bconcmds}
if test "$debug" -eq 1 ; then
- cat $bconsole_file | $bin/bconsole -c bin/bconsole.conf
+ cat $bconsole_file | ${bin}/bconsole -c ${scripts}/bconsole.conf
else
- cat $bconsole_file | $bin/bconsole -c bin/bconsole.conf 2>&1 >/dev/null
+ cat $bconsole_file | ${bin}/bconsole -c ${scripts}/bconsole.conf 2>&1 >/dev/null
fi
}
run_btape()
{
if test "$debug" -eq 1 ; then
- cat tmp/bconcmds | $bin/btape -c bin/bacula-sd.conf DDS-4 | tee tmp/log1.out
+ cat ${tmp}/bconcmds | ${bin}/btape -c ${scripts}/bacula-sd.conf DDS-4 | tee ${tmp}/log1.out
else
- cat tmp/bconcmds | $bin/btape -c bin/bacula-sd.conf DDS-4 >tmp/log1.out 2>&1
+ cat ${tmp}/bconcmds | ${bin}/btape -c ${scripts}/bacula-sd.conf DDS-4 >${tmp}/log1.out 2>&1
fi
}
run_bscan()
{
if test "$debug" -eq 1 ; then
- $bin/bscan $* | tee tmp/log.out
+ ${bin}/bscan $* | tee ${tmp}/log.out
else
- $bin/bscan $* 2>&1 >/dev/null
+ ${bin}/bscan $* 2>&1 >/dev/null
fi
}
stop_bacula()
{
- bin/bacula stop 2>&1 >/dev/null
+ ${bin}/bacula stop 2>&1 >/dev/null
zstat=0
bstat=0
rstat=0
check_for_zombie_jobs()
{
- scripts/check_for_zombie_jobs $*
+ ${rscripts}/check_for_zombie_jobs $*
}
change_jobname()
oldname=$1
newname=$2
fi
- rm -f bin/1
- mv bin/bacula-dir.conf bin/1
- echo "s%${oldname}%${newname}%g" >tmp/1
- sed -f tmp/1 bin/1 >bin/bacula-dir.conf
+ rm -f ${bin}/1
+ mv ${scripts}/bacula-dir.conf ${bin}/1
+ echo "s%${oldname}%${newname}%g" >${tmp}/1
+ sed -f ${tmp}/1 ${bin}/1 >${scripts}/bacula-dir.conf
# echo "Job ${oldname} changed to ${newname}"
}
check_two_logs()
{
- grep "^ Termination: *Backup OK" tmp/log1.out 2>&1 >/dev/null
+ grep "^ Termination: *Backup OK" ${tmp}/log1.out 2>&1 >/dev/null
bstat=${bstat:-$?}
- grep "^ Termination: .*Backup Error" tmp/log1.out 2>&1 >/dev/null
+ grep "^ Termination: .*Backup Error" ${tmp}/log1.out 2>&1 >/dev/null
if test $? -eq 0; then
bstat=2
fi
- grep "^ Termination: *Restore OK" tmp/log2.out 2>&1 >/dev/null
+ grep "^ Termination: *Restore OK" ${tmp}/log2.out 2>&1 >/dev/null
rstat=${rstat:-$?}
- grep "^ Termination: .*Restore Error" tmp/log2.out 2>&1 >/dev/null
+ grep "^ Termination: .*Restore Error" ${tmp}/log2.out 2>&1 >/dev/null
if test $? -eq 0; then
rstat=2
fi
- grep "^ Termination: *Restore OK -- warning file count mismatch" tmp/log2.out 2>&1 >/dev/null
+ grep "^ Termination: *Restore OK -- warning file count mismatch" ${tmp}/log2.out 2>&1 >/dev/null
if test $? -eq 0; then
rstat=3
fi
- grep "^ Termination: .*Verify Differences" tmp/log2.out 2>&1 >/dev/null
+ grep "^ Termination: .*Verify Differences" ${tmp}/log2.out 2>&1 >/dev/null
if test $? -eq 0; then
rstat=4
fi
- grep "Encoding error for database" tmp/log1.out > /dev/null
+ grep "Encoding error for database" ${tmp}/log1.out > /dev/null
if test $? -eq 0; then
print_debug "Found database encoding error"
bstat=2
check_restore_diff()
{
if test "$debug" -eq 1 ; then
- diff -ur build tmp/bacula-restores${cwd}/build
+ diff -ur build ${tmp}/bacula-restores${cwd}/build
else
- diff -ur build tmp/bacula-restores${cwd}/build 2>&1 >/dev/null
+ diff -ur build ${tmp}/bacula-restores${cwd}/build 2>&1 >/dev/null
fi
dstat=$?
}
check_restore_tmp_build_diff()
{
if test "$debug" -eq 1 ; then
- diff -ur tmp/build tmp/bacula-restores${cwd}/tmp/build
+ diff -ur ${tmp}/build ${tmp}/bacula-restores${cwd}/tmp/build
else
- diff -ur tmp/build tmp/bacula-restores${cwd}/tmp/build 2>&1 >/dev/null
+ diff -ur ${tmp}/build ${tmp}/bacula-restores${cwd}/tmp/build 2>&1 >/dev/null
fi
dstat=$?
}
echo " ===== $TestName OK `date +%R:%S` ===== "
echo " ===== $TestName OK `date +%R:%S` ===== " >>test.out
if test "$debug" -eq 0 ; then
- scripts/cleanup
+ ${rscripts}/cleanup
fi
fi
}
copy_tape_confs()
{
- scripts/copy-tape-confs
- scripts/cleanup-tape
+ ${rscripts}/copy-tape-confs
+ ${rscripts}/cleanup-tape
}
copy_test_confs()
{
- scripts/copy-test-confs
- scripts/cleanup
+ ${rscripts}/copy-test-confs
+ ${rscripts}/cleanup
}
debug_wait()
load_slot1()
{
# Get a tape from slot1
-slot=`$scripts/$MTX ${AUTOCHANGER} loaded 0 ${TAPE_DRIVE} $DRIVE1`
+slot=`${scripts}/$MTX ${AUTOCHANGER} loaded 0 ${TAPE_DRIVE} $DRIVE1`
case $slot in
0)
- $scripts/$MTX ${AUTOCHANGER} load $SLOT1 ${TAPE_DRIVE} $DRIVE1
+ ${scripts}/$MTX ${AUTOCHANGER} load $SLOT1 ${TAPE_DRIVE} $DRIVE1
slot=$SLOT1
;;
$SLOT1)
;;
*)
rewind_drive ${TAPE_DRIVE}
- $scripts/$MTX ${AUTOCHANGER} unload $slot ${TAPE_DRIVE} $DRIVE1
- $scripts/$MTX ${AUTOCHANGER} load $SLOT1 ${TAPE_DRIVE} $DRIVE1
+ ${scripts}/$MTX ${AUTOCHANGER} unload $slot ${TAPE_DRIVE} $DRIVE1
+ ${scripts}/$MTX ${AUTOCHANGER} load $SLOT1 ${TAPE_DRIVE} $DRIVE1
slot=$SLOT1
;;
esac
rewind_drive ${TAPE_DRIVE}
case $1 in
0)
- $scripts/${AUTOCHANGER_SCRIPT} ${AUTOCHANGER} load $SLOT1 ${TAPE_DRIVE} $DRIVE1
+ ${scripts}/${AUTOCHANGER_SCRIPT} ${AUTOCHANGER} load $SLOT1 ${TAPE_DRIVE} $DRIVE1
slot=1
;;
$SLOT1)
- $scripts/${AUTOCHANGER_SCRIPT} ${AUTOCHANGER} unload $1 ${TAPE_DRIVE} $DRIVE1
- $scripts/${AUTOCHANGER_SCRIPT} ${AUTOCHANGER} load $SLOT2 ${TAPE_DRIVE} $DRIVE1
+ ${scripts}/${AUTOCHANGER_SCRIPT} ${AUTOCHANGER} unload $1 ${TAPE_DRIVE} $DRIVE1
+ ${scripts}/${AUTOCHANGER_SCRIPT} ${AUTOCHANGER} load $SLOT2 ${TAPE_DRIVE} $DRIVE1
slot=2
;;
$SLOT2)
- $scripts/${AUTOCHANGER_SCRIPT} ${AUTOCHANGER} unload $1 ${TAPE_DRIVE} $DRIVE1
- $scripts/${AUTOCHANGER_SCRIPT} ${AUTOCHANGER} load $SLOT1 ${TAPE_DRIVE} $DRIVE1
+ ${scripts}/${AUTOCHANGER_SCRIPT} ${AUTOCHANGER} unload $1 ${TAPE_DRIVE} $DRIVE1
+ ${scripts}/${AUTOCHANGER_SCRIPT} ${AUTOCHANGER} load $SLOT1 ${TAPE_DRIVE} $DRIVE1
slot=1
;;
*)
db_password=${db_password:-""}
working=${working:-"$cwd/working"}
bin=${bin:-"$cwd/bin"}
+# Bacula scripts
scripts=${scripts:-"$bin"}
+# Regress scripts
+rscripts=${rscripts:-"$cwd/scripts"}
+tmp=${tmp:-"$cwd/tmp"}
export bin
export working
export scripts
+export rscripts
+export tmp
+
+touch ${tmp}/dir.out ${tmp}/fd.out ${tmp}/sd.out
CLIENT=${HOST}-fd
# Zap out any schedule in default conf file so that
# it doesn't start during our test
#
-outf="tmp/sed_tmp"
+outf="$tmp/sed_tmp"
echo "s% Schedule =%# Schedule =%g" >${outf}
-cp ${cwd}/bin/bacula-dir.conf ${cwd}/tmp/1
-sed -f ${outf} ${cwd}/tmp/1 >${cwd}/bin/bacula-dir.conf
+cp $scripts/bacula-dir.conf $tmp/1
+sed -f ${outf} $tmp/1 >$scripts/bacula-dir.conf
change_jobname Client1 $JobName
start_test
-cat <<END_OF_DATA >${cwd}/tmp/bconcmds
+cat <<END_OF_DATA >$tmp/bconcmds
@output /dev/null
messages
-@$out ${cwd}/tmp/log1.out
+@$out $tmp/log1.out
setdebug level=100 storage=File
label volume=TestVolume001 storage=File pool=Default
run job=$JobName yes
@#
@# now do a restore
@#
-@$out ${cwd}/tmp/log2.out
-restore where=${cwd}/tmp/bacula-restores select all done
+@$out $tmp/log2.out
+restore where=$tmp/bacula-restores select all done
yes
wait
messages
check_for_zombie_jobs storage=File
stop_bacula
-cat <<END_OF_DATA >${cwd}/tmp/bconcmds
+cat <<END_OF_DATA >$tmp/bconcmds
@output /dev/null
messages
-@$out ${cwd}/tmp/log1.out
+@$out $tmp/log1.out
@#setdebug level=100 storage=File
run job=$JobName yes
wait
@#
@# now do a restore
@#
-@$out ${cwd}/tmp/log2.out
-restore where=${cwd}/tmp/bacula-restores select all done
+@$out $tmp/log2.out
+restore where=$tmp/bacula-restores select all done
yes
wait
messages
JobName=Incremental
. scripts/functions
-scripts/cleanup
-scripts/copy-test-confs
-echo "${cwd}/tmp/build" >${cwd}/tmp/file-list
-mkdir ${cwd}/tmp/build
-cp -p ${cwd}/build/src/dird/*.c ${cwd}/tmp/build
+${rscripts}/cleanup
+${rscripts}/copy-test-confs
+echo "${tmp}/build" >${tmp}/file-list
+mkdir ${tmp}/build
+cp -p ${cwd}/build/src/dird/*.c ${tmp}/build
cd ${cwd}/tmp
-echo "${cwd}/tmp/build/ficheriro1.txt" >restore-list
-echo "${cwd}/tmp/build/ficheriro2.txt" >>restore-list
+echo "${tmp}/build/ficheriro1.txt" >restore-list
+echo "${tmp}/build/ficheriro2.txt" >>restore-list
cd ${cwd}
change_jobname CompressedTest $JobName
start_test
-cat <<END_OF_DATA >${cwd}/tmp/bconcmds
+cat <<END_OF_DATA >${tmp}/bconcmds
@output /dev/null
messages
-@$out ${cwd}/tmp/log1.out
+@$out ${tmp}/log1.out
@#setdebug level=100 storage=File
label storage=File volume=TestVolume001
label storage=File volume=TestVolume002
# Now create two new files to be restored later
#
sleep 1
-echo "ficheriro1.txt" >${cwd}/tmp/build/ficheriro1.txt
-cp -f ${cwd}/tmp/build/dird.c ${cwd}/tmp/build/ficheriro2.txt
+echo "ficheriro1.txt" >${tmp}/build/ficheriro1.txt
+cp -f ${tmp}/build/dird.c ${tmp}/build/ficheriro2.txt
-cat <<END_OF_DATA >${cwd}/tmp/bconcmds
+cat <<END_OF_DATA >${tmp}/bconcmds
@output /dev/null
messages
-@$out ${cwd}/tmp/log1.out
+@$out ${tmp}/log1.out
@# Force Incremental on the second Volume
update volume=TestVolume001 VolStatus=Used
run level=Differential job=$JobName yes
run_bconsole
sleep 1
-touch ${cwd}/tmp/build/ficheriro1.txt
-touch ${cwd}/tmp/build/ficheriro2.txt
+touch ${tmp}/build/ficheriro1.txt
+touch ${tmp}/build/ficheriro2.txt
-cat <<END_OF_DATA >${cwd}/tmp/bconcmds
+cat <<END_OF_DATA >${tmp}/bconcmds
@output /dev/null
messages
-@$out ${cwd}/tmp/log1.out
+@$out ${tmp}/log1.out
run level=Incremental job=$JobName yes
wait
messages
run_bconsole
sleep 1
-cd ${cwd}/tmp/build
+cd ${tmp}/build
cp -f ficheriro2.txt 1
sed "s%a%b%g" 1 >ficheriro2.txt
rm -f 1
cd ${cwd}
-cat <<END_OF_DATA >${cwd}/tmp/bconcmds
+cat <<END_OF_DATA >${tmp}/bconcmds
@output /dev/null
messages
-@$out ${cwd}/tmp/log1.out
+@$out ${tmp}/log1.out
run level=Differential job=$JobName yes
wait
messages
run_bconsole
sleep 1
-touch ${cwd}/tmp/build/ficheriro1.txt
-touch ${cwd}/tmp/build/ficheriro2.txt
-cat <<END_OF_DATA >${cwd}/tmp/bconcmds
+touch ${tmp}/build/ficheriro1.txt
+touch ${tmp}/build/ficheriro2.txt
+cat <<END_OF_DATA >${tmp}/bconcmds
@output /dev/null
messages
-@$out ${cwd}/tmp/log1.out
+@$out ${tmp}/log1.out
run level=Incremental job=$JobName yes
wait
messages
run_bconsole
sleep 1
-touch ${cwd}/tmp/build/ficheriro1.txt
-touch ${cwd}/tmp/build/ficheriro2.txt
-cat <<END_OF_DATA >${cwd}/tmp/bconcmds
+touch ${tmp}/build/ficheriro1.txt
+touch ${tmp}/build/ficheriro2.txt
+cat <<END_OF_DATA >${tmp}/bconcmds
@output /dev/null
messages
-@$out ${cwd}/tmp/log1.out
+@$out ${tmp}/log1.out
run level=Incremental job=$JobName yes
wait
messages
run_bconsole
sleep 1
-touch ${cwd}/tmp/build/ficheriro1.txt
-touch ${cwd}/tmp/build/ficheriro2.txt
-cat <<END_OF_DATA >${cwd}/tmp/bconcmds
+touch ${tmp}/build/ficheriro1.txt
+touch ${tmp}/build/ficheriro2.txt
+cat <<END_OF_DATA >${tmp}/bconcmds
@output /dev/null
messages
-@$out ${cwd}/tmp/log1.out
+@$out ${tmp}/log1.out
run level=Incremental job=$JobName yes
wait
messages
run_bconsole
sleep 1
-touch ${cwd}/tmp/build/ficheriro1.txt
-touch ${cwd}/tmp/build/ficheriro2.txt
+touch ${tmp}/build/ficheriro1.txt
+touch ${tmp}/build/ficheriro2.txt
-cat <<END_OF_DATA >${cwd}/tmp/bconcmds
+cat <<END_OF_DATA >${tmp}/bconcmds
@output /dev/null
messages
-@$out ${cwd}/tmp/log1.out
+@$out ${tmp}/log1.out
setdebug level=200 storage=File
run level=Incremental job=$JobName yes
wait
@#
@# now do a restore
@#
-@$out ${cwd}/tmp/log2.out
+@$out ${tmp}/log2.out
setdebug level=10 storage=File
-restore where=${cwd}/tmp/bacula-restores storage=File file=<${cwd}/tmp/restore-list
+restore where=${tmp}/bacula-restores storage=File file=<${tmp}/restore-list
yes
wait
status storage=File
#
# Delete .c files because we will only restored the txt files
#
-rm -f ${cwd}/tmp/build/*.c
+rm -f ${tmp}/build/*.c
check_restore_tmp_build_diff
end_test