summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorAllen Byrne <50328838+byrnHDF@users.noreply.github.com>2023-03-23 00:37:04 (GMT)
committerGitHub <noreply@github.com>2023-03-23 00:37:04 (GMT)
commit7b4387df4322c3a953f5747c3ffbf907875ca815 (patch)
treea2f3147456059ebb06b3fbe9675c5fc83b87863a /test
parent98728706dd800e365cee6f601873b515e5f8822c (diff)
downloadhdf5-7b4387df4322c3a953f5747c3ffbf907875ca815.zip
hdf5-7b4387df4322c3a953f5747c3ffbf907875ca815.tar.gz
hdf5-7b4387df4322c3a953f5747c3ffbf907875ca815.tar.bz2
Merge CMake cleanup process from develop (#2622)
* Merge CMake cleanup process from develop * Update test script files
Diffstat (limited to 'test')
-rw-r--r--test/CMakeTests.cmake410
-rw-r--r--test/CMakeVFDTests.cmake48
-rw-r--r--test/ShellTests.cmake24
-rw-r--r--test/test_mirror.sh.in13
-rw-r--r--test/test_plugin.sh.in5
-rw-r--r--test/test_swmr.pwsh.in519
-rw-r--r--test/test_swmr.sh.in47
-rw-r--r--test/test_vds_swmr.pwsh.in190
8 files changed, 971 insertions, 285 deletions
diff --git a/test/CMakeTests.cmake b/test/CMakeTests.cmake
index 6ee9981..bbb9372 100644
--- a/test/CMakeTests.cmake
+++ b/test/CMakeTests.cmake
@@ -213,6 +213,12 @@ add_test (
WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST
)
set_tests_properties (H5TEST-testhdf5-clear-objects PROPERTIES FIXTURES_SETUP clear_testhdf5)
+add_test (
+ NAME H5TEST-testhdf5-clean-objects
+ COMMAND ${CMAKE_COMMAND} -E remove ${testhdf5_CLEANFILES}
+ WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST
+)
+set_tests_properties (H5TEST-testhdf5-clean-objects PROPERTIES FIXTURES_CLEANUP clear_testhdf5)
add_test (NAME H5TEST-testhdf5-base COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:testhdf5> -x file -x select)
set_tests_properties (H5TEST-testhdf5-base PROPERTIES
@@ -240,228 +246,94 @@ set_tests_properties (H5TEST-testhdf5-select PROPERTIES
##############################################################################
set (test_CLEANFILES
- accum.h5
- cmpd_dset.h5
- compact_dataset.h5
- dataset.h5
- dset_offset.h5
- max_compact_dataset.h5
- simple.h5
- set_local.h5
- random_chunks.h5
- huge_chunks.h5
- chunk_cache.h5
- big_chunk.h5
- chunk_fast.h5
- chunk_expand.h5
- chunk_fixed.h5
- copy_dcpl_newfile.h5
- partial_chunks.h5
- layout_extend.h5
- zero_chunk.h5
- chunk_single.h5
- swmr_non_latest.h5
- earray_hdr_fd.h5
- farray_hdr_fd.h5
- bt2_hdr_fd.h5
- storage_size.h5
- dls_01_strings.h5
- extend.h5
- istore.h5
- extlinks*.h5
- frspace.h5
- links*.h5
- sys_file1
- tfile*.h5
- th5s*.h5
- lheap.h5
- fheap.h5
- ohdr.h5
- ohdr_min_a.h5
- ohdr_min_b.h5
- min_dset_ohdr_testfile.h5
- stab.h5
- extern_*.h5
- extern_*.raw
- gheap*.h5
- dt_arith1
- dt_arith2
- links.h5
- links*.h5
- extlinks16A00000.h5
- extlinks16A00001.h5
- extlinks16A00002.h5
- extlinks16B-b.h5
- extlinks16B-g.h5
- extlinks16B-l.h5
- extlinks16B-r.h5
- extlinks16B-s.h5
- extlinks19B00000.h5
- extlinks19B00001.h5
- extlinks19B00002.h5
- extlinks19B00003.h5
- extlinks19B00004.h5
- extlinks19B00005.h5
- extlinks19B00006.h5
- extlinks19B00007.h5
- extlinks19B00008.h5
- extlinks19B00009.h5
- extlinks19B00010.h5
- extlinks19B00011.h5
- extlinks19B00012.h5
- extlinks19B00013.h5
- extlinks19B00014.h5
- extlinks19B00015.h5
- extlinks19B00016.h5
- extlinks19B00017.h5
- extlinks19B00018.h5
- extlinks19B00019.h5
- extlinks19B00020.h5
- extlinks19B00021.h5
- extlinks19B00022.h5
- extlinks19B00023.h5
- extlinks19B00024.h5
- extlinks19B00025.h5
- extlinks19B00026.h5
- extlinks19B00027.h5
- extlinks19B00028.h5
- big.data
- big*.h5
- stdio.h5
- sec2.h5
- dtypes0.h5
- dtypes1.h5
- dtypes2.h5
- dtypes3.h5
- dtypes4.h5
- dtypes5.h5
- dtypes6.h5
- dtypes7.h5
- dtypes8.h5
- dtypes9.h5
- dtypes10.h5
+ cmpd_dtransform.h5
+ direct_chunk.h5
dt_arith1.h5
dt_arith2.h5
- tattr.h5
- tselect.h5
- mtime.h5
- unlink.h5
- unicode.h5
- coord.h5
- fillval_*.h5
- fillval.raw
- mount_*.h5
- testmeta.h5
- ttime.h5
- trefer1.h5
- trefer2.h5
- trefer3.h5
- tvltypes.h5
- tvlstr.h5
- tvlstr2.h5
- twriteorder.dat
- enum1.h5
- titerate.h5
- ttsafe.h5
- tarray1.h5
- tgenprop.h5
- tmisc*.h5
- set_extent1.h5
- set_extent2.h5
- set_extent3.h5
- set_extent4.h5
- set_extent5.h5
- ext1.bin
- ext2.bin
- getname.h5
- getname1.h5
- getname2.h5
- getname3.h5
- sec2_file.h5
- direct_file.h5
- family_file000*.h5
- new_family_v16_000*.h5
- multi_file-r.h5
- multi_file-s.h5
- core_file
- filter_plugin.h5
- new_move_a.h5
- new_move_b.h5
- ntypes.h5
- dangle.h5
- error_test.h5
- err_compat.h5
dtransform.h5
- test_filters.h5
- get_file_name.h5
+ dtypes3.h5
+ dtypes4.h5
+ min_dset_ohdr_testfile.h5
+ ohdr_min_a.h5
+ sec2_file.h5
+ single_latest.h5
+ source_file.h5
+ splitter_rw_file.h5
+ splitter_tmp.h5
+ splitter_wo_file.h5
+ stdio_file.h5
+ swmr0.h5
+ tfile_is_accessible_non_hdf5.h5
+ tfile_is_accessible.h5
+ tfile1.h5.h5
+ tfile8.h5
+ tfile8.h5.h5
+ tmisc15.h5.h5
tstint1.h5
tstint2.h5
- unlink_chunked.h5
- btree2.h5
- btree2_tmp.h5
- objcopy_src.h5
- objcopy_dst.h5
+ tverbounds_dtype.h5
+ virtual_file1.h5
objcopy_ext.dat
- trefer1.h5
- trefer2.h5
- app_ref.h5
- farray.h5
- farray_tmp.h5
- earray.h5
- earray_tmp.h5
- efc0.h5
- efc1.h5
- efc2.h5
- efc3.h5
- efc4.h5
- efc5.h5
log_vfd_out.log
- new_multi_file_v16-r.h5
- new_multi_file_v16-s.h5
- split_get_file_image_test-m.h5
- split_get_file_image_test-r.h5
- file_image_core_test.h5.copy
- unregister_filter_1.h5
- unregister_filter_2.h5
- vds_virt.h5
- vds_dapl.h5
- vds_src_0.h5
- vds_src_1.h5
- swmr_data.h5
- use_use_append_chunk.h5
- use_append_mchunks.h5
- use_disable_mdc_flushes.h5
- tbogus.h5.copy
- flushrefresh.h5
- flushrefresh_VERIFICATION_START
- flushrefresh_VERIFICATION_CHECKPOINT1
- flushrefresh_VERIFICATION_CHECKPOINT2
- flushrefresh_VERIFICATION_DONE
- filenotclosed.h5
- del_many_dense_attrs.h5
- atomic_data
- accum_swmr_big.h5
- ohdr_swmr.h5
- test_swmr*.h5
- cache_logging.h5
- cache_logging.out
- vds_swmr.h5
- vds_swmr_src_*.h5
- tmp_vds_env/vds_src_2.h5
- direct_chunk.h5
- splitter*.h5
splitter.log
- mirror_rw/*
- mirror_wo/*
+ tbogus.h5.copy
+ tmp_vds/vds_src_2.h5
+)
+
+set (EXTLINKS_CLEANFILES
+ extlinks16A-000000.h5
+ extlinks16A-000001.h5
+ extlinks16B-b.h5
+ extlinks16B-g.h5
+ extlinks16B-l.h5
+ extlinks16B-r.h5
+ extlinks16B-s.h5
+ extlinks19B-000000.h5
+ extlinks19B-000001.h5
+ extlinks19B-000002.h5
+ extlinks19B-000003.h5
+ extlinks19B-000004.h5
+ extlinks19B-000005.h5
+ extlinks19B-000006.h5
+ extlinks19B-000007.h5
+ extlinks19B-000008.h5
+ extlinks19B-000009.h5
+ extlinks19B-000010.h5
+ extlinks19B-000011.h5
+ extlinks19B-000012.h5
+ extlinks19B-000013.h5
+ extlinks19B-000014.h5
+ extlinks19B-000015.h5
+ extlinks19B-000016.h5
+ extlinks19B-000017.h5
+ extlinks19B-000018.h5
+ extlinks19B-000019.h5
+ extlinks19B-000020.h5
+ extlinks19B-000021.h5
+ extlinks19B-000022.h5
+ extlinks19B-000023.h5
+ extlinks19B-000024.h5
+ extlinks19B-000025.h5
+ extlinks19B-000026.h5
+ extlinks19B-000027.h5
+ extlinks19B-000028.h5
)
# Remove any output file left over from previous test run
add_test (
NAME H5TEST-clear-objects
- COMMAND ${CMAKE_COMMAND} -E remove ${test_CLEANFILES}
+ COMMAND ${CMAKE_COMMAND} -E remove ${test_CLEANFILES} ${EXTLINKS_CLEANFILES}
+ COMMAND_EXPAND_LISTS
WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST
)
set_tests_properties (H5TEST-clear-objects PROPERTIES FIXTURES_SETUP clear_H5TEST)
+add_test (
+ NAME H5TEST-clean-objects
+ COMMAND ${CMAKE_COMMAND} -E remove ${test_CLEANFILES} ${EXTLINKS_CLEANFILES}
+ COMMAND_EXPAND_LISTS
+ WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST
+)
+set_tests_properties (H5TEST-clean-objects PROPERTIES FIXTURES_CLEANUP clear_H5TEST)
set (H5TEST_SEPARATE_TESTS
testhdf5
@@ -477,7 +349,7 @@ foreach (h5_test ${H5_TESTS})
if (HDF5_ENABLE_USING_MEMCHECKER)
add_test (NAME H5TEST-${h5_test} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:${h5_test}>)
set_tests_properties (H5TEST-${h5_test} PROPERTIES
- FIXTURES_REQUIRED clear_objects
+ FIXTURES_REQUIRED clear_H5TEST
ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST"
WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST
)
@@ -518,10 +390,18 @@ set_tests_properties (H5TEST-objcopy PROPERTIES TIMEOUT ${CTEST_VERY_LONG_TIMEOU
if (NOT CYGWIN)
add_test (
NAME H5TEST-cache-clear-objects
- COMMAND ${CMAKE_COMMAND} -E remove cache_test.h5
+ COMMAND ${CMAKE_COMMAND} -E remove
+ cache_test.h5
WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST
)
set_tests_properties (H5TEST-cache-clear-objects PROPERTIES FIXTURES_SETUP clear_cache)
+ add_test (
+ NAME H5TEST-cache-clean-objects
+ COMMAND ${CMAKE_COMMAND} -E remove
+ cache_test.h5
+ WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST
+ )
+ set_tests_properties (H5TEST-cache-clean-objects PROPERTIES FIXTURES_CLEANUP clear_cache)
if (HDF5_ENABLE_USING_MEMCHECKER)
add_test (NAME H5TEST-cache COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:cache>)
else ()
@@ -553,6 +433,12 @@ if (TEST_CACHE_IMAGE)
WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST
)
set_tests_properties (H5TEST-cache_image-clear-objects PROPERTIES FIXTURES_SETUP clear_cache_image)
+ add_test (
+ NAME H5TEST-cache_image-clean-objects
+ COMMAND ${CMAKE_COMMAND} -E remove cache_image_test.h5
+ WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST
+ )
+ set_tests_properties (H5TEST-cache_image-clean-objects PROPERTIES FIXTURES_CLEANUP clear_cache_image)
add_test (NAME H5TEST_cache_image COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:cache_image>)
set_tests_properties (H5TEST-cache_image PROPERTIES
FIXTURES_REQUIRED clear_cache_image
@@ -562,21 +448,28 @@ if (TEST_CACHE_IMAGE)
endif ()
#-- Adding test for external_env
+set (H5TEST_EXTERNAL_CLEANFILES
+ extern_1r.raw
+ extern_2r.raw
+ extern_3r.raw
+ extern_4r.raw
+ extern_1w.raw
+ extern_2w.raw
+ extern_3w.raw
+ extern_4w.raw
+)
add_test (
NAME H5TEST-external_env-clear-objects
- COMMAND ${CMAKE_COMMAND} -E remove
- extern_1r.raw
- extern_2r.raw
- extern_3r.raw
- extern_4r.raw
- extern_1w.raw
- extern_2w.raw
- extern_3w.raw
- extern_4w.raw
- WORKING_DIRECTORY
- ${HDF5_TEST_BINARY_DIR}/H5TEST
+ COMMAND ${CMAKE_COMMAND} -E remove ${H5TEST_EXTERNAL_CLEANFILES}
+ WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST
)
set_tests_properties (H5TEST-external_env-clear-objects PROPERTIES FIXTURES_SETUP clear_external_env)
+add_test (
+ NAME H5TEST-external_env-clean-objects
+ COMMAND ${CMAKE_COMMAND} -E remove ${H5TEST_EXTERNAL_CLEANFILES}
+ WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST
+)
+set_tests_properties (H5TEST-external_env-clean-objects PROPERTIES FIXTURES_CLEANUP clear_external_env)
if (HDF5_ENABLE_USING_MEMCHECKER)
add_test (NAME H5TEST-external_env COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:external_env>)
else ()
@@ -602,15 +495,13 @@ set_tests_properties (H5TEST-external_env PROPERTIES
#-- Adding test for vds_env
add_test (
- NAME H5TEST-vds_env-clear-objects
+ NAME H5TEST-vds_env-clean-objects
COMMAND ${CMAKE_COMMAND} -E remove
- vds_virt_0.h5
- vds_virt_3.h5
- vds_src_2.h5
+ tmp_vds_env/vds_env_src_2.h5
WORKING_DIRECTORY
${HDF5_TEST_BINARY_DIR}/H5TEST
)
-set_tests_properties (H5TEST-vds_env-clear-objects PROPERTIES FIXTURES_SETUP clear_vds_env)
+set_tests_properties (H5TEST-vds_env-clean-objects PROPERTIES FIXTURES_CLEANUP clear_vds_env)
if (HDF5_ENABLE_USING_MEMCHECKER)
add_test (NAME H5TEST-vds_env COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:vds_env>)
else ()
@@ -635,20 +526,26 @@ set_tests_properties (H5TEST-vds_env PROPERTIES
)
#-- Adding test for flush1/2
+set (FLUSH_CLEANFILES
+ flush.h5
+ flush-swmr.h5
+ noflush.h5
+ noflush-swmr.h5
+ flush_extend.h5
+ flush_extend-swmr.h5
+ noflush_extend.h5
+ noflush_extend-swmr.h5
+)
add_test (NAME H5TEST-flush-clear-objects
- COMMAND ${CMAKE_COMMAND} -E remove
- flush.h5
- flush-swmr.h5
- noflush.h5
- noflush-swmr.h5
- flush_extend.h5
- flush_extend-swmr.h5
- noflush_extend.h5
- noflush_extend-swmr.h5
- WORKING_DIRECTORY
- ${HDF5_TEST_BINARY_DIR}/H5TEST
+ COMMAND ${CMAKE_COMMAND} -E remove ${FLUSH_CLEANFILES}
+ WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST
)
set_tests_properties (H5TEST-flush-clear-objects PROPERTIES FIXTURES_SETUP clear_flush)
+add_test (NAME H5TEST-flush-clean-objects
+ COMMAND ${CMAKE_COMMAND} -E remove ${FLUSH_CLEANFILES}
+ WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST
+)
+set_tests_properties (H5TEST-flush-clean-objects PROPERTIES FIXTURES_CLEANUP clear_flush)
if (HDF5_ENABLE_USING_MEMCHECKER)
add_test (NAME H5TEST-flush1 COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:flush1>)
else ()
@@ -743,6 +640,12 @@ add_test (
WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST
)
set_tests_properties (H5TEST-filenotclosed-clear-objects PROPERTIES FIXTURES_SETUP clear_filenotclosed)
+add_test (
+ NAME H5TEST-filenotclosed-clean-objects
+ COMMAND ${CMAKE_COMMAND} -E remove filenotclosed.h5
+ WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST
+)
+set_tests_properties (H5TEST-filenotclosed-clean-objects PROPERTIES FIXTURES_CLEANUP clear_filenotclosed)
add_test (NAME H5TEST-filenotclosed COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:filenotclosed>)
set_tests_properties (H5TEST-filenotclosed PROPERTIES
FIXTURES_REQUIRED clear_filenotclosed
@@ -757,6 +660,12 @@ add_test (
WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST
)
set_tests_properties (H5TEST-del_many_dense_attrs-clear-objects PROPERTIES FIXTURES_SETUP clear_del_many_dense_attrs)
+add_test (
+ NAME H5TEST-del_many_dense_attrs-clean-objects
+ COMMAND ${CMAKE_COMMAND} -E remove del_many_dense_attrs.h5
+ WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST
+)
+set_tests_properties (H5TEST-del_many_dense_attrs-clean-objects PROPERTIES FIXTURES_CLEANUP clear_del_many_dense_attrs)
add_test (NAME H5TEST-del_many_dense_attrs COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:del_many_dense_attrs>)
set_tests_properties (H5TEST-del_many_dense_attrs PROPERTIES
FIXTURES_REQUIRED clear_del_many_dense_attrs
@@ -836,6 +745,14 @@ else ()
ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST;HDF5_PLUGIN_PRELOAD=::"
WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST
)
+ add_test (
+ NAME H5TEST-error_test-clean-objects
+ COMMAND ${CMAKE_COMMAND} -E remove error_test.txt
+ )
+ set_tests_properties (H5TEST-error_test-clean-objects PROPERTIES
+ DEPENDS H5TEST-error_test
+ WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST
+ )
endif ()
#-- Adding test for links_env
@@ -848,6 +765,15 @@ add_test (NAME H5TEST-links_env-clear-objects
${HDF5_TEST_BINARY_DIR}/H5TEST
)
set_tests_properties (H5TEST-links_env-clear-objects PROPERTIES FIXTURES_SETUP clear_links_env)
+add_test (NAME H5TEST-links_env-clean-objects
+ COMMAND ${CMAKE_COMMAND} -E remove
+ extlinks_env0.h5
+ extlinks_env1.h5
+ tmp_links_env/extlinks_env1.h5
+ WORKING_DIRECTORY
+ ${HDF5_TEST_BINARY_DIR}/H5TEST
+)
+set_tests_properties (H5TEST-links_env-clean-objects PROPERTIES FIXTURES_CLEANUP clear_links_env)
if (HDF5_ENABLE_USING_MEMCHECKER)
add_test (NAME H5TEST-links_env COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:links_env>)
else ()
@@ -933,10 +859,20 @@ if (ENABLE_EXTENDED_TESTS)
if (H5_PERL_FOUND)
add_test (
NAME H5TEST-testflushrefresh-clear-objects
- COMMAND ${CMAKE_COMMAND} -E remove flushrefresh.h5
+ COMMAND ${CMAKE_COMMAND} -E remove
+ flushrefresh.h5
+ flushrefresh_test/flushrefresh.h5
WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST/flushrefresh_test
)
set_tests_properties (H5TEST-testflushrefresh-clear-objects PROPERTIES FIXTURES_SETUP clear_testflushrefresh)
+ add_test (
+ NAME H5TEST-testflushrefresh-clean-objects
+ COMMAND ${CMAKE_COMMAND} -E remove
+ flushrefresh.h5
+ flushrefresh_test/flushrefresh.h5
+ WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST/flushrefresh_test
+ )
+ set_tests_properties (H5TEST-testflushrefresh-clean-objects PROPERTIES FIXTURES_CLEANUP clear_testflushrefresh)
add_test (NAME H5TEST-testflushrefresh COMMAND "${CMAKE_COMMAND}"
-D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}"
-D "TEST_PROGRAM=$<TARGET_FILE:flushrefresh>"
@@ -980,7 +916,7 @@ endif ()
if (HDF5_BUILD_GENERATORS AND BUILD_STATIC_LIBS)
macro (ADD_H5_GENERATOR genfile)
add_executable (${genfile} ${HDF5_TEST_SOURCE_DIR}/${genfile}.c)
- target_include_directories (${genfile} PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ target_include_directories (${genfile} PRIVATE "${HDF5_SRC_INCLUDE_DIRS};${HDF5_SRC_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
TARGET_C_PROPERTIES (${genfile} STATIC)
target_link_libraries (${genfile} PRIVATE ${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET})
set_target_properties (${genfile} PROPERTIES FOLDER generator/test)
diff --git a/test/CMakeVFDTests.cmake b/test/CMakeVFDTests.cmake
index 87683fa..32877a4 100644
--- a/test/CMakeVFDTests.cmake
+++ b/test/CMakeVFDTests.cmake
@@ -138,21 +138,23 @@ add_custom_target(HDF5_VFDTEST_LIB_files ALL COMMENT "Copying files needed by HD
endmacro ()
macro (DO_VFD_TEST vfdtest vfdname resultcode)
- add_test (NAME VFD-${vfdname}-${vfdtest}
- COMMAND "${CMAKE_COMMAND}"
- -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}"
- -D "TEST_PROGRAM=$<TARGET_FILE:${vfdtest}>"
- -D "TEST_ARGS:STRING="
- -D "TEST_VFD:STRING=${vfdname}"
- -D "TEST_EXPECT=${resultcode}"
- -D "TEST_OUTPUT=${vfdname}-${vfdtest}.out"
- -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/${vfdname}"
- -P "${HDF_RESOURCES_DIR}/vfdTest.cmake"
- )
- set_tests_properties (VFD-${vfdname}-${vfdtest} PROPERTIES
- ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${vfdname}"
- WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${vfdname}
- )
+ if (NOT "${vfdtest}" IN_LIST H5_VFD_${vfdname}_SKIP_TESTS)
+ add_test (NAME VFD-${vfdname}-${vfdtest}
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:${vfdtest}>"
+ -D "TEST_ARGS:STRING="
+ -D "TEST_VFD:STRING=${vfdname}"
+ -D "TEST_EXPECT=${resultcode}"
+ -D "TEST_OUTPUT=${vfdname}-${vfdtest}.out"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/${vfdname}"
+ -P "${HDF_RESOURCES_DIR}/vfdTest.cmake"
+ )
+ set_tests_properties (VFD-${vfdname}-${vfdtest} PROPERTIES
+ ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${vfdname}"
+ WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${vfdname}
+ )
+ endif ()
endmacro ()
macro (ADD_VFD_TEST vfdname resultcode)
@@ -165,10 +167,18 @@ add_custom_target(HDF5_VFDTEST_LIB_files ALL COMMENT "Copying files needed by HD
endif ()
endif ()
endforeach ()
- set_tests_properties (VFD-${vfdname}-flush2 PROPERTIES DEPENDS VFD-${vfdname}-flush1)
- set_tests_properties (VFD-${vfdname}-flush1 PROPERTIES TIMEOUT 10)
- set_tests_properties (VFD-${vfdname}-flush2 PROPERTIES TIMEOUT 10)
- set_tests_properties (VFD-${vfdname}-istore PROPERTIES TIMEOUT ${CTEST_VERY_LONG_TIMEOUT})
+ if (NOT "flush2" IN_LIST H5_VFD_${vfdname}_SKIP_TESTS)
+ if (NOT "flush1" IN_LIST H5_VFD_${vfdname}_SKIP_TESTS)
+ set_tests_properties (VFD-${vfdname}-flush2 PROPERTIES DEPENDS VFD-${vfdname}-flush1)
+ endif ()
+ set_tests_properties (VFD-${vfdname}-flush2 PROPERTIES TIMEOUT 10)
+ endif ()
+ if (NOT "flush1" IN_LIST H5_VFD_${vfdname}_SKIP_TESTS)
+ set_tests_properties (VFD-${vfdname}-flush1 PROPERTIES TIMEOUT 10)
+ endif ()
+ if (NOT "istore" IN_LIST H5_VFD_${vfdname}_SKIP_TESTS)
+ set_tests_properties (VFD-${vfdname}-istore PROPERTIES TIMEOUT ${CTEST_VERY_LONG_TIMEOUT})
+ endif ()
if (NOT CYGWIN)
set_tests_properties (VFD-${vfdname}-cache PROPERTIES TIMEOUT ${CTEST_VERY_LONG_TIMEOUT})
endif ()
diff --git a/test/ShellTests.cmake b/test/ShellTests.cmake
index 99faa00..140da6f 100644
--- a/test/ShellTests.cmake
+++ b/test/ShellTests.cmake
@@ -15,8 +15,30 @@
### T E S T I N G S H E L L S C R I P T S ###
##############################################################################
-if (UNIX)
+find_program (PWSH NAMES pwsh powershell)
+if (PWSH)
+ file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/H5TEST/use_cases_test")
+ file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/H5TEST/swmr_test")
+ file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/H5TEST/vds_swmr_test")
+ set (srcdir ${HDF5_TEST_SOURCE_DIR})
+ set (H5_UTILS_TEST_BUILDDIR ${CMAKE_TEST_OUTPUT_DIRECTORY})
+ set (H5_TEST_BUILDDIR ${HDF5_TEST_BINARY_DIR}/H5TEST)
+ configure_file(${HDF5_TEST_SOURCE_DIR}/test_swmr.pwsh.in ${HDF5_TEST_BINARY_DIR}/H5TEST/test_swmr.ps1 @ONLY)
+ # test commented out as currently the programs are not allowing another access to the data file
+ #add_test (H5SHELL-testswmr ${PWSH} ${HDF5_TEST_BINARY_DIR}/H5TEST/testswmr.ps1)
+ #set_tests_properties (H5SHELL-testswmr PROPERTIES
+ # ENVIRONMENT "PATH=$ENV{PATH}:${CMAKE_RUNTIME_OUTPUT_DIRECTORY}"
+ # WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST
+ #)
+ configure_file(${HDF5_TEST_SOURCE_DIR}/test_vds_swmr.pwsh.in ${HDF5_TEST_BINARY_DIR}/H5TEST/test_vds_swmr.ps1 @ONLY)
+ # test commented out as currently the programs are not allowing another access to the data file
+ #add_test (H5SHELL-testvdsswmr ${PWSH} ${HDF5_TEST_BINARY_DIR}/H5TEST/testvdsswmr.ps1)
+ #set_tests_properties (H5SHELL-testvdsswmr PROPERTIES
+ # ENVIRONMENT "LD_LIBRARY_PATH=$ENV{LD_LIBRARY_PATH}:${CMAKE_RUNTIME_OUTPUT_DIRECTORY}"
+ # WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST
+ #)
+elseif (UNIX)
find_program (SH_PROGRAM bash)
if (SH_PROGRAM)
set (srcdir ${HDF5_TEST_SOURCE_DIR})
diff --git a/test/test_mirror.sh.in b/test/test_mirror.sh.in
index b3e75c6..ded73ad 100644
--- a/test/test_mirror.sh.in
+++ b/test/test_mirror.sh.in
@@ -45,7 +45,9 @@ done
RUN_DIR=mirror_vfd_test
MIRROR_UTILS=../utils/mirror_vfd # TODO: presupposes from test/
-mkdir $RUN_DIR
+if [[ ! -d $RUN_DIR ]] ; then
+ mkdir $RUN_DIR
+fi
# Copy program files into dedicated test directory
for FILE in $MIRROR_UTILS/mirror_* ; do
@@ -61,6 +63,10 @@ cp mirror_vfd $RUN_DIR
# wrapper script. Copy these libs builds if appropriate.
if [ -f $MIRROR_UTILS/.libs/mirror_server ] ; then
RUN_LIBS=$RUN_DIR/.libs
+ # Delete previous .libs directory, to remove any generated libtool files
+ if [[ -d $RUN_LIBS ]] ; then
+ rm -rf $RUN_LIBS
+ fi
mkdir $RUN_LIBS
for FILE in $MIRROR_UTILS/.libs/mirror_* ; do
case "$FILE" in
@@ -77,12 +83,15 @@ echo "Launching Mirror Server"
SERVER_ARGS="$SERVER_PORT $SERVER_VERBOSITY"
./mirror_server $SERVER_ARGS &
-./mirror_vfd
+./mirror_vfd $SERVER_PORT
nerrors=$?
echo "Stopping Mirror Server"
./mirror_server_stop $SERVER_PORT
+# Wait for background server process to exit
+wait
+
###############################################################################
## Report and exit
###############################################################################
diff --git a/test/test_plugin.sh.in b/test/test_plugin.sh.in
index 78cdb3a..ac89c0e 100644
--- a/test/test_plugin.sh.in
+++ b/test/test_plugin.sh.in
@@ -1,4 +1,4 @@
-#! /bin/sh
+#!/usr/bin/env bash
#
# Copyright by The HDF Group.
# All rights reserved.
@@ -19,6 +19,9 @@ DEPRECATED_SYMBOLS="@DEPRECATED_SYMBOLS@"
EXIT_SUCCESS=0
EXIT_FAILURE=1
+CP="cp -p" # Use -p to preserve mode,ownership, timestamps
+RM="rm -rf"
+
nerrors=0
verbose=yes
exit_code=$EXIT_SUCCESS
diff --git a/test/test_swmr.pwsh.in b/test/test_swmr.pwsh.in
new file mode 100644
index 0000000..de7a57a
--- /dev/null
+++ b/test/test_swmr.pwsh.in
@@ -0,0 +1,519 @@
+# 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://www.hdfgroup.org/licenses.
+# If you do not have access to either file, you may request a copy from
+# help@hdfgroup.org.
+#
+# Tests for the swmr feature.
+
+$srcdir = '@srcdir@'
+$utils_testdir=@H5_UTILS_TEST_BUILDDIR@
+$testdir=@H5_TEST_BUILDDIR@
+
+###############################################################################
+## test parameters
+###############################################################################
+
+$Nreaders = 5 # number of readers to launch
+$Nrdrs_spa = 3 # number of sparse readers to launch
+$Nrecords = 200000 # number of records to write
+$Nrecs_rem = 40000 # number of times to shrink
+$Nrecs_spa = 20000 # number of records to write in the sparse test
+$Nsecs_add = 5 # number of seconds per read interval
+$Nsecs_rem = 3 # number of seconds per read interval
+$Nsecs_addrem = 8 # number of seconds per read interval
+$nerrors = 0
+
+###############################################################################
+## definitions for message file to coordinate test runs
+###############################################################################
+$WRITER_MESSAGE = 'SWMR_WRITER_MESSAGE' # The message file created by writer that the open is complete
+ # This should be the same as the define in "test/swmr_common.h"
+$MESSAGE_TIMEOUT = 300 # Message timeout length in secs
+ # This should be the same as the define in "test/h5test.h"
+
+# Print a line-line message left justified in a field of 70 characters
+# beginning with the word "Testing".
+#
+function Test-WithSpaces {
+ $SPACES=' '
+ #Write-Output "Testing $* $SPACES" | cut -c1-70 | tr -d '\012'
+}
+
+# To wait for the writer message file or till the maximum # of seconds is reached
+# $Message is the message file to wait for
+# This performs similar function as the routine h5_wait_message() in test/h5test.c
+function Wait-Message {
+ [CmdletBinding()]
+ param (
+ [Parameter(Mandatory, ValueFromPipeline)]
+ [string]$TestPath, # Get the path of the message file to wait for
+ [Parameter(Mandatory, ValueFromPipeline)]
+ [string]$Message # Get the name of the message file to wait for
+ )
+
+ PROCESS {
+ $message = Join-Path -Path $TestPath -ChildPath $Message
+ $t0 = Get-Date # Get current time
+ $t1 = $t0
+ $difft = New-Timespan -Start $t0 -End $t1 # Initialize the time difference
+ $mexist = 0 # Indicate whether the message file is found
+ while ($difft.TotalSeconds -lt $MESSAGE_TIMEOUT) { # Loop till message times out
+ $t1 = Get-Date # Get current time in seconds
+ $difft = New-Timespan -Start $t0 -End $t1 # Calculate the time difference
+ #Write-Output "Check for $message : time=$difft"
+ if ([System.IO.File]::Exists($message)) { # If message file is found:
+ $mexist = 1 # indicate the message file is found
+ Remove-Item $message # remove the message file
+ break # get out of the while loop
+ }
+ }
+ if ($mexist -eq 0) {
+ # Issue warning that the writer message file is not found, continue with launching the reader(s)
+ Write-Warning -Message "$WRITER_MESSAGE is not found after waiting $MESSAGE_TIMEOUT seconds"
+ }
+ else {
+ Write-Output "$WRITER_MESSAGE is found"
+ }
+ }
+}
+
+###############################################################################
+## Main
+##
+## Modifications:
+## Vailin Choi; July 2013
+## Add waiting of message file before launching the reader(s).
+## Due to the implementation of file locking, coordination
+## is needed in file opening for the writer/reader tests
+## to proceed as expected.
+##
+###############################################################################
+
+# Check to see if the VFD specified by the HDF5_DRIVER environment variable
+# supports SWMR.
+$testprog = Join-Path -Path $utils_testdir -ChildPath swmr_check_compat_vfd.exe
+$rp = Start-Process -FilePath $testprog -PassThru -Wait -NoNewWindow
+if ($rp.ExitCode -ne 0) {
+ Write-Output ""
+ Write-Output "The VFD specified by the HDF5_DRIVER environment variable"
+ Write-Output "does not support SWMR."
+ Write-Output ""
+ Write-Output "SWMR acceptance tests skipped"
+ Write-Output ""
+ exit 0
+}
+
+Set-Location -Path swmr_test
+$testdir = Join-Path -Path $testdir -ChildPath swmr_test
+
+# Loop over index types
+$IndexTypeLoop = '-i ea', '-i b2'
+foreach ($index_type in $IndexTypeLoop) {
+ # Try with and without compression
+ $CompressLoop = '', '-c 5'
+ foreach ($compress in $CompressLoop) {
+ Write-Output ""
+ Write-Output "*******************************************************************************"
+ Write-Output "** Loop testing parameters: $index_type $compress"
+ Write-Output "*******************************************************************************"
+ Write-Output ""
+ Write-Output ""
+ Write-Output "###############################################################################"
+ Write-Output "## Generator test"
+ Write-Output "###############################################################################"
+ # Launch the Generator without SWMR_WRITE
+ Write-Output "launch the swmr_generator"
+ $rp = Start-Process -FilePath $testdir/swmr_generator.exe -NoNewWindow -ArgumentList "$compress $index_type" -PassThru -Wait
+ if ($rp.ExitCode -ne 0) {
+ Write-Warning "generator had error"
+ $nerrors += 1
+ }
+
+ # Launch the Generator with SWMR_WRITE
+ Write-Output "launch the swmr_generator with SWMR_WRITE"
+ $rp = Start-Process -FilePath $testdir/swmr_generator.exe -NoNewWindow -ArgumentList "-s $compress $index_type" -PassThru -Wait
+ if ($rp.ExitCode -ne 0) {
+ Write-Warning "generator had error"
+ $nerrors += 1
+ }
+
+ # Check for error and exit if one occurred
+ #Write-Output "nerrors=$nerrors"
+ if ($nerrors -ne 0) {
+ Write-Warning "SWMR tests failed with $nerrors errors."
+ exit 1
+ }
+
+ Write-Output ""
+ Write-Output "###############################################################################"
+ Write-Output "## Use H5Fstart_swmr_write() to enable SWMR writing mode"
+ Write-Output "###############################################################################"
+
+ # Remove any possible writer message file before launching writer
+ if ([System.IO.File]::Exists($WRITER_MESSAGE)) { # If message file is found
+ Remove-Item $WRITER_MESSAGE
+ }
+ #
+ # Launch the Writer
+ Write-Output "launch the swmr_start_writer"
+ $seed = "" # Put -r <random seed> command here
+ $rp = Start-Process -FilePath $testdir/swmr_start_write.exe -NoNewWindow -PassThru -ArgumentList "$compress $index_type $Nrecords $seed" 2>&1 |tee swmr_writer.out
+ $pid_writer = $rp.id
+ #Write-Output "pid_writer=$pid_writer"
+
+ # Wait for message from writer process before starting reader(s)
+ Wait-Message $testdir $WRITER_MESSAGE
+
+ #
+ # Launch the Readers
+ #declare -a seeds = (<seed1> <seed2> <seed3> ... )
+ Write-Output "launch $Nreaders swmr_readers"
+ $pid_readers = @()
+ $n = 0
+ while ($n -lt $Nreaders) {
+ #seed = "-r ${seeds[$n]}"
+ $seed = ""
+ $rp = Start-Process -FilePath $testdir/swmr_reader.exe -NoNewWindow -PassThru -ArgumentList "$Nsecs_add $seed" 2>&1 | tee swmr_reader.out.$n
+ $pid_readers += $rp.id
+ $n += 1
+ }
+ #Write-Output "pid_readers=$pid_readers"
+
+ # Collect exit code of the readers first because they usually finish
+ # before the writer.
+ foreach ($xpid in $pid_readers) {
+ #Write-Output "checked reader $xpid"
+ $result = Wait-Process -Id $xpid
+ if ($result.ExitCode -ne 0) {
+ Write-Warning "reader had error"
+ $nerrors += 1
+ }
+ }
+
+ # Collect exit code of the writer
+ #Write-Output "checked writer $pid_writer"
+ $result = Wait-Process -Id $pid_writer
+ if ($result.ExitCode -ne 0) {
+ Write-Warning "writer had error"
+ $nerrors += 1
+ }
+
+ # Check for error and exit if one occurred
+ #Write-Output "nerrors=$nerrors"
+ if ($nerrors -ne 0) {
+ Write-Warning "SWMR tests failed with $nerrors errors."
+ Write-Warning "(Writer and reader output preserved)"
+ exit 1
+ }
+
+ # Clean up output files
+ Remove-Item swmr_writer.out
+ Remove-Item swmr_reader.out.*
+
+ Write-Output ""
+ Write-Output "###############################################################################"
+ Write-Output "## Writer test - test expanding the dataset"
+ Write-Output "###############################################################################"
+
+ # Launch the Generator
+ Write-Output "launch the swmr_generator"
+ $rp = Start-Process -FilePath $testdir/swmr_generator.exe -NoNewWindow -PassThru -Wait -ArgumentList "-s $compress $index_type"
+ if ($rp.ExitCode -ne 0) {
+ Write-Warning "generator had error"
+ $nerrors += 1
+ }
+
+ # Remove any possible writer message file before launching writer
+ Remove-Item $WRITER_MESSAGE
+ #
+ # Launch the Writer
+ Write-Output "launch the swmr_writer"
+ $seed = "" # Put -r <random seed> command here
+ $rp = Start-Process -FilePath $testdir/swmr_writer.exe -NoNewWindow -PassThru -ArgumentList "-o $Nrecords $seed" 2>&1 |tee swmr_writer.out
+ $pid_writer = $rp.id
+ #Write-Output "pid_writer=$pid_writer"
+
+ # Wait for message from writer process before starting reader(s)
+ Wait-Message $testdir $WRITER_MESSAGE
+ #
+ # Launch the Readers
+ #declare -a seeds = (<seed1> <seed2> <seed3> ... )
+ Write-Output "launch $Nreaders swmr_readers"
+ $pid_readers = @()
+ $n = 0
+ while ($n -lt $Nreaders) {
+ #seed = "-r ${seeds[$n]}"
+ $seed = ""
+ $rp = Start-Process -FilePath $testdir/swmr_reader.exe -NoNewWindow -PassThru -ArgumentList "$Nsecs_add $seed" 2>&1 |tee swmr_reader.out.$n
+ $pid_readers += $rp.id
+ $n += 1
+ }
+ #Write-Output "pid_readers=$pid_readers"
+
+ # Collect exit code of the readers first because they usually finish
+ # before the writer.
+ foreach ($xpid in $pid_readers) {
+ #Write-Output "checked reader $xpid"
+ $result = Wait-Process -Id $xpid
+ if ($result.ExitCode -ne 0) {
+ Write-Warning "reader had error"
+ $nerrors += 1
+ }
+ }
+
+ # Collect exit code of the writer
+ #Write-Output "checked writer $pid_writer"
+ $result = Wait-Process -Id $pid_writer
+ if ($result.ExitCode -ne 0) {
+ Write-Warning "writer had error"
+ $nerrors += 1
+ }
+
+ # Check for error and exit if one occurred
+ #Write-Output "nerrors=$nerrors"
+ if ($nerrors -ne 0) {
+ Write-Warning "SWMR tests failed with $nerrors errors."
+ Write-Warning "(Writer and reader output preserved)"
+ exit 1
+ }
+
+ # Clean up output files
+ Remove-Item swmr_writer.out
+ Remove-Item swmr_reader.out.*
+
+ Write-Output ""
+ Write-Output "###############################################################################"
+ Write-Output "## Remove test - test shrinking the dataset"
+ Write-Output "###############################################################################"
+
+ # Remove any possible writer message file before launching writer
+ Remove-Item $WRITER_MESSAGE
+ # Launch the Remove Writer
+ Write-Output "launch the swmr_remove_writer"
+ $seed = "" # Put -r <random seed> command here
+ $rp = Start-Process -FilePath $testdir/swmr_remove_writer.exe -NoNewWindow -PassThru -ArgumentList "-o $Nrecs_rem $seed" 2>&1 |tee swmr_writer.out
+ $pid_writer = $rp.id
+ #Write-Output "pid_writer=$pid_writer"
+
+ # Wait for message from writer process before starting reader(s)
+ Wait-Message $testdir $WRITER_MESSAGE
+ #
+ # Launch the Remove Readers
+ #declare -a seeds = (<seed1> <seed2> <seed3> ... )
+ $n = 0
+ $pid_readers = @()
+ Write-Output "launch $Nreaders swmr_remove_readers"
+ while ($n -lt $Nreaders) {
+ #seed = "-r ${seeds[$n]}"
+ $seed = ""
+ $rp = Start-Process -FilePath $testdir/swmr_remove_reader.exe -NoNewWindow -PassThru -ArgumentList "$Nsecs_rem $seed" 2>&1 |tee swmr_reader.out.$n
+ $pid_readers += $rp.id
+ $n += 1
+ }
+ #Write-Output "pid_readers=$pid_readers"
+
+ # Collect exit code of the readers first because they usually finish
+ # before the writer.
+ foreach ($xpid in $pid_readers) {
+ #Write-Output "checked reader $xpid"
+ $result = Wait-Process -Id $xpid
+ if ($result.ExitCode -ne 0) {
+ Write-Warning "reader had error"
+ $nerrors += 1
+ }
+ }
+
+ # Collect exit code of the writer
+ #Write-Output "checked writer $pid_writer"
+ $result = Wait-Process -Id $pid_writer
+ if ($result.ExitCode -ne 0) {
+ Write-Warning "writer had error"
+ $nerrors += 1
+ }
+
+ # Check for error and exit if one occurred
+ #Write-Output "nerrors=$nerrors"
+ if ($nerrors -ne 0) {
+ Write-Warning "SWMR tests failed with $nerrors errors."
+ Write-Warning "(Writer and reader output preserved)"
+ exit 1
+ }
+
+ # Clean up output files
+ Remove-Item swmr_writer.out
+ Remove-Item swmr_reader.out.*
+
+ Write-Output ""
+ Write-Output "###############################################################################"
+ Write-Output "## Add/remove test - randomly grow or shrink the dataset"
+ Write-Output "###############################################################################"
+
+ # Launch the Generator
+ Write-Output "launch the swmr_generator"
+ $rp = Start-Process -FilePath $testdir/swmr_generator.exe -NoNewWindow-PassThru -Wait -ArgumentList "$compress $index_type"
+ if ($rp.ExitCode -ne 0) {
+ Write-Warning "generator had error"
+ $nerrors += 1
+ }
+
+ # Launch the Writer (not in parallel - just to rebuild the datasets)
+ Write-Output "launch the swmr_writer"
+ $seed = "" # Put -r <random seed> command here
+ $rp = Start-Process -FilePath $testdir/swmr_writer.exe -NoNewWindow -PassThru -Wait -ArgumentList "$Nrecords $seed"
+ if ($rp.ExitCode -ne 0) {
+ Write-Warning "writer had error"
+ $nerrors += 1
+ }
+
+ # Remove any possible writer message file before launching writer
+ Remove-Item $WRITER_MESSAGE
+ #
+ # Launch the Add/Remove Writer
+ Write-Output "launch the swmr_addrem_writer"
+ $seed = "" # Put -r <random seed> command here
+ $rp = Start-Process -FilePath $testdir/swmr_addrem_writer.exe -NoNewWindow -PassThru -ArgumentList "$Nrecords $seed" 2>&1 |tee swmr_writer.out
+ $pid_writer = $rp.id
+ #Write-Output "pid_writer=$pid_writer"
+
+ # Wait for message from writer process before starting reader(s)
+ Wait-Message $testdir $WRITER_MESSAGE
+ #
+ # Launch the Add/Remove Readers
+ #declare -a seeds = (<seed1> <seed2> <seed3> ... )
+ $n = 0
+ $pid_readers = @()
+ Write-Output "launch $Nreaders swmr_remove_readers"
+ while ($n -lt $Nreaders) {
+ #seed = "-r ${seeds[$n]}"
+ $seed = ""
+ $rp = Start-Process -FilePath $testdir/swmr_remove_reader.exe -NoNewWindow -PassThru -ArgumentList "$Nsecs_addrem $seed" 2>&1 |tee swmr_reader.out.$n
+ $pid_readers += $rp.id
+ $n += 1
+ }
+ #Write-Output "pid_readers=$pid_readers"
+
+ # Collect exit code of the readers first because they usually finish
+ # before the writer.
+ foreach ($xpid in $pid_readers) {
+ #Write-Output "checked reader $xpid"
+ $result = Wait-Process -Id $xpid
+ if ($result.ExitCode -ne 0) {
+ Write-Warning "reader had error"
+ $nerrors += 1
+ }
+ }
+
+ # Collect exit code of the writer
+ #Write-Output "checked writer $pid_writer"
+ $result = Wait-Process -Id $pid_writer
+ if ($result.ExitCode -ne 0) {
+ Write-Warning "writer had error"
+ $nerrors += 1
+ }
+
+ # Check for error and exit if one occurred
+ #Write-Output "nerrors=$nerrors"
+ if ($nerrors -ne 0) {
+ Write-Warning "SWMR tests failed with $nerrors errors."
+ Write-Warning "(Writer and reader output preserved)"
+ exit 1
+ }
+
+ # Clean up output files
+ Remove-Item swmr_writer.out
+ Remove-Item swmr_reader.out.*
+
+ Write-Output ""
+ Write-Output "###############################################################################"
+ Write-Output "## Sparse writer test - test writing to random locations in the dataset"
+ Write-Output "###############################################################################"
+
+ # Launch the Generator
+ # NOTE: Random seed is shared between readers and writers and is
+ # created by the generator.
+ Write-Output "launch the swmr_generator"
+ $seed = "" # Put -r <random seed> command here
+ $rp = Start-Process -FilePath $testdir/swmr_generator.exe -NoNewWindow -PassThru -Wait -ArgumentList "$compress $index_type $seed"
+ if ($rp.ExitCode -ne 0) {
+ Write-Warning "generator had error"
+ $nerrors += 1
+ }
+
+ # Remove any possible writer message file before launching writer
+ Remove-Item $WRITER_MESSAGE
+ # Launch the Sparse writer
+ Write-Output "launch the swmr_sparse_writer"
+ $rp = Start-Process -FilePath $testdir/swmr_sparse_writer.exe -NoNewWindow -PassThru -ArgumentList "$Nrecs_spa" 2>&1 |tee swmr_writer.out
+ $pid_writer = $rp.Id
+ #Write-Output "pid_writer=$pid_writer"
+
+ # Wait for message from writer process before starting reader(s)
+ Wait-Message $testdir $WRITER_MESSAGE
+ #
+ # Launch the Sparse readers
+ $n = 0
+ $pid_readers = @()
+ Write-Output "launch $Nrdrs_spa swmr_sparse_readers"
+ while ($n -lt $Nrdrs_spa) {
+ # The sparse reader spits out a LOT of data so it's set to 'quiet'
+ $rp = Start-Process -FilePath $testdir/swmr_sparse_reader.exe -NoNewWindow -PassThru -ArgumentList "-q $Nrecs_spa" 2>&1 |tee swmr_reader.out.$n
+ $pid_readers += $rp.id
+ $n += 1
+ }
+ #Write-Output "pid_readers=$pid_readers"
+
+ # Collect exit code of the writer
+ #Write-Output "checked writer $pid_writer"
+ $result = Wait-Process -Id $pid_writer
+ if ($result.ExitCode -ne 0) {
+ Write-Warning "writer had error"
+ $nerrors += 1
+ }
+
+ # Collect exit code of the readers
+ foreach ($xpid in $pid_readers) {
+ #Write-Output "checked reader $xpid"
+ $result = Wait-Process -Id $xpid
+ if ($result.ExitCode -ne 0) {
+ Write-Warning "reader had error"
+ $nerrors += 1
+ }
+ }
+
+ # Check for error and exit if one occurred
+ #Write-Output "nerrors=$nerrors"
+ if ($nerrors -ne 0) {
+ Write-Warning "SWMR tests failed with $nerrors errors."
+ Write-Warning "(Writer and reader output preserved)"
+ exit 1
+ }
+
+ # Clean up output files
+ Remove-Item swmr_writer.out
+ Remove-Item swmr_reader.out.*
+ }
+}
+
+###############################################################################
+## Report and exit
+###############################################################################
+cd ..
+#Write-Output "nerrors=$nerrors"
+if ($nerrors -eq 0) {
+ Write-Output "SWMR tests passed."
+# if test -z "$HDF5_NOCLEANUP"; then
+# # delete the test directory
+# Remove-Item swmr_test -Recurse
+# fi
+ exit 0
+}
+else {
+ Write-Warning "SWMR tests failed with $nerrors errors."
+ exit 1
+}
+
diff --git a/test/test_swmr.sh.in b/test/test_swmr.sh.in
index 33734b7..aacd575 100644
--- a/test/test_swmr.sh.in
+++ b/test/test_swmr.sh.in
@@ -1,4 +1,4 @@
-#! /bin/bash
+#!/usr/bin/env bash
#
# Copyright by The HDF Group.
# All rights reserved.
@@ -10,12 +10,10 @@
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
#
-# Tests for the swmr feature.
+# Acceptance tests for the SWMR feature
#
-# Created:
-# Albert Cheng, 2009/07/22
+###############################################################################
-srcdir=@srcdir@
utils_testdir=@abs_top_builddir@/@H5_UTILS_TEST_BUILDDIR@
testdir=@abs_top_builddir@/@H5_TEST_BUILDDIR@
@@ -42,7 +40,7 @@ MESSAGE_TIMEOUT=300 # Message timeout length in secs
# This should be the same as the define in "test/h5test.h"
###############################################################################
-## short hands and function definitions
+## Aliases and function definitions
###############################################################################
DPRINT=: # Set to "echo Debug:" for debugging printing,
# else ":" for noop.
@@ -169,7 +167,7 @@ do
echo "###############################################################################"
# Launch the Generator without SWMR_WRITE
echo launch the swmr_generator
- $testdir/swmr_generator $compress $index_type
+ $testdir/swmr_generator -q $compress $index_type
if test $? -ne 0; then
echo generator had error
nerrors=`expr $nerrors + 1`
@@ -177,7 +175,7 @@ do
# Launch the Generator with SWMR_WRITE
echo launch the swmr_generator with SWMR_WRITE
- $testdir/swmr_generator -s $compress $index_type
+ $testdir/swmr_generator -q -s $compress $index_type
if test $? -ne 0; then
echo generator had error
nerrors=`expr $nerrors + 1`
@@ -201,14 +199,13 @@ do
# Launch the Writer
echo launch the swmr_start_writer
seed="" # Put -r <random seed> command here
- $testdir/swmr_start_write $compress $index_type $Nrecords $seed 2>&1 |tee swmr_writer.out &
+ $testdir/swmr_start_write -q $compress $index_type $Nrecords $seed 2>&1 |tee swmr_writer.out &
pid_writer=$!
$DPRINT pid_writer=$pid_writer
# Wait for message from writer process before starting reader(s)
WAIT_MESSAGE $WRITER_MESSAGE
- #
# Launch the Readers
#declare -a seeds=(<seed1> <seed2> <seed3> ... )
echo launch $Nreaders swmr_readers
@@ -217,14 +214,14 @@ do
while [ $n -lt $Nreaders ]; do
#seed="-r ${seeds[$n]}"
seed=""
- $testdir/swmr_reader $Nsecs_add $seed 2>&1 |tee swmr_reader.out.$n &
+ $testdir/swmr_reader -q $Nsecs_add $seed 2>&1 |tee swmr_reader.out.$n &
pid_readers="$pid_readers $!"
n=`expr $n + 1`
done
$DPRINT pid_readers=$pid_readers
$IFDEBUG ps
- # Collect exit code of the readers first because they usually finish
+ # Collect exit codes of the readers first because they usually finish
# before the writer.
for xpid in $pid_readers; do
$DPRINT checked reader $xpid
@@ -262,7 +259,7 @@ do
# Launch the Generator
echo launch the swmr_generator
- $testdir/swmr_generator -s $compress $index_type
+ $testdir/swmr_generator -q -s $compress $index_type
if test $? -ne 0; then
echo generator had error
nerrors=`expr $nerrors + 1`
@@ -274,13 +271,13 @@ do
# Launch the Writer
echo launch the swmr_writer
seed="" # Put -r <random seed> command here
- $testdir/swmr_writer -o $Nrecords $seed 2>&1 |tee swmr_writer.out &
+ $testdir/swmr_writer -q -o $Nrecords $seed 2>&1 |tee swmr_writer.out &
pid_writer=$!
$DPRINT pid_writer=$pid_writer
# Wait for message from writer process before starting reader(s)
WAIT_MESSAGE $WRITER_MESSAGE
- #
+
# Launch the Readers
#declare -a seeds=(<seed1> <seed2> <seed3> ... )
echo launch $Nreaders swmr_readers
@@ -289,7 +286,7 @@ do
while [ $n -lt $Nreaders ]; do
#seed="-r ${seeds[$n]}"
seed=""
- $testdir/swmr_reader $Nsecs_add $seed 2>&1 |tee swmr_reader.out.$n &
+ $testdir/swmr_reader -q $Nsecs_add $seed 2>&1 |tee swmr_reader.out.$n &
pid_readers="$pid_readers $!"
n=`expr $n + 1`
done
@@ -337,13 +334,13 @@ do
# Launch the Remove Writer
echo launch the swmr_remove_writer
seed="" # Put -r <random seed> command here
- $testdir/swmr_remove_writer -o $Nrecs_rem $seed 2>&1 |tee swmr_writer.out &
+ $testdir/swmr_remove_writer -q -o $Nrecs_rem $seed 2>&1 |tee swmr_writer.out &
pid_writer=$!
$DPRINT pid_writer=$pid_writer
# Wait for message from writer process before starting reader(s)
WAIT_MESSAGE $WRITER_MESSAGE
- #
+
# Launch the Remove Readers
#declare -a seeds=(<seed1> <seed2> <seed3> ... )
n=0
@@ -352,7 +349,7 @@ do
while [ $n -lt $Nreaders ]; do
#seed="-r ${seeds[$n]}"
seed=""
- $testdir/swmr_remove_reader $Nsecs_rem $seed 2>&1 |tee swmr_reader.out.$n &
+ $testdir/swmr_remove_reader -q $Nsecs_rem $seed 2>&1 |tee swmr_reader.out.$n &
pid_readers="$pid_readers $!"
n=`expr $n + 1`
done
@@ -397,7 +394,7 @@ do
# Launch the Generator
echo launch the swmr_generator
- $testdir/swmr_generator $compress $index_type
+ $testdir/swmr_generator -q $compress $index_type
if test $? -ne 0; then
echo generator had error
nerrors=`expr $nerrors + 1`
@@ -406,7 +403,7 @@ do
# Launch the Writer (not in parallel - just to rebuild the datasets)
echo launch the swmr_writer
seed="" # Put -r <random seed> command here
- $testdir/swmr_writer $Nrecords $seed
+ $testdir/swmr_writer -q $Nrecords $seed
if test $? -ne 0; then
echo writer had error
nerrors=`expr $nerrors + 1`
@@ -418,7 +415,7 @@ do
# Launch the Add/Remove Writer
echo launch the swmr_addrem_writer
seed="" # Put -r <random seed> command here
- $testdir/swmr_addrem_writer $Nrecords $seed 2>&1 |tee swmr_writer.out &
+ $testdir/swmr_addrem_writer -q $Nrecords $seed 2>&1 |tee swmr_writer.out &
pid_writer=$!
$DPRINT pid_writer=$pid_writer
@@ -433,7 +430,7 @@ do
while [ $n -lt $Nreaders ]; do
#seed="-r ${seeds[$n]}"
seed=""
- $testdir/swmr_remove_reader $Nsecs_addrem $seed 2>&1 |tee swmr_reader.out.$n &
+ $testdir/swmr_remove_reader -q $Nsecs_addrem $seed 2>&1 |tee swmr_reader.out.$n &
pid_readers="$pid_readers $!"
n=`expr $n + 1`
done
@@ -481,7 +478,7 @@ do
# created by the generator.
echo launch the swmr_generator
seed="" # Put -r <random seed> command here
- $testdir/swmr_generator $compress $index_type $seed
+ $testdir/swmr_generator -q $compress $index_type $seed
if test $? -ne 0; then
echo generator had error
nerrors=`expr $nerrors + 1`
@@ -491,7 +488,7 @@ do
rm -f $WRITER_MESSAGE
# Launch the Sparse writer
echo launch the swmr_sparse_writer
- nice -n 20 $testdir/swmr_sparse_writer $Nrecs_spa 2>&1 |tee swmr_writer.out &
+ nice -n 20 $testdir/swmr_sparse_writer -q $Nrecs_spa 2>&1 |tee swmr_writer.out &
pid_writer=$!
$DPRINT pid_writer=$pid_writer
diff --git a/test/test_vds_swmr.pwsh.in b/test/test_vds_swmr.pwsh.in
new file mode 100644
index 0000000..bf5aabb
--- /dev/null
+++ b/test/test_vds_swmr.pwsh.in
@@ -0,0 +1,190 @@
+# 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://www.hdfgroup.org/licenses.
+# If you do not have access to either file, you may request a copy from
+# help@hdfgroup.org.
+#
+# Tests for the swmr feature using virtual datasets.
+
+$srcdir = '@srcdir@'
+$utils_testdir=@H5_UTILS_TEST_BUILDDIR@
+$testdir=@H5_TEST_BUILDDIR@
+
+###############################################################################
+## test parameters
+###############################################################################
+
+$Nwriters = 6 # number of writers (1 per source dataset)
+$Nreaders = 5 # number of readers to launch
+$nerrors = 0
+
+###############################################################################
+## definitions for message file to coordinate test runs
+###############################################################################
+$WRITER_MESSAGE = 'SWMR_WRITER_MESSAGE' # The message file created by writer that the open is complete
+ # This should be the same as the define in "test/swmr_common.h"
+$MESSAGE_TIMEOUT = 300 # Message timeout length in secs
+ # This should be the same as the define in "test/h5test.h"
+
+# Print a line-line message left justified in a field of 70 characters
+# beginning with the word "Testing".
+#
+function Test-WithSpaces {
+ $SPACES=' '
+ #Write-Output "Testing $* $SPACES" | cut -c1-70 | tr -d '\012'
+}
+
+# To wait for the writer message file or till the maximum # of seconds is reached
+# $Message is the message file to wait for
+# This performs similar function as the routine h5_wait_message() in test/h5test.c
+function Wait-Message {
+ [CmdletBinding()]
+ param (
+ [Parameter(Mandatory, ValueFromPipeline)]
+ [string]$TestPath, # Get the path of the message file to wait for
+ [Parameter(Mandatory, ValueFromPipeline)]
+ [string]$Message # Get the name of the message file to wait for
+ )
+
+ PROCESS {
+ $message = Join-Path -Path $TestPath -ChildPath $Message
+ $t0 = Get-Date # Get current time
+ $t1 = $t0
+ $difft = New-Timespan -Start $t0 -End $t1 # Initialize the time difference
+ $mexist = 0 # Indicate whether the message file is found
+ while ($difft.TotalSeconds -lt $MESSAGE_TIMEOUT) { # Loop till message times out
+ $t1 = Get-Date # Get current time in seconds
+ $difft = New-Timespan -Start $t0 -End $t1 # Calculate the time difference
+ #Write-Output "Check for $message : time=$difft"
+ if ([System.IO.File]::Exists($message)) { # If message file is found:
+ $mexist = 1 # indicate the message file is found
+ Remove-Item $message # remove the message file
+ break # get out of the while loop
+ }
+ }
+ if ($mexist -eq 0) {
+ # Issue warning that the writer message file is not found, continue with launching the reader(s)
+ Write-Warning -Message "$WRITER_MESSAGE is not found after waiting $MESSAGE_TIMEOUT seconds"
+ }
+ else {
+ Write-Output "$WRITER_MESSAGE is found"
+ }
+ }
+}
+
+###############################################################################
+## Main
+###############################################################################
+
+# Check to see if the VFD specified by the HDF5_DRIVER environment variable
+# supports SWMR.
+$testprog = Join-Path -Path $utils_testdir -ChildPath swmr_check_compat_vfd.exe
+$rp = Start-Process -FilePath $testprog -PassThru -Wait -NoNewWindow
+if ($rp.ExitCode -ne 0) {
+ Write-Output ""
+ Write-Output "The VFD specified by the HDF5_DRIVER environment variable"
+ Write-Output "does not support SWMR."
+ Write-Output ""
+ Write-Output "SWMR acceptance tests skipped"
+ Write-Output ""
+ exit 0
+}
+
+Set-Location -Path vds_swmr_test
+$testdir = Join-Path -Path $testdir -ChildPath vds_swmr_test
+
+Write-Output ""
+Write-Output "###############################################################################"
+Write-Output "## Basic VDS SWMR test - writing to a tiled plane"
+Write-Output "###############################################################################"
+
+# Launch the file generator
+Write-Output "launch the swmr_generator"
+$rp = Start-Process -FilePath $testdir/vds_swmr_gen.exe -NoNewWindow -PassThru -Wait
+if ($rp.ExitCode -ne 0) {
+ Write-Warning "generator had error"
+ $nerrors += 1
+}
+
+# Check for error and exit if one occurred
+#Write-Output "nerrors=$nerrors"
+if ($nerrors -ne 0) {
+ Write-Warning "VDS SWMR tests failed with $nerrors errors."
+ exit 1
+}
+
+# Launch the writers
+Write-Output "launch the $Nwriters SWMR VDS writers (1 per source)"
+$pid_writers = @()
+$n = 0
+while ($n -lt $Nwriters) {
+ $rp = Start-Process -FilePath $testdir/vds_swmr_writer.exe -NoNewWindow -PassThru -ArgumentList "$n" 2>&1 | tee swmr_writer.out.$n
+ $pid_writers += $rp.id
+ $n += 1
+}
+#Write-Output "pid_writers=$pid_writers"
+
+# Sleep to ensure that the writers have started
+Start-Sleep -Seconds 3
+
+# Launch the readers
+Write-Output "launch $Nreaders SWMR readers"
+$pid_readers = @()
+$n = 0
+while ($n -lt $Nreaders) {
+ $rp = Start-Process -FilePath $testdir/vds_swmr_reader.exe -NoNewWindow -PassThru 2>&1 | tee swmr_reader.out.$n
+ $pid_readers += $rp.id
+ $n += 1
+}
+#Write-Output "pid_readers=$pid_readers"
+
+# Collect exit code of the writers
+foreach ($xpid in $pid_writers) {
+ #Write-Output "checked writer $xpid"
+ $result = Wait-Process -Id $xpid
+ if ($result.ExitCode -ne 0) {
+ Write-Warning "writer had error"
+ $nerrors += 1
+ }
+}
+
+# Collect exit code of the readers
+# (they usually finish after the writers)
+foreach ($xpid in $pid_readers) {
+ #Write-Output "checked reader $xpid"
+ $result = Wait-Process -Id $xpid
+ if ($result.ExitCode -ne 0) {
+ Write-Warning "reader had error"
+ $nerrors += 1
+ }
+}
+
+# Check for error and exit if one occurred
+#Write-Output "nerrors=$nerrors"
+if ($nerrors -ne 0) {
+ Write-Warning "VDS SWMR tests failed with $nerrors errors."
+ exit 1
+}
+
+###############################################################################
+## Report and exit
+###############################################################################
+cd ..
+#Write-Output "nerrors=$nerrors"
+if ($nerrors -eq 0) {
+ Write-Output "VDS SWMR tests passed."
+# if test -z "$HDF5_NOCLEANUP"; then
+# # delete the test directory
+# Remove-Item vds_swmr_test -Recurse
+# fi
+ exit 0
+}
+else {
+ Write-Warning "VDS SWMR tests failed with $nerrors errors."
+ exit 1
+}
+