From 290b52f1b840e4945cf12508bd4832c5750695d8 Mon Sep 17 00:00:00 2001 From: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Date: Fri, 10 Dec 2021 20:19:04 -0600 Subject: Merge Fix directory variable in shell scripts #1273 (#1278) --- configure.ac | 8 +++++++- hl/tools/h5watch/testh5watch.sh.in | 13 ++----------- test/ShellTests.cmake | 16 ++-------------- test/test_usecases.sh.in | 23 ++++------------------- test/testcheck_version.sh.in | 4 ++-- test/testflushrefresh.sh.in | 23 ++++------------------- test/testlibinfo.sh.in | 2 +- test/testswmr.sh.in | 36 +++++++++++------------------------- test/testvdsswmr.sh.in | 28 +++++++--------------------- 9 files changed, 40 insertions(+), 113 deletions(-) diff --git a/configure.ac b/configure.ac index d5714e1..24ab177 100644 --- a/configure.ac +++ b/configure.ac @@ -605,7 +605,7 @@ if test "X$HDF_FORTRAN" = "Xyes"; then AC_SUBST([OBJECT_NAMELEN_DEFAULT_F]) ## -------------------------------------------------------------------- - ## Fortran source extention + ## Fortran source extension ## AC_FC_SRCEXT([f90]) @@ -1109,6 +1109,12 @@ else AC_MSG_RESULT([no]) fi +## These need to be exposed for some tests. +AC_SUBST([H5_UTILS_TEST_BUILDDIR]) +H5_UTILS_TEST_BUILDDIR='utils/test' +AC_SUBST([H5_TEST_BUILDDIR]) +H5_TEST_BUILDDIR='test' + ## ---------------------------------------------------------------------- ## Check if they would like to disable building tools ## diff --git a/hl/tools/h5watch/testh5watch.sh.in b/hl/tools/h5watch/testh5watch.sh.in index 04b6ef8..0432384 100644 --- a/hl/tools/h5watch/testh5watch.sh.in +++ b/hl/tools/h5watch/testh5watch.sh.in @@ -13,16 +13,11 @@ # # Tests for the h5watch tool # -bindir=@bindir@ - -# If the bindir directory is not set just use current (.). -if test -z "$bindir"; then - bindir=. -fi +utils_testdir=@abs_top_builddir@/@H5_UTILS_TEST_BUILDDIR@ # Check to see if the VFD specified by the HDF5_DRIVER environment variable # supports SWMR. -$bindir/swmr_check_compat_vfd +$utils_testdir/swmr_check_compat_vfd rc=$? if [ $rc != 0 ] ; then echo @@ -72,10 +67,6 @@ fi nerrors=0 verbose=yes -# The build (current) directory might be different than the source directory. -if test -z "$srcdir"; then - srcdir=. -fi test -d ../testfiles || mkdir ../testfiles # Print a line-line message left justified in a field of 70 characters diff --git a/test/ShellTests.cmake b/test/ShellTests.cmake index 732091b..bbb3f7c 100644 --- a/test/ShellTests.cmake +++ b/test/ShellTests.cmake @@ -20,8 +20,8 @@ if (UNIX) find_program (SH_PROGRAM bash) if (SH_PROGRAM) set (srcdir ${HDF5_TEST_SOURCE_DIR}) - set (bindir ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) - set (testdir ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) + set (H5_UTILS_TEST_BUILDDIR ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) + set (H5_TEST_BUILDDIR ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) ############################################################################## # configure scripts to test dir ############################################################################## @@ -35,8 +35,6 @@ if (UNIX) ############################################################################## # copy test programs to test dir ############################################################################## - #shell script creates dir - #file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/H5TEST/swmr_test") add_custom_command ( TARGET accum_swmr_reader POST_BUILD @@ -44,15 +42,6 @@ if (UNIX) ARGS -E copy_if_different "${HDF5_SOURCE_DIR}/bin/output_filter.sh" "${HDF5_TEST_BINARY_DIR}/H5TEST/bin/output_filter.sh" ) - #shell script creates dir - #file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/H5TEST/usecases_test") - - #shell script creates dir - #file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/H5TEST/swmr_test") - - #shell script creates dir - #file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/H5TEST/vds_swmr_test") - ############################################################################## ############################################################################## ### A D D I T I O N A L T E S T S ### @@ -108,6 +97,5 @@ if (UNIX) ENVIRONMENT "LD_LIBRARY_PATH=$ENV{LD_LIBRARY_PATH}:${CMAKE_RUNTIME_OUTPUT_DIRECTORY}" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) - endif () endif () diff --git a/test/test_usecases.sh.in b/test/test_usecases.sh.in index 3f7d5f1..fd30afd 100644 --- a/test/test_usecases.sh.in +++ b/test/test_usecases.sh.in @@ -35,27 +35,12 @@ verbose=yes ## Main ############################################################################### srcdir=@srcdir@ -bindir=@bindir@ -testdir=@testdir@ - -# The build (current) directory might be different than the source directory. -if test -z "$srcdir"; then - srcdir=. -fi - -# If the bindir directory is not set just use current (.). -if test -z "$bindir"; then - bindir=. -fi - -# If the testdir directory is not set just use current (.). -if test -z "$testdir"; then - testdir=. -fi +utils_testdir=@abs_top_builddir@/@H5_UTILS_TEST_BUILDDIR@ +testdir=@abs_top_builddir@/@H5_TEST_BUILDDIR@ # Check to see if the VFD specified by the HDF5_DRIVER environment variable # supports SWMR. -$bindir/swmr_check_compat_vfd +$utils_testdir/swmr_check_compat_vfd rc=$? if [[ $rc != 0 ]] ; then echo @@ -143,7 +128,7 @@ TOOLTEST() { # the test. Running each of these tests in its own directory should eliminate # the problem. mkdir usecases_test -cp $bindir/twriteorder usecases_test +cp $testdir/twriteorder usecases_test for FILE in use_*; do case "$FILE" in *.o) continue ;; ## don't copy the .o files diff --git a/test/testcheck_version.sh.in b/test/testcheck_version.sh.in index 6378ee5..273702e 100644 --- a/test/testcheck_version.sh.in +++ b/test/testcheck_version.sh.in @@ -36,7 +36,7 @@ RM='rm -f' PURPOSE() { echo "Tests for the H5check_version function." echo "Note that abort messages may appear due to the expected termination" - echo "of the program when it is tested with mis-matched version numnbers." + echo "of the program when it is tested with mis-matched version numbers." } # Print a line-line message left justified in a field of 70 characters. @@ -232,7 +232,7 @@ 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*** Serial Exit Code is not passed back to shell correctly." echo "***Warning*** Exit code checking is skipped." h5haveexitcode=no fi diff --git a/test/testflushrefresh.sh.in b/test/testflushrefresh.sh.in index 3c7f13d..209d370 100644 --- a/test/testflushrefresh.sh.in +++ b/test/testflushrefresh.sh.in @@ -59,27 +59,12 @@ fi ## Main ############################################################################### srcdir=@srcdir@ -bindir=@bindir@ -testdir=@testdir@ - -# The build (current) directory might be different than the source directory. -if test -z "$srcdir"; then - srcdir=. -fi - -# If the bindir directory is not set just use current (.). -if test -z "$bindir"; then - bindir=. -fi - -# If the testdir directory is not set just use current (.). -if test -z "$testdir"; then - testdir=. -fi +utils_testdir=@abs_top_builddir@/@H5_UTILS_TEST_BUILDDIR@ +testdir=@abs_top_builddir@/@H5_TEST_BUILDDIR@ # Check to see if the VFD specified by the HDF5_DRIVER environment variable # supports SWMR. -$bindir/swmr_check_compat_vfd +$utils_testdir/swmr_check_compat_vfd rc=$? if [ $rc -ne 0 ] ; then echo @@ -97,7 +82,7 @@ fi # the test. Running each of these tests in its own directory should eliminate # the problem. mkdir -p flushrefresh_test -cp $bindir/flushrefresh flushrefresh_test +cp $testdir/flushrefresh flushrefresh_test # With the --disable-shared option, flushrefresh is built in the test directory, # otherwise it is in test/.libs with a wrapper script named flushrefresh in diff --git a/test/testlibinfo.sh.in b/test/testlibinfo.sh.in index 2a9a05c..d9fee48 100644 --- a/test/testlibinfo.sh.in +++ b/test/testlibinfo.sh.in @@ -19,7 +19,7 @@ # libhdf5.settings file. # Part 2: # If executable is linked with the static hdf5 library (how to determine?), -# verify an executable indeed contains an exact copy of hte content of the +# verify an executable indeed contains an exact copy of the content of the # libhdf5.settings file. # # Programmer: Albert Cheng diff --git a/test/testswmr.sh.in b/test/testswmr.sh.in index cb60fce..771fe4a 100644 --- a/test/testswmr.sh.in +++ b/test/testswmr.sh.in @@ -17,8 +17,8 @@ # Albert Cheng, 2009/07/22 srcdir=@srcdir@ -bindir=@bindir@ -testdir=@testdir@ +utils_testdir=@abs_top_builddir@/@H5_UTILS_TEST_BUILDDIR@ +testdir=@abs_top_builddir@/@H5_TEST_BUILDDIR@ ############################################################################### ## test parameters @@ -38,9 +38,9 @@ nerrors=0 ## definitions for message file to coordinate test runs ############################################################################### WRITER_MESSAGE=SWMR_WRITER_MESSAGE # The message file created by writer that the open is complete - # This should be the same as the define in "./swmr_common.h" + # This should be the same as the define in "test/swmr_common.h" MESSAGE_TIMEOUT=300 # Message timeout length in secs - # This should be the same as the define in "./h5test.h" + # This should be the same as the define in "test/h5test.h" ############################################################################### ## short hands and function definitions @@ -94,24 +94,10 @@ WAIT_MESSAGE() { ## to proceed as expected. ## ############################################################################### -# The build (current) directory might be different than the source directory. -if test -z "$srcdir"; then - srcdir=. -fi - -# If the bindir directory is not set just use current (.). -if test -z "$bindir"; then - bindir=. -fi - -# If the testdir directory is not set just use current (.). -if test -z "$testdir"; then - testdir=. -fi # Check to see if the VFD specified by the HDF5_DRIVER environment variable # supports SWMR. -$bindir/swmr_check_compat_vfd +$utils_testdir/swmr_check_compat_vfd rc=$? if [ $rc -ne 0 ] ; then echo @@ -198,7 +184,7 @@ do nerrors=`expr $nerrors + 1` fi - # Check for error and exit if one occured + # Check for error and exit if one occurred $DPRINT nerrors=$nerrors if test $nerrors -ne 0 ; then echo "SWMR tests failed with $nerrors errors." @@ -258,7 +244,7 @@ do nerrors=`expr $nerrors + 1` fi - # Check for error and exit if one occured + # Check for error and exit if one occurred $DPRINT nerrors=$nerrors if test $nerrors -ne 0 ; then echo "SWMR tests failed with $nerrors errors." @@ -330,7 +316,7 @@ do nerrors=`expr $nerrors + 1` fi - # Check for error and exit if one occured + # Check for error and exit if one occurred $DPRINT nerrors=$nerrors if test $nerrors -ne 0 ; then echo "SWMR tests failed with $nerrors errors." @@ -393,7 +379,7 @@ do nerrors=`expr $nerrors + 1` fi - # Check for error and exit if one occured + # Check for error and exit if one occurred $DPRINT nerrors=$nerrors if test $nerrors -ne 0 ; then echo "SWMR tests failed with $nerrors errors." @@ -474,7 +460,7 @@ do nerrors=`expr $nerrors + 1` fi - # Check for error and exit if one occured + # Check for error and exit if one occurred $DPRINT nerrors=$nerrors if test $nerrors -ne 0 ; then echo "SWMR tests failed with $nerrors errors." @@ -544,7 +530,7 @@ do fi done - # Check for error and exit if one occured + # Check for error and exit if one occurred $DPRINT nerrors=$nerrors if test $nerrors -ne 0 ; then echo "SWMR tests failed with $nerrors errors." diff --git a/test/testvdsswmr.sh.in b/test/testvdsswmr.sh.in index c57cc08..399fdef 100644 --- a/test/testvdsswmr.sh.in +++ b/test/testvdsswmr.sh.in @@ -17,8 +17,8 @@ # Dana Robinson, November 2015 srcdir=@srcdir@ -bindir=@bindir@ -testdir=@testdir@ +utils_testdir=@abs_top_builddir@/@H5_UTILS_TEST_BUILDDIR@ +testdir=@abs_top_builddir@/@H5_TEST_BUILDDIR@ ############################################################################### ## test parameters @@ -32,9 +32,9 @@ nerrors=0 ## definitions for message file to coordinate test runs ############################################################################### WRITER_MESSAGE=SWMR_WRITER_MESSAGE # The message file created by writer that the open is complete - # This should be the same as the define in "$bindir/swmr_common.h" + # This should be the same as the define in "test/swmr_common.h" MESSAGE_TIMEOUT=300 # Message timeout length in secs - # This should be the same as the define in "./h5test.h" + # This should be the same as the define in "test/h5test.h" ############################################################################### ## short hands and function definitions @@ -80,24 +80,10 @@ WAIT_MESSAGE() { ############################################################################### ## Main ############################################################################### -# The build (current) directory might be different than the source directory. -if test -z "$srcdir"; then - srcdir=. -fi - -# If the bindir directory is not set just use current (.). -if test -z "$bindir"; then - bindir=. -fi - -# If the testdir directory is not set just use current (.). -if test -z "$testdir"; then - testdir=. -fi # Check to see if the VFD specified by the HDF5_DRIVER environment variable # supports SWMR. -$bindir/swmr_check_compat_vfd +$utils_testdir/swmr_check_compat_vfd rc=$? if [ $rc -ne 0 ] ; then echo @@ -166,7 +152,7 @@ if test $? -ne 0; then nerrors=`expr $nerrors + 1` fi -# Check for error and exit if one occured +# Check for error and exit if one occurred $DPRINT nerrors=$nerrors if test $nerrors -ne 0 ; then echo "VDS SWMR tests failed with $nerrors errors." @@ -221,7 +207,7 @@ for xpid in $pid_readers; do fi done -# Check for error and exit if one occured +# Check for error and exit if one occurred $DPRINT nerrors=$nerrors if test $nerrors -ne 0 ; then echo "VDS SWMR tests failed with $nerrors errors." -- cgit v0.12