mirror of
https://github.com/HDFGroup/hdf5.git
synced 2026-09-25 04:09:44 +03:00
Generate VOL tests for h5ls (#5769)
* Generate VOL tests for h5ls * Update workflow * Rework test skipping Co-authored-by: jhendersonHDF <jhenderson@hdfgroup.org>
This commit is contained in:
@@ -191,4 +191,4 @@ jobs:
|
||||
HSDS_ENDPOINT=http+unix://%2Ftmp%2Fhs%2Fsn_1.sock \
|
||||
ROOT_DIR=${{github.workspace}}/hsdsdata \
|
||||
BUCKET_NAME=hsdstest \
|
||||
ctest --build-config ${{ inputs.build_mode }} -VV -R "h5_api" -E "H5COPY|H5DIFF" .
|
||||
ctest --build-config ${{ inputs.build_mode }} -VV -R "h5_api" -E "H5COPY|H5DIFF|H5LS" .
|
||||
|
||||
@@ -151,7 +151,38 @@ foreach (lists3file ${H5LS_S3PROXY_TEST_FILES})
|
||||
endforeach ()
|
||||
add_custom_target(h5ls_files ALL COMMENT "Copying files needed by h5ls tests" DEPENDS ${h5ls_files_list})
|
||||
|
||||
# Generate testfiles for VOL connector(s) through script, if enabled
|
||||
set(h5ls_vol_files_list "")
|
||||
foreach (external_vol_tgt ${HDF5_EXTERNAL_VOL_TARGETS})
|
||||
HDF5_GET_VOL_TGT_INFO(${external_vol_tgt} vol vol_env)
|
||||
|
||||
# Setup testfiles directory
|
||||
file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/${vol}/testfiles" RESULT)
|
||||
if (NOT ${RESULT} EQUAL 0)
|
||||
message(FATAL_ERROR "Could not create directory ${PROJECT_BINARY_DIR}/${external_vol_tgt}/testfiles")
|
||||
endif()
|
||||
|
||||
add_test(NAME ${external_vol_tgt}-h5lsgentest COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5gentest> --h5ls)
|
||||
|
||||
set_tests_properties(${external_vol_tgt}-h5lsgentest PROPERTIES
|
||||
ENVIRONMENT "${vol_env}"
|
||||
WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/${vol}/testfiles"
|
||||
FIXTURES_SETUP h5ls_vol_files
|
||||
)
|
||||
|
||||
foreach (listfiles ${LIST_HDF5_TEST_FILES_ALWAYS_COPY})
|
||||
HDFTEST_COPY_FILE("${HDF5_TOOLS_TST_DIR}/h5dump/testfiles/${listfiles}" "${PROJECT_BINARY_DIR}/${vol}/testfiles/${listfiles}" "h5ls_vol_files")
|
||||
endforeach()
|
||||
|
||||
# These aren't HDF5 files, just copy them to the VOL's subdirectory
|
||||
foreach (listothers ${LIST_OTHER_TEST_FILES})
|
||||
HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/expected/${listothers}"
|
||||
"${PROJECT_BINARY_DIR}/${vol}/testfiles/${listothers}"
|
||||
"h5ls_vol_files"
|
||||
)
|
||||
endforeach ()
|
||||
endforeach ()
|
||||
add_custom_target(h5ls_vol_files ALL COMMENT "Copying files needed by h5ls tests" DEPENDS ${h5ls_vol_files_list})
|
||||
##############################################################################
|
||||
##############################################################################
|
||||
### T H E T E S T S M A C R O S ###
|
||||
@@ -171,9 +202,14 @@ add_custom_target(h5ls_files ALL COMMENT "Copying files needed by h5ls tests" DE
|
||||
# RESULT_ERRCHECK <string> - value to pass to test script as TEST_ERRREF
|
||||
# Ignored if memchecker is enabled.
|
||||
#
|
||||
# OPTIONAL FLAGS:
|
||||
# WILL_FAIL - indicates that the test is expected to fail. Defaults to false
|
||||
# NATIVE_ONLY - only run this test with the native VOL connector
|
||||
# SKIP_TEST - Skip this test.
|
||||
#
|
||||
macro (ADD_H5_TEST testname)
|
||||
cmake_parse_arguments(ARG
|
||||
"" # flags
|
||||
"WILL_FAIL;SKIP_TEST;NATIVE_ONLY" # flags
|
||||
"RESULT_CODE;RESULT_ERRCHECK" # one-value args
|
||||
"" # multi-value args
|
||||
${ARGN}
|
||||
@@ -184,37 +220,80 @@ macro (ADD_H5_TEST testname)
|
||||
message (FATAL_ERROR "ADD_H5_TEST: RESULT_CODE parameter required")
|
||||
endif ()
|
||||
|
||||
# If using memchecker add tests without using scripts
|
||||
if (HDF5_ENABLE_USING_MEMCHECKER)
|
||||
add_test (NAME H5LS-${testname} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5ls> ${ARG_UNPARSED_ARGUMENTS})
|
||||
set_tests_properties (H5LS-${testname} PROPERTIES
|
||||
WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles"
|
||||
)
|
||||
if ("${ARG_RESULT_CODE}" STREQUAL "1")
|
||||
set_tests_properties (H5LS-${testname} PROPERTIES WILL_FAIL "true")
|
||||
if (${ARG_NATIVE_ONLY})
|
||||
set(num_ext_vols 0)
|
||||
else()
|
||||
list(LENGTH HDF5_EXTERNAL_VOL_TARGETS num_ext_vols)
|
||||
endif ()
|
||||
|
||||
# Add a test for the native connector and each external VOL connector
|
||||
foreach (vol_idx RANGE 0 ${num_ext_vols})
|
||||
# First, populate VOL info to be passed to tests
|
||||
if (${vol_idx} EQUAL 0)
|
||||
set(vol "native")
|
||||
set(vol_prefix "")
|
||||
set(vol_workdir "${PROJECT_BINARY_DIR}/testfiles")
|
||||
else ()
|
||||
# An external VOL connector
|
||||
set(vol_env "")
|
||||
|
||||
math(EXPR vol_idx_fixed "${vol_idx} - 1")
|
||||
list(GET HDF5_EXTERNAL_VOL_TARGETS ${vol_idx_fixed} ext_vol_tgt)
|
||||
HDF5_GET_VOL_TGT_INFO(${ext_vol_tgt} vol vol_env)
|
||||
|
||||
set (vol_prefix "HDF5_VOL_${vol}-")
|
||||
set (vol_workdir "${PROJECT_BINARY_DIR}/${vol}/testfiles")
|
||||
endif ()
|
||||
else ()
|
||||
# Remove any output file left over from previous test run
|
||||
add_test (
|
||||
NAME H5LS-${testname}
|
||||
COMMAND "${CMAKE_COMMAND}"
|
||||
-D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}"
|
||||
-D "TEST_PROGRAM=$<TARGET_FILE:h5ls>"
|
||||
-D "TEST_ARGS=${ARG_UNPARSED_ARGUMENTS}"
|
||||
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles"
|
||||
-D "TEST_OUTPUT=${testname}.out"
|
||||
-D "TEST_EXPECT=${ARG_RESULT_CODE}"
|
||||
-D "TEST_ERRREF=${ARG_RESULT_ERRCHECK}"
|
||||
-D "TEST_REFERENCE=${testname}.ls"
|
||||
-P "${HDF_RESOURCES_DIR}/runTest.cmake"
|
||||
|
||||
|
||||
# If using memchecker add tests without using scripts
|
||||
if (HDF5_ENABLE_USING_MEMCHECKER)
|
||||
add_test (NAME ${vol_prefix}H5LS-${testname} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5ls> ${ARG_UNPARSED_ARGUMENTS})
|
||||
|
||||
if ("${ARG_RESULT_CODE}" STREQUAL "1")
|
||||
set_tests_properties (${vol_prefix}H5LS-${testname} PROPERTIES WILL_FAIL "true")
|
||||
endif ()
|
||||
else ()
|
||||
# Remove any output file left over from previous test run
|
||||
add_test (
|
||||
NAME ${vol_prefix}H5LS-${testname}
|
||||
COMMAND "${CMAKE_COMMAND}"
|
||||
-D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}"
|
||||
-D "TEST_PROGRAM=$<TARGET_FILE:h5ls>"
|
||||
-D "TEST_ARGS=${ARG_UNPARSED_ARGUMENTS}"
|
||||
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles"
|
||||
-D "TEST_OUTPUT=${testname}.out"
|
||||
-D "TEST_EXPECT=${ARG_RESULT_CODE}"
|
||||
-D "TEST_ERRREF=${ARG_RESULT_ERRCHECK}"
|
||||
-D "TEST_REFERENCE=${testname}.ls"
|
||||
-P "${HDF_RESOURCES_DIR}/runTest.cmake"
|
||||
)
|
||||
endif ()
|
||||
|
||||
if (${ARG_WILL_FAIL})
|
||||
set_tests_properties (${vol_prefix}H5LS-${testname} PROPERTIES WILL_FAIL "true")
|
||||
endif ()
|
||||
|
||||
set_tests_properties (${vol_prefix}H5LS-${testname} PROPERTIES
|
||||
WORKING_DIRECTORY "${vol_workdir}"
|
||||
)
|
||||
endif ()
|
||||
set_tests_properties (H5LS-${testname} PROPERTIES
|
||||
WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles"
|
||||
)
|
||||
if ("H5LS-${testname}" MATCHES "${HDF5_DISABLE_TESTS_REGEX}")
|
||||
set_tests_properties (H5LS-${testname} PROPERTIES DISABLED true)
|
||||
endif ()
|
||||
|
||||
if ("${vol_prefix}H5LS-${testname}" MATCHES "${HDF5_DISABLE_TESTS_REGEX}")
|
||||
set_tests_properties (${vol_prefix}H5LS-${testname} PROPERTIES DISABLED true)
|
||||
endif ()
|
||||
|
||||
if (NOT "${vol}" STREQUAL "native")
|
||||
set_tests_properties (${vol_prefix}H5LS-${testname} PROPERTIES
|
||||
ENVIRONMENT "${vol_env}"
|
||||
FIXTURES_REQUIRED h5ls_vol_files
|
||||
)
|
||||
endif ()
|
||||
|
||||
if (${ARG_SKIP_TEST})
|
||||
set_tests_properties( ${vol_prefix}H5LS-${testname} PROPERTIES DISABLED true)
|
||||
endif()
|
||||
|
||||
endforeach() # per-VOL loop
|
||||
endmacro ()
|
||||
|
||||
macro (ADD_H5_UD_TEST testname resultcode resultfile)
|
||||
@@ -376,22 +455,18 @@ if (${${HDF_PREFIX}_HAVE__FLOAT16})
|
||||
# rather than "IEEE 16-bit little-endian float".
|
||||
if (H5_WORDS_BIGENDIAN)
|
||||
ADD_H5_TEST (tfloat16_be RESULT_CODE 0 -w80 -v tfloat16_be.h5)
|
||||
ADD_H5_TEST (tfloat16_be_nosupport RESULT_CODE 0 -w80 -v tfloat16_be.h5)
|
||||
set_tests_properties (H5LS-tfloat16_be_nosupport PROPERTIES WILL_FAIL "true")
|
||||
ADD_H5_TEST (tfloat16_be_nosupport RESULT_CODE 0 -w80 -v tfloat16_be.h5 WILL_FAIL)
|
||||
else ()
|
||||
ADD_H5_TEST (tfloat16 RESULT_CODE 0 -w80 -v tfloat16.h5)
|
||||
ADD_H5_TEST (tfloat16_nosupport RESULT_CODE 0 -w80 -v tfloat16.h5)
|
||||
set_tests_properties (H5LS-tfloat16_nosupport PROPERTIES WILL_FAIL "true")
|
||||
ADD_H5_TEST (tfloat16_nosupport RESULT_CODE 0 -w80 -v tfloat16.h5 WILL_FAIL)
|
||||
endif ()
|
||||
else ()
|
||||
# If support is NOT available for _Float16 type, the first two tests
|
||||
# will fail as the types will be printed out as
|
||||
# "IEEE 16-bit little-endian float" and "IEEE 16-bit big-endian float"
|
||||
# rather than "native _Float16"
|
||||
ADD_H5_TEST (tfloat16 RESULT_CODE 0 -w80 -v tfloat16.h5)
|
||||
set_tests_properties (H5LS-tfloat16 PROPERTIES WILL_FAIL "true")
|
||||
ADD_H5_TEST (tfloat16_be RESULT_CODE 0 -w80 -v tfloat16_be.h5)
|
||||
set_tests_properties (H5LS-tfloat16_be PROPERTIES WILL_FAIL "true")
|
||||
ADD_H5_TEST (tfloat16 RESULT_CODE 0 -w80 -v tfloat16.h5 WILL_FAIL)
|
||||
ADD_H5_TEST (tfloat16_be RESULT_CODE 0 -w80 -v tfloat16_be.h5 WILL_FAIL)
|
||||
ADD_H5_TEST (tfloat16_nosupport RESULT_CODE 0 -w80 -v tfloat16.h5)
|
||||
ADD_H5_TEST (tfloat16_be_nosupport RESULT_CODE 0 -w80 -v tfloat16_be.h5)
|
||||
endif ()
|
||||
@@ -403,12 +478,10 @@ if (${${HDF_PREFIX}_HAVE_COMPLEX_NUMBERS})
|
||||
# for example, rather than "complex number of native float".
|
||||
if (H5_WORDS_BIGENDIAN)
|
||||
ADD_H5_TEST (tcomplex_be RESULT_CODE 0 -w80 -v tcomplex_be.h5)
|
||||
ADD_H5_TEST (tcomplex_be_nosupport RESULT_CODE 0 -w80 -v tcomplex_be.h5)
|
||||
set_tests_properties (H5LS-tcomplex_be_nosupport PROPERTIES WILL_FAIL "true")
|
||||
ADD_H5_TEST (tcomplex_be_nosupport RESULT_CODE 0 -w80 -v tcomplex_be.h5 WILL_FAIL)
|
||||
else ()
|
||||
ADD_H5_TEST (tcomplex RESULT_CODE 0 -w80 -v tcomplex.h5)
|
||||
ADD_H5_TEST (tcomplex_nosupport RESULT_CODE 0 -w80 -v tcomplex.h5)
|
||||
set_tests_properties (H5LS-tcomplex_nosupport PROPERTIES WILL_FAIL "true")
|
||||
ADD_H5_TEST (tcomplex_nosupport RESULT_CODE 0 -w80 -v tcomplex.h5 WILL_FAIL)
|
||||
endif ()
|
||||
else ()
|
||||
# If support is NOT available for complex numbers, the first two tests
|
||||
@@ -418,25 +491,21 @@ else ()
|
||||
# depending on the endian-ness of the machine, as the types will be printed
|
||||
# out as "complex number of IEEE 32-bit little-endian float", for example,
|
||||
# rather than "complex number of native float".
|
||||
ADD_H5_TEST (tcomplex RESULT_CODE 0 -w80 -v tcomplex.h5)
|
||||
set_tests_properties (H5LS-tcomplex PROPERTIES WILL_FAIL "true")
|
||||
ADD_H5_TEST (tcomplex_be RESULT_CODE 0 -w80 -v tcomplex_be.h5)
|
||||
set_tests_properties (H5LS-tcomplex_be PROPERTIES WILL_FAIL "true")
|
||||
ADD_H5_TEST (tcomplex RESULT_CODE 0 -w80 -v tcomplex.h5 WILL_FAIL)
|
||||
ADD_H5_TEST (tcomplex_be RESULT_CODE 0 -w80 -v tcomplex_be.h5 WILL_FAIL)
|
||||
|
||||
if (H5_WORDS_BIGENDIAN)
|
||||
ADD_H5_TEST (tcomplex_nosupport RESULT_CODE 0 -w80 -v tcomplex.h5)
|
||||
set_tests_properties (H5LS-tcomplex_nosupport PROPERTIES WILL_FAIL "true")
|
||||
ADD_H5_TEST (tcomplex_nosupport RESULT_CODE 0 -w80 -v tcomplex.h5 WILL_FAIL)
|
||||
ADD_H5_TEST (tcomplex_be_nosupport RESULT_CODE 0 -w80 -v tcomplex_be.h5)
|
||||
else ()
|
||||
ADD_H5_TEST (tcomplex_nosupport RESULT_CODE 0 -w80 -v tcomplex.h5)
|
||||
ADD_H5_TEST (tcomplex_be_nosupport RESULT_CODE 0 -w80 -v tcomplex_be.h5)
|
||||
set_tests_properties (H5LS-tcomplex_be_nosupport PROPERTIES WILL_FAIL "true")
|
||||
ADD_H5_TEST (tcomplex_be_nosupport RESULT_CODE 0 -w80 -v tcomplex_be.h5 WILL_FAIL)
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
# test for wildcards in filename (does not work with cmake)
|
||||
# ADD_H5_TEST (tstarfile RESULT_CODE 0 -w80 t*link.h5)
|
||||
# ADD_H5_TEST (tqmarkfile RESULT_CODE 0 -w80 t?link.h5)
|
||||
ADD_H5_TEST (tstarfile RESULT_CODE 0 -w80 t*link.h5 SKIP_TEST)
|
||||
ADD_H5_TEST (tqmarkfile RESULT_CODE 0 -w80 t?link.h5 SKIP_TEST)
|
||||
ADD_H5_TEST (tmultifile RESULT_CODE 0 -w80 thlink.h5 tslink.h5)
|
||||
|
||||
# tests for hard links
|
||||
@@ -461,7 +530,7 @@ ADD_H5_TEST (tloop-1 RESULT_CODE 0 -w80 -r -d tloop.h5)
|
||||
ADD_H5_TEST (tstr-1 RESULT_CODE 0 -w80 -r -d tstr.h5)
|
||||
|
||||
# test test file created from lib SAF team
|
||||
ADD_H5_TEST (tsaf RESULT_CODE 0 -w80 -r -d tsaf.h5)
|
||||
ADD_H5_TEST (tsaf RESULT_CODE 0 -w80 -r -d tsaf.h5 NATIVE_ONLY)
|
||||
|
||||
# test for variable length data types
|
||||
ADD_H5_TEST (tvldtypes1 RESULT_CODE 0 -w80 -r -d tvldtypes1.h5)
|
||||
|
||||
Reference in New Issue
Block a user