diff options
Diffstat (limited to 'tools/test')
80 files changed, 758 insertions, 503 deletions
diff --git a/tools/test/h5copy/CMakeTests.cmake b/tools/test/h5copy/CMakeTests.cmake index 924ade1..85a8788 100644 --- a/tools/test/h5copy/CMakeTests.cmake +++ b/tools/test/h5copy/CMakeTests.cmake @@ -30,6 +30,7 @@ set (LIST_OTHER_TEST_FILES ${HDF5_TOOLS_TEST_H5COPY_SOURCE_DIR}/testfiles/h5copy_misc1.out + ${HDF5_TOOLS_TEST_H5COPY_SOURCE_DIR}/testfiles/h5copy_misc1.err ${HDF5_TOOLS_TEST_H5COPY_SOURCE_DIR}/testfiles/tudfilter.h5.txt ${HDF5_TOOLS_TEST_H5COPY_SOURCE_DIR}/testfiles/tudfilter.h5_ERR.txt ${HDF5_TOOLS_TEST_H5COPY_SOURCE_DIR}/testfiles/h5copy_plugin_fail_ERR.out.h5.txt @@ -69,7 +70,7 @@ COMMAND $<TARGET_FILE:h5copy> -f ${fparam} -i ./testfiles/${infile} -o ./testfiles/${testname}.out.h5 ${vparam} ${sparam} ${srcname} ${dparam} ${dstname} ${ARGN} ) if (HDF5_ENABLE_USING_MEMCHECKER) - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (H5COPY_F-${testname} PROPERTIES DEPENDS ${last_test}) endif () else () @@ -77,13 +78,13 @@ endif () # resultcode=2 will cause the test to skip the diff test - if (NOT "${resultcode}" STREQUAL "2") + if (NOT ${resultcode} EQUAL 2) add_test ( NAME H5COPY_F-${testname}-DIFF COMMAND $<TARGET_FILE:h5diff> -v ./testfiles/${infile} ./testfiles/${testname}.out.h5 ${srcname} ${dstname} ) set_tests_properties (H5COPY_F-${testname}-DIFF PROPERTIES DEPENDS H5COPY_F-${testname}) - if ("${resultcode}" STREQUAL "1") + if (${resultcode} EQUAL 1) set_tests_properties (H5COPY_F-${testname}-DIFF PROPERTIES WILL_FAIL "true") endif () endif () @@ -105,7 +106,7 @@ COMMAND $<TARGET_FILE:h5copy> -i ./testfiles/${infile} -o ./testfiles/${testname}.out.h5 ${vparam} ${sparam} ${srcname} ${dparam} ${dstname} ${ARGN} ) if (HDF5_ENABLE_USING_MEMCHECKER) - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (H5COPY-${testname} PROPERTIES DEPENDS ${last_test}) endif () else () @@ -113,13 +114,13 @@ endif () # resultcode=2 will cause the test to skip the diff test - if (NOT "${resultcode}" STREQUAL "2") + if (NOT ${resultcode} EQUAL 2) add_test ( NAME H5COPY-${testname}-DIFF COMMAND $<TARGET_FILE:h5diff> -v ./testfiles/${infile} ./testfiles/${testname}.out.h5 ${srcname} ${dstname} ) set_tests_properties (H5COPY-${testname}-DIFF PROPERTIES DEPENDS H5COPY-${testname}) - if ("${resultcode}" STREQUAL "1") + if (${resultcode} EQUAL 1) set_tests_properties (H5COPY-${testname}-DIFF PROPERTIES WILL_FAIL "true") endif () endif () @@ -151,7 +152,7 @@ COMMAND $<TARGET_FILE:h5copy> -i ./testfiles/${infile} -o ./testfiles/${testname}.out.h5 -v -s ${psparam} -d ${pdparam} ) if (HDF5_ENABLE_USING_MEMCHECKER) - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (H5COPY-${testname}-prefill PROPERTIES DEPENDS ${last_test}) endif () else () @@ -164,13 +165,13 @@ ) set_tests_properties (H5COPY-${testname} PROPERTIES DEPENDS H5COPY-${testname}-prefill) # resultcode=2 will cause the test to skip the diff test - if (NOT "${resultcode}" STREQUAL "2") + if (NOT ${resultcode} EQUAL 2) add_test ( NAME H5COPY-${testname}-DIFF COMMAND $<TARGET_FILE:h5diff> -v ./testfiles/${infile} ./testfiles/${testname}.out.h5 ${srcname} ${dstname} ) set_tests_properties (H5COPY-${testname}-DIFF PROPERTIES DEPENDS H5COPY-${testname}) - if ("${resultcode}" STREQUAL "1") + if (${resultcode} EQUAL 1) set_tests_properties (H5COPY-${testname}-DIFF PROPERTIES WILL_FAIL "true") endif () endif () @@ -192,7 +193,7 @@ COMMAND $<TARGET_FILE:h5copy> -i ./testfiles/${pfile} -o ./testfiles/${testname}.out.h5 -v -s ${psparam} -d ${pdparam} ) if (HDF5_ENABLE_USING_MEMCHECKER) - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (H5COPY_SAME-${testname}-prefill PROPERTIES DEPENDS ${last_test}) endif () else (HDF5_ENABLE_USING_MEMCHECKER) @@ -205,13 +206,13 @@ ) set_tests_properties (H5COPY_SAME-${testname} PROPERTIES DEPENDS H5COPY_SAME-${testname}-prefill) # resultcode=2 will cause the test to skip the diff test - if (NOT "${resultcode}" STREQUAL "2") + if (NOT ${resultcode} EQUAL 2) add_test ( NAME H5COPY_SAME-${testname}-DIFF COMMAND $<TARGET_FILE:h5diff> -v ./testfiles/${testname}.out.h5 ./testfiles/${testname}.out.h5 ${srcname} ${dstname} ) set_tests_properties (H5COPY_SAME-${testname}-DIFF PROPERTIES DEPENDS H5COPY_SAME-${testname}) - if ("${resultcode}" STREQUAL "1") + if (${resultcode} EQUAL 1) set_tests_properties (H5COPY_SAME-${testname}-DIFF PROPERTIES WILL_FAIL "true") endif () endif () @@ -225,10 +226,10 @@ # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME H5COPY-CMP-${testname} COMMAND $<TARGET_FILE:h5copy> -i ./testfiles/${infile} -o ./testfiles/${testname}.out.h5 ${vparam} ${sparam} ${srcname} ${dparam} ${dstname} ${ARGN}) - if ("${resultcode}" STREQUAL "1") + if (${resultcode} EQUAL 1) set_tests_properties (H5COPY-CMP-${testname} PROPERTIES WILL_FAIL "true") endif () - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (H5COPY-CMP-${testname} PROPERTIES DEPENDS ${last_test}) endif () else () @@ -250,6 +251,7 @@ -D "TEST_OUTPUT=./testfiles/${testname}.out.out" -D "TEST_EXPECT=${resultcode}" -D "TEST_REFERENCE=./testfiles/${testname}.out" + -D "TEST_ERRREF=./testfiles/${testname}.err" -D "TEST_MASK=true" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) @@ -270,7 +272,7 @@ testfiles/${testname}.out.h5.out testfiles/${testname}.out.h5.out.err ) - if ("${resultcode}" STREQUAL "2") + if (${resultcode} EQUAL 2) add_test ( NAME H5COPY_UD-${testname} COMMAND "${CMAKE_COMMAND}" @@ -333,7 +335,7 @@ testfiles/${testname}_ERR.out.h5.out testfiles/${testname}_ERR.out.h5.out.err ) - if ("${resultcode}" STREQUAL "2") + if (${resultcode} EQUAL 2) add_test ( NAME H5COPY_UD_ERR-${testname} COMMAND "${CMAKE_COMMAND}" @@ -441,7 +443,7 @@ h5copy_misc1.out.out.err ) set_tests_properties (H5COPY-clearall-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (H5COPY-clearall-objects PROPERTIES DEPENDS ${last_test}) endif () set (last_test "H5COPY-clearall-objects") diff --git a/tools/test/h5copy/testfiles/h5copy_misc1.err b/tools/test/h5copy/testfiles/h5copy_misc1.err new file mode 100644 index 0000000..2c2c867 --- /dev/null +++ b/tools/test/h5copy/testfiles/h5copy_misc1.err @@ -0,0 +1 @@ +h5copy error: group </g1> doesn't exist. Use -p to create parent groups. diff --git a/tools/test/h5copy/testfiles/h5copy_misc1.out b/tools/test/h5copy/testfiles/h5copy_misc1.out index 1624f2b..1c7181b 100644 --- a/tools/test/h5copy/testfiles/h5copy_misc1.out +++ b/tools/test/h5copy/testfiles/h5copy_misc1.out @@ -1,3 +1,2 @@ Copying file <./testfiles/h5copytst.h5> and object </simple> to file <./testfiles/h5copy_misc1.out.h5> and object </g1/g2/simple> Error in copy...Exiting -h5copy error: group </g1> doesn't exist. Use -p to create parent groups. diff --git a/tools/test/h5copy/testh5copy.sh.in b/tools/test/h5copy/testh5copy.sh.in index 203bfef..50758b5 100644 --- a/tools/test/h5copy/testh5copy.sh.in +++ b/tools/test/h5copy/testh5copy.sh.in @@ -60,6 +60,7 @@ $SRC_H5COPY_TESTFILES/h5copy_extlinks_trg.h5 # List of expect files that will be copied over to local test dir LIST_OTHER_TEST_FILES=" $SRC_H5COPY_TESTFILES/h5copy_misc1.out +$SRC_H5COPY_TESTFILES/h5copy_misc1.err " H5COPY=../../src/h5copy/h5copy # The tool name @@ -396,6 +397,7 @@ CMP_OUTPUT() TOOLTEST_FAIL() { expectout="$TESTDIR/$1" + expecterr="$TESTDIR/`basename $1 .out`.err" actualout="$TESTDIR/$1.actualout" actualerr="$TESTDIR/$1.actualerr" actualout_sav=${actualout}-sav @@ -426,10 +428,7 @@ TOOLTEST_FAIL() echo " PASSED" # Verifying output text from h5copy if [ "$expectout" != "SKIP" ]; then - # combine stderr to stdout to compare the output at once. - # We may seperate stdout and stderr later. - cat $actualerr >> $actualout - CMP_OUTPUT $expectout $actualout + CMP_OUTPUT $expecterr $actualerr fi else echo "*FAILED*" diff --git a/tools/test/h5diff/CMakeTests.cmake b/tools/test/h5diff/CMakeTests.cmake index e06f069..6bce3f7 100644 --- a/tools/test/h5diff/CMakeTests.cmake +++ b/tools/test/h5diff/CMakeTests.cmake @@ -168,21 +168,12 @@ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_452.txt ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_453.txt ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_454.txt - ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_454_ERR.txt - ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_454_ERR.err + ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/dangling_link.err ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_455.txt - ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_455_ERR.txt - ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_455_ERR.err ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_456.txt ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_457.txt - ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_457_ERR.txt - ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_457_ERR.err ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_458.txt - ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_458_ERR.txt - ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_458_ERR.err ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_459.txt - ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_459_ERR.txt - ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_459_ERR.err ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_465.txt ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_466.txt ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_467.txt @@ -238,7 +229,6 @@ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_63.txt ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_600.txt ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_601.txt - ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_601_ERR.txt ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_601_ERR.err ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_603.txt ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_604.txt @@ -293,6 +283,7 @@ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_8625.txt ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_8639.txt ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_ud.txt + ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_udfail.err ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_udfail.txt ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_v1.txt ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_v2.txt @@ -363,10 +354,10 @@ if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME H5DIFF-${resultfile} COMMAND $<TARGET_FILE:h5diff> ${ARGN}) set_tests_properties (H5DIFF-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") - if (NOT "${resultcode}" STREQUAL "0") + if (${resultcode}) set_tests_properties (H5DIFF-${resultfile} PROPERTIES WILL_FAIL "true") endif () - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (H5DIFF-${resultfile} PROPERTIES DEPENDS ${last_test}) endif () else () @@ -378,7 +369,7 @@ testfiles/${resultfile}.out testfiles/${resultfile}.out.err ) - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (H5DIFF-${resultfile}-clear-objects PROPERTIES DEPENDS ${last_test}) endif () add_test ( @@ -400,72 +391,31 @@ endif () endmacro () - macro (ADD_H5_ERR_TEST resultfile resultcode) - # If using memchecker add tests without using scripts - if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME H5DIFF_ERR-${resultfile} COMMAND $<TARGET_FILE:h5diff> --enable-error-stack ${ARGN}) - set_tests_properties (H5DIFF_ERR-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") - if (NOT "${resultcode}" STREQUAL "0") - set_tests_properties (H5DIFF_ERR-${resultfile} PROPERTIES WILL_FAIL "true") - endif () - if (NOT "${last_test}" STREQUAL "") - set_tests_properties (H5DIFF_ERR-${resultfile} PROPERTIES DEPENDS ${last_test}) - endif () - else () - # Remove any output file left over from previous test run - add_test ( - NAME H5DIFF_ERR-${resultfile}-clear-objects - COMMAND ${CMAKE_COMMAND} - -E remove - testfiles/${resultfile}_ERR.out - testfiles/${resultfile}_ERR.out.err - ) - if (NOT "${last_test}" STREQUAL "") - set_tests_properties (H5DIFF_ERR-${resultfile}-clear-objects PROPERTIES DEPENDS ${last_test}) - endif () - add_test ( - NAME H5DIFF_ERR-${resultfile} - COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$<TARGET_FILE:h5diff>" - -D "TEST_ARGS:STRING=--enable-error-stack;${ARGN}" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" - -D "TEST_OUTPUT=${resultfile}_ERR.out" - -D "TEST_EXPECT=${resultcode}" - -D "TEST_REFERENCE=${resultfile}_ERR.txt" - -D "TEST_MASK_ERROR=true" - -D "TEST_APPEND=EXIT CODE:" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" - ) - set_tests_properties (H5DIFF_ERR-${resultfile} PROPERTIES DEPENDS H5DIFF_ERR-${resultfile}-clear-objects) - endif () - set (last_test "H5DIFF_ERR-${resultfile}") - endmacro () - macro (ADD_PH5_TEST resultfile resultcode) # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) - add_test (NAME PH5DIFF-${resultfile} COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_PREFLAGS} $<TARGET_FILE:ph5diff> ${MPIEXEC_POSTFLAGS} ${ARGN}) - set_tests_properties (PH5DIFF-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/PAR/testfiles") - if (NOT "${resultcode}" STREQUAL "0") - set_tests_properties (PH5DIFF-${resultfile} PROPERTIES WILL_FAIL "true") + add_test (NAME MPI_TEST_H5DIFF-${resultfile} COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_PREFLAGS} $<TARGET_FILE:ph5diff> ${MPIEXEC_POSTFLAGS} ${ARGN}) + set_tests_properties (MPI_TEST_H5DIFF-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/PAR/testfiles") + if (${resultcode}) + set_tests_properties (MPI_TEST_H5DIFF-${resultfile} PROPERTIES WILL_FAIL "true") endif () - if (NOT "${last_test}" STREQUAL "") - set_tests_properties (PH5DIFF-${resultfile} PROPERTIES DEPENDS ${last_test}) + if (last_test) + set_tests_properties (MPI_TEST_H5DIFF-${resultfile} PROPERTIES DEPENDS ${last_test}) endif () else () # Remove any output file left over from previous test run add_test ( - NAME PH5DIFF-${resultfile}-clear-objects + NAME MPI_TEST_H5DIFF-${resultfile}-clear-objects COMMAND ${CMAKE_COMMAND} -E remove PAR/testfiles/${resultfile}.out PAR/testfiles/${resultfile}.out.err ) - if (NOT "${last_test}" STREQUAL "") - set_tests_properties (PH5DIFF-${resultfile}-clear-objects PROPERTIES DEPENDS ${last_test}) + if (last_test) + set_tests_properties (MPI_TEST_H5DIFF-${resultfile}-clear-objects PROPERTIES DEPENDS ${last_test}) endif () add_test ( - NAME PH5DIFF-${resultfile} + NAME MPI_TEST_H5DIFF-${resultfile} COMMAND "${CMAKE_COMMAND}" -D "TEST_PROGRAM=${MPIEXEC_EXECUTABLE};${MPIEXEC_NUMPROC_FLAG};${MPIEXEC_MAX_NUMPROCS};${MPIEXEC_PREFLAGS};$<TARGET_FILE:ph5diff>;${MPIEXEC_POSTFLAGS}" -D "TEST_ARGS:STRING=${ARGN}" @@ -479,7 +429,7 @@ -D "TEST_SORT_COMPARE=TRUE" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) - set_tests_properties (PH5DIFF-${resultfile} PROPERTIES DEPENDS PH5DIFF-${resultfile}-clear-objects) + set_tests_properties (MPI_TEST_H5DIFF-${resultfile} PROPERTIES DEPENDS MPI_TEST_H5DIFF-${resultfile}-clear-objects) set (last_test "PH5DIFF-${resultfile}") endif () endmacro () @@ -494,7 +444,7 @@ testfiles/${resultfile}.out testfiles/${resultfile}.out.err ) - if ("${resultcode}" STREQUAL "2") + if (${resultcode} EQUAL 2) add_test ( NAME H5DIFF_UD-${testname} COMMAND "${CMAKE_COMMAND}" @@ -529,53 +479,6 @@ endif () endmacro () - macro (ADD_H5_UD_ERR_TEST testname resultcode resultfile) - if (NOT HDF5_ENABLE_USING_MEMCHECKER) - # Remove any output file left over from previous test run - add_test ( - NAME H5DIFF_UD_ERR-${testname}-clearall-objects - COMMAND ${CMAKE_COMMAND} - -E remove - testfiles/${resultfile}_ERR.out - testfiles/${resultfile}_ERR.out.err - ) - if ("${resultcode}" STREQUAL "2") - add_test ( - NAME H5DIFF_UD_ERR-${testname} - COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$<TARGET_FILE:h5diff-shared>" - -D "TEST_ARGS:STRING=--enable-error-stack;${ARGN}" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" - -D "TEST_OUTPUT=${resultfile}_ERR.out" - -D "TEST_EXPECT=${resultcode}" - -D "TEST_REFERENCE=${resultfile}_ERR.txt" - -D "TEST_MASK_ERROR=true" - -D "TEST_APPEND=EXIT CODE:" - -D "TEST_ENV_VAR=HDF5_PLUGIN_PATH" - -D "TEST_ENV_VALUE=${CMAKE_BINARY_DIR}" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" - ) - else () - add_test ( - NAME H5DIFF_UD_ERR-${testname} - COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$<TARGET_FILE:h5diff-shared>" - -D "TEST_ARGS:STRING=--enable-error-stack;${ARGN}" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" - -D "TEST_OUTPUT=${resultfile}_ERR.out" - -D "TEST_EXPECT=${resultcode}" - -D "TEST_REFERENCE=${resultfile}_ERR.txt" - -D "TEST_MASK_ERROR=true" - -D "TEST_APPEND=EXIT CODE:" - -D "TEST_ENV_VAR=HDF5_PLUGIN_PATH" - -D "TEST_ENV_VALUE=${CMAKE_BINARY_DIR}/plugins" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" - ) - endif () - set_tests_properties (H5DIFF_UD_ERR-${testname} PROPERTIES DEPENDS H5DIFF_UD_ERR-${testname}-clearall-objects) - endif () - endmacro () - ############################################################################## ############################################################################## ### T H E T E S T S ### @@ -798,26 +701,16 @@ h5diff_453.out.err h5diff_454.out h5diff_454.out.err - h5diff_454_ERR.out - h5diff_454_ERR.out.err h5diff_455.out h5diff_455.out.err - h5diff_455_ERR.out - h5diff_455_ERR.out.err h5diff_456.out h5diff_456.out.err h5diff_457.out h5diff_457.out.err - h5diff_457_ERR.out - h5diff_457_ERR.out.err h5diff_458.out h5diff_458.out.err - h5diff_458_ERR.out - h5diff_458_ERR.out.err h5diff_459.out h5diff_459.out.err - h5diff_459_ERR.out - h5diff_459_ERR.out.err h5diff_465.out h5diff_465.out.err h5diff_466.out @@ -922,8 +815,6 @@ h5diff_600.out.err h5diff_601.out h5diff_601.out.err - h5diff_601_ERR.out - h5diff_601_ERR.out.err h5diff_603.out h5diff_603.out.err h5diff_604.out @@ -1034,7 +925,7 @@ h5diff_vlstr.out.err ) set_tests_properties (H5DIFF-clearall-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (H5DIFF-clearall-objects PROPERTIES DEPENDS ${last_test}) endif () set (last_test "H5DIFF-clearall-objects") @@ -1181,7 +1072,6 @@ ADD_H5_TEST (h5diff_600 1 ${FILE1}) # 6.1: Check if non-exist object name is specified ADD_H5_TEST (h5diff_601 2 ${FILE1} ${FILE1} nono_obj) -ADD_H5_ERR_TEST (h5diff_601 2 ${FILE1} ${FILE1} nono_obj) # ############################################################################## # # -d @@ -1481,26 +1371,21 @@ ADD_H5_TEST (h5diff_453 2 --follow-symlinks -v --no-dangling-links ${FILE13} $ # dangling link found for soft links (obj to obj) ADD_H5_TEST (h5diff_454 2 --follow-symlinks -v --no-dangling-links ${FILE13} ${FILE13} /softlink_dset2 /softlink_noexist) -ADD_H5_ERR_TEST (h5diff_454 2 --follow-symlinks -v --no-dangling-links ${FILE13} ${FILE13} /softlink_dset2 /softlink_noexist) # dangling link found for soft links (obj to obj) Both dangle links ADD_H5_TEST (h5diff_455 2 --follow-symlinks -v --no-dangling-links ${FILE13} ${FILE13} /softlink_noexist /softlink_noexist) -ADD_H5_ERR_TEST (h5diff_455 2 --follow-symlinks -v --no-dangling-links ${FILE13} ${FILE13} /softlink_noexist /softlink_noexist) # dangling link found for ext links (FILE to FILE) ADD_H5_TEST (h5diff_456 2 --follow-symlinks -v --no-dangling-links ${FILE15} ${FILE15}) # dangling link found for ext links (obj to obj). target file exist ADD_H5_TEST (h5diff_457 2 --follow-symlinks -v --no-dangling-links ${FILE15} ${FILE15} /ext_link_dset1 /ext_link_noexist1) -ADD_H5_ERR_TEST (h5diff_457 2 --follow-symlinks -v --no-dangling-links ${FILE15} ${FILE15} /ext_link_dset1 /ext_link_noexist1) # dangling link found for ext links (obj to obj). target file NOT exist ADD_H5_TEST (h5diff_458 2 --follow-symlinks -v --no-dangling-links ${FILE15} ${FILE15} /ext_link_dset1 /ext_link_noexist2) -ADD_H5_ERR_TEST (h5diff_458 2 --follow-symlinks -v --no-dangling-links ${FILE15} ${FILE15} /ext_link_dset1 /ext_link_noexist2) # dangling link found for ext links (obj to obj). Both dangle links ADD_H5_TEST (h5diff_459 2 --follow-symlinks -v --no-dangling-links ${FILE15} ${FILE15} /ext_link_noexist1 /ext_link_noexist2) -ADD_H5_ERR_TEST (h5diff_459 2 --follow-symlinks -v --no-dangling-links ${FILE15} ${FILE15} /ext_link_noexist1 /ext_link_noexist2) # dangling link --follow-symlinks (obj vs obj) # (HDFFV-7836) diff --git a/tools/test/h5diff/h5diff_plugin.sh.in b/tools/test/h5diff/h5diff_plugin.sh.in index 212f5d6..341cba5 100644 --- a/tools/test/h5diff/h5diff_plugin.sh.in +++ b/tools/test/h5diff/h5diff_plugin.sh.in @@ -62,6 +62,7 @@ LIST_HDF5_TEST_FILES=" $SRC_H5DIFF_TESTFILES/tudfilter.h5 $SRC_H5DIFF_TESTFILES/tudfilter2.h5 $SRC_H5DIFF_TESTFILES/h5diff_ud.txt +$SRC_H5DIFF_TESTFILES/h5diff_udfail.err $SRC_H5DIFF_TESTFILES/h5diff_udfail.txt " @@ -204,7 +205,7 @@ VERIFY() { TOOLTEST() { expect="$TESTDIR/$1" actual="$TESTDIR/`basename $1 .txt`.out" - actual_err="$TESTDIR/`basename $1 .txt`.err" + actual_err="$TESTDIR/`basename $1 .txt`.out.err" actual_sav=${actual}-sav actual_err_sav=${actual_err}-sav shift @@ -287,6 +288,90 @@ TOOLTEST() { rm -f $actual_sorted $expect_sorted fi } +# Same as TOOLSET except only err file checked +TOOLTEST_ERR() { + expect="$TESTDIR/$1" + expect_err="$TESTDIR/`basename $1 .txt`.err" + actual="$TESTDIR/`basename $1 .txt`.out" + actual_err="$TESTDIR/`basename $1 .txt`.out.err" + actual_sav=${actual}-sav + actual_err_sav=${actual_err}-sav + shift + if test -n "$pmode"; then + RUNCMD=$RUNPARALLEL + else + RUNCMD=$RUNSERIAL + fi + + # Run test. + TESTING $H5DIFF $@ + ( + #echo "#############################" + #echo "Expected output for '$H5DIFF $@'" + #echo "#############################" + cd $TESTDIR + eval $ENVCMD $RUNCMD $H5DIFF_BIN "$@" + ) >$actual 2>$actual_err + EXIT_CODE=$? + # save actual and actual_err in case they are needed later. + cp $actual $actual_sav + STDOUT_FILTER $actual + cp $actual_err $actual_err_sav + STDERR_FILTER $actual_err + # don't add exit code check in pmode, as it causes failure. (exit code + # 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 $h5haveexitcode = 'yes' -a -z "$pmode"; then + echo "EXIT CODE: $EXIT_CODE" >> $actual + fi + + if [ ! -f $expect ]; then + # Create the expect file if it doesn't yet exist. + echo " CREATED" + cp $actual $expect + echo " Expected result (*.ddl) missing" + nerrors="`expr $nerrors + 1`" + elif $CMP $expect_err $actual_err; then + echo " PASSED" + elif test $h5haveexitcode = 'yes' -a -z "$pmode"; then + echo "*FAILED*" + echo " Expected result ($expect_err) differs from actual result ($actual_err)" + nerrors="`expr $nerrors + 1`" + test yes = "$verbose" && $DIFF $expect_err $actual_err |sed 's/^/ /' + else + # parallel mode output are often of different ordering from serial + # output. If the sorted expect_err and actual_err files compare the same, + # it is safe to assume the actual output match the expected file. + expect_sorted=expect_sorted + actual_sorted=actual_sorted + sort $expect_err -o $expect_sorted + sort $actual_err -o $actual_sorted + mv $expect_sorted.noexit $expect_sorted + if $CMP $expect_sorted $actual_sorted; then + echo " PASSED" + else + echo "*FAILED*" + nerrors="`expr $nerrors + 1`" + if test yes = "$verbose"; then + echo "====Expected result ($expect_sorted) differs from actual result ($actual_sorted)" + $DIFF $expect_sorted $actual_sorted |sed 's/^/ /' + echo "====The actual output ($actual_sav)" + sed 's/^/ /' < $actual_sav + echo "====The actual stderr ($actual_err_sav)" + sed 's/^/ /' < $actual_err_sav + echo "====End of actual stderr ($actual_err_sav)" + echo "" + fi + fi + fi + + # Clean up output file + if test -z "$HDF5_NOCLEANUP"; then + rm -f $actual $actual_err $actual_sav $actual_err_sav + rm -f $actual_sorted $expect_sorted + fi +} ############################################################################## ### T H E T E S T S diff --git a/tools/test/h5diff/testfiles/h5diff_459_ERR.err b/tools/test/h5diff/testfiles/dangling_link.err index 82802a1..82802a1 100644 --- a/tools/test/h5diff/testfiles/h5diff_459_ERR.err +++ b/tools/test/h5diff/testfiles/dangling_link.err diff --git a/tools/test/h5diff/testfiles/h5diff_454_ERR.err b/tools/test/h5diff/testfiles/h5diff_454_ERR.err deleted file mode 100644 index 82802a1..0000000 --- a/tools/test/h5diff/testfiles/h5diff_454_ERR.err +++ /dev/null @@ -1,4 +0,0 @@ -H5tools-DIAG: Error detected in HDF5:tools (version (number)) thread (IDs): - #000: (file name) line (number) in h5diff(): treat dangling link as error - major: Failure in tools library - minor: error in function diff --git a/tools/test/h5diff/testfiles/h5diff_454_ERR.txt b/tools/test/h5diff/testfiles/h5diff_454_ERR.txt deleted file mode 100644 index 4501071..0000000 --- a/tools/test/h5diff/testfiles/h5diff_454_ERR.txt +++ /dev/null @@ -1,6 +0,0 @@ -Warning: </softlink_noexist> is a dangling link. -H5tools-DIAG: Error detected in HDF5:tools (version (number)) thread (IDs): - #000: (file name) line (number) in h5diff(): treat dangling link as error - major: Failure in tools library - minor: error in function -EXIT CODE: 2 diff --git a/tools/test/h5diff/testfiles/h5diff_455_ERR.err b/tools/test/h5diff/testfiles/h5diff_455_ERR.err deleted file mode 100644 index 82802a1..0000000 --- a/tools/test/h5diff/testfiles/h5diff_455_ERR.err +++ /dev/null @@ -1,4 +0,0 @@ -H5tools-DIAG: Error detected in HDF5:tools (version (number)) thread (IDs): - #000: (file name) line (number) in h5diff(): treat dangling link as error - major: Failure in tools library - minor: error in function diff --git a/tools/test/h5diff/testfiles/h5diff_455_ERR.txt b/tools/test/h5diff/testfiles/h5diff_455_ERR.txt deleted file mode 100644 index 4501071..0000000 --- a/tools/test/h5diff/testfiles/h5diff_455_ERR.txt +++ /dev/null @@ -1,6 +0,0 @@ -Warning: </softlink_noexist> is a dangling link. -H5tools-DIAG: Error detected in HDF5:tools (version (number)) thread (IDs): - #000: (file name) line (number) in h5diff(): treat dangling link as error - major: Failure in tools library - minor: error in function -EXIT CODE: 2 diff --git a/tools/test/h5diff/testfiles/h5diff_457_ERR.err b/tools/test/h5diff/testfiles/h5diff_457_ERR.err deleted file mode 100644 index 82802a1..0000000 --- a/tools/test/h5diff/testfiles/h5diff_457_ERR.err +++ /dev/null @@ -1,4 +0,0 @@ -H5tools-DIAG: Error detected in HDF5:tools (version (number)) thread (IDs): - #000: (file name) line (number) in h5diff(): treat dangling link as error - major: Failure in tools library - minor: error in function diff --git a/tools/test/h5diff/testfiles/h5diff_457_ERR.txt b/tools/test/h5diff/testfiles/h5diff_457_ERR.txt deleted file mode 100644 index 9d73750..0000000 --- a/tools/test/h5diff/testfiles/h5diff_457_ERR.txt +++ /dev/null @@ -1,6 +0,0 @@ -Warning: </ext_link_noexist1> is a dangling link. -H5tools-DIAG: Error detected in HDF5:tools (version (number)) thread (IDs): - #000: (file name) line (number) in h5diff(): treat dangling link as error - major: Failure in tools library - minor: error in function -EXIT CODE: 2 diff --git a/tools/test/h5diff/testfiles/h5diff_458_ERR.err b/tools/test/h5diff/testfiles/h5diff_458_ERR.err deleted file mode 100644 index 82802a1..0000000 --- a/tools/test/h5diff/testfiles/h5diff_458_ERR.err +++ /dev/null @@ -1,4 +0,0 @@ -H5tools-DIAG: Error detected in HDF5:tools (version (number)) thread (IDs): - #000: (file name) line (number) in h5diff(): treat dangling link as error - major: Failure in tools library - minor: error in function diff --git a/tools/test/h5diff/testfiles/h5diff_458_ERR.txt b/tools/test/h5diff/testfiles/h5diff_458_ERR.txt deleted file mode 100644 index b084914..0000000 --- a/tools/test/h5diff/testfiles/h5diff_458_ERR.txt +++ /dev/null @@ -1,6 +0,0 @@ -Warning: </ext_link_noexist2> is a dangling link. -H5tools-DIAG: Error detected in HDF5:tools (version (number)) thread (IDs): - #000: (file name) line (number) in h5diff(): treat dangling link as error - major: Failure in tools library - minor: error in function -EXIT CODE: 2 diff --git a/tools/test/h5diff/testfiles/h5diff_459_ERR.txt b/tools/test/h5diff/testfiles/h5diff_459_ERR.txt deleted file mode 100644 index 9d73750..0000000 --- a/tools/test/h5diff/testfiles/h5diff_459_ERR.txt +++ /dev/null @@ -1,6 +0,0 @@ -Warning: </ext_link_noexist1> is a dangling link. -H5tools-DIAG: Error detected in HDF5:tools (version (number)) thread (IDs): - #000: (file name) line (number) in h5diff(): treat dangling link as error - major: Failure in tools library - minor: error in function -EXIT CODE: 2 diff --git a/tools/test/h5diff/testfiles/h5diff_600.txt b/tools/test/h5diff/testfiles/h5diff_600.txt index f3b346a..13d627c 100644 --- a/tools/test/h5diff/testfiles/h5diff_600.txt +++ b/tools/test/h5diff/testfiles/h5diff_600.txt @@ -142,5 +142,4 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]] Use h5diff file1 file1 /g1/dset1 /g1/dset2 to compare '/g1/dset1' and '/g1/dset2' in the same file -h5diff error: missing file names EXIT CODE: 1 diff --git a/tools/test/h5diff/testfiles/h5diff_601_ERR.txt b/tools/test/h5diff/testfiles/h5diff_601_ERR.txt deleted file mode 100644 index b58124a..0000000 --- a/tools/test/h5diff/testfiles/h5diff_601_ERR.txt +++ /dev/null @@ -1,6 +0,0 @@ -Object </nono_obj> could not be found in <h5diff_basic1.h5> -H5tools-DIAG: Error detected in HDF5:tools (version (number)) thread (IDs): - #000: (file name) line (number) in h5diff(): Error: Object could not be found - major: Failure in tools library - minor: error in function -EXIT CODE: 2 diff --git a/tools/test/h5diff/testfiles/h5diff_udfail.err b/tools/test/h5diff/testfiles/h5diff_udfail.err new file mode 100644 index 0000000..d51de38 --- /dev/null +++ b/tools/test/h5diff/testfiles/h5diff_udfail.err @@ -0,0 +1,12 @@ + +file1 file2 +--------------------------------------- + x x / + x x /dynlibud + +group : </> and </> +0 differences found +dataset: </dynlibud> and </dynlibud> +0 differences found +Warning: dataset </dynlibud> cannot be read, user defined filter is not available +EXIT CODE: 2 diff --git a/tools/test/h5diff/testfiles/h5diff_udfail.txt b/tools/test/h5diff/testfiles/h5diff_udfail.txt index d51de38..e6000fc 100644 --- a/tools/test/h5diff/testfiles/h5diff_udfail.txt +++ b/tools/test/h5diff/testfiles/h5diff_udfail.txt @@ -8,5 +8,4 @@ group : </> and </> 0 differences found dataset: </dynlibud> and </dynlibud> 0 differences found -Warning: dataset </dynlibud> cannot be read, user defined filter is not available EXIT CODE: 2 diff --git a/tools/test/h5diff/testh5diff.sh.in b/tools/test/h5diff/testh5diff.sh.in index c464f94..557d2ff 100644 --- a/tools/test/h5diff/testh5diff.sh.in +++ b/tools/test/h5diff/testh5diff.sh.in @@ -226,6 +226,7 @@ $SRC_H5DIFF_TESTFILES/h5diff_451.txt $SRC_H5DIFF_TESTFILES/h5diff_452.txt $SRC_H5DIFF_TESTFILES/h5diff_453.txt $SRC_H5DIFF_TESTFILES/h5diff_454.txt +$SRC_H5DIFF_TESTFILES/dangling_link.err $SRC_H5DIFF_TESTFILES/h5diff_455.txt $SRC_H5DIFF_TESTFILES/h5diff_456.txt $SRC_H5DIFF_TESTFILES/h5diff_457.txt @@ -286,6 +287,7 @@ $SRC_H5DIFF_TESTFILES/h5diff_62.txt $SRC_H5DIFF_TESTFILES/h5diff_63.txt $SRC_H5DIFF_TESTFILES/h5diff_600.txt $SRC_H5DIFF_TESTFILES/h5diff_601.txt +$SRC_H5DIFF_TESTFILES/h5diff_601_ERR.err $SRC_H5DIFF_TESTFILES/h5diff_603.txt $SRC_H5DIFF_TESTFILES/h5diff_604.txt $SRC_H5DIFF_TESTFILES/h5diff_605.txt @@ -462,8 +464,9 @@ TESTING() { # TOOLTEST() { expect="$TESTDIR/$1" + expect_err="$TESTDIR/`basename $1 .txt`.err" actual="$TESTDIR/`basename $1 .txt`.out" - actual_err="$TESTDIR/`basename $1 .txt`.err" + actual_err="$TESTDIR/`basename $1 .txt`.out.err" actual_sav=${actual}-sav actual_err_sav=${actual_err}-sav shift @@ -488,7 +491,6 @@ TOOLTEST() { STDOUT_FILTER $actual cp $actual_err $actual_err_sav STDERR_FILTER $actual_err - cat $actual_err >> $actual # don't add exit code check in pmode, as it causes failure. (exit code # is from mpirun not tool) # if any problem occurs relate to an exit code, it will be caught in diff --git a/tools/test/h5dump/CMakeTests.cmake b/tools/test/h5dump/CMakeTests.cmake index 382e664..16dbc4d 100644 --- a/tools/test/h5dump/CMakeTests.cmake +++ b/tools/test/h5dump/CMakeTests.cmake @@ -406,7 +406,7 @@ if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME H5DUMP-${testname} COMMAND $<TARGET_FILE:h5dump> ${ARGN}) set_tests_properties (H5DUMP-${testname} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (H5DUMP-${testname} PROPERTIES DEPENDS ${last_test}) endif () set (last_test "H5DUMP-${testname}") @@ -419,7 +419,7 @@ testfiles/std/h5dump-${testname}.out testfiles/std/h5dump-${testname}.out.err ) - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (H5DUMP-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) endif () add_test ( @@ -456,10 +456,10 @@ if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME H5DUMP-${resultfile} COMMAND $<TARGET_FILE:h5dump> ${ARGN}) set_tests_properties (H5DUMP-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") - if (NOT "${resultcode}" STREQUAL "0") + if (${resultcode}) set_tests_properties (H5DUMP-${resultfile} PROPERTIES WILL_FAIL "true") endif () - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (H5DUMP-${resultfile} PROPERTIES DEPENDS ${last_test}) endif () else () @@ -492,10 +492,10 @@ if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME H5DUMP-N-${resultfile} COMMAND $<TARGET_FILE:h5dump> ${ARGN}) set_tests_properties (H5DUMP-N-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") - if (NOT "${resultcode}" STREQUAL "0") + if (${resultcode}) set_tests_properties (H5DUMP-N-${resultfile} PROPERTIES WILL_FAIL "true") endif () - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (H5DUMP-N-${resultfile} PROPERTIES DEPENDS ${last_test}) endif () else () @@ -528,10 +528,10 @@ if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME H5DUMP-${resultfile} COMMAND $<TARGET_FILE:h5dump> ${ARGN} ${resultfile}.txt ${targetfile}) set_tests_properties (H5DUMP-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") - if (NOT "${resultcode}" STREQUAL "0") + if (${resultcode}) set_tests_properties (H5DUMP-${resultfile} PROPERTIES WILL_FAIL "true") endif () - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (H5DUMP-${resultfile} PROPERTIES DEPENDS ${last_test}) endif () else () @@ -571,10 +571,10 @@ if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME H5DUMP-${resultfile} COMMAND $<TARGET_FILE:h5dump> --ddl=${ddlfile}.txt ${ARGN} ${resultfile}.txt ${targetfile}) set_tests_properties (H5DUMP-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") - if (NOT "${resultcode}" STREQUAL "0") + if (${resultcode}) set_tests_properties (H5DUMP-${resultfile} PROPERTIES WILL_FAIL "true") endif () - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (H5DUMP-${resultfile} PROPERTIES DEPENDS ${last_test}) endif () else () @@ -1149,7 +1149,7 @@ zerodim.out.err ) set_tests_properties (H5DUMP-clearall-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (H5DUMP-clearall-objects PROPERTIES DEPENDS ${last_test}) endif () set (last_test "H5DUMP-clearall-objects") diff --git a/tools/test/h5dump/CMakeTestsPBITS.cmake b/tools/test/h5dump/CMakeTestsPBITS.cmake index 4f3ee9f..a8ccb7d 100644 --- a/tools/test/h5dump/CMakeTestsPBITS.cmake +++ b/tools/test/h5dump/CMakeTestsPBITS.cmake @@ -124,10 +124,10 @@ if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME H5DUMP-${resultfile} COMMAND $<TARGET_FILE:h5dump> ${ARGN}) set_tests_properties (H5DUMP-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/pbits") - if (NOT ${resultcode} STREQUAL "0") + if (${resultcode}) set_tests_properties (H5DUMP-${resultfile} PROPERTIES WILL_FAIL "true") endif () - if (NOT "${last_pbits_test}" STREQUAL "") + if (last_pbits_test) set_tests_properties (H5DUMP-${resultfile} PROPERTIES DEPENDS ${last_pbits_test}) endif () else () @@ -275,7 +275,7 @@ tpbitsUnsignedLongLong16.out.err ) set_tests_properties (H5DUMP_PACKED_BITS-clearall-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/pbits") - if (NOT "${last_pbits_test}" STREQUAL "") + if (last_pbits_test) set_tests_properties (H5DUMP_PACKED_BITS-clearall-objects PROPERTIES DEPENDS ${last_pbits_test}) endif () set (last_pbits_test "H5DUMP_PACKED_BITS-clearall-objects") diff --git a/tools/test/h5dump/CMakeTestsVDS.cmake b/tools/test/h5dump/CMakeTestsVDS.cmake index 922e79e..d7e3b88 100644 --- a/tools/test/h5dump/CMakeTestsVDS.cmake +++ b/tools/test/h5dump/CMakeTestsVDS.cmake @@ -120,10 +120,10 @@ if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME H5DUMP-${resultfile} COMMAND $<TARGET_FILE:h5dump> ${ARGN}) set_tests_properties (H5DUMP-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/vds") - if (NOT "${resultcode}" STREQUAL "0") + if (${resultcode}) set_tests_properties (H5DUMP-${resultfile} PROPERTIES WILL_FAIL "true") endif () - if (NOT "${last_vds_test}" STREQUAL "") + if (last_vds_test) set_tests_properties (H5DUMP-${resultfile} PROPERTIES DEPENDS ${last_VDS_test}) endif () else () @@ -159,10 +159,10 @@ ENVIRONMENT "HDF5_VDS_PREFIX=${PROJECT_BINARY_DIR}/testfiles/vds/" WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/vds/prefix" ) - if (NOT "${resultcode}" STREQUAL "0") + if (${resultcode}) set_tests_properties (H5DUMP_PREFIX-${resultfile} PROPERTIES WILL_FAIL "true") endif () - if (NOT "${last_vds_test}" STREQUAL "") + if (last_vds_test) set_tests_properties (H5DUMP_PREFIX-${resultfile} PROPERTIES DEPENDS ${last_VDS_test}) endif () else () @@ -197,10 +197,10 @@ if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME H5DUMP-${resultfile} COMMAND $<TARGET_FILE:h5dump> -p ${ARGN}) set_tests_properties (H5DUMP-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/vds") - if (NOT "${resultcode}" STREQUAL "0") + if (${resultcode}) set_tests_properties (H5DUMP-${resultfile} PROPERTIES WILL_FAIL "true") endif () - if (NOT "${last_vds_test}" STREQUAL "") + if (last_vds_test) set_tests_properties (H5DUMP-${resultfile} PROPERTIES DEPENDS ${last_VDS_test}) endif () else () @@ -276,7 +276,7 @@ vds_layout-maxmin.out.err ) set_tests_properties (H5DUMP_VDS-clearall-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/vds") - if (NOT "${last_vds_test}" STREQUAL "") + if (last_vds_test) set_tests_properties (H5DUMP_VDS-clearall-objects PROPERTIES DEPENDS ${last_vds_test}) endif () set (last_VDS_test "H5DUMP_VDS-clearall-objects") diff --git a/tools/test/h5dump/CMakeTestsXML.cmake b/tools/test/h5dump/CMakeTestsXML.cmake index de87d2f..e48cec1 100644 --- a/tools/test/h5dump/CMakeTestsXML.cmake +++ b/tools/test/h5dump/CMakeTestsXML.cmake @@ -178,10 +178,10 @@ if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME H5DUMP_XML-${resultfile} COMMAND $<TARGET_FILE:h5dump> --xml ${ARGN}) set_tests_properties (H5DUMP_XML-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/xml") - if (NOT "${resultcode}" STREQUAL "0") + if (${resultcode}) set_tests_properties (H5DUMP_XML-${resultfile} PROPERTIES WILL_FAIL "true") endif () - if (NOT "${last_xml_test}" STREQUAL "") + if (last_xml_test) set_tests_properties (H5DUMP_XML-${resultfile} PROPERTIES DEPENDS ${last_xml_test}) endif () else () @@ -357,7 +357,7 @@ tvlstr.h5.out.err ) set_tests_properties (H5DUMP-XML-clearall-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/xml") - if (NOT "${last_xml_test}" STREQUAL "") + if (last_xml_test) set_tests_properties (H5DUMP-XML-clearall-objects PROPERTIES DEPENDS ${last_xml_test}) endif () set (last_test "H5DUMP-XML-clearall-objects") diff --git a/tools/test/h5dump/errfiles/tall-1.err b/tools/test/h5dump/errfiles/tall-1.err index 2d2b289..84140f2 100644 --- a/tools/test/h5dump/errfiles/tall-1.err +++ b/tools/test/h5dump/errfiles/tall-1.err @@ -32,6 +32,3 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #010: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'somefile' major: Links minor: Unable to open file - #011: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'somefile', temp_file_name = 'somefile' - major: File accessibility - minor: Unable to open file diff --git a/tools/test/h5dump/errfiles/tall-2A.err b/tools/test/h5dump/errfiles/tall-2A.err index 2d2b289..84140f2 100644 --- a/tools/test/h5dump/errfiles/tall-2A.err +++ b/tools/test/h5dump/errfiles/tall-2A.err @@ -32,6 +32,3 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #010: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'somefile' major: Links minor: Unable to open file - #011: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'somefile', temp_file_name = 'somefile' - major: File accessibility - minor: Unable to open file diff --git a/tools/test/h5dump/errfiles/tall-2A0.err b/tools/test/h5dump/errfiles/tall-2A0.err index 2d2b289..84140f2 100644 --- a/tools/test/h5dump/errfiles/tall-2A0.err +++ b/tools/test/h5dump/errfiles/tall-2A0.err @@ -32,6 +32,3 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #010: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'somefile' major: Links minor: Unable to open file - #011: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'somefile', temp_file_name = 'somefile' - major: File accessibility - minor: Unable to open file diff --git a/tools/test/h5dump/errfiles/tall-2B.err b/tools/test/h5dump/errfiles/tall-2B.err index 2d2b289..84140f2 100644 --- a/tools/test/h5dump/errfiles/tall-2B.err +++ b/tools/test/h5dump/errfiles/tall-2B.err @@ -32,6 +32,3 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #010: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'somefile' major: Links minor: Unable to open file - #011: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'somefile', temp_file_name = 'somefile' - major: File accessibility - minor: Unable to open file diff --git a/tools/test/h5dump/errfiles/textlink.err b/tools/test/h5dump/errfiles/textlink.err index aaf3144..3f77f38 100644 --- a/tools/test/h5dump/errfiles/textlink.err +++ b/tools/test/h5dump/errfiles/textlink.err @@ -32,9 +32,6 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #010: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'filename' major: Links minor: Unable to open file - #011: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'filename', temp_file_name = 'filename' - major: File accessibility - minor: Unable to open file HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Oopen(): unable to open object major: Object header @@ -69,6 +66,3 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #010: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'anotherfile' major: Links minor: Unable to open file - #011: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'anotherfile', temp_file_name = 'anotherfile' - major: File accessibility - minor: Unable to open file diff --git a/tools/test/h5dump/errfiles/torderlinks1.err b/tools/test/h5dump/errfiles/torderlinks1.err index ce31ced..caeef27 100644 --- a/tools/test/h5dump/errfiles/torderlinks1.err +++ b/tools/test/h5dump/errfiles/torderlinks1.err @@ -32,6 +32,3 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #010: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'fname' major: Links minor: Unable to open file - #011: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'fname', temp_file_name = 'fname' - major: File accessibility - minor: Unable to open file diff --git a/tools/test/h5dump/errfiles/torderlinks2.err b/tools/test/h5dump/errfiles/torderlinks2.err index ce31ced..caeef27 100644 --- a/tools/test/h5dump/errfiles/torderlinks2.err +++ b/tools/test/h5dump/errfiles/torderlinks2.err @@ -32,6 +32,3 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #010: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'fname' major: Links minor: Unable to open file - #011: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'fname', temp_file_name = 'fname' - major: File accessibility - minor: Unable to open file diff --git a/tools/test/h5dump/h5dumpgentest.c b/tools/test/h5dump/h5dumpgentest.c index cbbbcfa..946ca04 100644 --- a/tools/test/h5dump/h5dumpgentest.c +++ b/tools/test/h5dump/h5dumpgentest.c @@ -9529,15 +9529,13 @@ gent_intattrscalars(void) } /*------------------------------------------------------------------------- - * Function: gent_packedbits + * Function: gent_intsattrs * - * Purpose: Generate a file to be used in the h5dump packed bits tests. + * Purpose: Generate a file to be used in the h5dump tests. * Four datasets of 1, 2, 4 and 8 bytes of unsigned int types are created. * Four more datasets of 1, 2, 4 and 8 bytes of signed int types are created. * Fill them with raw data such that no bit will be all zero in a dataset. * A dummy dataset of double type is created for failure test. - * Created: Albert Cheng, 2010/5/10. - * Modified: Allen Byrne, 2011/1/5 Use file to test Signed/Unsigned datatypes *------------------------------------------------------------------------- */ static void diff --git a/tools/test/h5dump/testh5dump.sh.in b/tools/test/h5dump/testh5dump.sh.in index 42e4b07..af5d547 100644 --- a/tools/test/h5dump/testh5dump.sh.in +++ b/tools/test/h5dump/testh5dump.sh.in @@ -490,7 +490,6 @@ TOOLTEST() { STDOUT_FILTER $actual cp $actual_err $actual_err_sav STDERR_FILTER $actual_err - cat $actual_err >> $actual if [ ! -f $expect ]; then # Create the expect file if it doesn't yet exist. @@ -534,7 +533,6 @@ TOOLTEST2() { cd $TESTDIR $RUNSERIAL $DUMPER_BIN "$@" ) >$actual 2>$actual_err - cat $actual_err >> $actual if [ ! -f $expect ]; then # Create the expect file if it doesn't yet exist. @@ -593,7 +591,6 @@ TOOLTEST2A() { cd $TESTDIR $RUNSERIAL $DUMPER_BIN "$@" ) >$actual 2>$actual_err - cat $actual_err >> $actual if [ ! -f $expect ]; then # Create the expect file if it doesn't yet exist. @@ -660,7 +657,6 @@ TOOLTEST2B() { cd $TESTDIR $RUNSERIAL $DUMPER_BIN "$@" ) >$actual 2>$actual_err - cat $actual_err >> $actual if [ ! -f $expectdata ]; then # Create the expect data file if it doesn't yet exist. @@ -717,7 +713,6 @@ TOOLTEST3() { -e 's/H5Eget_auto[1-2]*/H5Eget_auto(1 or 2)/' \ -e 's/H5Eset_auto[1-2]*/H5Eset_auto(1 or 2)/' \ $actual_err > $actual_ext - cat $actual_ext >> $actual if [ ! -f $expect ]; then # Create the expect file if it doesn't yet exist. @@ -776,7 +771,6 @@ TOOLTEST4() { -e 's/H5Eget_auto[1-2]*/H5Eget_auto(1 or 2)/' \ -e 's/H5Eset_auto[1-2]*/H5Eset_auto(1 or 2)/' \ $actual_err > $actual_ext - #cat $actual_ext >> $actual if [ ! -f $expect ]; then # Create the expect file if it doesn't yet exist. @@ -842,7 +836,6 @@ TOOLTEST5() { -e 's/H5Eget_auto[1-2]*/H5Eget_auto(1 or 2)/' \ -e 's/H5Eset_auto[1-2]*/H5Eset_auto(1 or 2)/' \ $actual_err > $actual_ext - #cat $actual_ext >> $actual if [ ! -f $expect ]; then # Create the expect file if it doesn't yet exist. @@ -886,7 +879,6 @@ TOOLTEST_HELP() { cd $TESTDIR $RUNSERIAL $DUMPER_BIN "$@" ) >$actual 2>$actual_err - cat $actual_err >> $actual if [ ! -f $expectdata ]; then # Create the expect data file if it doesn't yet exist. diff --git a/tools/test/h5dump/testh5dumppbits.sh.in b/tools/test/h5dump/testh5dumppbits.sh.in index 9cf5c99..febce2c 100644 --- a/tools/test/h5dump/testh5dumppbits.sh.in +++ b/tools/test/h5dump/testh5dumppbits.sh.in @@ -235,7 +235,6 @@ TOOLTEST() { STDOUT_FILTER $actual cp $actual_err $actual_err_sav STDERR_FILTER $actual_err - cat $actual_err >> $actual if [ ! -f $expect ]; then # Create the expect file if it doesn't yet exist. @@ -278,7 +277,6 @@ TOOLTEST2() { cd $TESTDIR $RUNSERIAL $DUMPER_BIN "$@" ) >$actual 2>$actual_err - cat $actual_err >> $actual if [ ! -f $expect ]; then # Create the expect file if it doesn't yet exist. @@ -348,7 +346,6 @@ TOOLTEST3() { -e 's/H5Eget_auto[1-2]*/H5Eget_auto(1 or 2)/' \ -e 's/H5Eset_auto[1-2]*/H5Eset_auto(1 or 2)/' \ $actual_err > $actual_ext - cat $actual_ext >> $actual if [ ! -f $expect ]; then # Create the expect file if it doesn't yet exist. @@ -406,7 +403,6 @@ TOOLTEST4() { -e 's/H5Eget_auto[1-2]*/H5Eget_auto(1 or 2)/' \ -e 's/H5Eset_auto[1-2]*/H5Eset_auto(1 or 2)/' \ $actual_err > $actual_ext - #cat $actual_ext >> $actual if [ ! -f $expect ]; then # Create the expect file if it doesn't yet exist. diff --git a/tools/test/h5format_convert/CMakeTests.cmake b/tools/test/h5format_convert/CMakeTests.cmake index 2240813..5599c1b 100644 --- a/tools/test/h5format_convert/CMakeTests.cmake +++ b/tools/test/h5format_convert/CMakeTests.cmake @@ -22,10 +22,8 @@ set (HDF5_REFERENCE_FILES h5fc_help.ddl h5fc_nooption.ddl - h5fc_nonexistfile.ddl h5fc_d_file.ddl h5fc_dname.ddl - h5fc_nonexistdset_file.ddl h5fc_v_non_chunked.ddl h5fc_v_bt1.ddl h5fc_v_ndata_bt1.ddl @@ -49,6 +47,12 @@ h5fc_v_err.ddl h5fc_v_err.ddl.err ) + set (HDF5_REFERENCE_ERR_FILES + h5fc_d_file.ddl.err + h5fc_dname.err + h5fc_nonexistfile.ddl.err + h5fc_nonexistdset_file.ddl.err + ) set (HDF5_REFERENCE_TEST_FILES h5fc_non_v3.h5 h5fc_edge_v3.h5 @@ -78,6 +82,10 @@ HDFTEST_COPY_FILE("${HDF5_TOOLS_TEST_H5FC_SOURCE_DIR}/testfiles/${ddl_file}" "${PROJECT_BINARY_DIR}/testfiles/${ddl_file}" "h5fc_files") endforeach () + foreach (h5_file ${HDF5_REFERENCE_ERR_FILES}) + HDFTEST_COPY_FILE("${HDF5_TOOLS_TEST_H5FC_SOURCE_DIR}/testfiles/${h5_file}" "${PROJECT_BINARY_DIR}/testfiles/${h5_file}" "h5fc_files") + endforeach () + foreach (h5_file ${HDF5_REFERENCE_TEST_FILES}) HDFTEST_COPY_FILE("${HDF5_TOOLS_TEST_H5FC_SOURCE_DIR}/testfiles/${h5_file}" "${PROJECT_BINARY_DIR}/testfiles/${h5_file}" "h5fc_files") endforeach () @@ -100,10 +108,10 @@ ./testfiles/${testname}.out ./testfiles/${testname}.out.err ) - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (H5FC-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) endif () - if (NOT "${testfile}" STREQUAL "") + if (${testfile}) add_test ( NAME H5FC-${testname}-${testfile}-tmpfile COMMAND ${CMAKE_COMMAND} @@ -119,6 +127,7 @@ -D "TEST_OUTPUT=${testname}.out" -D "TEST_EXPECT=${resultcode}" -D "TEST_REFERENCE=${resultfile}" + -D "TEST_ERRREF=${resultfile}.err" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) set_tests_properties (H5FC-${testname}-${testfile} PROPERTIES DEPENDS "H5FC-${testname}-${testfile}-tmpfile") @@ -141,7 +150,7 @@ endif () endmacro () - macro (ADD_H5_MASK_OUTPUT testname resultfile resultcode testfile) + macro (ADD_H5_NOERR_OUTPUT testname resultfile resultcode testfile) # If using memchecker add tests without using scripts if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( @@ -152,48 +161,66 @@ ./testfiles/${testname}.out ./testfiles/${testname}.out.err ) - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (H5FC-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) endif () - if (NOT "${testfile}" STREQUAL "") - add_test ( - NAME H5FC-${testname}-${testfile}-tmpfile - COMMAND ${CMAKE_COMMAND} - -E copy_if_different ${HDF5_TOOLS_TEST_H5FC_SOURCE_DIR}/testfiles/${testfile} ./testfiles/outtmp.h5 - ) - set_tests_properties (H5FC-${testname}-${testfile}-tmpfile PROPERTIES DEPENDS "H5FC-${testname}-clear-objects") - add_test ( - NAME H5FC-${testname}-${testfile} - COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$<TARGET_FILE:h5format_convert>" - -D "TEST_ARGS=${ARGN};outtmp.h5" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" - -D "TEST_OUTPUT=${testname}.out" - -D "TEST_EXPECT=${resultcode}" - -D "TEST_REFERENCE=${resultfile}" - -D "TEST_ERRREF=${resultfile}.err" - -D "TEST_MASK_ERROR=true" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" - ) - set_tests_properties (H5FC-${testname}-${testfile} PROPERTIES DEPENDS "H5FC-${testname}-${testfile}-tmpfile") - set (last_test "H5FC-${testname}-${testfile}") - else () - add_test ( - NAME H5FC-${testname}-NA - COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$<TARGET_FILE:h5format_convert>" - -D "TEST_ARGS=${ARGN}" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" - -D "TEST_OUTPUT=${testname}.out" - -D "TEST_EXPECT=${resultcode}" - -D "TEST_REFERENCE=${resultfile}" - -D "TEST_ERRREF=${resultfile}.err" - -D "TEST_MASK_ERROR=true" - -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" - ) - set_tests_properties (H5FC-${testname}-NA PROPERTIES DEPENDS "H5FC-${testname}-clear-objects") - set (last_test "H5FC-${testname}-NA") + add_test ( + NAME H5FC-${testname}-${testfile}-tmpfile + COMMAND ${CMAKE_COMMAND} + -E copy_if_different ${HDF5_TOOLS_TEST_H5FC_SOURCE_DIR}/testfiles/${testfile} ./testfiles/outtmp.h5 + ) + set_tests_properties (H5FC-${testname}-${testfile}-tmpfile PROPERTIES DEPENDS "H5FC-${testname}-clear-objects") + add_test ( + NAME H5FC-${testname}-${testfile} + COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$<TARGET_FILE:h5format_convert>" + -D "TEST_ARGS=${ARGN};outtmp.h5" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" + -D "TEST_OUTPUT=${testname}.out" + -D "TEST_EXPECT=${resultcode}" + -D "TEST_REFERENCE=${resultfile}" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) + set_tests_properties (H5FC-${testname}-${testfile} PROPERTIES DEPENDS "H5FC-${testname}-${testfile}-tmpfile") + set (last_test "H5FC-${testname}-${testfile}") + endif () + endmacro () + + macro (ADD_H5_MASK_OUTPUT testname resultfile resultcode testfile) + # If using memchecker add tests without using scripts + if (NOT HDF5_ENABLE_USING_MEMCHECKER) + add_test ( + NAME H5FC-${testname}-clear-objects + COMMAND ${CMAKE_COMMAND} + -E remove + ./testfiles/outtmp.h5 + ./testfiles/${testname}.out + ./testfiles/${testname}.out.err + ) + if (last_test) + set_tests_properties (H5FC-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) endif () + add_test ( + NAME H5FC-${testname}-${testfile}-tmpfile + COMMAND ${CMAKE_COMMAND} + -E copy_if_different ${HDF5_TOOLS_TEST_H5FC_SOURCE_DIR}/testfiles/${testfile} ./testfiles/outtmp.h5 + ) + set_tests_properties (H5FC-${testname}-${testfile}-tmpfile PROPERTIES DEPENDS "H5FC-${testname}-clear-objects") + add_test ( + NAME H5FC-${testname}-${testfile} + COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$<TARGET_FILE:h5format_convert>" + -D "TEST_ARGS=${ARGN};outtmp.h5" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" + -D "TEST_OUTPUT=${testname}.out" + -D "TEST_EXPECT=${resultcode}" + -D "TEST_REFERENCE=${resultfile}" + -D "TEST_ERRREF=${resultfile}.err" + -D "TEST_MASK_ERROR=true" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) + set_tests_properties (H5FC-${testname}-${testfile} PROPERTIES DEPENDS "H5FC-${testname}-${testfile}-tmpfile") + set (last_test "H5FC-${testname}-${testfile}") endif () endmacro () @@ -208,7 +235,7 @@ ./testfiles/${testname}.out ./testfiles/${testname}.out.err ) - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (H5FC-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) endif () add_test ( @@ -255,7 +282,7 @@ ./testfiles/${testname}.out ./testfiles/${testname}.out.err ) - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (H5FC-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) endif () add_test ( @@ -298,7 +325,7 @@ ./testfiles/${testname}_chk.out ./testfiles/${testname}_chk.out.err ) - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (H5FC-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) endif () add_test ( @@ -404,7 +431,7 @@ chktmp.h5 dmptmp.h5 ) - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (H5FC-clearall-objects PROPERTIES DEPENDS ${last_test}) endif () set (last_test "H5FC-clearall-objects") @@ -433,17 +460,17 @@ # h5format_convert -d /GROUP/DSET_BT2 --verbose old_h5fc_ext_none.h5 (verbose, bt1 dataset) # h5format_convert -d /DSET_NDATA_BT2 -v -n old_h5fc_ext_none.h5 (verbose, noop, bt1+nodata dataset) # h5format_convert -v old_h5fc_ext_none.h5 (verbose, all datasets) - ADD_H5_OUTPUT (h5fc_v_non_chunked h5fc_v_non_chunked.ddl 0 old_h5fc_ext_none.h5 -d /DSET_CONTIGUOUS -v) - ADD_H5_OUTPUT (h5fc_v_bt1 h5fc_v_bt1.ddl 0 old_h5fc_ext_none.h5 -d /GROUP/DSET_BT2 --verbose) - ADD_H5_OUTPUT (h5fc_v_ndata_bt1 h5fc_v_ndata_bt1.ddl 0 old_h5fc_ext_none.h5 -d /DSET_NDATA_BT2 -v -n) - ADD_H5_OUTPUT (h5fc_v_all h5fc_v_all.ddl 0 old_h5fc_ext_none.h5 -v) + ADD_H5_NOERR_OUTPUT (h5fc_v_non_chunked h5fc_v_non_chunked.ddl 0 old_h5fc_ext_none.h5 -d /DSET_CONTIGUOUS -v) + ADD_H5_NOERR_OUTPUT (h5fc_v_bt1 h5fc_v_bt1.ddl 0 old_h5fc_ext_none.h5 -d /GROUP/DSET_BT2 --verbose) + ADD_H5_NOERR_OUTPUT (h5fc_v_ndata_bt1 h5fc_v_ndata_bt1.ddl 0 old_h5fc_ext_none.h5 -d /DSET_NDATA_BT2 -v -n) + ADD_H5_NOERR_OUTPUT (h5fc_v_all h5fc_v_all.ddl 0 old_h5fc_ext_none.h5 -v) # # # # h5format_convert -d /DSET_EA -v -n h5fc_ext_none.h5 (verbose, noop, one ea dataset) # h5format_convert -v -n h5fc_non_v3.h5 (verbose, noop, all datasets) - ADD_H5_OUTPUT (h5fc_v_n_1d h5fc_v_n_1d.ddl 0 h5fc_ext_none.h5 -d /DSET_EA -v -n) - ADD_H5_OUTPUT (h5fc_v_n_all h5fc_v_n_all.ddl 0 h5fc_non_v3.h5 -v -n) + ADD_H5_NOERR_OUTPUT (h5fc_v_n_1d h5fc_v_n_1d.ddl 0 h5fc_ext_none.h5 -d /DSET_EA -v -n) + ADD_H5_NOERR_OUTPUT (h5fc_v_n_all h5fc_v_n_all.ddl 0 h5fc_non_v3.h5 -v -n) # # # diff --git a/tools/test/h5format_convert/testfiles/h5fc_d_file-d.ddl b/tools/test/h5format_convert/testfiles/h5fc_d_file-d.ddl new file mode 100644 index 0000000..bc0229c --- /dev/null +++ b/tools/test/h5format_convert/testfiles/h5fc_d_file-d.ddl @@ -0,0 +1,25 @@ +usage: h5format_convert [OPTIONS] file_name + OPTIONS + -h, --help Print a usage message and exit + -V, --version Print version number and exit + -v, --verbose Turn on verbose mode + -d dname, --dname=dataset_name Pathname for the dataset + -n, --noop Perform all the steps except the actual conversion + +Examples of use: + +h5format_convert -d /group/dataset file_name + Convert the dataset </group/dataset> in the HDF5 file <file_name>: + a. chunked dataset: convert the chunk indexing type to version 1 B-tree + b. compact/contiguous dataset: downgrade the layout version to 3 + c. virtual dataset: no action + +h5format_convert file_name + Convert all datasets in the HDF5 file <file_name>: + a. chunked dataset: convert the chunk indexing type to version 1 B-tree + b. compact/contiguous dataset: downgrade the layout version to 3 + c. virtual dataset: no action + +h5format_convert -n -d /group/dataset file_name + Go through all the steps except the actual conversion when + converting the dataset </group/dataset> in the HDF5 file <file_name>. diff --git a/tools/test/h5format_convert/testfiles/h5fc_d_file.ddl b/tools/test/h5format_convert/testfiles/h5fc_d_file.ddl index 38fc432..bc0229c 100644 --- a/tools/test/h5format_convert/testfiles/h5fc_d_file.ddl +++ b/tools/test/h5format_convert/testfiles/h5fc_d_file.ddl @@ -23,4 +23,3 @@ h5format_convert file_name h5format_convert -n -d /group/dataset file_name Go through all the steps except the actual conversion when converting the dataset </group/dataset> in the HDF5 file <file_name>. -h5format_convert error: missing file name diff --git a/tools/test/h5format_convert/testfiles/h5fc_d_file.ddl.err b/tools/test/h5format_convert/testfiles/h5fc_d_file.ddl.err new file mode 100644 index 0000000..ceb0fe4 --- /dev/null +++ b/tools/test/h5format_convert/testfiles/h5fc_d_file.ddl.err @@ -0,0 +1 @@ +h5format_convert error: missing file name diff --git a/tools/test/h5format_convert/testfiles/h5fc_dname.ddl b/tools/test/h5format_convert/testfiles/h5fc_dname.ddl index 48564b7..bc0229c 100644 --- a/tools/test/h5format_convert/testfiles/h5fc_dname.ddl +++ b/tools/test/h5format_convert/testfiles/h5fc_dname.ddl @@ -23,4 +23,3 @@ h5format_convert file_name h5format_convert -n -d /group/dataset file_name Go through all the steps except the actual conversion when converting the dataset </group/dataset> in the HDF5 file <file_name>. -h5format_convert error: No dataset name diff --git a/tools/test/h5format_convert/testfiles/h5fc_dname.err b/tools/test/h5format_convert/testfiles/h5fc_dname.err new file mode 100644 index 0000000..361d8a9 --- /dev/null +++ b/tools/test/h5format_convert/testfiles/h5fc_dname.err @@ -0,0 +1 @@ +h5format_convert error: No dataset name diff --git a/tools/test/h5format_convert/testfiles/h5fc_nonexistdset_file.ddl b/tools/test/h5format_convert/testfiles/h5fc_nonexistdset_file.ddl.err index 39450c0..39450c0 100644 --- a/tools/test/h5format_convert/testfiles/h5fc_nonexistdset_file.ddl +++ b/tools/test/h5format_convert/testfiles/h5fc_nonexistdset_file.ddl.err diff --git a/tools/test/h5format_convert/testfiles/h5fc_nonexistfile.ddl b/tools/test/h5format_convert/testfiles/h5fc_nonexistfile.ddl.err index 706ea9d..706ea9d 100644 --- a/tools/test/h5format_convert/testfiles/h5fc_nonexistfile.ddl +++ b/tools/test/h5format_convert/testfiles/h5fc_nonexistfile.ddl.err diff --git a/tools/test/h5format_convert/testh5fc.sh.in b/tools/test/h5format_convert/testh5fc.sh.in index 585d389..2cdd445 100644 --- a/tools/test/h5format_convert/testh5fc.sh.in +++ b/tools/test/h5format_convert/testh5fc.sh.in @@ -103,13 +103,18 @@ $SRC_H5FORMCONV_TESTFILES/old_h5fc_ext3_isf.h5 $SRC_H5FORMCONV_TESTFILES/h5fc_err_level.h5 " +LIST_ERR_TEST_FILES=" +$SRC_H5FORMCONV_TESTFILES/h5fc_d_file.ddl.err +$SRC_H5FORMCONV_TESTFILES/h5fc_dname.err +$SRC_H5FORMCONV_TESTFILES/h5fc_nonexistfile.ddl.err +$SRC_H5FORMCONV_TESTFILES/h5fc_nonexistdset_file.ddl.err +" + LIST_OTHER_TEST_FILES=" $SRC_H5FORMCONV_TESTFILES/h5fc_help.ddl $SRC_H5FORMCONV_TESTFILES/h5fc_nooption.ddl -$SRC_H5FORMCONV_TESTFILES/h5fc_nonexistfile.ddl $SRC_H5FORMCONV_TESTFILES/h5fc_d_file.ddl $SRC_H5FORMCONV_TESTFILES/h5fc_dname.ddl -$SRC_H5FORMCONV_TESTFILES/h5fc_nonexistdset_file.ddl $SRC_H5FORMCONV_TESTFILES/h5fc_v_non_chunked.ddl $SRC_H5FORMCONV_TESTFILES/h5fc_v_bt1.ddl $SRC_H5FORMCONV_TESTFILES/h5fc_v_ndata_bt1.ddl @@ -137,7 +142,7 @@ $SRC_H5FORMCONV_TESTFILES/h5fc_v_err.ddl.err # # copy test files and expected output files from source dirs to test dir # -COPY_TESTFILES="$LIST_HDF5_TEST_FILES $LIST_OTHER_TEST_FILES" +COPY_TESTFILES="$LIST_HDF5_TEST_FILES $LIST_ERR_TEST_FILES $LIST_OTHER_TEST_FILES" COPY_TESTFILES_TO_TESTDIR() { @@ -193,6 +198,9 @@ TESTING() { echo "Testing $* $SPACES" | cut -c1-80 | tr -d '\012' } +# Source in the output filter function definitions. +. $srcdir/../../../bin/output_filter.sh + # Run a test and print PASS or *FAIL*. If a test fails then increment # the `nerrors' global variable and (if $verbose is set) display the # difference between the actual output and the expected output. The @@ -212,8 +220,9 @@ TESTING() { TOOLTEST_OUT() { # Prepare expected and actual output expect="$TESTDIR/$1" + expect_err="$TESTDIR/`basename $1 .ddl`.err" actual="$TESTDIR/`basename $1 .ddl`.out" - actual_err="$TESTDIR/`basename $1 .ddl`.err" + actual_err="$TESTDIR/`basename $1 .ddl`.out.err" actual_sav=${actual}-sav actual_err_sav=${actual_err}-sav @@ -233,7 +242,6 @@ TOOLTEST_OUT() { ) >$actual 2>$actual_err cp $actual $actual_sav cp $actual_err $actual_err_sav - cat $actual_err >> $actual # Compare output COMPARE_OUT $expect $actual @@ -251,7 +259,7 @@ TOOLTEST_MASK_OUT() { expect_err="$TESTDIR/$1.err" actual_ext="$TESTDIR/$1.ext" actual="$TESTDIR/`basename $1 .ddl`.out" - actual_err="$TESTDIR/`basename $1 .ddl`.err" + actual_err="$TESTDIR/`basename $1 .ddl`.out.err" actual_sav=${actual}-sav actual_err_sav=${actual_err}-sav @@ -305,6 +313,42 @@ TOOLTEST_MASK_OUT() { $RM $actual $actual_err $actual_sav $actual_err_sav fi } +# Same as TOOLTEST_OUT except only compares error outout +TOOLTEST_ERR() { + # Prepare expected and actual output + expect="$TESTDIR/$1" + expect_err="$TESTDIR/$1.err" + actual="$TESTDIR/`basename $1 .ddl`.out" + actual_err="$TESTDIR/`basename $1 .ddl`.out.err" + actual_sav=${actual}-sav + actual_err_sav=${actual_err}-sav + + # Prepare the test file + $RM $TESTDIR/$TMPOUTFILE + TFILE=$2 + if [ ! -z "$2" ] && [ -e $TESTDIR/$2 ] ; then + $CP $TESTDIR/$2 $TESTDIR/$TMPOUTFILE + TFILE=$TMPOUTFILE + fi + + # Run test. + TESTING $FORMCONV $3 $4 $5 $6 $2 + ( + cd $TESTDIR + $RUNSERIAL $FORMCONV_BIN $3 $4 $5 $6 $TFILE + ) >$actual 2>$actual_err + cp $actual $actual_sav + cp $actual_err $actual_err_sav + + # Compare output + COMPARE_OUT $expect_err $actual_err + + # Clean up output file + if test -z "$HDF5_NOCLEANUP"; then + $RM $actual $actual_err + $RM $actual $actual_err $actual_sav $actual_err_sav + fi +} # To check that the tool exits success, no output # Assume all short options @@ -406,7 +450,7 @@ COPY_TESTFILES_TO_TESTDIR # h5format_convert nonexist.h5 (no options, file does not exist) TOOLTEST_OUT h5fc_help.ddl '' --help TOOLTEST_OUT h5fc_nooption.ddl '' -TOOLTEST_OUT h5fc_nonexistfile.ddl nonexist.h5 +TOOLTEST_ERR h5fc_nonexistfile.ddl nonexist.h5 # # # h5format_convert -d old_h5fc_ext_none.h5 (just -d option, file exists) @@ -416,7 +460,7 @@ TOOLTEST_OUT h5fc_nonexistfile.ddl nonexist.h5 TOOLTEST_OUT h5fc_d_file.ddl old_h5fc_ext_none.h5 -d TOOLTEST_OUT h5fc_d_file.ddl old_h5fc_ext_none.h5 --dname TOOLTEST_OUT h5fc_dname.ddl '' --dname -TOOLTEST_OUT h5fc_nonexistdset_file.ddl old_h5fc_ext_none.h5 --dname=nonexist +TOOLTEST_ERR h5fc_nonexistdset_file.ddl old_h5fc_ext_none.h5 --dname=nonexist # # # diff --git a/tools/test/h5import/CMakeTests.cmake b/tools/test/h5import/CMakeTests.cmake index 7d76fba..1090640 100644 --- a/tools/test/h5import/CMakeTests.cmake +++ b/tools/test/h5import/CMakeTests.cmake @@ -99,7 +99,7 @@ # If using memchecker skip macro based tests if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME H5IMPORT-${testname} COMMAND $<TARGET_FILE:h5import> ${importfile} -c ${conffile} -o ${testfile}) - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (H5IMPORT-${testname} PROPERTIES DEPENDS H5IMPORT-h5importtest) endif () else () @@ -499,7 +499,7 @@ binuin32.bin binuin32.conf ) - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (H5IMPORT-h5importtest-clear-objects PROPERTIES DEPENDS ${last_test}) endif () set (last_test "H5IMPORT-clear-objects") diff --git a/tools/test/h5jam/CMakeTests.cmake b/tools/test/h5jam/CMakeTests.cmake index 66ff715..677ba5c 100644 --- a/tools/test/h5jam/CMakeTests.cmake +++ b/tools/test/h5jam/CMakeTests.cmake @@ -55,7 +55,7 @@ # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME H5JAM-${expectfile} COMMAND $<TARGET_FILE:h5jam> ${ARGN}) - if (NOT "${resultcode}" STREQUAL "0") + if (${resultcode}) set_tests_properties (H5JAM-${expectfile} PROPERTIES WILL_FAIL "true") endif () else () @@ -74,6 +74,8 @@ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" -D "TEST_OUTPUT=${expectfile}.out" -D "TEST_EXPECT=${resultcode}" + -D "TEST_ERRREF=testfiles/${expectfile}.txt" + -D "TEST_SKIP_COMPARE=1" -D "TEST_REFERENCE=testfiles/${expectfile}.txt" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) @@ -89,7 +91,7 @@ # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME H5JAM-UNJAM-${expectfile} COMMAND $<TARGET_FILE:h5unjam> ${ARGN}) - if (NOT "${resultcode}" STREQUAL "0") + if (${resultcode}) set_tests_properties (H5JAM-UNJAM-${expectfile} PROPERTIES WILL_FAIL "true") endif () else () @@ -203,7 +205,7 @@ set (compare_test "") endif () endif () - if (NOT "${compare_test}" STREQUAL "") + if (${compare_test}) add_test ( NAME H5JAM-${testname}-UNJAM-CHECK_UB_1-clear-objects COMMAND ${CMAKE_COMMAND} @@ -242,7 +244,7 @@ -D "TEST_OFILE=NULL" -P "${HDF_RESOURCES_DIR}/userblockTest.cmake" ) - if (NOT "${compare_test}" STREQUAL "") + if (${compare_test}) set_tests_properties (H5JAM-${testname}-UNJAM-CHECK_NOUB PROPERTIES DEPENDS H5JAM-${testname}-UNJAM-CHECK_UB_1) else () set_tests_properties (H5JAM-${testname}-UNJAM-CHECK_NOUB PROPERTIES DEPENDS H5JAM-${testname}-UNJAM) diff --git a/tools/test/h5jam/tellub.c b/tools/test/h5jam/tellub.c index 26c725d..559c677 100644 --- a/tools/test/h5jam/tellub.c +++ b/tools/test/h5jam/tellub.c @@ -53,7 +53,7 @@ usage (const char *prog) /*------------------------------------------------------------------------- * Function: parse_command_line * - * Purpose: Parse the command line for the h5dumper. + * Purpose: Parse the command line. * * Return: Success: void * Failure: Exits program with EXIT_FAILURE value. @@ -89,7 +89,7 @@ parse_command_line (int argc, const char *argv[]) /*------------------------------------------------------------------------- * Function: main * - * Purpose: HDF5 user block unjammer + * Purpose: HDF5 user block tell size * * Return: EXIT_SUCCESS/EXIT_FAILURE *------------------------------------------------------------------------- @@ -104,7 +104,7 @@ main (int argc, const char *argv[]) hsize_t usize; htri_t testval; herr_t status; - hid_t plist = -1; + hid_t plist = H5I_INVALID_HID; h5tools_setprogname(PROGRAMNAME); h5tools_setstatus(EXIT_SUCCESS); diff --git a/tools/test/h5ls/CMakeTests.cmake b/tools/test/h5ls/CMakeTests.cmake index 488b271..95af5ab 100644 --- a/tools/test/h5ls/CMakeTests.cmake +++ b/tools/test/h5ls/CMakeTests.cmake @@ -47,6 +47,12 @@ ${HDF5_TOOLS_DIR}/testfiles/tdset_idx.h5 ) + set (LIST_ERR_TEST_FILES + ${HDF5_TOOLS_DIR}/test/h5ls/errfiles/nosuchfile.err + ${HDF5_TOOLS_DIR}/test/h5ls/errfiles/textlinksrc-nodangle-1.err + ${HDF5_TOOLS_DIR}/test/h5ls/errfiles/tgroup-1.err + ) + set (LIST_OTHER_TEST_FILES ${HDF5_TOOLS_DIR}/testfiles/help-1.ls ${HDF5_TOOLS_DIR}/testfiles/help-2.ls @@ -116,6 +122,10 @@ get_filename_component(fname "${listfiles}" NAME) HDFTEST_COPY_FILE("${listfiles}" "${PROJECT_BINARY_DIR}/testfiles/${fname}" "h5ls_files") endforeach () + foreach (listfiles ${LIST_ERR_TEST_FILES}) + get_filename_component(fname "${listfiles}" NAME) + HDFTEST_COPY_FILE("${listfiles}" "${PROJECT_BINARY_DIR}/testfiles/${fname}" "h5ls_files") + endforeach () add_custom_target(h5ls_files ALL COMMENT "Copying files needed by h5ls tests" DEPENDS ${h5ls_files_list}) ############################################################################## @@ -129,10 +139,45 @@ if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME H5LS-${resultfile} COMMAND $<TARGET_FILE:h5ls> ${ARGN}) set_tests_properties (H5LS-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") - if ("${resultcode}" STREQUAL "1") + if (${resultcode} EQUAL 1) + set_tests_properties (H5LS-${resultfile} PROPERTIES WILL_FAIL "true") + endif () + if (last_test) + set_tests_properties (H5LS-${resultfile} PROPERTIES DEPENDS ${last_test}) + endif () + else () + # Remove any output file left over from previous test run + add_test ( + NAME H5LS-${resultfile}-clear-objects + COMMAND ${CMAKE_COMMAND} + -E remove + testfiles/${resultfile}.out + testfiles/${resultfile}.out.err + ) + add_test ( + NAME H5LS-${resultfile} + COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$<TARGET_FILE:h5ls>" + -D "TEST_ARGS=${ARGN}" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" + -D "TEST_OUTPUT=${resultfile}.out" + -D "TEST_EXPECT=${resultcode}" + -D "TEST_REFERENCE=${resultfile}.ls" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) + set_tests_properties (H5LS-${resultfile} PROPERTIES DEPENDS H5LS-${resultfile}-clear-objects) + endif () + endmacro () + + macro (ADD_H5_ERR_TEST resultfile resultcode) + # If using memchecker add tests without using scripts + if (HDF5_ENABLE_USING_MEMCHECKER) + add_test (NAME H5LS-${resultfile} COMMAND $<TARGET_FILE:h5ls> ${ARGN}) + set_tests_properties (H5LS-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") + if (${resultcode} EQUAL 1) set_tests_properties (H5LS-${resultfile} PROPERTIES WILL_FAIL "true") endif () - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (H5LS-${resultfile} PROPERTIES DEPENDS ${last_test}) endif () else () @@ -153,6 +198,7 @@ -D "TEST_OUTPUT=${resultfile}.out" -D "TEST_EXPECT=${resultcode}" -D "TEST_REFERENCE=${resultfile}.ls" + -D "TEST_ERRREF=${resultfile}.err" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) set_tests_properties (H5LS-${resultfile} PROPERTIES DEPENDS H5LS-${resultfile}-clear-objects) @@ -308,7 +354,7 @@ tvldtypes2be.out.err ) set_tests_properties (H5LS-clearall-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (H5LS-clearall-objects PROPERTIES DEPENDS ${last_test}) endif () set (last_test "H5LS-clearall-objects") @@ -341,7 +387,7 @@ # test for displaying groups # The following combination of arguments is expected to return an error message # and return value 1 - ADD_H5_TEST (tgroup-1 1 -w80 -r -g tgroup.h5) + ADD_H5_ERR_TEST (tgroup-1 1 -w80 -r -g tgroup.h5) ADD_H5_TEST (tgroup-2 0 -w80 -g tgroup.h5/g1) # test for files with groups that have long comments @@ -382,7 +428,7 @@ # tests for no-dangling-links # if this option is given on dangling link, h5ls should return exit code 1 # when used alone , expect to print out help and return exit code 1 - ADD_H5_TEST (textlinksrc-nodangle-1 1 -w80 --no-dangling-links textlinksrc.h5) + ADD_H5_ERR_TEST (textlinksrc-nodangle-1 1 -w80 --no-dangling-links textlinksrc.h5) # external dangling link - expected exit code 1 ADD_H5_TEST (textlinksrc-nodangle-2 1 -w80 --follow-symlinks --no-dangling-links textlinksrc.h5) # soft dangling link - expected exit code 1 @@ -444,7 +490,7 @@ endif () # test for non-existing file - ADD_H5_TEST (nosuchfile 1 nosuchfile.h5) + ADD_H5_ERR_TEST (nosuchfile 1 nosuchfile.h5) # test for variable length data types in verbose mode if (H5_WORDS_BIGENDIAN) diff --git a/tools/test/h5ls/CMakeTestsVDS.cmake b/tools/test/h5ls/CMakeTestsVDS.cmake index 2b6f61e..562a892 100644 --- a/tools/test/h5ls/CMakeTestsVDS.cmake +++ b/tools/test/h5ls/CMakeTestsVDS.cmake @@ -85,10 +85,10 @@ if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME H5LS-${resultfile} COMMAND $<TARGET_FILE:h5ls> ${ARGN}) set_tests_properties (H5LS-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/vds") - if ("${resultcode}" STREQUAL "1") + if (${resultcode} EQUAL 1) set_tests_properties (H5LS-${resultfile} PROPERTIES WILL_FAIL "true") endif () - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (H5LS-${resultfile} PROPERTIES DEPENDS ${last_test}) endif () else () @@ -123,10 +123,10 @@ ENVIRONMENT "HDF5_VDS_PREFIX=\${ORIGIN}" WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles" ) - if ("${resultcode}" STREQUAL "1") + if (${resultcode} EQUAL 1) set_tests_properties (H5LS_PREFIX-${resultfile} PROPERTIES WILL_FAIL "true") endif () - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (H5LS_PREFIX-${resultfile} PROPERTIES DEPENDS ${last_test}) endif () else () @@ -193,7 +193,7 @@ tvds_layout-5.out.err ) set_tests_properties (H5LS_VDS-clearall-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/vds") - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (H5LS_VDS-clearall-objects PROPERTIES DEPENDS ${last_test}) endif () set (last_test "H5LS_VDS-clearall-objects") diff --git a/tools/test/h5ls/errfiles/nosuchfile.err b/tools/test/h5ls/errfiles/nosuchfile.err new file mode 100644 index 0000000..8c4ee42 --- /dev/null +++ b/tools/test/h5ls/errfiles/nosuchfile.err @@ -0,0 +1 @@ +nosuchfile.h5: unable to open file diff --git a/tools/test/h5ls/errfiles/textlinksrc-nodangle-1.err b/tools/test/h5ls/errfiles/textlinksrc-nodangle-1.err new file mode 100644 index 0000000..8991fc1 --- /dev/null +++ b/tools/test/h5ls/errfiles/textlinksrc-nodangle-1.err @@ -0,0 +1,2 @@ +Error: --no-dangling-links must be used along with --follow-symlinks option! + diff --git a/tools/test/h5ls/errfiles/tgroup-1.err b/tools/test/h5ls/errfiles/tgroup-1.err new file mode 100644 index 0000000..ba4cf07 --- /dev/null +++ b/tools/test/h5ls/errfiles/tgroup-1.err @@ -0,0 +1,2 @@ +Error: 'recursive' option not compatible with 'group info' option! + diff --git a/tools/test/h5ls/testh5ls.sh.in b/tools/test/h5ls/testh5ls.sh.in index 8c6551b..353f1bb 100644 --- a/tools/test/h5ls/testh5ls.sh.in +++ b/tools/test/h5ls/testh5ls.sh.in @@ -53,6 +53,7 @@ SRC_H5REPACK_TESTFILES="$SRC_TOOLS/test/h5repack/testfiles" SRC_H5JAM_TESTFILES="$SRC_TOOLS/test/h5jam/testfiles" SRC_H5STAT_TESTFILES="$SRC_TOOLS/test/h5stat/testfiles" SRC_H5IMPORT_TESTFILES="$SRC_TOOLS/test/h5import/testfiles" +SRC_H5LS_ERRFILES="$SRC_TOOLS/test/h5ls/errfiles" TESTDIR=./testfiles test -d $TESTDIR || mkdir $TESTDIR @@ -93,6 +94,12 @@ $SRC_H5LS_TESTFILES/tvldtypes1.h5 $SRC_H5LS_TESTFILES/tdset_idx.h5 " +LIST_ERROR_TEST_FILES=" +$SRC_H5LS_ERRFILES/nosuchfile.err +$SRC_H5LS_ERRFILES/textlinksrc-nodangle-1.err +$SRC_H5LS_ERRFILES/tgroup-1.err +" + LIST_OTHER_TEST_FILES=" $SRC_H5LS_TESTFILES/help-1.ls $SRC_H5LS_TESTFILES/help-2.ls @@ -228,8 +235,9 @@ TESTING() { # $2 and on -- argument for the h5ls tool TOOLTEST() { expect="$TESTDIR/$1" + expect_err="$TESTDIR/`basename $1 .ls`.err" actual="$TESTDIR/`basename $1 .ls`.out" - actual_err="$TESTDIR/`basename $1 .ls`.err" + actual_err="$TESTDIR/`basename $1 .ls`.out.err" actual_sav=${actual}-sav actual_err_sav=${actual_err}-sav shift @@ -251,7 +259,6 @@ TOOLTEST() { STDOUT_FILTER $actual cp $actual_err $actual_err_sav STDERR_FILTER $actual_err - cat $actual_err >> $actual if [ $h5haveexitcode = 'yes' -a $exitcode -ne $retvalexpect ]; then echo "*FAILED*" nerrors="`expr $nerrors + 1`" diff --git a/tools/test/h5repack/CMakeTests.cmake b/tools/test/h5repack/CMakeTests.cmake index 3ee5e27..2ad12ad 100644 --- a/tools/test/h5repack/CMakeTests.cmake +++ b/tools/test/h5repack/CMakeTests.cmake @@ -16,39 +16,6 @@ ############################################################################## ############################################################################## - if (HDF5_TEST_VFD) - set (VFD_LIST - sec2 - stdio - core - split - multi - family - ) - - if (DIRECT_VFD) - set (VFD_LIST ${VFD_LIST} direct) - endif () - - macro (ADD_VFD_TEST vfdname resultcode) - add_test ( - NAME H5REPACK-VFD-${vfdname}-h5repacktest - COMMAND "${CMAKE_COMMAND}" - -D "TEST_PROGRAM=$<TARGET_FILE:h5repacktest>" - -D "TEST_ARGS:STRING=" - -D "TEST_VFD:STRING=${vfdname}" - -D "TEST_EXPECT=${resultcode}" - -D "TEST_OUTPUT=h5repacktest" - -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" - -P "${HDF_RESOURCES_DIR}/vfdTest.cmake" - ) - if (NOT "${last_test}" STREQUAL "") - set_tests_properties (H5REPACK-VFD-${vfdname}-h5repacktest PROPERTIES DEPENDS ${last_test}) - endif () - set (last_test "H5REPACK-VFD-${vfdname}-h5repacktest") - endmacro () - endif () - # -------------------------------------------------------------------- # Copy all the HDF5 files from the source directory into the test directory # -------------------------------------------------------------------- @@ -195,7 +162,7 @@ if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME H5REPACK-h5repack-${testname} COMMAND $<TARGET_FILE:h5repack> ${ARGN}) set_tests_properties (H5REPACK-h5repack-${testname} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (H5REPACK-h5repack-${testname} PROPERTIES DEPENDS ${last_test}) endif () set (last_test "H5REPACK-h5repack-${testname}") @@ -207,7 +174,7 @@ testfiles/h5repack-${testname}.out testfiles/h5repack-${testname}.out.err ) - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (H5REPACK-h5repack-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) endif () add_test ( @@ -241,7 +208,7 @@ -E remove testfiles/out-${testname}.${testfile} ) - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (H5REPACK_OLD-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) endif () add_test ( @@ -273,7 +240,7 @@ -E remove testfiles/out-${testname}.${testfile} ) - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (H5REPACK-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) endif () add_test ( @@ -305,7 +272,7 @@ NAME H5REPACK_CMP-${testname} COMMAND $<TARGET_FILE:h5repack> ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${resultfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${resultfile} ) - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (H5REPACK_CMP-${testname} PROPERTIES DEPENDS ${last_test}) endif () else () @@ -317,7 +284,7 @@ testfiles/${resultfile}-${testname}.out testfiles/${resultfile}-${testname}.out.err ) - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (H5REPACK_CMP-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) endif () add_test ( @@ -353,7 +320,7 @@ NAME H5REPACK_MASK-${testname} COMMAND $<TARGET_FILE:h5repack> ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${resultfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${resultfile} ) - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (H5REPACK_MASK-${testname} PROPERTIES DEPENDS ${last_test}) endif () else (HDF5_ENABLE_USING_MEMCHECKER) @@ -365,7 +332,7 @@ testfiles/${resultfile}-${testname}.out testfiles/${resultfile}-${testname}.out.err ) - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (H5REPACK_MASK-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) endif () add_test ( @@ -377,7 +344,8 @@ -D "TEST_OUTPUT=${resultfile}-${testname}.out" -D "TEST_EXPECT=${resultcode}" -D "TEST_MASK_ERROR=true" - -D "TEST_REFERENCE=${resultfile}-${testname}.tst" + -D "TEST_REFERENCE=${resultfile}.mty" + -D "TEST_ERRREF=${resultfile}-${testname}.tst" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) set_tests_properties (H5REPACK_MASK-${testname} PROPERTIES DEPENDS H5REPACK_MASK-${testname}-clear-objects) @@ -403,7 +371,7 @@ testfiles/${resultfile}-${testname}.out testfiles/${resultfile}-${testname}.out.err ) - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (H5REPACK_DMP-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) endif () add_test ( @@ -446,7 +414,7 @@ testfiles/${resultfile}-${testname}.out testfiles/${resultfile}-${testname}.out.err ) - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (H5REPACK_STAT-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) endif () add_test ( @@ -490,7 +458,7 @@ testfiles/${testfile}-${testname}-v.out testfiles/${testfile}-${testname}-v.out.err ) - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (H5REPACK_VERIFY_LAYOUT-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) endif () add_test ( @@ -503,7 +471,7 @@ COMMAND $<TARGET_FILE:h5diff> ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} ) set_tests_properties (H5REPACK_VERIFY_LAYOUT-${testname}_DFF PROPERTIES DEPENDS H5REPACK_VERIFY_LAYOUT-${testname}) - if ("${resultcode}" STREQUAL "0") + if (NOT ${resultcode}) add_test ( NAME H5REPACK_VERIFY_LAYOUT-${testname}_DMP COMMAND "${CMAKE_COMMAND}" @@ -565,7 +533,7 @@ testfiles/${testfile}-${testname}-v.out testfiles/${testfile}-${testname}-v.out.err ) - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (H5REPACK_VERIFY_LAYOUT_VDS-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) endif () add_test ( @@ -602,7 +570,7 @@ testfiles/${testfile}-${testname}-v.out testfiles/${testfile}-${testname}-v.out.err ) - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (H5REPACK_VERIFY_SUPERBLOCK-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) endif () add_test ( @@ -633,7 +601,7 @@ -E remove testfiles/out-${testname}.${testfile} ) - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (ADD_H5_VERIFY_INVALIDBOUNDS-h5repack-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) endif () add_test ( @@ -656,7 +624,7 @@ testfiles/out-${testname}_N.${testname}.h5 testfiles/out-${testname}_M.${testname}.h5 ) - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (H5REPACK_META-${testname}_N-clear-objects PROPERTIES DEPENDS ${last_test}) endif () add_test ( @@ -688,7 +656,7 @@ testfiles/${resultfile}-${testname}.out testfiles/${resultfile}-${testname}.out.err ) - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (H5REPACK_UD-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) endif () add_test ( @@ -933,7 +901,7 @@ COMMAND ${CMAKE_COMMAND} -E remove ${LIST_TO_CLEAR} ) set_tests_properties (H5REPACK-clearall-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (H5REPACK-clearall-objects PROPERTIES DEPENDS ${last_test}) endif () endif () @@ -1458,9 +1426,12 @@ if (BUILD_SHARED_LIBS) ADD_H5_UD_TEST (plugin_zero 0 h5repack_layout.h5 -v -f UD=250,0,0) endif () - if (HDF5_TEST_VFD) - # Run test with different Virtual File Driver - foreach (vfd ${VFD_LIST}) - ADD_VFD_TEST (${vfd} 0) - endforeach () - endif () +############################################################################## +############################################################################## +### V F D T E S T S ### +############################################################################## +############################################################################## + +if (HDF5_TEST_VFD) + include (CMakeVFDTests.cmake) +endif () diff --git a/tools/test/h5repack/CMakeVFDTests.cmake b/tools/test/h5repack/CMakeVFDTests.cmake new file mode 100644 index 0000000..e100e3c --- /dev/null +++ b/tools/test/h5repack/CMakeVFDTests.cmake @@ -0,0 +1,65 @@ +# +# Copyright by The HDF Group. +# All rights reserved. +# +# This file is part of HDF5. The full HDF5 copyright notice, including +# terms governing use, modification, and redistribution, is contained in +# the COPYING file, which can be found at the root of the source code +# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. +# If you do not have access to either file, you may request a copy from +# help@hdfgroup.org. +# + +############################################################################## +############################################################################## +### T E S T I N G ### +############################################################################## +############################################################################## + + set (VFD_LIST + sec2 + stdio + core + split + multi + family + ) + + if (DIRECT_VFD) + set (VFD_LIST ${VFD_LIST} direct) + endif () + +############################################################################## +############################################################################## +### T H E T E S T S M A C R O S ### +############################################################################## +############################################################################## + + macro (ADD_VFD_TEST vfdname resultcode) + add_test ( + NAME H5REPACK-VFD-${vfdname}-h5repacktest + COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$<TARGET_FILE:h5repacktest>" + -D "TEST_ARGS:STRING=" + -D "TEST_VFD:STRING=${vfdname}" + -D "TEST_EXPECT=${resultcode}" + -D "TEST_OUTPUT=h5repacktest" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" + -P "${HDF_RESOURCES_DIR}/vfdTest.cmake" + ) + if (last_test) + set_tests_properties (H5REPACK-VFD-${vfdname}-h5repacktest PROPERTIES DEPENDS ${last_test}) + endif () + set (last_test "H5REPACK-VFD-${vfdname}-h5repacktest") + endmacro () + +############################################################################## +############################################################################## +### T H E T E S T S ### +############################################################################## +############################################################################## + + # Run test with different Virtual File Driver + foreach (vfd ${VFD_LIST}) + ADD_VFD_TEST (${vfd} 0) + endforeach () diff --git a/tools/test/h5stat/CMakeTests.cmake b/tools/test/h5stat/CMakeTests.cmake index bd55ac1..737f4b5 100644 --- a/tools/test/h5stat/CMakeTests.cmake +++ b/tools/test/h5stat/CMakeTests.cmake @@ -39,23 +39,30 @@ h5stat_newgrat h5stat_newgrat-UG h5stat_newgrat-UA - h5stat_err1_links h5stat_idx h5stat_links1 h5stat_links2 h5stat_links3 h5stat_links4 h5stat_links5 - h5stat_err1_dims h5stat_dims1 h5stat_dims2 - h5stat_err1_numattrs - h5stat_err2_numattrs h5stat_numattrs1 h5stat_numattrs2 h5stat_numattrs3 h5stat_numattrs4 ) + set (HDF5_REFERENCE_ERR_FILES + h5stat_err_refcount + h5stat_err_old_layout + h5stat_err_old_fill + h5stat_err1_dims + h5stat_err1_links + h5stat_err1_numattrs + h5stat_err2_numattrs + h5stat_notexist + h5stat_nofile + ) set (HDF5_REFERENCE_TEST_FILES h5stat_err_refcount.h5 h5stat_err_old_layout.h5 @@ -71,6 +78,10 @@ HDFTEST_COPY_FILE("${HDF5_TOOLS_TEST_H5STAT_SOURCE_DIR}/testfiles/${ddl_file}.ddl" "${PROJECT_BINARY_DIR}/${ddl_file}.ddl" "h5stat_files") endforeach () + foreach (h5_file ${HDF5_REFERENCE_ERR_FILES}) + HDFTEST_COPY_FILE("${HDF5_TOOLS_TEST_H5STAT_SOURCE_DIR}/testfiles/${h5_file}.err" "${PROJECT_BINARY_DIR}/${h5_file}.err" "h5stat_files") + endforeach () + foreach (h5_file ${HDF5_REFERENCE_TEST_FILES}) HDFTEST_COPY_FILE("${HDF5_TOOLS_TEST_H5STAT_SOURCE_DIR}/testfiles/${h5_file}" "${PROJECT_BINARY_DIR}/${h5_file}" "h5stat_files") endforeach () @@ -86,10 +97,10 @@ # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME H5STAT-${resultfile} COMMAND $<TARGET_FILE:h5stat> ${ARGN}) - if (NOT "${resultcode}" STREQUAL "0") + if (${resultcode}) set_tests_properties (H5STAT-${resultfile} PROPERTIES WILL_FAIL "true") endif () - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (H5STAT-${resultfile} PROPERTIES DEPENDS ${last_test}) endif () else (HDF5_ENABLE_USING_MEMCHECKER) @@ -100,7 +111,7 @@ ${resultfile}.out ${resultfile}.out.err ) - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (H5STAT-${resultfile}-clear-objects PROPERTIES DEPENDS ${last_test}) endif () add_test ( @@ -118,6 +129,43 @@ endif () endmacro () + macro (ADD_H5_ERR_TEST resultfile resultcode) + # If using memchecker add tests without using scripts + if (HDF5_ENABLE_USING_MEMCHECKER) + add_test (NAME H5STAT-${resultfile} COMMAND $<TARGET_FILE:h5stat> ${ARGN}) + if (${resultcode}) + set_tests_properties (H5STAT-${resultfile} PROPERTIES WILL_FAIL "true") + endif () + if (last_test) + set_tests_properties (H5STAT-${resultfile} PROPERTIES DEPENDS ${last_test}) + endif () + else (HDF5_ENABLE_USING_MEMCHECKER) + add_test ( + NAME H5STAT-${resultfile}-clear-objects + COMMAND ${CMAKE_COMMAND} + -E remove + ${resultfile}.out + ${resultfile}.out.err + ) + if (last_test) + set_tests_properties (H5STAT-${resultfile}-clear-objects PROPERTIES DEPENDS ${last_test}) + endif () + add_test ( + NAME H5STAT-${resultfile} + COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$<TARGET_FILE:h5stat>" + -D "TEST_ARGS=${ARGN}" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}" + -D "TEST_OUTPUT=${resultfile}.out" + -D "TEST_EXPECT=${resultcode}" + -D "TEST_REFERENCE=${resultfile}.mty" + -D "TEST_ERRREF=${resultfile}.err" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) + set_tests_properties (H5STAT-${resultfile} PROPERTIES DEPENDS H5STAT-${resultfile}-clear-objects) + endif () + endmacro () + ############################################################################## ############################################################################## ### T H E T E S T S ### @@ -134,7 +182,7 @@ COMMAND ${CMAKE_COMMAND} -E remove ${CLEAR_LIST} ) - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (H5STAT-clearall-objects PROPERTIES DEPENDS ${last_test}) endif () set (last_test "H5STAT-clearall-objects") @@ -173,7 +221,7 @@ # -g -l 8 # --links=8 # --links=20 -g - ADD_H5_TEST (h5stat_err1_links 1 -l 0 h5stat_threshold.h5) + ADD_H5_ERR_TEST (h5stat_err1_links 1 -l 0 h5stat_threshold.h5) ADD_H5_TEST (h5stat_links1 0 -g -l 8 h5stat_threshold.h5) ADD_H5_TEST (h5stat_links2 0 --links=8 h5stat_threshold.h5) ADD_H5_TEST (h5stat_links3 0 --links=20 -g h5stat_threshold.h5) @@ -188,7 +236,7 @@ # -d --dims=-1 (incorrect threshold value) # -gd -m 5 # -d --di=15 - ADD_H5_TEST (h5stat_err1_dims 1 -d --dims=-1 h5stat_threshold.h5) + ADD_H5_ERR_TEST (h5stat_err1_dims 1 -d --dims=-1 h5stat_threshold.h5) ADD_H5_TEST (h5stat_dims1 0 -gd -m 5 h5stat_threshold.h5) ADD_H5_TEST (h5stat_dims2 0 -d --di=15 h5stat_threshold.h5) # @@ -198,8 +246,8 @@ # -AS -a 10 # -a 1 # -A --numattrs=25 - ADD_H5_TEST (h5stat_err1_numattrs 1 -a -2 h5stat_threshold.h5) - ADD_H5_TEST (h5stat_err2_numattrs 1 --numattrs h5stat_threshold.h5) + ADD_H5_ERR_TEST (h5stat_err1_numattrs 1 -a -2 h5stat_threshold.h5) + ADD_H5_ERR_TEST (h5stat_err2_numattrs 1 --numattrs h5stat_threshold.h5) ADD_H5_TEST (h5stat_numattrs1 0 -AS -a 10 h5stat_threshold.h5) ADD_H5_TEST (h5stat_numattrs2 0 -a 1 h5stat_threshold.h5) ADD_H5_TEST (h5stat_numattrs3 0 -A --numattrs=25 h5stat_threshold.h5) diff --git a/tools/test/h5stat/testfiles/h5stat_err1_dims.ddl b/tools/test/h5stat/testfiles/h5stat_err1_dims.err index 86d375b..86d375b 100644 --- a/tools/test/h5stat/testfiles/h5stat_err1_dims.ddl +++ b/tools/test/h5stat/testfiles/h5stat_err1_dims.err diff --git a/tools/test/h5stat/testfiles/h5stat_err1_links.ddl b/tools/test/h5stat/testfiles/h5stat_err1_links.err index d43207c..d43207c 100644 --- a/tools/test/h5stat/testfiles/h5stat_err1_links.ddl +++ b/tools/test/h5stat/testfiles/h5stat_err1_links.err diff --git a/tools/test/h5stat/testfiles/h5stat_err2_numattrs.ddl b/tools/test/h5stat/testfiles/h5stat_err1_numattrs.err index 01b6c18..01b6c18 100644 --- a/tools/test/h5stat/testfiles/h5stat_err2_numattrs.ddl +++ b/tools/test/h5stat/testfiles/h5stat_err1_numattrs.err diff --git a/tools/test/h5stat/testfiles/h5stat_err1_numattrs.ddl b/tools/test/h5stat/testfiles/h5stat_err2_numattrs.err index 01b6c18..01b6c18 100644 --- a/tools/test/h5stat/testfiles/h5stat_err1_numattrs.ddl +++ b/tools/test/h5stat/testfiles/h5stat_err2_numattrs.err diff --git a/tools/test/h5stat/testfiles/h5stat_err_old_fill.ddl b/tools/test/h5stat/testfiles/h5stat_err_old_fill.ddl index e751b7f..5cc1e32 100644 --- a/tools/test/h5stat/testfiles/h5stat_err_old_fill.ddl +++ b/tools/test/h5stat/testfiles/h5stat_err_old_fill.ddl @@ -1,2 +1 @@ Filename: h5stat_err_old_fill.h5 -h5stat error: unable to traverse objects/links in file "h5stat_err_old_fill.h5" diff --git a/tools/test/h5stat/testfiles/h5stat_err_old_fill.err b/tools/test/h5stat/testfiles/h5stat_err_old_fill.err new file mode 100644 index 0000000..8b886d2 --- /dev/null +++ b/tools/test/h5stat/testfiles/h5stat_err_old_fill.err @@ -0,0 +1 @@ +h5stat error: unable to traverse objects/links in file "h5stat_err_old_fill.h5" diff --git a/tools/test/h5stat/testfiles/h5stat_err_old_layout.ddl b/tools/test/h5stat/testfiles/h5stat_err_old_layout.ddl index a3e27e2..112190c 100644 --- a/tools/test/h5stat/testfiles/h5stat_err_old_layout.ddl +++ b/tools/test/h5stat/testfiles/h5stat_err_old_layout.ddl @@ -1,2 +1 @@ Filename: h5stat_err_old_layout.h5 -h5stat error: unable to traverse objects/links in file "h5stat_err_old_layout.h5" diff --git a/tools/test/h5stat/testfiles/h5stat_err_old_layout.err b/tools/test/h5stat/testfiles/h5stat_err_old_layout.err new file mode 100644 index 0000000..7aa2fa7 --- /dev/null +++ b/tools/test/h5stat/testfiles/h5stat_err_old_layout.err @@ -0,0 +1 @@ +h5stat error: unable to traverse objects/links in file "h5stat_err_old_layout.h5" diff --git a/tools/test/h5stat/testfiles/h5stat_err_refcount.ddl b/tools/test/h5stat/testfiles/h5stat_err_refcount.ddl index 1f1b491..41e533e 100644 --- a/tools/test/h5stat/testfiles/h5stat_err_refcount.ddl +++ b/tools/test/h5stat/testfiles/h5stat_err_refcount.ddl @@ -1,2 +1 @@ Filename: h5stat_err_refcount.h5 -h5stat error: unable to traverse objects/links in file "h5stat_err_refcount.h5" diff --git a/tools/test/h5stat/testfiles/h5stat_err_refcount.err b/tools/test/h5stat/testfiles/h5stat_err_refcount.err new file mode 100644 index 0000000..d176996 --- /dev/null +++ b/tools/test/h5stat/testfiles/h5stat_err_refcount.err @@ -0,0 +1 @@ +h5stat error: unable to traverse objects/links in file "h5stat_err_refcount.h5" diff --git a/tools/test/h5stat/testfiles/h5stat_nofile.ddl b/tools/test/h5stat/testfiles/h5stat_nofile.ddl index 7171320..01e39af 100644 --- a/tools/test/h5stat/testfiles/h5stat_nofile.ddl +++ b/tools/test/h5stat/testfiles/h5stat_nofile.ddl @@ -23,4 +23,3 @@ Usage: h5stat [OPTIONS] file -s, --freespace Print free space information -S, --summary Print summary of file space information --enable-error-stack Prints messages from the HDF5 error stack as they occur -h5stat error: missing file name diff --git a/tools/test/h5stat/testfiles/h5stat_nofile.err b/tools/test/h5stat/testfiles/h5stat_nofile.err new file mode 100644 index 0000000..3b7e979 --- /dev/null +++ b/tools/test/h5stat/testfiles/h5stat_nofile.err @@ -0,0 +1 @@ +h5stat error: missing file name diff --git a/tools/test/h5stat/testfiles/h5stat_notexist.ddl b/tools/test/h5stat/testfiles/h5stat_notexist.ddl index cc25e43..7f71941 100644 --- a/tools/test/h5stat/testfiles/h5stat_notexist.ddl +++ b/tools/test/h5stat/testfiles/h5stat_notexist.ddl @@ -1,2 +1 @@ Filename: notexist.h5 -h5stat error: unable to open file "notexist.h5" diff --git a/tools/test/h5stat/testfiles/h5stat_notexist.err b/tools/test/h5stat/testfiles/h5stat_notexist.err new file mode 100644 index 0000000..c1d9e54 --- /dev/null +++ b/tools/test/h5stat/testfiles/h5stat_notexist.err @@ -0,0 +1 @@ +h5stat error: unable to open file "notexist.h5" diff --git a/tools/test/h5stat/testh5stat.sh.in b/tools/test/h5stat/testh5stat.sh.in index 0a5127f..69b856e 100644 --- a/tools/test/h5stat/testh5stat.sh.in +++ b/tools/test/h5stat/testh5stat.sh.in @@ -79,6 +79,18 @@ $SRC_H5STAT_TESTFILES/h5stat_idx.h5 $SRC_H5STAT_TESTFILES/h5stat_threshold.h5 " +LIST_ERR_TEST_FILES=" +$SRC_H5STAT_TESTFILES/h5stat_err_refcount.err +$SRC_H5STAT_TESTFILES/h5stat_err_old_layout.err +$SRC_H5STAT_TESTFILES/h5stat_err_old_fill.err +$SRC_H5STAT_TESTFILES/h5stat_err1_links.err +$SRC_H5STAT_TESTFILES/h5stat_err1_dims.err +$SRC_H5STAT_TESTFILES/h5stat_err1_numattrs.err +$SRC_H5STAT_TESTFILES/h5stat_err2_numattrs.err +$SRC_H5STAT_TESTFILES/h5stat_notexist.err +$SRC_H5STAT_TESTFILES/h5stat_nofile.err +" + LIST_OTHER_TEST_FILES=" $SRC_H5STAT_TESTFILES/h5stat_err_refcount.ddl $SRC_H5STAT_TESTFILES/h5stat_err_old_layout.ddl @@ -100,17 +112,13 @@ $SRC_H5STAT_TESTFILES/h5stat_newgrat.ddl $SRC_H5STAT_TESTFILES/h5stat_newgrat-UG.ddl $SRC_H5STAT_TESTFILES/h5stat_newgrat-UA.ddl $SRC_H5STAT_TESTFILES/h5stat_idx.ddl -$SRC_H5STAT_TESTFILES/h5stat_err1_links.ddl $SRC_H5STAT_TESTFILES/h5stat_links1.ddl $SRC_H5STAT_TESTFILES/h5stat_links2.ddl $SRC_H5STAT_TESTFILES/h5stat_links3.ddl $SRC_H5STAT_TESTFILES/h5stat_links4.ddl $SRC_H5STAT_TESTFILES/h5stat_links5.ddl -$SRC_H5STAT_TESTFILES/h5stat_err1_dims.ddl $SRC_H5STAT_TESTFILES/h5stat_dims1.ddl $SRC_H5STAT_TESTFILES/h5stat_dims2.ddl -$SRC_H5STAT_TESTFILES/h5stat_err1_numattrs.ddl -$SRC_H5STAT_TESTFILES/h5stat_err2_numattrs.ddl $SRC_H5STAT_TESTFILES/h5stat_numattrs1.ddl $SRC_H5STAT_TESTFILES/h5stat_numattrs2.ddl $SRC_H5STAT_TESTFILES/h5stat_numattrs3.ddl @@ -120,7 +128,7 @@ $SRC_H5STAT_TESTFILES/h5stat_numattrs4.ddl # # copy test files and expected output files from source dirs to test dir # -COPY_TESTFILES="$LIST_HDF5_TEST_FILES $LIST_OTHER_TEST_FILES" +COPY_TESTFILES="$LIST_HDF5_TEST_FILES $LIST_ERR_TEST_FILES $LIST_OTHER_TEST_FILES" COPY_TESTFILES_TO_TESTDIR() { @@ -184,8 +192,9 @@ TESTING() { # TOOLTEST() { expect="$TESTDIR/$1" + expect_err="$TESTDIR/`basename $1 .ddl`.err" actual="$TESTDIR/`basename $1 .ddl`.out" - actual_err="$TESTDIR/`basename $1 .ddl`.err" + actual_err="$TESTDIR/`basename $1 .ddl`.out.err" actual_sav=${actual}-sav actual_err_sav=${actual_err}-sav shift @@ -202,14 +211,17 @@ TOOLTEST() { STDOUT_FILTER $actual cp $actual_err $actual_err_sav STDERR_FILTER $actual_err - cat $actual_err >> $actual if [ ! -f $expect ]; then - # Create the expect file if it doesn't yet exist. - echo " CREATED" - cp $actual $expect - echo " Expected result (*.ddl) missing" - nerrors="`expr $nerrors + 1`" + # Compare error files if the expect file doesn't exist. + if $CMP $expect_err $actual_err; then + echo " PASSED" + else + echo "*FAILED*" + echo " Expected result (*.err) differs from actual result (*.out.err)" + nerrors="`expr $nerrors + 1`" + test yes = "$verbose" && $DIFF $expect_err $actual_err |sed 's/^/ /' + fi elif $CMP $expect $actual; then echo " PASSED" else diff --git a/tools/test/misc/CMakeTestsClear.cmake b/tools/test/misc/CMakeTestsClear.cmake index a51d0e9..24774fd 100644 --- a/tools/test/misc/CMakeTestsClear.cmake +++ b/tools/test/misc/CMakeTestsClear.cmake @@ -49,8 +49,6 @@ h5clear_missing_file.ddl h5clear_noclose_after_size.ddl h5clear_noclose_before_size.ddl - h5clear_no_mdc_image.ddl - h5clear_open_fail.ddl h5clear_status_noclose_after_size.ddl h5clear_usage.ddl h5clear_user_equal_after_size.ddl @@ -60,10 +58,17 @@ h5clear_user_less_after_size.ddl h5clear_user_less_before_size.ddl ) + set (HDF5_REFERENCE_ERR_FILES + h5clear_no_mdc_image.err + h5clear_open_fail.err + ) foreach (h5_file ${HDF5_TEST_FILES} ${HDF5_SEC2_TEST_FILES} ${HDF5_REFERENCE_TEST_FILES}) HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/testfiles/${h5_file}" "${PROJECT_BINARY_DIR}/testfiles/${h5_file}" "h5clear_files") endforeach () + foreach (h5_file ${HDF5_REFERENCE_ERR_FILES}) + HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/testfiles/${h5_file}" "${PROJECT_BINARY_DIR}/testfiles/${h5_file}" "h5clear_files") + endforeach () # make second copy of h5clear_sec2.h5 foreach (h5_file ${HDF5_SEC2_TEST_FILES}) HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/testfiles/${h5_file}" "${PROJECT_BINARY_DIR}/testfiles/orig_${h5_file}" "h5clear_files") @@ -89,7 +94,7 @@ testfiles/${testname}.out testfiles/${testname}.out.err ) - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (H5CLEAR_CMP-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) endif () add_test ( @@ -108,6 +113,35 @@ endif () endmacro () + macro (ADD_H5_ERR_CMP testname resultfile resultcode) + if (NOT HDF5_ENABLE_USING_MEMCHECKER) + add_test ( + NAME H5CLEAR_CMP-${testname}-clear-objects + COMMAND ${CMAKE_COMMAND} + -E remove + testfiles/${testname}.out + testfiles/${testname}.out.err + ) + if (last_test) + set_tests_properties (H5CLEAR_CMP-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) + endif () + add_test ( + NAME H5CLEAR_CMP-${testname} + COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$<TARGET_FILE:h5clear>" + -D "TEST_ARGS:STRING=${ARGN}" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" + -D "TEST_OUTPUT=${testname}.out" + -D "TEST_EXPECT=${resultcode}" + -D "TEST_REFERENCE=${resultfile}.mty" + -D "TEST_ERRREF=${resultfile}.err" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) + set_tests_properties (H5CLEAR_CMP-${testname} PROPERTIES DEPENDS H5CLEAR_CMP-${testname}-clear-objects) + set (last_test "H5CLEAR_CMP-${testname}") + endif () + endmacro () + macro (ADD_H5_CMP_WITH_COPY testname resultcode resultfile testfile) if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( @@ -118,7 +152,7 @@ testfiles/${testname}.out.err testfiles/${testfile} ) - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (H5CLEAR_CMP-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) endif () add_test ( @@ -144,6 +178,43 @@ endif () endmacro () + macro (ADD_H5_ERR_CMP_WITH_COPY testname resultcode resultfile testfile) + if (NOT HDF5_ENABLE_USING_MEMCHECKER) + add_test ( + NAME H5CLEAR_CMP-${testname}-clear-objects + COMMAND ${CMAKE_COMMAND} + -E remove + testfiles/${testname}.out + testfiles/${testname}.out.err + testfiles/${testfile} + ) + if (last_test) + set_tests_properties (H5CLEAR_CMP-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) + endif () + add_test ( + NAME H5CLEAR_CMP-copy_${testname} + COMMAND ${CMAKE_COMMAND} + -E copy_if_different + "${PROJECT_SOURCE_DIR}/testfiles/${testfile}" "${PROJECT_BINARY_DIR}/testfiles/${testfile}" + ) + set_tests_properties (H5CLEAR_CMP-copy_${testname} PROPERTIES DEPENDS H5CLEAR_CMP-${testname}-clear-objects) + add_test ( + NAME H5CLEAR_CMP-${testname} + COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$<TARGET_FILE:h5clear>" + -D "TEST_ARGS:STRING=${ARGN};${testfile}" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" + -D "TEST_OUTPUT=${testname}.out" + -D "TEST_EXPECT=${resultcode}" + -D "TEST_REFERENCE=${resultfile}.mty" + -D "TEST_ERRREF=${resultfile}.err" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) + set_tests_properties (H5CLEAR_CMP-${testname} PROPERTIES DEPENDS H5CLEAR_CMP-copy_${testname}) + set (last_test "H5CLEAR_CMP-${testname}") + endif () + endmacro () + macro (ADD_H5_RETTEST testname resultcode) if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( @@ -152,7 +223,7 @@ ) set_tests_properties (H5CLEAR_RET-${testname} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") set_tests_properties (H5CLEAR_RET-${testname} PROPERTIES WILL_FAIL "${resultcode}") - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (H5CLEAR_RET-${testname} PROPERTIES DEPENDS ${last_test}) endif () set (last_test "H5CLEAR_RET-${testname}") @@ -171,7 +242,7 @@ testfiles/${testname}_after_size.out.err testfiles/${testname}.h5 ) - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (H5CLEAR_FILESIZE_TEST-${testname}-clear-objects PROPERTIES DEPENDS ${last_test}) endif () add_test ( @@ -231,7 +302,7 @@ -E copy_if_different "${PROJECT_SOURCE_DIR}/testfiles/${testfile}.h5" "${PROJECT_BINARY_DIR}/testfiles/${testfile}.h5" ) - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (H5CLEAR-clr_open_chk-copy_${testname}.h5 PROPERTIES DEPENDS ${last_test}) endif () set (last_test "H5CLEAR-clr_open_chk-copy_${testname}.h5") @@ -241,7 +312,7 @@ add_test (NAME H5CLEAR-clr_open_chk-${testname}_${resultcode} COMMAND $<TARGET_FILE:clear_open_chk> ${testfile}.h5) set_tests_properties (H5CLEAR-clr_open_chk-${testname}_${resultcode} PROPERTIES WILL_FAIL "${resultcode}") set_tests_properties (H5CLEAR-clr_open_chk-${testname}_${resultcode} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (H5CLEAR-clr_open_chk-${testname}_${resultcode} PROPERTIES DEPENDS ${last_test}) endif () @@ -285,7 +356,7 @@ if (HDF5_ENABLE_USING_MEMCHECKER) mod_h5clear_mdc_image2.h5 ${HDF5_TEST_FILES} ) - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (H5CLEAR-clearall-objects PROPERTIES DEPENDS ${last_test}) endif () set (last_test "H5CLEAR-clearall-objects") @@ -297,7 +368,7 @@ if (HDF5_ENABLE_USING_MEMCHECKER) -E copy_if_different "${PROJECT_SOURCE_DIR}/testfiles/${h5_file}" "${PROJECT_BINARY_DIR}/testfiles/${h5_file}" ) - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (H5CLEAR-copy_${h5_file} PROPERTIES DEPENDS ${last_test}) endif () set (last_test "H5CLEAR-copy_${h5_file}") @@ -310,7 +381,7 @@ if (HDF5_ENABLE_USING_MEMCHECKER) -E copy_if_different "${PROJECT_SOURCE_DIR}/testfiles/${h5_file}" "${PROJECT_BINARY_DIR}/testfiles/orig_${h5_file}" ) - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (H5CLEAR-copy_orig_${h5_file} PROPERTIES DEPENDS ${last_test}) endif () set (last_test "H5CLEAR-copy_orig_${h5_file}") @@ -322,7 +393,7 @@ if (HDF5_ENABLE_USING_MEMCHECKER) -E copy_if_different "${PROJECT_SOURCE_DIR}/testfiles/mod_h5clear_mdc_image.h5" "${PROJECT_BINARY_DIR}/testfiles/mod_h5clear_mdc_image2.h5" ) - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (H5CLEAR-copy_mod_h5clr_mdc_image2.h5 PROPERTIES DEPENDS ${last_test}) endif () set (last_test "H5CLEAR-copy_mod_h5clr_mdc_image2.h5") @@ -347,11 +418,11 @@ endif() ADD_H5_CMP (h5clr_usage_junk h5clear_usage 1 "" junk.h5) ADD_H5_CMP (h5clr_usage_none h5clear_usage 1 "" orig_h5clear_sec2_v3.h5) ADD_H5_CMP (h5clr_missing_file_m h5clear_missing_file 1 "-m") - ADD_H5_CMP (h5clr_open_fail_s h5clear_open_fail 1 "-s" junk.h5) + ADD_H5_ERR_CMP (h5clr_open_fail_s h5clear_open_fail 1 "-s" junk.h5) ADD_H5_CMP (h5clr_missing_file_ms h5clear_missing_file 1 "-m" "-s") - ADD_H5_CMP (h5clr_open_fail_ms h5clear_open_fail 1 "-m" "-s" junk.h5) - ADD_H5_CMP (h5clr_no_mdc_image_m h5clear_no_mdc_image 0 "-m" orig_h5clear_sec2_v2.h5) - ADD_H5_CMP (h5clr_no_mdc_image_ms h5clear_no_mdc_image 0 "-s" "-m" orig_h5clear_sec2_v0.h5) + ADD_H5_ERR_CMP (h5clr_open_fail_ms h5clear_open_fail 1 "-m" "-s" junk.h5) + ADD_H5_ERR_CMP (h5clr_no_mdc_image_m h5clear_no_mdc_image 0 "-m" orig_h5clear_sec2_v2.h5) + ADD_H5_ERR_CMP (h5clr_no_mdc_image_ms h5clear_no_mdc_image 0 "-s" "-m" orig_h5clear_sec2_v0.h5) # # # @@ -382,8 +453,8 @@ endif() # # # h5clear_mdc_image.h5 already has cache image removed earlier, verify the expected warning from h5clear: - ADD_H5_CMP (h5clr_mdc_image_m h5clear_no_mdc_image 0 "-m" mod_h5clear_mdc_image.h5) - ADD_H5_CMP (h5clr_mdc_image_sm h5clear_no_mdc_image 0 "-s" "-m" mod_h5clear_mdc_image2.h5) + ADD_H5_ERR_CMP (h5clr_mdc_image_m h5clear_no_mdc_image 0 "-m" mod_h5clear_mdc_image.h5) + ADD_H5_ERR_CMP (h5clr_mdc_image_sm h5clear_no_mdc_image 0 "-s" "-m" mod_h5clear_mdc_image2.h5) # # # @@ -404,7 +475,7 @@ endif() # "h5clear -s --increment=0 h5clear_status_noclose.h5" (clear status_flag, EOA = MAX(EOA, EOF) + 0) # (no output, check exit code) # "h5clear --filesize h5clear_status_noclose.h5" (print EOA/EOF after the last action) - ADD_H5_CMP_WITH_COPY (h5clr_open_fail_nc_s 1 h5clear_open_fail h5clear_status_noclose.h5 "--filesize") + ADD_H5_ERR_CMP_WITH_COPY (h5clr_open_fail_nc_s 1 h5clear_open_fail h5clear_status_noclose.h5 "--filesize") ADD_H5_RETTEST (h5clr_mdc_image_nc "false" "-s" "--increment=0" h5clear_status_noclose.h5) ADD_H5_CMP (h5clr_no_mdc_image_nc_m h5clear_status_noclose_after_size 0 "--filesize" h5clear_status_noclose.h5) # diff --git a/tools/test/misc/CMakeTestsMkgrp.cmake b/tools/test/misc/CMakeTestsMkgrp.cmake index e99983b..db3b7e4 100644 --- a/tools/test/misc/CMakeTestsMkgrp.cmake +++ b/tools/test/misc/CMakeTestsMkgrp.cmake @@ -73,7 +73,7 @@ ) set_tests_properties (H5MKGRP-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") if (HDF5_ENABLE_USING_MEMCHECKER) - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (H5MKGRP-${resultfile} PROPERTIES DEPENDS ${last_test}) endif () else (HDF5_ENABLE_USING_MEMCHECKER) @@ -174,7 +174,7 @@ h5mkgrp_nested_mult_lp.out.err ) set_tests_properties (H5MKGRP-clearall-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") - if (NOT "${last_test}" STREQUAL "") + if (last_test) set_tests_properties (H5MKGRP-clearall-objects PROPERTIES DEPENDS ${last_test}) endif () set (last_test "H5MKGRP-clearall-objects") diff --git a/tools/test/misc/CMakeTestsRepart.cmake b/tools/test/misc/CMakeTestsRepart.cmake index 830de11..8edd243 100644 --- a/tools/test/misc/CMakeTestsRepart.cmake +++ b/tools/test/misc/CMakeTestsRepart.cmake @@ -71,30 +71,37 @@ family_to_single.h5 family_to_sec2.h5 ) - if (NOT "${last_test}" STREQUAL "") - set_tests_properties (H5REPART-clearall-objects PROPERTIES DEPENDS ${last_test}) - endif () - set (last_test "H5REPART-clearall-objects") + set_tests_properties (H5REPART-clearall-objects PROPERTIES FIXTURES_SETUP clear_testrepart) # repartition family member size to 20,000 bytes. add_test (NAME H5REPART-h5repart_20K COMMAND $<TARGET_FILE:h5repart> -m 20000 family_file%05d.h5 fst_family%05d.h5) - set_tests_properties (H5REPART-h5repart_20K PROPERTIES DEPENDS H5REPART-clearall-objects) + set_tests_properties (H5REPART-h5repart_20K PROPERTIES + FIXTURES_REQUIRED clear_testrepart + ) # repartition family member size to 5 KB. add_test (NAME H5REPART-h5repart_5K COMMAND $<TARGET_FILE:h5repart> -m 5k family_file%05d.h5 scd_family%05d.h5) - set_tests_properties (H5REPART-h5repart_5K PROPERTIES DEPENDS H5REPART-clearall-objects) + set_tests_properties (H5REPART-h5repart_5K PROPERTIES + FIXTURES_REQUIRED clear_testrepart + ) # convert family file to sec2 file of 20,000 bytes add_test (NAME H5REPART-h5repart_single COMMAND $<TARGET_FILE:h5repart> -m 20000 -family_to_single family_file%05d.h5 family_to_single.h5) - set_tests_properties (H5REPART-h5repart_single PROPERTIES DEPENDS H5REPART-clearall-objects) + set_tests_properties (H5REPART-h5repart_single PROPERTIES + FIXTURES_REQUIRED clear_testrepart + ) # convert family file to sec2 file of 20,000 bytes (old argument) add_test (NAME H5REPART-h5repart_sec2 COMMAND $<TARGET_FILE:h5repart> -m 20000 -family_to_sec2 family_file%05d.h5 family_to_sec2.h5) - set_tests_properties (H5REPART-h5repart_sec2 PROPERTIES DEPENDS H5REPART-clearall-objects) + set_tests_properties (H5REPART-h5repart_sec2 PROPERTIES + FIXTURES_REQUIRED clear_testrepart + ) # test the output files repartitioned above. add_test (NAME H5REPART-h5repart_test COMMAND $<TARGET_FILE:h5repart_test>) - set_tests_properties (H5REPART-h5repart_test PROPERTIES DEPENDS "H5REPART-clearall-objects;H5REPART-h5repart_20K;H5REPART-h5repart_5K;H5REPART-h5repart_sec2") + set_tests_properties (H5REPART-h5repart_test PROPERTIES + DEPENDS "H5REPART-h5repart_20K;H5REPART-h5repart_5K;H5REPART-h5repart_single;H5REPART-h5repart_sec2" + ) set (H5_DEP_EXECUTABLES ${H5_DEP_EXECUTABLES} h5repart_test diff --git a/tools/test/misc/testfiles/h5clear_missing_file.ddl b/tools/test/misc/testfiles/h5clear_missing_file.ddl index 13eb2c9..32dd549 100644 --- a/tools/test/misc/testfiles/h5clear_missing_file.ddl +++ b/tools/test/misc/testfiles/h5clear_missing_file.ddl @@ -20,4 +20,3 @@ h5clear --increment file_name h5clear --increment=512 file_name Set the EOA to the maximum of (EOA, EOF) + 512 for the file <file_name>. -h5clear error: missing file name diff --git a/tools/test/misc/testfiles/h5clear_missing_file.err b/tools/test/misc/testfiles/h5clear_missing_file.err new file mode 100644 index 0000000..ea21b76 --- /dev/null +++ b/tools/test/misc/testfiles/h5clear_missing_file.err @@ -0,0 +1 @@ +h5clear error: missing file name diff --git a/tools/test/misc/testfiles/h5clear_no_mdc_image.ddl b/tools/test/misc/testfiles/h5clear_no_mdc_image.err index f5acd71..f5acd71 100644 --- a/tools/test/misc/testfiles/h5clear_no_mdc_image.ddl +++ b/tools/test/misc/testfiles/h5clear_no_mdc_image.err diff --git a/tools/test/misc/testfiles/h5clear_open_fail.ddl b/tools/test/misc/testfiles/h5clear_open_fail.err index 895ecd4..895ecd4 100644 --- a/tools/test/misc/testfiles/h5clear_open_fail.ddl +++ b/tools/test/misc/testfiles/h5clear_open_fail.err diff --git a/tools/test/misc/testh5clear.sh.in b/tools/test/misc/testh5clear.sh.in index 11c2ff9..3f2b32f 100644 --- a/tools/test/misc/testh5clear.sh.in +++ b/tools/test/misc/testh5clear.sh.in @@ -62,10 +62,10 @@ test -d $TESTDIR || mkdir -p $TESTDIR # copy test files and expected output files from source dirs to test dir # COPY_TESTFILES=" +$SRC_H5CLEAR_TESTFILES/h5clear_open_fail.err +$SRC_H5CLEAR_TESTFILES/h5clear_no_mdc_image.err $SRC_H5CLEAR_TESTFILES/h5clear_usage.ddl -$SRC_H5CLEAR_TESTFILES/h5clear_open_fail.ddl $SRC_H5CLEAR_TESTFILES/h5clear_missing_file.ddl -$SRC_H5CLEAR_TESTFILES/h5clear_no_mdc_image.ddl $SRC_H5CLEAR_TESTFILES/h5clear_status_noclose_after_size.ddl $SRC_H5CLEAR_TESTFILES/h5clear_noclose_before_size.ddl $SRC_H5CLEAR_TESTFILES/h5clear_noclose_after_size.ddl @@ -179,8 +179,9 @@ TOOLTEST_OUT() { expected=$5 # Prepare expected and actual output expect="$TESTDIR/$expected" + expect_err="$TESTDIR/`basename $expected .ddl`.err" actual="$TESTDIR/`basename $expected .ddl`.out" - actual_err="$TESTDIR/`basename $expected .ddl`.err" + actual_err="$TESTDIR/`basename $expected .ddl`.out.err" actual_sav=${actual}-sav actual_err_sav=${actual_err}-sav @@ -192,7 +193,6 @@ TOOLTEST_OUT() { ) >$actual 2>$actual_err cp $actual $actual_sav cp $actual_err $actual_err_sav - cat $actual_err >> $actual # Compare output COMPARE_OUT $expect $actual @@ -202,6 +202,38 @@ TOOLTEST_OUT() { $RM $actual $actual_err $actual_sav $actual_err_sav fi } +# same as TOOLTEST_OUT just compare stderr +TOOLTEST_ERR() { + fname=$1 + option1=$2 + option2=$3 + option3=$4 + expected=$5 + # Prepare expected and actual output + expect_err="$TESTDIR/$expected" + expect="$TESTDIR/`basename $expected .err`.ddl" + actual="$TESTDIR/`basename $expected .err`.out" + actual_err="$TESTDIR/`basename $expected .err`.out.err" + actual_sav=${actual}-sav + actual_err_sav=${actual_err}-sav + + # Run test. + TESTING $H5CLEAR $option1 $option2 $option3 $option4 $fname + ( + cd $TESTDIR + $RUNSERIAL $H5CLEAR_BIN $option1 $option2 $option3 $option4 $fname + ) >$actual 2>$actual_err + cp $actual $actual_sav + cp $actual_err $actual_err_sav + + # Compare output + COMPARE_OUT $expect_err $actual_err + + # Clean up output file + if test -z "$HDF5_NOCLEANUP"; then + $RM $actual $actual_err $actual_sav $actual_err_sav + fi +} # $1 is the filename to open # $2 is the expected return from the open/check program @@ -274,11 +306,11 @@ TOOLTEST_OUT "" "" "" "" h5clear_usage.ddl TOOLTEST_OUT junk.h5 "" "" "" h5clear_usage.ddl TOOLTEST_OUT orig_h5clear_sec2_v3.h5 "" "" "" h5clear_usage.ddl TOOLTEST_OUT "" -m "" "" h5clear_missing_file.ddl -TOOLTEST_OUT junk.h5 -s "" "" h5clear_open_fail.ddl +TOOLTEST_ERR junk.h5 -s "" "" h5clear_open_fail.err TOOLTEST_OUT "" -m -s "" h5clear_missing_file.ddl -TOOLTEST_OUT junk.h5 -m -s "" h5clear_open_fail.ddl -TOOLTEST_OUT orig_h5clear_sec2_v2.h5 -m "" "" h5clear_no_mdc_image.ddl -TOOLTEST_OUT orig_h5clear_sec2_v0.h5 -s -m "" h5clear_no_mdc_image.ddl +TOOLTEST_ERR junk.h5 -m -s "" h5clear_open_fail.err +TOOLTEST_ERR orig_h5clear_sec2_v2.h5 -m "" "" h5clear_no_mdc_image.err +TOOLTEST_ERR orig_h5clear_sec2_v0.h5 -s -m "" h5clear_no_mdc_image.err # # # The following are tests to verify the expected exit code from h5clear: @@ -308,8 +340,8 @@ TOOLTEST h5clear_sec2_v0.h5 -l -m $FAIL # # # h5clear_mdc_image.h5 already has cache image removed earlier, verify the expected warning from h5clear: -TOOLTEST_OUT mod_h5clear_mdc_image.h5 -m "" "" h5clear_no_mdc_image.ddl -TOOLTEST_OUT mod_h5clear_mdc_image.h5 -s -m "" h5clear_no_mdc_image.ddl +TOOLTEST_ERR mod_h5clear_mdc_image.h5 -m "" "" h5clear_no_mdc_image.err +TOOLTEST_ERR mod_h5clear_mdc_image.h5 -s -m "" h5clear_no_mdc_image.err # # # @@ -342,16 +374,16 @@ OPEN_CHK h5clear_sec2_v2.h5 $SUCCEED # # # -# (1) h5clear_status_noclose.h5 +# (1) h5clear_status_noclose.h5 # "h5clear --filesize h5clear_status_noclose.h5" (unable to open the file because status_flag is on) -# "h5clear -s --increment=0 h5clear_status_noclose.h5" (clear status_flag, EOA = MAX(EOA, EOF) + 0) +# "h5clear -s --increment=0 h5clear_status_noclose.h5" (clear status_flag, EOA = MAX(EOA, EOF) + 0) # (no output, check exit code) # "h5clear --filesize h5clear_status_noclose_user.h5" (print EOA/EOF after the last action) -TOOLTEST_OUT h5clear_status_noclose.h5 --filesize "" "" h5clear_open_fail.ddl +TOOLTEST_ERR h5clear_status_noclose.h5 --filesize "" "" h5clear_open_fail.err TOOLTEST h5clear_status_noclose.h5 -s --increment=0 $SUCCEED TOOLTEST_OUT h5clear_status_noclose.h5 --filesize "" "" h5clear_status_noclose_after_size.ddl # -# (2) h5clear_fsm_persist_noclose.h5 +# (2) h5clear_fsm_persist_noclose.h5 # "h5clear --filesize h5clear_fsm_persist_noclose.h5" (print EOA/EOF before the next action) # "h5clear --increment=0 h5clear_fsm_persist_noclose.h5" (EOA = MAX(EOA, EOF)) (no output, check exit code) # "h5clear --filesize h5clear_fsm_persist_noclose.h5" (print EOA/EOF after the last action) @@ -364,7 +396,7 @@ TOOLTEST_OUT h5clear_fsm_persist_noclose.h5 --filesize "" "" h5clear_noclose_aft # "h5clear --increment h5clear_fsm_persist_equal.h5" (EOA = MAX(EOA, EOF) + 1M) (no output, check exit code) # "h5clear --filesize h5clear_fsm_persist_equal.h5" (print EOA/EOF after the last action) TOOLTEST_OUT h5clear_fsm_persist_equal.h5 --filesize "" "" h5clear_equal_before_size.ddl -TOOLTEST h5clear_fsm_persist_equal.h5 --increment "" $SUCCEED +TOOLTEST h5clear_fsm_persist_equal.h5 --increment "" $SUCCEED TOOLTEST_OUT h5clear_fsm_persist_equal.h5 --filesize "" "" h5clear_equal_after_size.ddl # # (4) h5clear_fsm_persist_greater.h5 @@ -372,7 +404,7 @@ TOOLTEST_OUT h5clear_fsm_persist_equal.h5 --filesize "" "" h5clear_equal_after_s # "h5clear --increment=0 h5clear_fsm_persist_greater.h5" (EOA = MAX(EOA, EOF) + 0) (no output, check exit code) # "h5clear --filesize h5clear_fsm_persist_greater.h5" (print EOA/EOF after the last action) TOOLTEST_OUT h5clear_fsm_persist_greater.h5 --filesize "" "" h5clear_greater_before_size.ddl -TOOLTEST h5clear_fsm_persist_greater.h5 --increment=0 "" $SUCCEED +TOOLTEST h5clear_fsm_persist_greater.h5 --increment=0 "" $SUCCEED TOOLTEST_OUT h5clear_fsm_persist_greater.h5 --filesize "" "" h5clear_greater_after_size.ddl # # (5) h5clear_fsm_persist_less.h5 @@ -380,7 +412,7 @@ TOOLTEST_OUT h5clear_fsm_persist_greater.h5 --filesize "" "" h5clear_greater_aft # "h5clear --increment=200 h5clear_fsm_persist_less.h5" (EOA = MAX(EOA, EOF) + 200) (no output, check exit code) # "h5clear --filesize h5clear_fsm_persist_less.h5" (print EOA/EOF after the last action) TOOLTEST_OUT h5clear_fsm_persist_less.h5 --filesize "" "" h5clear_less_before_size.ddl -TOOLTEST h5clear_fsm_persist_less.h5 --increment=200 "" $SUCCEED +TOOLTEST h5clear_fsm_persist_less.h5 --increment=200 "" $SUCCEED TOOLTEST_OUT h5clear_fsm_persist_less.h5 --filesize "" "" h5clear_less_after_size.ddl # # (6) h5clear_fsm_persist_user_equal.h5 @@ -388,7 +420,7 @@ TOOLTEST_OUT h5clear_fsm_persist_less.h5 --filesize "" "" h5clear_less_after_siz # "h5clear --increment h5clear_fsm_persist_user_equal.h5" (EOA = MAX(EOA, EOF) + 1M) (no output, check exit code) # "h5clear --filesize h5clear_fsm_persist_user_equal.h5" (print EOA/EOF after the last action) TOOLTEST_OUT h5clear_fsm_persist_user_equal.h5 --filesize "" "" h5clear_user_equal_before_size.ddl -TOOLTEST h5clear_fsm_persist_user_equal.h5 --increment "" $SUCCEED +TOOLTEST h5clear_fsm_persist_user_equal.h5 --increment "" $SUCCEED TOOLTEST_OUT h5clear_fsm_persist_user_equal.h5 --filesize "" "" h5clear_user_equal_after_size.ddl # # (7) h5clear_fsm_persist_user_greater.h5 @@ -396,7 +428,7 @@ TOOLTEST_OUT h5clear_fsm_persist_user_equal.h5 --filesize "" "" h5clear_user_equ # "h5clear --increment=0 h5clear_fsm_persist_user_greater.h5" (EOA = MAX(EOA, EOF) + 0) (no output, check exit code) # "h5clear --filesize h5clear_fsm_persist_user_greater.h5" (print EOA/EOF after the last action) TOOLTEST_OUT h5clear_fsm_persist_user_greater.h5 --filesize "" "" h5clear_user_greater_before_size.ddl -TOOLTEST h5clear_fsm_persist_user_greater.h5 --increment=0 "" $SUCCEED +TOOLTEST h5clear_fsm_persist_user_greater.h5 --increment=0 "" $SUCCEED TOOLTEST_OUT h5clear_fsm_persist_user_greater.h5 --filesize "" "" h5clear_user_greater_after_size.ddl # # (8) h5clear_fsm_persist_user_less.h5 @@ -404,7 +436,7 @@ TOOLTEST_OUT h5clear_fsm_persist_user_greater.h5 --filesize "" "" h5clear_user_g # "h5clear --increment=200 h5clear_fsm_persist_user_less.h5" (EOA = MAX(EOA, EOF) + 200) (no output, check exit code) # "h5clear --filesize h5clear_fsm_persist_user_less.h5" (print EOA/EOF after the last action) TOOLTEST_OUT h5clear_fsm_persist_user_less.h5 --filesize "" "" h5clear_user_less_before_size.ddl -TOOLTEST h5clear_fsm_persist_user_less.h5 --increment=200 "" $SUCCEED +TOOLTEST h5clear_fsm_persist_user_less.h5 --increment=200 "" $SUCCEED TOOLTEST_OUT h5clear_fsm_persist_user_less.h5 --filesize "" "" h5clear_user_less_after_size.ddl # # diff --git a/tools/test/perform/CMakeTests.cmake b/tools/test/perform/CMakeTests.cmake index 450667a..36172d1 100644 --- a/tools/test/perform/CMakeTests.cmake +++ b/tools/test/perform/CMakeTests.cmake @@ -66,7 +66,7 @@ else () -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) endif () -set_tests_properties (PERFORM_h5perf_serial PROPERTIES TIMEOUT 1800) +set_tests_properties (PERFORM_h5perf_serial PROPERTIES TIMEOUT ${CTEST_VERY_LONG_TIMEOUT}) set_tests_properties (PERFORM_h5perf_serial PROPERTIES DEPENDS "PERFORM_h5perform-clearall-objects") if (HDF5_BUILD_PERFORM_STANDALONE) @@ -170,9 +170,9 @@ endif () set_tests_properties (PERFORM_zip_perf PROPERTIES DEPENDS "PERFORM_zip_perf_help;PERFORM_h5perform-clearall-objects") if (H5_HAVE_PARALLEL) - add_test (NAME PERFORM_h5perf COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_PREFLAGS} $<TARGET_FILE:h5perf> ${MPIEXEC_POSTFLAGS}) + add_test (NAME MPI_TEST_PERFORM_h5perf COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_PREFLAGS} $<TARGET_FILE:h5perf> ${MPIEXEC_POSTFLAGS}) if (HDF5_BUILD_PERFORM_STANDALONE) - add_test (NAME PERFORM_h5perf_alone COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_PREFLAGS} $<TARGET_FILE:h5perf_alone> ${MPIEXEC_POSTFLAGS}) + add_test (NAME MPI_TEST_PERFORM_h5perf_alone COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_PREFLAGS} $<TARGET_FILE:h5perf_alone> ${MPIEXEC_POSTFLAGS}) endif () endif () |