# Run a simple backup of the Bacula build directory
# then restore it.
#
-MUID=`/usr/bin/id -u`
-if [ $MUID != 0 ] ; then
- echo " "
- echo "You must be root to run this test."
- echo " ===== !!!! dev-test-root not run !!!! ===== "
- echo " ===== !!!! dev-test-root not run !!!! ===== " >>test.out
- echo " "
- exit 1
-fi
-cwd=`pwd`
+
+TestName="dev-test-root"
+. scripts/functions
+
+require_root
+
scripts/cleanup
scripts/copy-test-confs
-echo "/dev" >/tmp/file-list
+echo "/dev" >${cwd}/tmp/file-list
-echo " "
-echo " "
-echo " === Starting dev-test-root test ==="
-echo " "
-echo " === Note, this test can fail for trivial ==="
-echo " === reasons on non-Linux systems. ==="
-echo " "
-echo " "
+start_test
-bin/bacula start 2>&1 >/dev/null
-bin/bconsole -c bin/bconsole.conf <<END_OF_DATA
+cat <<END_OF_DATA >${cwd}/tmp/bconcmds
@output /dev/null
messages
-@output tmp/log1.out
+@output ${cwd}/tmp/log1.out
label storage=File volume=TestVolume001
run job=NightlySave yes
wait
@#
@# now do a restore
@#
-@output tmp/log2.out
+@output ${cwd}/tmp/log2.out
restore where=${cwd}/tmp/bacula-restores select all done
yes
wait
@output
quit
END_OF_DATA
-bin/bacula stop 2>&1 >/dev/null
+
+run_bacula
+check_for_zombie_jobs storage=File
+stop_bacula
+
+# More cleanup needed below
+
cd /
${cwd}/bin/testls -e ${cwd}/scripts/exclude-etc-test dev >${cwd}/tmp/original
cd ${cwd}/tmp/bacula-restores
rm -f sed.scr
#
cd ${cwd}
-diff tmp/original tmp/restored 2>&1 1>/dev/null
+diff ${cwd}/tmp/original ${cwd}/tmp/restored 2>&1 1>/dev/null
if [ $? != 0 ] ; then
echo " "
echo " "