Kern Sibbald
April 2003
-This is Bacula's regression script directory.
+This is Bacula's regression script directory. At this time
+(May 2003), it is still in development, so all the tests are
+not complete.
To set it up, first edit Makefile and set BACULA-SOURCE to point
to your source.
-Second, make sure that depkgs is in the parent directory of this
-directory (i.e. at the same level) and that it is pre-built.
+!!!!!!!!!! IMPORTANT !!!!!!!!
+Second, edit the EMAIL address in the Makefile to be your
+email address and not mine or I will get LOTS of unwanted
+email!
+
+Third, edit the DEPKGS path in the Makefile to point to the
+depkgs directory.
+
+Fourth, make sure that depkgs is pre-built if it isn't
+already: (cd your-depkgs; make sqlite).
Then do:
make setup
-You run the above one time.
+You run the above one time. This will copy the Bacula
+source, configure, build it, and configure all the scripts
+and conf files. If you change your source, you will need
+to redo this command.
Then you can run any of the tests in the tests subdirectory.
Each test whose name ends in -root requires you to be root for
sparse-compressed-test
two-jobs-test
wierd-files-test
+verify-vol-test
The tests expect you to execute them from the main regress
directory!
tests/two-jobs-test
-or all tests:
+or all non-root tests (my normal testing under my account)
+
+ ./all-non-root-tests
+
+or all tests (I only run these before a production release):
su
./all-tests
-or all non-root tests
-
- ./all-non-root-tests
after running the root tests, while still root, it is a good idea
to do:
make reset
this cleans up any files that may be created with root permissions.
+
--- /dev/null
+#!/bin/sh
+#
+# Run all root tests
+#
+tests/dev-test-root
+tests/etc-test-root
+tests/lib-test-root
+cat test.out
#
# Run all tests
#
-tests/test0
-tests/backup-bacula-test
-tests/sparse-test
-tests/compressed-test
-tests/sparse-compressed-test
-tests/wierd-files-test
-tests/two-jobs-test
-tests/dev-test-root
-tests/etc-test-root
-tests/lib-test-root
+./all-non-root-tests
+./all-root-tests
cat test.out
echo "s%@working_dir@%${cwd}/bin/working%g" >>${out}
echo "s%@piddir@%${cwd}/bin/working%g" >>${out}
echo "s%@subsysdir@%${cwd}/bin/working%g" >>${out}
+echo "s%@job_email@%${1}%g">>${out}
# process .in files with sed script
sed -f ${out} ${cwd}/scripts/test-bacula-dir.conf.in >${cwd}/scripts/test-bacula-dir.conf
--with-pid-dir=$1/bin/working \
--with-subsys-dir=$1/bin/working \
--enable-smartalloc \
- --with-sqlite=$1/../depkgs/sqlite \
+ --with-sqlite=$2 \
--with-working-dir=$1/bin/working \
- --with-dump-email=kern+ok@sibbald.com \
- --with-job-email=kern+ok@sibbald.com \
+ --with-dump-email=$3 \
+ --with-job-email=$3 \
--with-baseport=8101
exit 0
# Script to setup running Bacula regression tests
#
cwd=`pwd`
-if [ $# != 1 ] ; then
- echo "Arg 1 must be a Bacula release directory."
+if [ $# != 3 ] ; then
+ echo "Incorrect number of arguments. Need:"
+ echo "setup bacula-src depkgs email-address"
echo " "
exit 1
fi
echo " "
exit 1
fi
-if [ ! -d ../depkgs ] ; then
+if [ ! -d $2 ] ; then
cd ..
cwd=`pwd`
- echo "The regression scripts require ${cwd}/depkgs but not found!"
+ echo "The regression scripts require DEPKGS as arg 2 but not found!"
echo " "
exit 1
fi
rm -rf build bin
+# Copy new source
cp -rp $1 build
cp scripts/regress-config build
cd build
-./regress-config ${cwd}
+rm -f Makefile config.cache
+# Run Bacula configuration, make, install
+./regress-config ${cwd} $2 $3
make
make install
cp src/tools/testls ../bin
bin/create_sqlite_database
bin/drop_sqlite_tables
bin/make_sqlite_tables
+# Start and stop Bacula to ensure conf files are OK
bin/bacula start
bin/bacula stop
#
# Save Bacula default conf files for later use
#
cp -f bin/*.conf scripts
-scripts/do_sed
# and to the console
Messages {
Name = Standard
- mailcommand = "@sbindir@/smtp -h localhost -f \"\(Bacula\) %r\" -s \"Bacula: %t %e of %c %l\" %r"
- operatorcommand = "@sbindir@/smtp -h localhost -f \"\(Bacula\) %r\" -s \"Bacula: Intervention needed for %j\" %r"
- MailOnError = kern+ok@sibbald.com = all
- operator = kern+ok@sibbald.com = mount
+ mailcommand = "@sbindir@/smtp -h localhost -f \"\(Bacula Regression\) %r\" -s \"Bacula: %t %e of %c %l\" %r"
+ operatorcommand = "@sbindir@/smtp -h localhost -f \"\(Bacula Regression\) %r\" -s \"Bacula: Intervention needed for %j\" %r"
+ MailOnError = @job_email@ = all
+ operator = @job_email@ = mount
console = all, !skipped
#
# WARNING! the following will create a file that you must cycle from
#
append = "@working_dir@/log" = all, !skipped
}
+
+Messages {
+ Name = NoEmail
+ mailcommand = "@sbindir@/smtp -h localhost -f \"\(Bacula Regression\) %r\" -s \"Bacula: %t %e of %c %l\" %r"
+ console = all, !skipped
+#
+# WARNING! the following will create a file that you must cycle from
+# time to time as it will grow indefinitely. However, it will
+# also keep all your messages if the scroll off the console.
+#
+ append = "@working_dir@/log" = all, !skipped
+}
+
# Default pool definition
Pool {
else
echo " ===== Backup Bacula Test OK ===== "
echo " ===== Backup Bacula Test OK ===== " >>test.out
+ rm -rf /tmp/bacula-restores /tmp/TestVolume001
fi
-rm -rf /tmp/bacula-restores
else
echo " ===== compressed-test Bacula source OK ===== "
echo " ===== compressed-test OK ===== " >>test.out
+ rm -rf /tmp/bacula-restores /tmp/TestVolume001
fi
-rm -rf /tmp/bacula-restores
END_OF_DATA
bin/bacula stop
cd /
-${cwd}/bin/testls -e ${cwd}/scripts/exclude-etc-test dev >/tmp/original
+${cwd}/bin/testls -e ${cwd}/scripts/exclude-etc-test dev >${cwd}/tmp/original
cd /tmp/bacula-restores
-${cwd}/bin/testls -e ${cwd}/scripts/exclude-etc-test dev >/tmp/restored
+${cwd}/bin/testls -e ${cwd}/scripts/exclude-etc-test dev >${cwd}/tmp/restored
diff /tmp/original /tmp/restored
if [ $? != 0 ] ; then
echo " "
else
echo " ===== dev test OK ===== "
echo " ===== dev test OK ===== " >>test.out
- rm -rf /tmp/bacula-restores /tmp/original /tmp/restored
+ rm -rf /tmp/bacula-restores ${cwd}/tmp/original ${cwd}/tmp/restored
rm -rf /tmp/file-list /tmp/job /tmp/TestVolume001
fi
END_OF_DATA
bin/bacula stop
cd /
-${cwd}/bin/testls -e ${cwd}/scripts/exclude-etc-test etc >/tmp/original
+${cwd}/bin/testls -e ${cwd}/scripts/exclude-etc-test etc >${cwd}/tmp/original
cd /tmp/bacula-restores
-${cwd}/bin/testls -e ${cwd}/scripts/exclude-etc-test etc >/tmp/restored
-diff /tmp/original /tmp/restored
+${cwd}/bin/testls -e ${cwd}/scripts/exclude-etc-test etc >${cwd}/tmp/restored
+diff ${cwd}/tmp/original ${cwd}/tmp/restored
if [ $? != 0 ] ; then
echo " "
echo " "
else
echo " ===== Test4 /etc OK ===== "
echo " ===== Test4 OK ===== " >>test.out
- rm -rf /tmp/bacula-restores /tmp/original /tmp/restored
+ rm -rf /tmp/bacula-restores ${cwd}/tmp/original ${cwd}/tmp/restored
rm -rf /tmp/file-list /tmp/job /tmp/TestVolume001
fi
END_OF_DATA
bin/bacula stop
cd /
-${cwd}/bin/testls -e ${cwd}/scripts/exclude-lib-test lib >/tmp/original
+${cwd}/bin/testls -e ${cwd}/scripts/exclude-lib-test lib >${cwd}/tmp/original
cd /tmp/bacula-restores
-${cwd}/bin/testls -e ${cwd}/scripts/exclude-lib-test lib >/tmp/restored
-diff /tmp/original /tmp/restored
+${cwd}/bin/testls -e ${cwd}/scripts/exclude-lib-test lib >${cwd}/tmp/restored
+diff ${cwd}/tmp/original ${cwd}/tmp/restored
if [ $? != 0 ] ; then
echo " "
echo " "
else
echo " ===== Test5 /lib OK ===== "
echo " ===== Test5 OK ===== " >>test.out
- rm -rf /tmp/bacula-restores /tmp/original /tmp/restored
+ rm -rf /tmp/bacula-restores ${cwd}/tmp/original ${cwd}/tmp/restored
rm -rf /tmp/file-list /tmp/job /tmp/TestVolume001
fi
else
echo " ===== sparse-compressed-test Bacula source OK ===== "
echo " ===== sparse-compressed-test OK ===== " >>test.out
+ rm -rf /tmp/bacula-restores /tmp/TestVolume001
fi
-rm -rf /tmp/bacula-restores
else
echo " ===== sparse-test Bacula source OK ===== "
echo " ===== sparse-test OK ===== " >>test.out
+ rm -rf /tmp/bacula-restores /tmp/TestVolume001
fi
-rm -rf /tmp/bacula-restores
else
echo " ===== two-jobs-test Bacula source OK ===== "
echo " ===== two-jobs-test OK ===== " >>test.out
+ rm -rf /tmp/bacula-restores /tmp/TestVolume001
fi
-rm -rf /tmp/bacula-restores
cwd=`pwd`
scripts/copy-test-confs
rm -rf /tmp/TestVolume001 /tmp/bacula-restores
+rm -f tmp/original
bin/bacula stop 2>&1 >/dev/null
bin/drop_sqlite_tables
bin/make_sqlite_tables
run job=VerifyVolume
yes
wait
-@tee /tmp/original
+@tee ${cwd}/tmp/original
messages
@output
quit
END_OF_DATA
sleep 2
bin/bacula stop
-grep "Termination: *Verify OK" /tmp/original 2>&1 >/dev/null
+grep "Termination: *Verify OK" ${cwd}/tmp/original 2>&1 >/dev/null
if [ $? != 0 ] ; then
echo " "
echo " "
else
echo " ===== Verify Volume Test OK ===== "
echo " ===== Verify Volume Test OK ===== " >>test.out
+ rm -rf /tmp/bacula-restores /tmp/TestVolume001
+ rm -f ${cwd}/tmp/original
fi
-rm -rf /tmp/bacula-restores
-rm -f /tmp/original