From 6d1c05b8d248a3e9ae8797e20744fdf5b2319af5 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Tue, 25 Jun 2019 10:22:47 -0500 Subject: HDFFV-9407 Merge test addition from develop --- MANIFEST | 1 + config/cmake/CTestCustom.cmake | 1 + tools/test/h5dump/CMakeTests.cmake | 30 ++++++++++++++++++++++++++++++ tools/test/h5dump/testh5dump.sh.in | 37 ++++++++++++++++++++++++++++++++++++- tools/testfiles/t128bit_float.h5 | Bin 0 -> 2160 bytes 5 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 tools/testfiles/t128bit_float.h5 diff --git a/MANIFEST b/MANIFEST index 7a59414..2b04ef2 100644 --- a/MANIFEST +++ b/MANIFEST @@ -1663,6 +1663,7 @@ ./tools/testfiles/h5dump-help.txt ./tools/testfiles/non_existing.ddl ./tools/testfiles/packedbits.ddl +./tools/testfiles/t128bit_float.h5 ./tools/testfiles/taindices.h5 ./tools/testfiles/tall-1.ddl ./tools/testfiles/tall-2.ddl diff --git a/config/cmake/CTestCustom.cmake b/config/cmake/CTestCustom.cmake index 2333f67..a3a1652 100644 --- a/config/cmake/CTestCustom.cmake +++ b/config/cmake/CTestCustom.cmake @@ -94,6 +94,7 @@ set (CTEST_CUSTOM_MEMCHECK_IGNORE H5DUMP_PACKED_BITS-clearall-objects H5DUMP-XML-clearall-objects H5DUMP_VDS-clearall-objects + H5DUMP-t128bit_float #uses grepTest.cmake ######### tools/h5format_convert ######### H5FC-clearall-objects ######### tools/h5import ######### diff --git a/tools/test/h5dump/CMakeTests.cmake b/tools/test/h5dump/CMakeTests.cmake index 682ea4b..7f52796 100644 --- a/tools/test/h5dump/CMakeTests.cmake +++ b/tools/test/h5dump/CMakeTests.cmake @@ -318,6 +318,7 @@ ${HDF5_TOOLS_DIR}/testfiles/tvlenstr_array.h5 ${HDF5_TOOLS_DIR}/testfiles/tvlstr.h5 ${HDF5_TOOLS_DIR}/testfiles/tvms.h5 + ${HDF5_TOOLS_DIR}/testfiles/t128bit_float.h5 ${HDF5_TOOLS_DIR}/testfiles/zerodim.h5 ) set (HDF5_ERROR_REFERENCE_TEST_FILES @@ -672,6 +673,32 @@ endif () endmacro () + macro (ADD_H5_GREP_TEST resultfile resultcode result_check) + if (NOT HDF5_ENABLE_USING_MEMCHECKER) + # Remove any output file left over from previous test run + add_test ( + NAME H5DUMP-${resultfile}-clear-objects + COMMAND ${CMAKE_COMMAND} + -E remove + ${resultfile}.out + ${resultfile}.out.err + ) + set_tests_properties (H5DUMP-${resultfile}-clear-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") + add_test ( + NAME H5DUMP-${resultfile} + COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$" + -D "TEST_ARGS:STRING=${ARGN}" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/std" + -D "TEST_OUTPUT=${resultfile}.out" + -D "TEST_EXPECT=${resultcode}" + -D "TEST_REFERENCE=${result_check}" + -P "${HDF_RESOURCES_EXT_DIR}/grepTest.cmake" + ) + set_tests_properties (H5DUMP-${resultfile} PROPERTIES DEPENDS "H5DUMP-${resultfile}-clear-objects") + endif () + endmacro () + macro (ADD_H5ERR_MASK_TEST resultfile resultcode result_errcheck) if (NOT HDF5_ENABLE_USING_MEMCHECKER) # Remove any output file left over from previous test run @@ -1546,6 +1573,9 @@ # test for non-existing file ADD_H5_TEST (non_existing 1 --enable-error-stack tgroup.h5 non_existing.h5) + # test to verify HDFFV-9407: long double full precision + ADD_H5_GREP_TEST (t128bit_float 1 "1.123456789012345" -m %.35Lf t128bit_float.h5) + ############################################################################## ### P L U G I N T E S T S ############################################################################## diff --git a/tools/test/h5dump/testh5dump.sh.in b/tools/test/h5dump/testh5dump.sh.in index 9b1543c..507556f 100644 --- a/tools/test/h5dump/testh5dump.sh.in +++ b/tools/test/h5dump/testh5dump.sh.in @@ -34,6 +34,7 @@ H5IMPORT_BIN=`pwd`/$H5IMPORT # The path of the h5import tool binary RM='rm -rf' CMP='cmp' DIFF='diff -c' +GREP='grep' CP='cp' DIRNAME='dirname' LS='ls' @@ -81,6 +82,7 @@ $SRC_H5DUMP_TESTFILES/charsets.h5 $SRC_H5DUMP_TESTFILES/file_space.h5 $SRC_H5DUMP_TESTFILES/filter_fail.h5 $SRC_H5DUMP_TESTFILES/packedbits.h5 +$SRC_H5DUMP_TESTFILES/t128bit_float.h5 $SRC_H5DUMP_TESTFILES/taindices.h5 $SRC_H5DUMP_TESTFILES/tall.h5 $SRC_H5DUMP_TESTFILES/tarray1.h5 @@ -752,7 +754,7 @@ TOOLTEST4() { TESTING $DUMPER $@ ( cd $TESTDIR - $RUNSERIAL $DUMPER_BIN "$@" + $ENVCMD $RUNSERIAL $DUMPER_BIN "$@" ) >$actual 2>$actual_err # save actual and actual_err in case they are needed later. @@ -899,6 +901,36 @@ TOOLTEST_HELP() { } +# Call the h5dump tool and grep for a value +# +GREPTEST() +{ + expectdata=$1 + actual=$TESTDIR/$2 + actual_err="$TESTDIR/`basename $2 .ddl`.oerr" + shift + shift + + # Run test. + TESTING $DUMPER -p $@ + ( + cd $TESTDIR + $ENVCMD $RUNSERIAL $DUMPER_BIN -p "$@" + ) >$actual 2>$actual_err + $GREP $expectdata $actual > /dev/null + if [ $? -eq 0 ]; then + echo " PASSED" + else + echo " FAILED" + nerrors="`expr $nerrors + 1`" + fi + + # Clean up output file + if test -z "$HDF5_NOCLEANUP"; then + rm -f $actual $actual_err + fi +} + # Print a "SKIP" message SKIP() { TESTING $DUMPER $@ @@ -1356,6 +1388,9 @@ TOOLTEST2 tall-6.exp --enable-error-stack -y -o tall-6.txt -d /g1/g1.1/dset1.1.1 # test for non-existing file TOOLTEST3 non_existing.ddl --enable-error-stack tgroup.h5 non_existing.h5 +# test to verify HDFFV-9407: long double full precision +GREPTEST "1.123456789012345" t128bit_float.ddl -m %.35Lf t128bit_float.h5 + # Clean up temporary files/directories CLEAN_TESTFILES_AND_TESTDIR diff --git a/tools/testfiles/t128bit_float.h5 b/tools/testfiles/t128bit_float.h5 new file mode 100644 index 0000000..134d510 Binary files /dev/null and b/tools/testfiles/t128bit_float.h5 differ -- cgit v0.12