#
# Run all root tests
#
+rm -f test.out
tests/dev-test-root
tests/etc-test-root
tests/lib-test-root
# Run a simple backup of the Bacula build directory
# then restore it.
#
-echo " "
-echo " "
-echo " === /dev save/restore test ==="
-echo " "
-echo " "
-UID=`/usr/bin/id -u`
-if [ $UID != 0 ] ; then
+MUID=`/usr/bin/id -u`
+if [ $MUID != 0 ] ; then
echo " "
echo "You must be root to run this test."
echo " ===== dev test failed!!! ===== "
fi
cwd=`pwd`
scripts/copy-test-confs
+scripts/cleanup
echo "/dev" >/tmp/file-list
-rm -rf /tmp/TestVolume001 /tmp/bacula-restores
bin/bacula stop 2>&1 >/dev/null
bin/drop_sqlite_tables
bin/make_sqlite_tables
+echo " "
+echo " "
+echo " === Starting /dev save/restore test ==="
+echo " "
+echo " "
bin/bacula start 2>&1 >/dev/null
bin/console -c bin/console.conf <<END_OF_DATA
@output /dev/null
messages
+@output tmp/log1.out
label storage=File
TestVolume001
run job=NightlySave
@#
@# now do a restore
@#
-restore
-5
-done
+@output tmp/log2.out
+restore where=${cwd}/tmp/bacula-restores current all
yes
-@sleep 1
wait
messages
@output
bin/bacula stop 2>&1 >/dev/null
cd /
${cwd}/bin/testls -e ${cwd}/scripts/exclude-etc-test dev >${cwd}/tmp/original
-cd /tmp/bacula-restores
+cd ${cwd}/tmp/bacula-restores
${cwd}/bin/testls -e ${cwd}/scripts/exclude-etc-test dev >${cwd}/tmp/restored
-diff ${cwd}/tmp/original ${cwd}/tmp/restored 2>&1 >/dev/null
+cd ${cwd}/tmp
+cat >sed.scr <<END_OF_DATA
+s%.*dev$%dev%
+s%.*[0-9][0-9]:[0-9][0-9]:[0-9][0-9] dev/ptmx%dev/ptmx%
+s%.*[0-9][0-9]:[0-9][0-9]:[0-9][0-9] dev/ttyp1%dev/ttyp1%
+s%.*[0-9][0-9]:[0-9][0-9]:[0-9][0-9] dev/null%dev/null%
+END_OF_DATA
+sed -f sed.scr original | sort >original
+#
+sed -f sed.scr restored | sort >restored
+rm -f sed.scr
+#
+cd ${cwd}
+diff tmp/original tmp/restored 2>&1 1>/dev/null 2>&1 1>/dev/null
if [ $? != 0 ] ; then
echo " "
echo " "
else
echo " ===== dev test OK ===== "
echo " ===== dev test OK ===== " >>test.out
- cd ${cwd}
scripts/cleanup
fi
# Run a simple backup of the Bacula build directory
# then restore it.
#
-echo " "
-echo " "
-echo " === /etc save/restore test ==="
-echo " "
-echo " "
-UID=`/usr/bin/id -u`
-if [ $UID != 0 ] ; then
+MUID=`/usr/bin/id -u`
+if [ $MUID != 0 ] ; then
echo " "
echo "You must be root to run this test."
- echo " ===== Test4 failed!!! ===== "
- echo " ===== Test4 failed!!! ===== " >>test.out
+ echo " ===== etc-test-root failed!!! ===== "
+ echo " ===== etc-test-root failed!!! ===== " >>test.out
echo " "
exit 1
fi
+echo " "
+echo " "
+echo " === Starting /etc save/restore test ==="
+echo " "
+echo " "
cwd=`pwd`
scripts/copy-test-confs
+scripts/cleanup
echo "/etc" >/tmp/file-list
-rm -rf /tmp/TestVolume001 /tmp/bacula-restores
bin/bacula stop 2>&1 >/dev/null
bin/drop_sqlite_tables
bin/make_sqlite_tables
bin/console -c bin/console.conf <<END_OF_DATA
@output /dev/null
messages
+@output tmp/log1.out
label storage=File
TestVolume001
run job=NightlySave
@#
@# now do a restore
@#
-restore
-5
-done
+@output tmp/log2.out
+restore where=${cwd}/tmp/bacula-restores current all
yes
-@sleep 1
wait
messages
@output
END_OF_DATA
bin/bacula stop 2>&1 >/dev/null
cd /
-${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 >${cwd}/tmp/restored
-diff ${cwd}/tmp/original ${cwd}/tmp/restored 2>&1 >/dev/null
+${cwd}/bin/testls -e ${cwd}/scripts/exclude-etc-test etc >${cwd}/tmp/1
+cd ${cwd}/tmp/bacula-restores
+${cwd}/bin/testls -e ${cwd}/scripts/exclude-etc-test etc >${cwd}/tmp/2
+sort <${cwd}/tmp/1 >${cwd}/tmp/original
+sort <${cwd}/tmp/2 >${cwd}/tmp/restored
+rm -f ${cwd}/tmp/1 ${cwd}/tmp/2
+cd ${cwd}
+diff tmp/original tmp/restored 2>&1 1>/dev/null
if [ $? != 0 ] ; then
echo " "
echo " "
- echo " ===== Test4 /etc failed!!! ===== "
- echo " ===== Test4 failed!!! ===== " >>test.out
+ echo " ===== etc-test-root failed!!! ===== "
+ echo " ===== etc-test-root failed!!! ===== " >>test.out
echo " "
else
- echo " ===== Test4 /etc OK ===== "
- echo " ===== Test4 OK ===== " >>test.out
- cd ${cwd}
+ echo " ===== etc-test-root OK ===== "
+ echo " ===== etc-test-root OK ===== " >>test.out
scripts/cleanup
fi
# Run a simple backup of the Bacula build directory
# then restore it.
#
-echo " "
-echo " "
-echo " === /lib save/restore test ==="
-echo " "
-echo " "
-UID=`/usr/bin/id -u`
-if [ $UID != 0 ] ; then
+MUID=`/usr/bin/id -u`
+if [ $MUID != 0 ] ; then
echo " "
echo "You must be root to run this test."
- echo " ===== Test5 failed!!! ===== "
- echo " ===== Test5 failed!!! ===== " >>test.out
+ echo " ===== lib-test-root failed!!! ===== "
+ echo " ===== lib-test-root failed!!! ===== " >>test.out
echo " "
exit 1
fi
cwd=`pwd`
scripts/copy-test-confs
+scripts/cleanup
echo "/lib" >/tmp/file-list
-rm -rf /tmp/TestVolume001 /tmp/bacula-restores
bin/bacula stop 2>&1 >/dev/null
bin/drop_sqlite_tables
bin/make_sqlite_tables
+echo " "
+echo " "
+echo " === Starting /lib save/restore test ==="
+echo " "
+echo " "
bin/bacula start 2>&1 >/dev/null
bin/console -c bin/console.conf <<END_OF_DATA
@output /dev/null
messages
+@output tmp/log1.out
label storage=File
TestVolume001
run job=NightlySave
@#
@# now do a restore
@#
-restore
-5
-done
+@output tmp/log2.out
+restore where=${cwd}/tmp/bacula-restores current all
yes
-@sleep 1
wait
messages
@output
bin/bacula stop 2>&1 >/dev/null
cd /
${cwd}/bin/testls -e ${cwd}/scripts/exclude-lib-test lib >${cwd}/tmp/original
-cd /tmp/bacula-restores
+cd ${cwd}/tmp/bacula-restores
${cwd}/bin/testls -e ${cwd}/scripts/exclude-lib-test lib >${cwd}/tmp/restored
-diff ${cwd}/tmp/original ${cwd}/tmp/restored 2>&1 >/dev/null
+cd ${cwd}/tmp
+sed s%.*lib/kbd/consolefonts$%lib/kbd/consolefonts% original >1
+sort <1 >original
+#
+sed s%.*lib/kbd/consolefonts$%lib/kbd/consolefonts% restored >1
+sort <1 >restored
+rm -f 1
+#
+cd ${cwd}
+diff tmp/original tmp/restored 2>&1 1>/dev/nul
if [ $? != 0 ] ; then
echo " "
echo " "
- echo " ===== Test5 /lib failed!!! ===== "
- echo " ===== Test5 failed!!! ===== " >>test.out
+ echo " ===== lib-test-root failed!!! ===== "
+ echo " ===== lib-test-root failed!!! ===== " >>test.out
echo " "
else
- echo " ===== Test5 /lib OK ===== "
- echo " ===== Test5 OK ===== " >>test.out
- cd ${cwd}
+ echo " ===== lib-test-root OK ===== "
+ echo " ===== lib-test-root OK ===== " >>test.out
scripts/cleanup
fi