From: Kern Sibbald Date: Sat, 4 Oct 2003 14:58:58 +0000 (+0000) Subject: Cleanup root tests X-Git-Tag: Release-1.34.0~397 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=73b3a529d6271d6f99adc81925d1fe0661f64a6c;p=bacula%2Fbacula Cleanup root tests git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@729 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/regress/all-root-tests b/regress/all-root-tests index 9eb8995c9f..ce7f7ae533 100755 --- a/regress/all-root-tests +++ b/regress/all-root-tests @@ -2,6 +2,7 @@ # # Run all root tests # +rm -f test.out tests/dev-test-root tests/etc-test-root tests/lib-test-root diff --git a/regress/tests/dev-test-root b/regress/tests/dev-test-root index 8f21e22db5..194748ce18 100755 --- a/regress/tests/dev-test-root +++ b/regress/tests/dev-test-root @@ -3,13 +3,8 @@ # 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!!! ===== " @@ -19,15 +14,21 @@ if [ $UID != 0 ] ; then 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 <&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 <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 " " @@ -62,6 +74,5 @@ if [ $? != 0 ] ; then else echo " ===== dev test OK ===== " echo " ===== dev test OK ===== " >>test.out - cd ${cwd} scripts/cleanup fi diff --git a/regress/tests/etc-test-root b/regress/tests/etc-test-root index 6459026b12..3181eba100 100755 --- a/regress/tests/etc-test-root +++ b/regress/tests/etc-test-root @@ -3,24 +3,24 @@ # 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 @@ -28,6 +28,7 @@ bin/bacula start 2>&1 >/dev/null bin/console -c bin/console.conf <&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 diff --git a/regress/tests/lib-test-root b/regress/tests/lib-test-root index 60320fb39b..b44dd3c67d 100755 --- a/regress/tests/lib-test-root +++ b/regress/tests/lib-test-root @@ -3,31 +3,32 @@ # 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 <&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