From ac5945b412d3f7d8453f46cdd3da6ec45f18c3df Mon Sep 17 00:00:00 2001 From: Albert Cheng Date: Sat, 26 Dec 2009 05:12:49 -0500 Subject: [svn-r18057] Bug fix: 1192 Description: Fixed exit code (sometimes return code in Main) to follow the HDF5 standards. Tested: Jam, both serial and parallel. --- c++/examples/testh5c++.sh.in | 14 ++++++++++---- c++/src/h5c++.in | 8 ++++++-- examples/testh5cc.sh.in | 14 ++++++++++---- fortran/examples/testh5fc.sh.in | 14 ++++++++++---- fortran/src/h5fc.in | 8 ++++++-- tools/misc/h5cc.in | 8 ++++++-- tools/misc/h5redeploy.in | 18 +++++++++++------- tools/misc/h5repart.c | 2 +- 8 files changed, 60 insertions(+), 26 deletions(-) diff --git a/c++/examples/testh5c++.sh.in b/c++/examples/testh5c++.sh.in index 2b7bbfe..4281e3c 100755 --- a/c++/examples/testh5c++.sh.in +++ b/c++/examples/testh5c++.sh.in @@ -20,6 +20,10 @@ # # Initializations +TESTNAME=h5c++ +EXIT_SUCCESS=0 +EXIT_FAILURE=1 + # Where the tool is installed. prefix="${prefix:-@prefix@}" AR="@AR@" @@ -30,7 +34,7 @@ H5TOOL_BIN="${prefix}/bin/${H5TOOL}" # The path of the tool binary CMP='cmp -s' DIFF='diff -c' -nerrors=0 +nerrors=$EXIT_SUCCESS verbose=yes # setup my machine information. @@ -271,7 +275,9 @@ if test -z "$HDF5_NOCLEANUP"; then fi if test $nerrors -eq 0 ; then - echo "All $H5TOOL tests passed." + echo "All $TESTNAME tests passed." + exit $EXIT_SUCCESS +else + echo "$TESTNAME tests failed with $nerrors errors." + exit $EXIT_FAILURE fi - -exit $nerrors diff --git a/c++/src/h5c++.in b/c++/src/h5c++.in index aac8f40..4e51c94 100755 --- a/c++/src/h5c++.in +++ b/c++/src/h5c++.in @@ -36,6 +36,10 @@ HL="@HL@" ## ## ############################################################################ +# Constants definitions +EXIT_SUCCESS=0 +EXIT_FAILURE=1 + host_os="@host_os@" prog_name="`basename $0`" @@ -91,7 +95,7 @@ usage() { echo " HDF5_CXX - use a different C++ compiler" echo " HDF5_CXXLINKER - use a different linker" echo " " - exit 1 + exit $EXIT_FAILURE } # Show the configuration summary of the library recorded in the @@ -103,7 +107,7 @@ showconfigure() } # Main -status=0 +status=$EXIT_SUCCESS if test "$#" = "0"; then # No parameters specified, issue usage statement and exit. diff --git a/examples/testh5cc.sh.in b/examples/testh5cc.sh.in index 818375b..0e2b851 100755 --- a/examples/testh5cc.sh.in +++ b/examples/testh5cc.sh.in @@ -24,6 +24,10 @@ # # Initializations +TESTNAME=h5cc +EXIT_SUCCESS=0 +EXIT_FAILURE=1 + # Where the tool is installed. prefix="${prefix:-@prefix@}" PARALLEL=@PARALLEL@ # Am I in parallel mode? @@ -39,7 +43,7 @@ H5TOOL_BIN="${prefix}/bin/${H5TOOL}" # The path of the tool binary CMP='cmp -s' DIFF='diff -c' -nerrors=0 +nerrors=$EXIT_SUCCESS verbose=${HDF5_VERBOSE:-1} # 0: none; 1: default; 2: chatty; 3: everything test $verbose -gt 2 && set -x H5_NO_DEPRECATED_SYMBOLS=`grep '#define H5_NO_DEPRECATED_SYMBOLS ' ../src/H5pubconf.h` @@ -343,7 +347,9 @@ if test -z "$HDF5_NOCLEANUP"; then fi if test $nerrors -eq 0 ; then - echo "All $H5TOOL tests passed." + echo "All $TESTNAME tests passed." + exit $EXIT_SUCCESS +else + echo "$TESTNAME tests failed with $nerrors errors." + exit $EXIT_FAILURE fi - -exit $nerrors diff --git a/fortran/examples/testh5fc.sh.in b/fortran/examples/testh5fc.sh.in index a25abbe..234d4e2 100755 --- a/fortran/examples/testh5fc.sh.in +++ b/fortran/examples/testh5fc.sh.in @@ -20,6 +20,10 @@ # # Initializations +TESTNAME=h5fc +EXIT_SUCCESS=0 +EXIT_FAILURE=1 + # Where the tool is installed. prefix="${prefix:-@prefix@}" PARALLEL=@PARALLEL@ # Am I in parallel mode? @@ -35,7 +39,7 @@ H5TOOL_BIN="${prefix}/bin/${H5TOOL}" # The path of the tool binary CMP='cmp -s' DIFF='diff -c' -nerrors=0 +nerrors=$EXIT_SUCCESS verbose=yes # setup my machine information. @@ -217,7 +221,9 @@ if test -z "$HDF5_NOCLEANUP"; then fi if test $nerrors -eq 0 ; then - echo "All $H5TOOL tests passed." + echo "All $TESTNAME tests passed." + exit $EXIT_SUCCESS +else + echo "$TESTNAME tests failed with $nerrors errors." + exit $EXIT_FAILURE fi - -exit $nerrors diff --git a/fortran/src/h5fc.in b/fortran/src/h5fc.in index df52971..db44600 100755 --- a/fortran/src/h5fc.in +++ b/fortran/src/h5fc.in @@ -36,6 +36,10 @@ HL="@HL@" ## ## ############################################################################ +# Constants definitions +EXIT_SUCCESS=0 +EXIT_FAILURE=1 + host_os="@host_os@" prog_name="`basename $0`" @@ -89,7 +93,7 @@ usage() { echo " HDF5_FC - use a different Fortran 90 or 95 compiler" echo " HDF5_FLINKER - use a different linker" echo " " - exit 1 + exit $EXIT_FAILURE } # Show the configuration summary of the library recorded in the @@ -101,7 +105,7 @@ showconfigure() } # Main -status=0 +status=$EXIT_SUCCESS if test "$#" = "0"; then # No parameters specified, issue usage statement and exit. diff --git a/tools/misc/h5cc.in b/tools/misc/h5cc.in index 28f0dee..c274f3f 100755 --- a/tools/misc/h5cc.in +++ b/tools/misc/h5cc.in @@ -38,6 +38,10 @@ HL="@HL@" ## ## ############################################################################ +# Constants definitions +EXIT_SUCCESS=0 +EXIT_FAILURE=1 + host_os="@host_os@" prog_name="`basename $0`" @@ -95,7 +99,7 @@ usage() { echo " HDF5_USE_SHLIB=[yes|no] - use shared or static version of the HDF5 library" echo " [default: no]" echo " " - exit 1 + exit $EXIT_FAILURE } # Show the configuration summary of the library recorded in the @@ -107,7 +111,7 @@ showconfigure() } # Main -status=0 +status=$EXIT_SUCCESS if test "$#" = "0"; then # No parameters specified, issue usage statement and exit. diff --git a/tools/misc/h5redeploy.in b/tools/misc/h5redeploy.in index 6abca62..ae79b70 100755 --- a/tools/misc/h5redeploy.in +++ b/tools/misc/h5redeploy.in @@ -18,6 +18,10 @@ ## in a new location. ## For help page, use "h5redeploy -help" +# Constants definitions +EXIT_SUCCESS=0 +EXIT_FAILURE=1 + # Function definitions # show help page @@ -34,7 +38,7 @@ usage() { echo " directory and writable. [default: $h5tools]" echo " -show Show the commands without executing them" echo " " - exit 1 + exit $EXIT_FAILURE } # display variable values @@ -96,7 +100,7 @@ for arg in $@ ; do *) ERROR "Unknown Option($arg)" usage - exit 1 + exit $EXIT_FAILURE ;; esac done @@ -104,7 +108,7 @@ done # Sanity checks if [ ! -d $prefix ]; then ERROR "prefix($prefix) is not an existing directory" - exit 1 + exit $EXIT_FAILURE fi for x in $h5tools; do @@ -112,14 +116,14 @@ for x in $h5tools; do foundtools="$foundtools $x" if [ ! -w $x ]; then ERROR "h5tool($x) is not writable" - exit 1 + exit $EXIT_FAILURE fi fi done if [ -z "$foundtools" ]; then ERROR "found no tools to modify" - exit 1 + exit $EXIT_FAILURE fi # Show actions to be taken and get consent @@ -131,7 +135,7 @@ if [ x-$fmode = x- ]; then ans=`echo $ansx | tr "[A-Z]" "[a-z]"` if [ x-$ans != x-yes ]; then echo ABORT. No tools changed. - exit 1 + exit $EXIT_FAILURE fi fi @@ -166,7 +170,7 @@ done # Cleanup rm -f $CMDFILE -exit 0 +exit $EXIT_SUCCESS # Some possible future features to add # CCBASE - Name of the alternative C compiler diff --git a/tools/misc/h5repart.c b/tools/misc/h5repart.c index 2374059..d41dfc9 100644 --- a/tools/misc/h5repart.c +++ b/tools/misc/h5repart.c @@ -238,7 +238,7 @@ main (int argc, char *argv[]) } else if (!strcmp(argv[argno], "-V")) { printf("This is %s version %u.%u release %u\n", prog_name, H5_VERS_MAJOR, H5_VERS_MINOR, H5_VERS_RELEASE); - exit(0); + exit(EXIT_SUCCESS); } else if (!strcmp (argv[argno], "-family_to_sec2")) { family_to_sec2 = TRUE; argno++; -- cgit v0.12