From: Kern Sibbald Date: Sat, 9 Jun 2007 13:25:45 +0000 (+0000) Subject: Make runscript scripting portable X-Git-Tag: Release-7.0.0~6143 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=6f0571bacc9f08da35030e0735cd6bece47d328b;p=bacula%2Fbacula Make runscript scripting portable git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@5004 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/regress/tests/runscript-test b/regress/tests/runscript-test index b9c8e54759..490af4e906 100755 --- a/regress/tests/runscript-test +++ b/regress/tests/runscript-test @@ -61,10 +61,15 @@ export dstat export bstat export rstat -if grep -q 'dir: BeforeJob: run command "/bin/echo RunBeforeJob"' tmp/RUN_ALL_OK.log && - grep -q 'fd: ClientRunBeforeJob: ClientRunBeforeJob' tmp/RUN_ALL_OK.log && - grep -q 'fd: ClientAfterJob: run command "/bin/echo ClientRunAfterJob' tmp/RUN_ALL_OK.log && - grep -q 'dir: AfterJob: run command "/bin/echo RunAfterJob' tmp/RUN_ALL_OK.log +grep 'dir: BeforeJob: run command "/bin/echo RunBeforeJob"' tmp/RUN_ALL_OK.log >/dev/null 2>&1 +a=$? +grep 'fd: ClientRunBeforeJob: ClientRunBeforeJob' tmp/RUN_ALL_OK.log >/dev/null 2>&1 +b=$? +grep 'fd: ClientAfterJob: run command "/bin/echo ClientRunAfterJob' tmp/RUN_ALL_OK.log >/dev/null 2>&1 +c=$? +grep 'dir: AfterJob: run command "/bin/echo RunAfterJob' tmp/RUN_ALL_OK.log >/dev/null 2>&1 +d=$? +if [ $a = 0 -a $b = 0 -a $c = 0 -a $d = 0 ] then [ "$debug" = 1 ] && echo RUN_ALL_OK ok else @@ -72,9 +77,11 @@ else rstat=1 fi -if grep -q 'dir: BeforeJob: run command "/bin/false RUN_DIR_FAILED"' tmp/RUN_DIR_FAILED.log && - grep -q 'dir: AfterJob: RunAfterFailedJob' tmp/RUN_DIR_FAILED.log && - true # grep -q 'Backup OK -- with warnings' tmp/RUN_DIR_FAILED.log +grep 'dir: BeforeJob: run command "/bin/false RUN_DIR_FAILED"' tmp/RUN_DIR_FAILED.log >/dev/null 2>&1 +a=$? +grep 'dir: AfterJob: RunAfterFailedJob' tmp/RUN_DIR_FAILED.log >/dev/null 2>&1 +b=$? +if [ $a = 0 -a $b = 0 ] then [ "$debug" = 1 ] && echo RUN_DIR_FAILED ok else @@ -82,10 +89,15 @@ else rstat=1 fi -if grep -q 'fd: ClientBeforeJob: run command "/bin/false RUN_FD_FAILED1"' tmp/RUN_FD_FAILED.log && - grep -q 'fd: ClientBeforeJob: run command "/bin/false RUN_FD_FAILED2"' tmp/RUN_FD_FAILED.log && - grep -q 'dir: AfterJob: run command "/bin/echo RunAfterFailedJob"' tmp/RUN_FD_FAILED.log && - grep -q '*** Backup Error ***' tmp/RUN_FD_FAILED.log +grep 'fd: ClientBeforeJob: run command "/bin/false RUN_FD_FAILED1"' tmp/RUN_FD_FAILED.log >/dev/null 2>&1 +a=$? +grep 'fd: ClientBeforeJob: run command "/bin/false RUN_FD_FAILED2"' tmp/RUN_FD_FAILED.log >/dev/null 2>&1 +b=$? +grep 'dir: AfterJob: run command "/bin/echo RunAfterFailedJob"' tmp/RUN_FD_FAILED.log >/dev/null 2>&1 +c=$? +grep '*** Backup Error ***' tmp/RUN_FD_FAILED.log >/dev/null 2>&1 +d=$? +if [ $a = 0 -a $b = 0 -a $c = 0 -a $d = 0 ] then [ "$debug" = 1 ] && echo RUN_FD_FAILED ok else @@ -93,12 +105,17 @@ else rstat=1 fi -if grep -q 'fd: ClientBeforeJob: run command "/bin/false RUN_FD_FAILED1"' tmp/RUN_FD_FAILED2.log && - ! grep -q 'fd: ClientBeforeJob: run command "/bin/false RUN_FD_FAILED2"' tmp/RUN_FD_FAILED2.log && - grep -q 'fd: ClientBeforeJob: run command "/bin/false RUN_FD_FAILED3"' tmp/RUN_FD_FAILED2.log && - grep -q 'dir: AfterJob: run command "/bin/echo RunAfterFailedJob"' tmp/RUN_FD_FAILED2.log && - grep -q '*** Backup Error ***' tmp/RUN_FD_FAILED2.log - +grep 'fd: ClientBeforeJob: run command "/bin/false RUN_FD_FAILED1"' tmp/RUN_FD_FAILED2.log >/dev/null 2>&1 +a=$? +grep 'fd: ClientBeforeJob: run command "/bin/false RUN_FD_FAILED2"' tmp/RUN_FD_FAILED2.log >/dev/null 2>&1 +b=$? +grep 'fd: ClientBeforeJob: run command "/bin/false RUN_FD_FAILED3"' tmp/RUN_FD_FAILED2.log >/dev/null 2>&1 +c=$? +grep 'dir: AfterJob: run command "/bin/echo RunAfterFailedJob"' tmp/RUN_FD_FAILED2.log >/dev/null 2>&1 +d=$? +grep '*** Backup Error ***' tmp/RUN_FD_FAILED2.log >/dev/null 2>&1 +e=$? +if [ $a = 0 -a $b != 0 -a $c = 0 -a $d = 0 -a $e = 0 ] then [ "$debug" = 1 ] && echo RUN_FD_FAILED ok else @@ -106,9 +123,13 @@ else rstat=1 fi -if grep -q 'fd: ClientBeforeJob: run command "/bin/false RUN_FD_WARNING"' tmp/RUN_FD_WARNING.log && - ! grep -q 'RunAfterFailedJob' tmp/RUN_FD_WARNING.log && - grep -q 'Backup OK -- with warnings' tmp/RUN_FD_WARNING.log +grep 'fd: ClientBeforeJob: run command "/bin/false RUN_FD_WARNING"' tmp/RUN_FD_WARNING.log >/dev/null 2>&1 +a=$? +grep 'RunAfterFailedJob' tmp/RUN_FD_WARNING.log >/dev/null 2>&1 +b=$? +grep 'Backup OK -- with warnings' tmp/RUN_FD_WARNING.log >/dev/null 2>&1 +c=$? +if [ $a = 0 -a $b != 0 -a $c = 0 ] then [ "$debug" = 1 ] && echo RUN_FD_WARNING ok else