From ed9a9f8c5077ab4ed9526ae97e2c5788ff7cf994 Mon Sep 17 00:00:00 2001 From: Albert Cheng Date: Tue, 8 Jun 2010 13:22:11 -0500 Subject: [svn-r18985] Test feature: (bugs 1919) Problem: some launching command like yod (and sometimes mpirun), do not pass back the exit code of the executables back to the shell. It always returns 0 if it can launch the executable. This cause tests that expect non-zero exit code to fail incorrectly. Short term Solution: Added the feature that if $RUNSERIAL_NOEXITCODE is defined, do not test conditions that rely on non-zero exit code. Tests: dove-linux using RUNSERIAL=thgyod to see the failures and using $RUNSERIAL_NOEXITCODE=yes to bypass the errors. Also h5committested. --- test/testcheck_version.sh.in | 10 +++++++++- tools/h5copy/testh5copy.sh | 10 +++++++++- tools/h5diff/testh5diff.sh | 12 ++++++++++-- tools/h5ls/testh5ls.sh.in | 10 +++++++++- 4 files changed, 37 insertions(+), 5 deletions(-) diff --git a/test/testcheck_version.sh.in b/test/testcheck_version.sh.in index 6e80654..a2c812d 100644 --- a/test/testcheck_version.sh.in +++ b/test/testcheck_version.sh.in @@ -24,6 +24,7 @@ Shared_Lib=@enable_shared@ Static_Lib=@enable_static@ Static_exec=@STATIC_EXEC@ +h5haveexitcode=yes # default is yes CMP='cmp -s' DIFF='diff -c' @@ -175,7 +176,7 @@ TESTING() { ret_code=$? cat $actual_err >> $actual - if [ \( $expect_code -ne $ret_code \) ]; then + if [ $h5haveexitcode = 'yes' -a \( $expect_code -ne $ret_code \) ]; then echo "*FAILED*" echo " Expected exit code ($expect_code) differs from actual code ($ret_code)" nerrors="`expr $nerrors + 1`" @@ -234,6 +235,13 @@ case "$h5versmajor$h5versminor$h5versrelease" in ;; esac +# RUNSERIAL is used. Check if it can return exit code from executalbe correctly. +if [ -n "$RUNSERIAL_NOEXITCODE" ]; then + echo "***Warning*** Serial Exit Code is not passed back to shell corretly." + echo "***Warning*** Exit code checking is skipped." + h5haveexitcode=no +fi + # Three Categories of tests: # Normal: where the version numbers all matched (wrong_version == none). # Mismatched version numbers (could be Major or minor version diff --git a/tools/h5copy/testh5copy.sh b/tools/h5copy/testh5copy.sh index 3f24bdf..e98e67e 100644 --- a/tools/h5copy/testh5copy.sh +++ b/tools/h5copy/testh5copy.sh @@ -41,6 +41,7 @@ DIFF='diff -c' nerrors=0 verbose=yes +h5haveexitcode=yes # default is yes # The build (current) directory might be different than the source directory. if test -z "$srcdir"; then @@ -51,6 +52,13 @@ OUTDIR=./testfiles test -d $OUTDIR || mkdir $OUTDIR +# RUNSERIAL is used. Check if it can return exit code from executalbe correctly. +if [ -n "$RUNSERIAL_NOEXITCODE" ]; then + echo "***Warning*** Serial Exit Code is not passed back to shell corretly." + echo "***Warning*** Exit code checking is skipped." + h5haveexitcode=no +fi + # Print a "SKIP" message SKIP() { TESTING $H5COPY $@ @@ -200,7 +208,7 @@ H5DIFFTEST_FAIL() $RUNSERIAL $H5DIFF_BIN -q "$@" RET=$? - if [ $RET != 1 ] ; then + if [ $h5haveexitcode = 'yes' -a $RET != 1 ] ; then echo "*FAILED*" nerrors="`expr $nerrors + 1`" else diff --git a/tools/h5diff/testh5diff.sh b/tools/h5diff/testh5diff.sh index 5bbec8d..421bf73 100755 --- a/tools/h5diff/testh5diff.sh +++ b/tools/h5diff/testh5diff.sh @@ -67,6 +67,7 @@ DIFF='diff -c' nerrors=0 verbose=yes +h5haveexitcode=yes # default is yes pmode= # default to run h5diff tests mydomainname=`domainname 2>/dev/null` @@ -103,6 +104,13 @@ while [ $# -gt 0 ]; do esac done +# RUNSERIAL is used. Check if it can return exit code from executalbe correctly. +if [ -n "$RUNSERIAL_NOEXITCODE" ]; then + echo "***Warning*** Serial Exit Code is not passed back to shell corretly." + echo "***Warning*** Exit code checking is skipped." + h5haveexitcode=no +fi + # Print a line-line message left justified in a field of 70 characters # beginning with the word "Testing". # @@ -224,7 +232,7 @@ TOOLTEST() { # is from mpirun not tool) # if any problem occurs relate to an exit code, it will be caught in # serial mode, so the test is fullfilled. - if test -z "$pmode"; then + if test $h5haveexitcode = 'yes' -a -z "$pmode"; then echo "EXIT CODE: $EXIT_CODE" >> $actual fi @@ -234,7 +242,7 @@ TOOLTEST() { cp $actual $expect elif $CMP $expect $actual; then echo " PASSED" - elif test -z "$pmode"; then + elif test $h5haveexitcode = 'yes' -a -z "$pmode"; then echo "*FAILED*" echo " Expected result ($expect) differs from actual result ($actual)" nerrors="`expr $nerrors + 1`" diff --git a/tools/h5ls/testh5ls.sh.in b/tools/h5ls/testh5ls.sh.in index 970646d..7f07898 100644 --- a/tools/h5ls/testh5ls.sh.in +++ b/tools/h5ls/testh5ls.sh.in @@ -30,6 +30,7 @@ WORDS_BIGENDIAN="@WORDS_BIGENDIAN@" nerrors=0 verbose=yes +h5haveexitcode=yes # default is yes # The build (current) directory might be different than the source directory. if test -z "$srcdir"; then @@ -37,6 +38,13 @@ if test -z "$srcdir"; then fi test -d ../testfiles || mkdir ../testfiles +# RUNSERIAL is used. Check if it can return exit code from executalbe correctly. +if [ -n "$RUNSERIAL_NOEXITCODE" ]; then + echo "***Warning*** Serial Exit Code is not passed back to shell corretly." + echo "***Warning*** Exit code checking is skipped." + h5haveexitcode=no +fi + # Print a line-line message left justified in a field of 70 characters # beginning with the word "Testing". TESTING() { @@ -74,7 +82,7 @@ TOOLTEST() { exitcode=$? cat $actual_err >> $actual - if [ $exitcode -ne $retvalexpect ]; then + if [ $h5haveexitcode = 'yes' -a $exitcode -ne $retvalexpect ]; then echo "*FAILED*" nerrors="`expr $nerrors + 1`" if [ yes = "$verbose" ]; then -- cgit v0.12