Convert ERR test to use grep (#4451)

* Convert ERR test to use grep
* Eliminate use of .err files in CMake
* Show error output if grep fails
* Turn off cuda in NVHPC CI
This commit is contained in:
Allen Byrne 2024-05-03 05:29:53 -05:00 committed by GitHub
parent dfc6295c1d
commit 1b6ae84d15
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
11 changed files with 254 additions and 198 deletions

View File

@ -59,6 +59,7 @@ jobs:
-DHDF5_BUILD_FORTRAN:BOOL=ON \
-DHDF5_BUILD_JAVA:BOOL=OFF \
-DMPIEXEC_MAX_NUMPROCS:STRING="2" \
-DMPIEXEC_PREFLAGS:STRING="--mca;opal_warn_on_missing_libcuda;0" \
$GITHUB_WORKSPACE
- name: CMake Build

View File

@ -11,6 +11,7 @@
#
# grepTest.cmake executes a command and captures the output in a file. File is then compared
# against a reference file. Exit status of command can also be compared.
cmake_policy(SET CMP0007 NEW)
# arguments checking
if (NOT TEST_PROGRAM)
@ -67,6 +68,11 @@ execute_process (
message (STATUS "COMMAND Result: ${TEST_RESULT}")
# append the test result status with a predefined text
if (TEST_APPEND)
file (APPEND ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_APPEND} ${TEST_RESULT}\n")
endif ()
message (STATUS "COMMAND Error: ${TEST_ERROR}")
# remove special output
@ -75,15 +81,22 @@ if (EXISTS "${TEST_FOLDER}/${TEST_OUTPUT}")
string (FIND "${TEST_STREAM}" "_pmi_alps" TEST_FIND_RESULT)
if (TEST_FIND_RESULT GREATER -1)
string (REGEX REPLACE "^.*_pmi_alps[^\n]+\n" "" TEST_STREAM "${TEST_STREAM}")
file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}")
file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} ${TEST_STREAM})
endif ()
string (FIND "${TEST_STREAM}" "ulimit -s" TEST_FIND_RESULT)
if (TEST_FIND_RESULT GREATER -1)
string (REGEX REPLACE "^.*ulimit -s[^\n]+\n" "" TEST_STREAM "${TEST_STREAM}")
file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}")
file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} ${TEST_STREAM})
endif ()
endif ()
if (TEST_REF_FILTER)
#message (STATUS "TEST_REF_FILTER: ${TEST_APPEND}${TEST_REF_FILTER}")
file (READ ${TEST_FOLDER}/${TEST_REFERENCE} TEST_STREAM)
string (REGEX REPLACE "${TEST_REF_APPEND}" "${TEST_REF_FILTER}" TEST_STREAM "${TEST_STREAM}")
file (WRITE ${TEST_FOLDER}/${TEST_REFERENCE} "${TEST_STREAM}")
endif ()
# if the TEST_ERRREF exists grep the error output with the error reference
set (TEST_ERRREF_RESULT 0)
if (TEST_ERRREF)
@ -96,26 +109,25 @@ if (TEST_ERRREF)
string (REGEX MATCH "${TEST_ERRREF}" TEST_MATCH ${TEST_ERR_STREAM})
string (COMPARE EQUAL "${TEST_ERRREF}" "${TEST_MATCH}" TEST_ERRREF_RESULT)
if (NOT TEST_ERRREF_RESULT)
# dump the output unless nodisplay option is set
if (NOT TEST_NO_DISPLAY)
execute_process (
COMMAND ${CMAKE_COMMAND} -E echo ${TEST_ERR_STREAM}
RESULT_VARIABLE TEST_ERRREF_RESULT
)
endif ()
message (FATAL_ERROR "Failed: The error output of ${TEST_PROGRAM} did not contain ${TEST_ERRREF}")
endif ()
endif ()
endif ()
#always compare output file to reference unless this must be skipped
# compare output files to references unless this must be skipped
set (TEST_COMPARE_RESULT 0)
if (NOT TEST_SKIP_COMPARE)
if (EXISTS "${TEST_FOLDER}/${TEST_REFERENCE}")
file (READ ${TEST_FOLDER}/${TEST_REFERENCE} TEST_STREAM)
list (LENGTH TEST_STREAM test_len)
if (test_len GREATER 0)
if (WIN32)
configure_file(${TEST_FOLDER}/${TEST_REFERENCE} ${TEST_FOLDER}/${TEST_REFERENCE}.tmp NEWLINE_STYLE CRLF)
if (EXISTS "${TEST_FOLDER}/${TEST_REFERENCE}.tmp")
file(RENAME ${TEST_FOLDER}/${TEST_REFERENCE}.tmp ${TEST_FOLDER}/${TEST_REFERENCE})
endif ()
#file (READ ${TEST_FOLDER}/${TEST_REFERENCE} TEST_STREAM)
#file (WRITE ${TEST_FOLDER}/${TEST_REFERENCE} "${TEST_STREAM}")
endif ()
if (NOT TEST_SORT_COMPARE)
# now compare the output with the reference
execute_process (
@ -138,7 +150,14 @@ if (TEST_ERRREF)
list (LENGTH test_act len_act)
file (STRINGS ${TEST_FOLDER}/${TEST_REFERENCE} test_ref)
list (LENGTH test_ref len_ref)
if (NOT len_act EQUAL len_ref)
set (TEST_COMPARE_RESULT 1)
endif ()
if (len_act GREATER 0 AND len_ref GREATER 0)
if (TEST_SORT_COMPARE)
list (SORT test_act)
list (SORT test_ref)
endif ()
math (EXPR _FP_LEN "${len_ref} - 1")
foreach (line RANGE 0 ${_FP_LEN})
list (GET test_act ${line} str_act)
@ -200,7 +219,7 @@ if (TEST_FILTER)
endif ()
if (NOT DEFINED ENV{HDF5_NOCLEANUP})
if (EXISTS "${TEST_FOLDER}/${TEST_OUTPUT}")
if (EXISTS "${TEST_FOLDER}/${TEST_OUTPUT}" AND NOT TEST_SAVE)
file (REMOVE ${TEST_FOLDER}/${TEST_OUTPUT})
endif ()

View File

@ -49,7 +49,7 @@ endif ()
if (TEST_ENV_VAR)
set (ENV{${TEST_ENV_VAR}} "${TEST_ENV_VALUE}")
#message (STATUS "ENV:${TEST_ENV_VAR}=$ENV{${TEST_ENV_VAR}}")
message (TRACE "ENV:${TEST_ENV_VAR}=$ENV{${TEST_ENV_VAR}}")
endif ()
if (NOT TEST_INPUT)
@ -233,7 +233,6 @@ if (NOT TEST_SKIP_COMPARE)
file (READ ${TEST_FOLDER}/${TEST_REFERENCE} TEST_STREAM)
list (LENGTH TEST_STREAM test_len)
if (test_len GREATER 0)
if (NOT TEST_SORT_COMPARE)
# now compare the output with the reference
execute_process (

View File

@ -30,7 +30,6 @@
set (LIST_OTHER_TEST_FILES
h5copy_misc1.out
h5copy_misc1.err
tudfilter.h5.txt
tudfilter.h5_ERR.txt
h5copy_plugin_fail_ERR.out.h5.txt

View File

@ -192,7 +192,6 @@
h5diff_452.txt
h5diff_453.txt
h5diff_454.txt
dangling_link.err
h5diff_455.txt
h5diff_456.txt
h5diff_457.txt
@ -254,7 +253,6 @@
h5diff_63.txt
h5diff_600.txt
h5diff_601.txt
h5diff_601_ERR.err
h5diff_603.txt
h5diff_604.txt
h5diff_605.txt
@ -313,7 +311,6 @@
h5diff_8639.txt
h5diff_reg.txt
h5diff_ud.txt
h5diff_udfail.err
h5diff_udfail.txt
h5diff_v1.txt
h5diff_v2.txt
@ -477,6 +474,82 @@
endif ()
endmacro ()
macro (ADD_H5_CMP_TEST resultfile resultcode result_errcheck)
if (HDF5_TEST_SERIAL)
ADD_SH5_CMP_TEST (${resultfile} ${resultcode} ${result_errcheck} ${ARGN})
endif ()
if (H5_HAVE_PARALLEL AND HDF5_TEST_PARALLEL)
ADD_PH5_CMP_TEST (${resultfile} ${resultcode} ${result_errcheck} ${ARGN})
endif ()
endmacro ()
macro (ADD_SH5_CMP_TEST resultfile resultcode result_errcheck)
# If using memchecker add tests without using scripts
if (HDF5_USING_ANALYSIS_TOOL)
add_test (NAME H5DIFF-${resultfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5diff> ${ARGN})
if (${resultcode})
set_tests_properties (H5DIFF-${resultfile} PROPERTIES WILL_FAIL "true")
endif ()
else ()
add_test (
NAME H5DIFF-${resultfile}
COMMAND "${CMAKE_COMMAND}"
-D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}"
-D "TEST_PROGRAM=$<TARGET_FILE:h5diff>"
-D "TEST_ARGS:STRING=${ARGN}"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles"
-D "TEST_OUTPUT=${resultfile}.out"
-D "TEST_EXPECT=${resultcode}"
-D "TEST_REFERENCE=${resultfile}.txt"
-D "TEST_ERRREF=${result_errcheck}"
-D "TEST_APPEND=EXIT CODE:"
-P "${HDF_RESOURCES_DIR}/grepTest.cmake"
)
endif ()
set_tests_properties (H5DIFF-${resultfile} PROPERTIES
WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles"
)
if ("H5DIFF-${resultfile}" MATCHES "${HDF5_DISABLE_TESTS_REGEX}")
set_tests_properties (H5DIFF-${resultfile} PROPERTIES DISABLED true)
endif ()
endmacro ()
macro (ADD_PH5_CMP_TEST resultfile resultcode result_errcheck)
# If using memchecker add tests without using scripts
if (HDF5_USING_ANALYSIS_TOOL)
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 ()
else ()
add_test (
NAME MPI_TEST_H5DIFF-${resultfile}
COMMAND "${CMAKE_COMMAND}"
-D "TEST_PROGRAM=${MPIEXEC_EXECUTABLE}"
-D "TEST_ARGS:STRING=${MPIEXEC_NUMPROC_FLAG};${MPIEXEC_MAX_NUMPROCS};${MPIEXEC_PREFLAGS};$<TARGET_FILE:ph5diff>;${MPIEXEC_POSTFLAGS};${ARGN}"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}/PAR/testfiles"
-D "TEST_OUTPUT=${resultfile}.out"
#-D "TEST_EXPECT=${resultcode}"
-D "TEST_EXPECT=0" # ph5diff currently always exits with a zero status code due to
# output from some MPI implementations from a non-zero exit code
-D "TEST_REFERENCE=${resultfile}.txt"
-D "TEST_ERRREF=${result_errcheck}"
-D "TEST_APPEND=EXIT CODE:"
-D "TEST_REF_APPEND=EXIT CODE: [0-9]"
-D "TEST_REF_FILTER=EXIT CODE: 0"
-D "TEST_SORT_COMPARE=TRUE"
-P "${HDF_RESOURCES_DIR}/grepTest.cmake"
)
endif ()
set_tests_properties (MPI_TEST_H5DIFF-${resultfile} PROPERTIES
WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/PAR/testfiles"
)
if ("MPI_TEST_H5DIFF-${resultfile}" MATCHES "${HDF5_DISABLE_TESTS_REGEX}")
set_tests_properties (MPI_TEST_H5DIFF-${resultfile} PROPERTIES DISABLED true)
endif ()
endmacro ()
macro (ADD_H5_UD_TEST testname resultcode resultfile)
if (NOT HDF5_USING_ANALYSIS_TOOL)
if ("${resultcode}" STREQUAL "2")
@ -490,11 +563,12 @@
-D "TEST_OUTPUT=${resultfile}.out"
-D "TEST_EXPECT=${resultcode}"
-D "TEST_REFERENCE=${resultfile}.txt"
-D "TEST_ERRREF=user defined filter is not available"
-D "TEST_APPEND=EXIT CODE:"
-D "TEST_ENV_VAR=HDF5_PLUGIN_PATH"
-D "TEST_ENV_VALUE=${CMAKE_BINARY_DIR}"
-D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}"
-P "${HDF_RESOURCES_DIR}/runTest.cmake"
-P "${HDF_RESOURCES_DIR}/grepTest.cmake"
)
else ()
add_test (
@ -734,7 +808,7 @@ ADD_H5_TEST (h5diff_63 1 -v ${STRINGS1} ${STRINGS2} string4 string4)
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_CMP_TEST (h5diff_601 2 "Object could not be found" ${FILE1} ${FILE1} nono_obj)
# ##############################################################################
# # -d

View File

@ -370,33 +370,6 @@
tst_onion_dset_1d.h5
tst_onion_dset_1d.h5.onion
)
set (HDF5_ERROR_REFERENCE_TEST_FILES
filter_fail.err
non_existing.err
infinite_loop.err
tall-1.err
tall-2A.err
tall-2A0.err
tall-2B.err
tarray1_big.err
tattrregR.err
tattr-3.err
tcomp-3.err
tdataregR.err
tdset-2.err
texceedsubblock.err
texceedsubcount.err
texceedsubstart.err
texceedsubstride.err
textlink.err
textlinkfar.err
textlinksrc.err
torderlinks1.err
torderlinks2.err
tgroup-2.err
tperror.err
tslink-D.err
)
# make test dir
file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles")
@ -420,10 +393,6 @@
HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/expected/${tst_h5N_file}" "${PROJECT_BINARY_DIR}/testfiles/std/${tst_h5N_file}-N" "h5dump_std_files")
endforeach ()
foreach (tst_error_file ${HDF5_ERROR_REFERENCE_TEST_FILES})
HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/errfiles/${tst_error_file}" "${PROJECT_BINARY_DIR}/testfiles/std/${tst_error_file}" "h5dump_std_files")
endforeach ()
# --------------------------------------------------------------------
# Special file handling
# --------------------------------------------------------------------
@ -1269,10 +1238,10 @@
ADD_H5_TEST (tindicessub4 0 --enable-error-stack -d 4d -s 0,0,1,2 -c 2,2,3,2 -S 1,1,3,3 -k 1,1,2,2 taindices.h5)
# Exceed the dimensions for subsetting
ADD_H5_TEST (texceedsubstart 1 --enable-error-stack -d 1d -s 1,3 taindices.h5)
ADD_H5_TEST (texceedsubcount 1 --enable-error-stack -d 1d -c 1,3 taindices.h5)
ADD_H5_TEST (texceedsubstride 1 --enable-error-stack -d 1d -S 1,3 taindices.h5)
ADD_H5_TEST (texceedsubblock 1 --enable-error-stack -d 1d -k 1,3 taindices.h5)
ADD_H5ERR_MASK_TEST (texceedsubstart 1 "exceed dataset dims" --enable-error-stack -d 1d -s 1,3 taindices.h5)
ADD_H5ERR_MASK_TEST (texceedsubcount 1 "exceed dataset dims" --enable-error-stack -d 1d -c 1,3 taindices.h5)
ADD_H5ERR_MASK_TEST (texceedsubstride 1 "exceed dataset dims" --enable-error-stack -d 1d -S 1,3 taindices.h5)
ADD_H5ERR_MASK_TEST (texceedsubblock 1 "exceed dataset dims" --enable-error-stack -d 1d -k 1,3 taindices.h5)
# tests for filters
# SZIP
@ -1424,24 +1393,24 @@
ADD_H5_TEST_EXPORT (tall-6 tall.h5 0 --enable-error-stack -d /g1/g1.1/dset1.1.1 -y -o)
# test for non-existing file
ADD_H5_TEST (non_existing 1 --enable-error-stack tgroup.h5 non_existing.h5)
ADD_H5ERR_MASK_TEST (non_existing 1 "unable to open file" --enable-error-stack tgroup.h5 non_existing.h5)
# test to verify github issue#3790: infinite loop closing library
ADD_H5_TEST (infinite_loop 1 3790_infinite_loop.h5)
ADD_H5ERR_MASK_TEST (infinite_loop 1 "unable to open file" 3790_infinite_loop.h5)
# test to verify HDFFV-10333: error similar to H5O_attr_decode in the jira issue
ADD_H5_TEST (err_attr_dspace 1 err_attr_dspace.h5)
ADD_H5ERR_MASK_TEST (err_attr_dspace 1 "error getting attribute information" err_attr_dspace.h5)
# test to verify HDFFV-9407: long double full precision
# ADD_H5_GREP_TEST (t128bit_float 1 "1.123456789012345" -m %.35Lg t128bit_float.h5)
# test to verify HDFFV-10480: out of bounds read in H5O_fill_new[old]_decode
ADD_H5_TEST (tCVE_2018_11206_fill_old 1 tCVE_2018_11206_fill_old.h5)
ADD_H5_TEST (tCVE_2018_11206_fill_new 1 tCVE_2018_11206_fill_new.h5)
ADD_H5ERR_MASK_TEST (tCVE_2018_11206_fill_old 1 "" tCVE_2018_11206_fill_old.h5)
ADD_H5ERR_MASK_TEST (tCVE_2018_11206_fill_new 1 "" tCVE_2018_11206_fill_new.h5)
# test to verify fix for CVE-2021-37501: multiplication overflow in H5O__attr_decode()
# https://github.com/ST4RF4LL/Something_Found/blob/main/HDF5_v1.13.0_h5dump_heap_overflow.assets/poc
ADD_H5_TEST (tCVE-2021-37501_attr_decode 1 tCVE-2021-37501_attr_decode.h5)
ADD_H5ERR_MASK_TEST (tCVE-2021-37501_attr_decode 1 "error getting attribute information" tCVE-2021-37501_attr_decode.h5)
# onion VFD tests
ADD_H5_TEST (tst_onion_objs 0 --enable-error-stack --vfd-name onion --vfd-info 3 tst_onion_objs.h5)

View File

@ -80,21 +80,6 @@
tarray1.h5
tcompound.h5
)
set (HDF5_ERROR_REFERENCE_PBITS
tnofilename-with-packed-bits.err
tpbitsCharLengthExceeded.err
tpbitsCharOffsetExceeded.err
tpbitsIncomplete.err
tpbitsIntLengthExceeded.err
tpbitsIntOffsetExceeded.err
tpbitsLengthExceeded.err
tpbitsLengthPositive.err
tpbitsLongLengthExceeded.err
tpbitsLongOffsetExceeded.err
tpbitsMaxExceeded.err
tpbitsOffsetExceeded.err
tpbitsOffsetNegative.err
)
foreach (pbits_h5_file ${HDF5_REFERENCE_TEST_PBITS})
HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/testfiles/${pbits_h5_file}" "${PROJECT_BINARY_DIR}/testfiles/pbits/${pbits_h5_file}" "h5dump_pbits_files")
@ -103,10 +88,6 @@
foreach (ddl_pbits ${HDF5_REFERENCE_PBITS})
HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/expected/pbits/${ddl_pbits}" "${PROJECT_BINARY_DIR}/testfiles/pbits/${ddl_pbits}" "h5dump_pbits_files")
endforeach ()
foreach (ddl_err_pbits ${HDF5_ERROR_REFERENCE_PBITS})
HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/errfiles/pbits/${ddl_err_pbits}" "${PROJECT_BINARY_DIR}/testfiles/pbits/${ddl_err_pbits}" "h5dump_pbits_files")
endforeach ()
add_custom_target(h5dump_pbits_files ALL COMMENT "Copying files needed by h5dump_pbits tests" DEPENDS ${h5dump_pbits_files_list})
##############################################################################
@ -115,7 +96,7 @@
##############################################################################
##############################################################################
macro (ADD_H5_PBITS_TEST resultfile resultcode)
macro (ADD_H5_PBITS_TEST resultfile resultcode result_errcheck)
# If using memchecker add tests without using scripts
if (HDF5_USING_ANALYSIS_TOOL)
add_test (NAME H5DUMP-${resultfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5dump> ${ARGN})
@ -123,18 +104,34 @@
set_tests_properties (H5DUMP-${resultfile} PROPERTIES WILL_FAIL "true")
endif ()
else ()
add_test (
NAME H5DUMP-${resultfile}
COMMAND "${CMAKE_COMMAND}"
-D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}"
-D "TEST_PROGRAM=$<TARGET_FILE:h5dump>"
-D "TEST_ARGS:STRING=${ARGN}"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/pbits"
-D "TEST_OUTPUT=${resultfile}.out"
-D "TEST_EXPECT=${resultcode}"
-D "TEST_REFERENCE=${resultfile}.ddl"
-P "${HDF_RESOURCES_DIR}/runTest.cmake"
)
if (${resultcode})
add_test (
NAME H5DUMP-${resultfile}
COMMAND "${CMAKE_COMMAND}"
-D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}"
-D "TEST_PROGRAM=$<TARGET_FILE:h5dump>"
-D "TEST_ARGS:STRING=${ARGN}"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/pbits"
-D "TEST_OUTPUT=${resultfile}.out"
-D "TEST_EXPECT=${resultcode}"
-D "TEST_REFERENCE=${resultfile}.ddl"
-D "TEST_ERRREF=${result_errcheck}"
-P "${HDF_RESOURCES_DIR}/grepTest.cmake"
)
else ()
add_test (
NAME H5DUMP-${resultfile}
COMMAND "${CMAKE_COMMAND}"
-D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}"
-D "TEST_PROGRAM=$<TARGET_FILE:h5dump>"
-D "TEST_ARGS:STRING=${ARGN}"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/pbits"
-D "TEST_OUTPUT=${resultfile}.out"
-D "TEST_EXPECT=${resultcode}"
-D "TEST_REFERENCE=${resultfile}.ddl"
-P "${HDF_RESOURCES_DIR}/runTest.cmake"
)
endif ()
endif ()
set_tests_properties (H5DUMP-${resultfile} PROPERTIES
WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/pbits"
@ -152,7 +149,7 @@
# test failure handling
# Missing file name
ADD_H5_PBITS_TEST (tnofilename-with-packed-bits 1 --enable-error-stack)
ADD_H5_PBITS_TEST (tnofilename-with-packed-bits 1 "missing file name" --enable-error-stack)
# Limits:
# Maximum number of packed bits is 8 (for now).
# Maximum integer size is 8*sizeof(long long).
@ -162,69 +159,69 @@
# Normal operation on both signed and unsigned int datasets.
# Sanity check
# Their rawdata output should be the same.
ADD_H5_PBITS_TEST (tpbitsSignedWhole 0 --enable-error-stack -d /DS08BITS -M 0,8 packedbits.h5)
ADD_H5_PBITS_TEST (tpbitsUnsignedWhole 0 --enable-error-stack -d /DU08BITS -M 0,8 packedbits.h5)
ADD_H5_PBITS_TEST (tpbitsSignedIntWhole 0 --enable-error-stack -d /DS16BITS -M 0,16 packedbits.h5)
ADD_H5_PBITS_TEST (tpbitsUnsignedIntWhole 0 --enable-error-stack -d /DU16BITS -M 0,16 packedbits.h5)
ADD_H5_PBITS_TEST (tpbitsSignedLongWhole 0 --enable-error-stack -d /DS32BITS -M 0,32 packedbits.h5)
ADD_H5_PBITS_TEST (tpbitsUnsignedLongWhole 0 --enable-error-stack -d /DU32BITS -M 0,32 packedbits.h5)
ADD_H5_PBITS_TEST (tpbitsSignedLongLongWhole 0 --enable-error-stack -d /DS64BITS -M 0,64 packedbits.h5)
ADD_H5_PBITS_TEST (tpbitsUnsignedLongLongWhole 0 --enable-error-stack -d /DU64BITS -M 0,64 packedbits.h5)
ADD_H5_PBITS_TEST (tpbitsSignedLongLongWhole63 0 --enable-error-stack -d /DS64BITS -M 0,63 packedbits.h5)
ADD_H5_PBITS_TEST (tpbitsUnsignedLongLongWhole63 0 --enable-error-stack -d /DU64BITS -M 0,63 packedbits.h5)
ADD_H5_PBITS_TEST (tpbitsSignedLongLongWhole1 0 --enable-error-stack -d /DS64BITS -M 1,63 packedbits.h5)
ADD_H5_PBITS_TEST (tpbitsUnsignedLongLongWhole1 0 --enable-error-stack -d /DU64BITS -M 1,63 packedbits.h5)
ADD_H5_PBITS_TEST (tpbitsSignedWhole 0 "" --enable-error-stack -d /DS08BITS -M 0,8 packedbits.h5)
ADD_H5_PBITS_TEST (tpbitsUnsignedWhole 0 "" --enable-error-stack -d /DU08BITS -M 0,8 packedbits.h5)
ADD_H5_PBITS_TEST (tpbitsSignedIntWhole 0 "" --enable-error-stack -d /DS16BITS -M 0,16 packedbits.h5)
ADD_H5_PBITS_TEST (tpbitsUnsignedIntWhole 0 "" --enable-error-stack -d /DU16BITS -M 0,16 packedbits.h5)
ADD_H5_PBITS_TEST (tpbitsSignedLongWhole 0 "" --enable-error-stack -d /DS32BITS -M 0,32 packedbits.h5)
ADD_H5_PBITS_TEST (tpbitsUnsignedLongWhole 0 "" --enable-error-stack -d /DU32BITS -M 0,32 packedbits.h5)
ADD_H5_PBITS_TEST (tpbitsSignedLongLongWhole 0 "" --enable-error-stack -d /DS64BITS -M 0,64 packedbits.h5)
ADD_H5_PBITS_TEST (tpbitsUnsignedLongLongWhole 0 "" --enable-error-stack -d /DU64BITS -M 0,64 packedbits.h5)
ADD_H5_PBITS_TEST (tpbitsSignedLongLongWhole63 0 "" --enable-error-stack -d /DS64BITS -M 0,63 packedbits.h5)
ADD_H5_PBITS_TEST (tpbitsUnsignedLongLongWhole63 0 "" --enable-error-stack -d /DU64BITS -M 0,63 packedbits.h5)
ADD_H5_PBITS_TEST (tpbitsSignedLongLongWhole1 0 "" --enable-error-stack -d /DS64BITS -M 1,63 packedbits.h5)
ADD_H5_PBITS_TEST (tpbitsUnsignedLongLongWhole1 0 "" --enable-error-stack -d /DU64BITS -M 1,63 packedbits.h5)
# Half sections
ADD_H5_PBITS_TEST (tpbitsSigned4 0 --enable-error-stack -d /DS08BITS -M 0,4,4,4 packedbits.h5)
ADD_H5_PBITS_TEST (tpbitsUnsigned4 0 --enable-error-stack -d /DU08BITS -M 0,4,4,4 packedbits.h5)
ADD_H5_PBITS_TEST (tpbitsSignedInt8 0 --enable-error-stack -d /DS16BITS -M 0,8,8,8 packedbits.h5)
ADD_H5_PBITS_TEST (tpbitsUnsignedInt8 0 --enable-error-stack -d /DU16BITS -M 0,8,8,8 packedbits.h5)
ADD_H5_PBITS_TEST (tpbitsSignedLong16 0 --enable-error-stack -d /DS32BITS -M 0,16,16,16 packedbits.h5)
ADD_H5_PBITS_TEST (tpbitsUnsignedLong16 0 --enable-error-stack -d /DU32BITS -M 0,16,16,16 packedbits.h5)
ADD_H5_PBITS_TEST (tpbitsSignedLongLong32 0 --enable-error-stack -d /DS64BITS -M 0,32,32,32 packedbits.h5)
ADD_H5_PBITS_TEST (tpbitsUnsignedLongLong32 0 --enable-error-stack -d /DU64BITS -M 0,32,32,32 packedbits.h5)
ADD_H5_PBITS_TEST (tpbitsSigned4 0 "" --enable-error-stack -d /DS08BITS -M 0,4,4,4 packedbits.h5)
ADD_H5_PBITS_TEST (tpbitsUnsigned4 0 "" --enable-error-stack -d /DU08BITS -M 0,4,4,4 packedbits.h5)
ADD_H5_PBITS_TEST (tpbitsSignedInt8 0 "" --enable-error-stack -d /DS16BITS -M 0,8,8,8 packedbits.h5)
ADD_H5_PBITS_TEST (tpbitsUnsignedInt8 0 "" --enable-error-stack -d /DU16BITS -M 0,8,8,8 packedbits.h5)
ADD_H5_PBITS_TEST (tpbitsSignedLong16 0 "" --enable-error-stack -d /DS32BITS -M 0,16,16,16 packedbits.h5)
ADD_H5_PBITS_TEST (tpbitsUnsignedLong16 0 "" --enable-error-stack -d /DU32BITS -M 0,16,16,16 packedbits.h5)
ADD_H5_PBITS_TEST (tpbitsSignedLongLong32 0 "" --enable-error-stack -d /DS64BITS -M 0,32,32,32 packedbits.h5)
ADD_H5_PBITS_TEST (tpbitsUnsignedLongLong32 0 "" --enable-error-stack -d /DU64BITS -M 0,32,32,32 packedbits.h5)
# Quarter sections
ADD_H5_PBITS_TEST (tpbitsSigned2 0 --enable-error-stack -d /DS08BITS -M 0,2,2,2,4,2,6,2 packedbits.h5)
ADD_H5_PBITS_TEST (tpbitsUnsigned2 0 --enable-error-stack -d /DU08BITS -M 0,2,2,2,4,2,6,2 packedbits.h5)
ADD_H5_PBITS_TEST (tpbitsSignedInt4 0 --enable-error-stack -d /DS16BITS -M 0,4,4,4,8,4,12,4 packedbits.h5)
ADD_H5_PBITS_TEST (tpbitsUnsignedInt4 0 --enable-error-stack -d /DU16BITS -M 0,4,4,4,8,4,12,4 packedbits.h5)
ADD_H5_PBITS_TEST (tpbitsSignedLong8 0 --enable-error-stack -d /DS32BITS -M 0,8,8,8,16,8,24,8 packedbits.h5)
ADD_H5_PBITS_TEST (tpbitsUnsignedLong8 0 --enable-error-stack -d /DU32BITS -M 0,8,8,8,16,8,24,8 packedbits.h5)
ADD_H5_PBITS_TEST (tpbitsSignedLongLong16 0 --enable-error-stack -d /DS64BITS -M 0,16,16,16,32,16,48,16 packedbits.h5)
ADD_H5_PBITS_TEST (tpbitsUnsignedLongLong16 0 --enable-error-stack -d /DU64BITS -M 0,16,16,16,32,16,48,16 packedbits.h5)
ADD_H5_PBITS_TEST (tpbitsSigned2 0 "" --enable-error-stack -d /DS08BITS -M 0,2,2,2,4,2,6,2 packedbits.h5)
ADD_H5_PBITS_TEST (tpbitsUnsigned2 0 "" --enable-error-stack -d /DU08BITS -M 0,2,2,2,4,2,6,2 packedbits.h5)
ADD_H5_PBITS_TEST (tpbitsSignedInt4 0 "" --enable-error-stack -d /DS16BITS -M 0,4,4,4,8,4,12,4 packedbits.h5)
ADD_H5_PBITS_TEST (tpbitsUnsignedInt4 0 "" --enable-error-stack -d /DU16BITS -M 0,4,4,4,8,4,12,4 packedbits.h5)
ADD_H5_PBITS_TEST (tpbitsSignedLong8 0 "" --enable-error-stack -d /DS32BITS -M 0,8,8,8,16,8,24,8 packedbits.h5)
ADD_H5_PBITS_TEST (tpbitsUnsignedLong8 0 "" --enable-error-stack -d /DU32BITS -M 0,8,8,8,16,8,24,8 packedbits.h5)
ADD_H5_PBITS_TEST (tpbitsSignedLongLong16 0 "" --enable-error-stack -d /DS64BITS -M 0,16,16,16,32,16,48,16 packedbits.h5)
ADD_H5_PBITS_TEST (tpbitsUnsignedLongLong16 0 "" --enable-error-stack -d /DU64BITS -M 0,16,16,16,32,16,48,16 packedbits.h5)
# Begin and End
ADD_H5_PBITS_TEST (tpbitsSigned 0 --enable-error-stack -d /DS08BITS -M 0,2,2,6 packedbits.h5)
ADD_H5_PBITS_TEST (tpbitsUnsigned 0 --enable-error-stack -d /DU08BITS -M 0,2,2,6 packedbits.h5)
ADD_H5_PBITS_TEST (tpbitsSignedInt 0 --enable-error-stack -d /DS16BITS -M 0,2,10,6 packedbits.h5)
ADD_H5_PBITS_TEST (tpbitsUnsignedInt 0 --enable-error-stack -d /DU16BITS -M 0,2,10,6 packedbits.h5)
ADD_H5_PBITS_TEST (tpbitsSignedLong 0 --enable-error-stack -d /DS32BITS -M 0,2,26,6 packedbits.h5)
ADD_H5_PBITS_TEST (tpbitsUnsignedLong 0 --enable-error-stack -d /DU32BITS -M 0,2,26,6 packedbits.h5)
ADD_H5_PBITS_TEST (tpbitsSignedLongLong 0 --enable-error-stack -d /DS64BITS -M 0,2,58,6 packedbits.h5)
ADD_H5_PBITS_TEST (tpbitsUnsignedLongLong 0 --enable-error-stack -d /DU64BITS -M 0,2,58,6 packedbits.h5)
ADD_H5_PBITS_TEST (tpbitsSigned 0 "" --enable-error-stack -d /DS08BITS -M 0,2,2,6 packedbits.h5)
ADD_H5_PBITS_TEST (tpbitsUnsigned 0 "" --enable-error-stack -d /DU08BITS -M 0,2,2,6 packedbits.h5)
ADD_H5_PBITS_TEST (tpbitsSignedInt 0 "" --enable-error-stack -d /DS16BITS -M 0,2,10,6 packedbits.h5)
ADD_H5_PBITS_TEST (tpbitsUnsignedInt 0 "" --enable-error-stack -d /DU16BITS -M 0,2,10,6 packedbits.h5)
ADD_H5_PBITS_TEST (tpbitsSignedLong 0 "" --enable-error-stack -d /DS32BITS -M 0,2,26,6 packedbits.h5)
ADD_H5_PBITS_TEST (tpbitsUnsignedLong 0 "" --enable-error-stack -d /DU32BITS -M 0,2,26,6 packedbits.h5)
ADD_H5_PBITS_TEST (tpbitsSignedLongLong 0 "" --enable-error-stack -d /DS64BITS -M 0,2,58,6 packedbits.h5)
ADD_H5_PBITS_TEST (tpbitsUnsignedLongLong 0 "" --enable-error-stack -d /DU64BITS -M 0,2,58,6 packedbits.h5)
# Overlapped packed bits.
ADD_H5_PBITS_TEST (tpbitsOverlapped 0 --enable-error-stack -d /DS08BITS -M 0,1,1,1,2,1,0,3 packedbits.h5)
ADD_H5_PBITS_TEST (tpbitsOverlapped 0 "" --enable-error-stack -d /DS08BITS -M 0,1,1,1,2,1,0,3 packedbits.h5)
# Maximum number of packed bits.
ADD_H5_PBITS_TEST (tpbitsMax 0 --enable-error-stack -d /DS08BITS -M 0,1,1,1,2,1,3,1,4,1,5,1,6,1,7,1 packedbits.h5)
ADD_H5_PBITS_TEST (tpbitsMax 0 "" --enable-error-stack -d /DS08BITS -M 0,1,1,1,2,1,3,1,4,1,5,1,6,1,7,1 packedbits.h5)
# Compound type.
ADD_H5_PBITS_TEST (tpbitsCompound 0 --enable-error-stack -d /dset1 -M 0,1,1,1 tcompound.h5)
ADD_H5_PBITS_TEST (tpbitsCompound 0 "" --enable-error-stack -d /dset1 -M 0,1,1,1 tcompound.h5)
# Array type.
ADD_H5_PBITS_TEST (tpbitsArray 0 --enable-error-stack -d /Dataset1 -M 0,1,1,1 tarray1.h5)
ADD_H5_PBITS_TEST (tpbitsArray 0 "" --enable-error-stack -d /Dataset1 -M 0,1,1,1 tarray1.h5)
# Test Error handling.
# Too many packed bits requested. Max is 8 for now.
ADD_H5_PBITS_TEST (tpbitsMaxExceeded 1 --enable-error-stack -d /DS08BITS -M 0,1,0,1,1,1,2,1,3,1,4,1,5,1,6,1,7,1 packedbits.h5)
ADD_H5_PBITS_TEST (tpbitsMaxExceeded 1 "Too many masks requested" --enable-error-stack -d /DS08BITS -M 0,1,0,1,1,1,2,1,3,1,4,1,5,1,6,1,7,1 packedbits.h5)
# Offset too large. Max is 8*sizeof(long long.
ADD_H5_PBITS_TEST (tpbitsOffsetExceeded 1 --enable-error-stack -d /DS08BITS -M 64,1 packedbits.h5)
ADD_H5_PBITS_TEST (tpbitsCharOffsetExceeded 0 --enable-error-stack -d /DS08BITS -M 8,1 packedbits.h5)
ADD_H5_PBITS_TEST (tpbitsIntOffsetExceeded 0 --enable-error-stack -d /DS16BITS -M 16,1 packedbits.h5)
ADD_H5_PBITS_TEST (tpbitsLongOffsetExceeded 0 --enable-error-stack -d /DS32BITS -M 32,1 packedbits.h5)
ADD_H5_PBITS_TEST (tpbitsOffsetExceeded 1 "must be between 0 and 63" --enable-error-stack -d /DS08BITS -M 64,1 packedbits.h5)
ADD_H5_PBITS_TEST (tpbitsCharOffsetExceeded 0 "" --enable-error-stack -d /DS08BITS -M 8,1 packedbits.h5)
ADD_H5_PBITS_TEST (tpbitsIntOffsetExceeded 0 "" --enable-error-stack -d /DS16BITS -M 16,1 packedbits.h5)
ADD_H5_PBITS_TEST (tpbitsLongOffsetExceeded 0 "" --enable-error-stack -d /DS32BITS -M 32,1 packedbits.h5)
# Bad offset, must not be negative.
ADD_H5_PBITS_TEST (tpbitsOffsetNegative 1 --enable-error-stack -d /DS08BITS -M -1,1 packedbits.h5)
ADD_H5_PBITS_TEST (tpbitsOffsetNegative 1 "Bad mask list" --enable-error-stack -d /DS08BITS -M -1,1 packedbits.h5)
# Bad length, must not be positive.
ADD_H5_PBITS_TEST (tpbitsLengthPositive 1 --enable-error-stack -d /DS08BITS -M 4,0 packedbits.h5)
ADD_H5_PBITS_TEST (tpbitsLengthPositive 1 "must be positive" --enable-error-stack -d /DS08BITS -M 4,0 packedbits.h5)
# Offset+Length is too large. Max is 8*sizeof(long long).
ADD_H5_PBITS_TEST (tpbitsLengthExceeded 1 --enable-error-stack -d /DS08BITS -M 37,28 packedbits.h5)
ADD_H5_PBITS_TEST (tpbitsCharLengthExceeded 0 --enable-error-stack -d /DS08BITS -M 2,7 packedbits.h5)
ADD_H5_PBITS_TEST (tpbitsIntLengthExceeded 0 --enable-error-stack -d /DS16BITS -M 10,7 packedbits.h5)
ADD_H5_PBITS_TEST (tpbitsLongLengthExceeded 0 --enable-error-stack -d /DS32BITS -M 26,7 packedbits.h5)
ADD_H5_PBITS_TEST (tpbitsLengthExceeded 1 "too large" --enable-error-stack -d /DS08BITS -M 37,28 packedbits.h5)
ADD_H5_PBITS_TEST (tpbitsCharLengthExceeded 0 "" --enable-error-stack -d /DS08BITS -M 2,7 packedbits.h5)
ADD_H5_PBITS_TEST (tpbitsIntLengthExceeded 0 "" --enable-error-stack -d /DS16BITS -M 10,7 packedbits.h5)
ADD_H5_PBITS_TEST (tpbitsLongLengthExceeded 0 "" --enable-error-stack -d /DS32BITS -M 26,7 packedbits.h5)
# Incomplete pair of packed bits request.
ADD_H5_PBITS_TEST (tpbitsIncomplete 1 --enable-error-stack -d /DS08BITS -M 0,2,2,1,0,2,2, packedbits.h5)
ADD_H5_PBITS_TEST (tpbitsIncomplete 1 "Bad mask list" --enable-error-stack -d /DS08BITS -M 0,2,2,1,0,2,2, packedbits.h5)

View File

@ -45,13 +45,10 @@
old_h5fc_ext2_sf.ddl
old_h5fc_ext3_isf.ddl
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
@ -266,7 +263,6 @@
set_tests_properties (H5FC_CHECK_IDX-${testname}-clean-objects PROPERTIES
FIXTURES_CLEANUP clear_H5FC-${testname}
)
add_test (
NAME H5FC-${testname}-tmpfile
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${HDF5_TOOLS_TEST_H5FC_SOURCE_DIR}/testfiles/${testfile} ./testfiles/${testname}-tmp.h5
@ -440,17 +436,20 @@
# h5format_convert nonexist.h5 (no options, file does not exist)
ADD_H5_OUTPUT (h5fc_help h5fc_help.ddl 0 "" --help)
ADD_H5_OUTPUT (h5fc_nooption h5fc_nooption.ddl 1 "")
# ADD_H5_MASK_OUTPUT (h5fc_nooption h5fc_nooption.ddl 1 "" "")
ADD_H5_OUTPUT (h5fc_nonexistfile h5fc_nonexistfile.ddl 1 "" nonexist.h5)
# ADD_H5_MASK_OUTPUT (h5fc_nonexistfile h5fc_nonexistfile.ddl 1 "unable to open file" "" nonexist.h5)
#
#
# h5format_convert -d old_h5fc_ext_none.h5 (just -d option, file exists)
# h5format_convert --dname old_h5fc_ext_none.h5 (just --dname option, file exists)
# h5format_convert --dname (just --dname option)
# h5format_convert --dname=nonexist old_h5fc_ext_none.h5 (dataset does not exist, file exists)
ADD_H5_OUTPUT (h5fc_d_file-d h5fc_d_file.ddl 1 old_h5fc_ext_none.h5 -d)
ADD_H5_OUTPUT (h5fc_d_file h5fc_d_file.ddl 1 old_h5fc_ext_none.h5 --dname)
ADD_H5_MASK_OUTPUT (h5fc_d_file-d h5fc_d_file.ddl 1 "missing file name" old_h5fc_ext_none.h5 -d)
ADD_H5_MASK_OUTPUT (h5fc_d_file h5fc_d_file.ddl 1 "missing file name" old_h5fc_ext_none.h5 --dname)
ADD_H5_OUTPUT (h5fc_dname h5fc_dname.ddl 1 "" --dname)
ADD_H5_OUTPUT (h5fc_nonexistdset_file h5fc_nonexistdset_file.ddl 1 old_h5fc_ext_none.h5 --dname=nonexist)
# ADD_H5_MASK_OUTPUT (h5fc_dname h5fc_dname.ddl 1 "missing file name" "" --dname)
ADD_H5_MASK_OUTPUT (h5fc_nonexistdset_file h5fc_nonexistdset_file.ddl 1 "unable to open dataset" old_h5fc_ext_none.h5 --dname=nonexist)
#
#
#

View File

@ -51,13 +51,6 @@
tudlink.h5
tvldtypes1.h5
)
set (LIST_ERR_TEST_FILES
nosuchfile.err
textlinksrc-nodangle-1.err
tgroup-1.err
)
set (LIST_OTHER_TEST_FILES
help-1.ls
help-2.ls
@ -136,9 +129,6 @@
foreach (listothers ${LIST_OTHER_TEST_FILES})
HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/expected/${listothers}" "${PROJECT_BINARY_DIR}/testfiles/${listothers}" "h5ls_files")
endforeach ()
foreach (listerrfiles ${LIST_ERR_TEST_FILES})
HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/errfiles/${listerrfiles}" "${PROJECT_BINARY_DIR}/testfiles/${listerrfiles}" "h5ls_files")
endforeach ()
add_custom_target(h5ls_files ALL COMMENT "Copying files needed by h5ls tests" DEPENDS ${h5ls_files_list})
##############################################################################

View File

@ -52,17 +52,6 @@
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
@ -78,10 +67,6 @@
HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/expected/${ddl_file}.ddl" "${PROJECT_BINARY_DIR}/${ddl_file}.ddl" "h5stat_files")
endforeach ()
foreach (h5_file ${HDF5_REFERENCE_ERR_FILES})
HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/expected/${h5_file}.err" "${PROJECT_BINARY_DIR}/${h5_file}.err" "h5stat_files")
endforeach ()
foreach (h5_file ${HDF5_REFERENCE_TEST_FILES})
HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/testfiles/${h5_file}" "${PROJECT_BINARY_DIR}/${h5_file}" "h5stat_files")
endforeach ()
@ -122,7 +107,7 @@
endif ()
endmacro ()
macro (ADD_H5_ERR_TEST resultfile resultcode)
macro (ADD_H5_ERR_TEST resultfile resultcode errtext)
# If using memchecker add tests without using scripts
if (HDF5_USING_ANALYSIS_TOOL)
add_test (NAME H5STAT-${resultfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5stat> ${ARGN})
@ -135,13 +120,44 @@
COMMAND "${CMAKE_COMMAND}"
-D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}"
-D "TEST_PROGRAM=$<TARGET_FILE:h5stat>"
-D "TEST_ARGS=${ARGN}"
-D "TEST_ARGS:STRING=${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_DIR}/runTest.cmake"
-D "TEST_ERRREF=${errtext}"
-D "TEST_SKIP_COMPARE=true"
-P "${HDF_RESOURCES_DIR}/grepTest.cmake"
)
endif ()
set_tests_properties (H5STAT-${resultfile} PROPERTIES
WORKING_DIRECTORY "${PROJECT_BINARY_DIR}"
)
if ("H5STAT-${resultfile}" MATCHES "${HDF5_DISABLE_TESTS_REGEX}")
set_tests_properties (H5STAT-${resultfile} PROPERTIES DISABLED true)
endif ()
endmacro ()
macro (ADD_H5_CMP_TEST resultfile resultcode errtext)
# If using memchecker add tests without using scripts
if (HDF5_USING_ANALYSIS_TOOL)
add_test (NAME H5STAT-${resultfile} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5stat> ${ARGN})
if (${resultcode})
set_tests_properties (H5STAT-${resultfile} PROPERTIES WILL_FAIL "true")
endif ()
else (HDF5_USING_ANALYSIS_TOOL)
add_test (
NAME H5STAT-${resultfile}
COMMAND "${CMAKE_COMMAND}"
-D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}"
-D "TEST_PROGRAM=$<TARGET_FILE:h5stat>"
-D "TEST_ARGS:STRING=${ARGN}"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
-D "TEST_OUTPUT=${resultfile}.out"
-D "TEST_EXPECT=${resultcode}"
-D "TEST_REFERENCE=${resultfile}.ddl"
-D "TEST_ERRREF=${errtext}"
-P "${HDF_RESOURCES_DIR}/grepTest.cmake"
)
endif ()
set_tests_properties (H5STAT-${resultfile} PROPERTIES
@ -163,8 +179,8 @@
ADD_H5_TEST (h5stat_help2 0 --help)
# Test when h5stat a file that does not exist
ADD_H5_TEST (h5stat_notexist 1 notexist.h5)
ADD_H5_TEST (h5stat_nofile 1 '')
ADD_H5_CMP_TEST (h5stat_notexist 1 "unable to open file" notexist.h5)
ADD_H5_CMP_TEST (h5stat_nofile 1 "missing file name" '')
# Test file with groups, compressed datasets, user-applied filters, etc.
# h5stat_filters.h5 is a copy of ../../testfiles/tfilters.h5 as of release 1.8.0-alpha4
@ -191,7 +207,7 @@
# -g -l 8
# --links=8
# --links=20 -g
ADD_H5_ERR_TEST (h5stat_err1_links 1 -l 0 h5stat_threshold.h5)
ADD_H5_ERR_TEST (h5stat_err1_links 1 "Invalid threshold for small groups" -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)
@ -206,7 +222,7 @@
# -d --dims=-1 (incorrect threshold value)
# -gd -m 5
# -d --di=15
ADD_H5_ERR_TEST (h5stat_err1_dims 1 -d --dims=-1 h5stat_threshold.h5)
ADD_H5_ERR_TEST (h5stat_err1_dims 1 "Invalid threshold for small datasets" -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 --dims=15 h5stat_threshold.h5)
#
@ -216,8 +232,8 @@
# -AS -a 10
# -a 1
# -A --numattrs=25
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_ERR_TEST (h5stat_err1_numattrs 1 "Invalid threshold for small # of attributes" -a -2 h5stat_threshold.h5)
ADD_H5_ERR_TEST (h5stat_err2_numattrs 1 "Invalid threshold for small # of attributes" --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)
@ -229,8 +245,8 @@
# Tests to verify HDFFV-10333:
# h5stat_err_refcount.h5 is generated by h5stat_gentest.c
# h5stat_err_old_layout.h5 and h5stat_err_old_fill.h5: see explanation in h5stat_gentest.c
ADD_H5_TEST (h5stat_err_refcount 1 h5stat_err_refcount.h5)
ADD_H5_TEST (h5stat_err_old_layout 1 h5stat_err_old_layout.h5)
ADD_H5_TEST (h5stat_err_old_fill 1 h5stat_err_old_fill.h5)
ADD_H5_CMP_TEST (h5stat_err_refcount 1 "unable to traverse objects" h5stat_err_refcount.h5)
ADD_H5_CMP_TEST (h5stat_err_old_layout 1 "unable to traverse objects" h5stat_err_old_layout.h5)
ADD_H5_CMP_TEST (h5stat_err_old_fill 1 "unable to traverse objects" h5stat_err_old_fill.h5)
#
#

View File

@ -58,10 +58,6 @@
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})
HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/testfiles/${h5_file}" "${PROJECT_BINARY_DIR}/testfiles/${h5_file}" "h5clear_files")
@ -69,9 +65,6 @@
foreach (h5_file ${HDF5_REFERENCE_TEST_FILES})
HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/expected/${h5_file}" "${PROJECT_BINARY_DIR}/testfiles/${h5_file}" "h5clear_files")
endforeach ()
foreach (h5_file ${HDF5_REFERENCE_ERR_FILES})
HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/expected/${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")