diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/CMakeTests.cmake | 132 | ||||
-rw-r--r-- | test/ShellTests.cmake | 216 | ||||
-rw-r--r-- | test/flushrefreshTest.cmake | 172 |
3 files changed, 492 insertions, 28 deletions
diff --git a/test/CMakeTests.cmake b/test/CMakeTests.cmake index 39d9d0d..cc6ebb8 100644 --- a/test/CMakeTests.cmake +++ b/test/CMakeTests.cmake @@ -228,29 +228,30 @@ add_test (NAME H5TEST-clear-testhdf5-objects WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) +set_tests_properties (H5TEST-clear-testhdf5-objects PROPERTIES FIXTURES_SETUP clear_testhdf5) if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME H5TEST-testhdf5-base COMMAND $<TARGET_FILE:testhdf5> -x heap -x file -x select) set_tests_properties (H5TEST-testhdf5-base PROPERTIES - DEPENDS H5TEST-clear-testhdf5-objects + FIXTURES_REQUIRED clear_testhdf5 ENVIRONMENT "HDF5_ALARM_SECONDS=3600;srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) add_test (NAME H5TEST-testhdf5-heap COMMAND $<TARGET_FILE:testhdf5> -o heap) set_tests_properties (H5TEST-testhdf5-heap PROPERTIES - DEPENDS H5TEST-clear-testhdf5-objects + FIXTURES_REQUIRED clear_testhdf5 ENVIRONMENT "HDF5_ALARM_SECONDS=3600;srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) add_test (NAME H5TEST-testhdf5-file COMMAND $<TARGET_FILE:testhdf5> -o file) set_tests_properties (H5TEST-testhdf5-file PROPERTIES - DEPENDS H5TEST-clear-testhdf5-objects + FIXTURES_REQUIRED clear_testhdf5 ENVIRONMENT "HDF5_ALARM_SECONDS=3600;srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) add_test (NAME H5TEST-testhdf5-select COMMAND $<TARGET_FILE:testhdf5> -o select) set_tests_properties (H5TEST-testhdf5-select PROPERTIES - DEPENDS H5TEST-clear-testhdf5-objects + FIXTURES_REQUIRED clear_testhdf5 ENVIRONMENT "HDF5_ALARM_SECONDS=3600;srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) @@ -266,7 +267,7 @@ else () -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) set_tests_properties (H5TEST-testhdf5 PROPERTIES - DEPENDS H5TEST-clear-testhdf5-objects + FIXTURES_REQUIRED clear_testhdf5 ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) @@ -295,6 +296,7 @@ else () WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST-shared ) + set_tests_properties (H5TEST-shared-clear-testhdf5-objects PROPERTIES FIXTURES_SETUP shared_clear_testhdf5) add_test (NAME H5TEST-shared-testhdf5 COMMAND "${CMAKE_COMMAND}" -D "TEST_PROGRAM=$<TARGET_FILE:testhdf5-shared>" -D "TEST_ARGS:STRING=" @@ -306,7 +308,7 @@ else () -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) set_tests_properties (H5TEST-shared-testhdf5 PROPERTIES - DEPENDS H5TEST-shared-clear-testhdf5-objects + FIXTURES_REQUIRED shared_clear_testhdf5 ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST-shared" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST-shared ) @@ -543,6 +545,7 @@ add_test (NAME H5TEST-clear-objects WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) +set_tests_properties (H5TEST-clear-objects PROPERTIES FIXTURES_SETUP clear_objects) set (H5TEST_SEPARATE_TESTS testhdf5 @@ -554,7 +557,7 @@ foreach (test ${H5_TESTS}) if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME H5TEST-${test} COMMAND $<TARGET_FILE:${test}>) set_tests_properties (H5TEST-${test} PROPERTIES - DEPENDS H5TEST-clear-objects + FIXTURES_REQUIRED clear_objects ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) @@ -576,7 +579,7 @@ foreach (test ${H5_TESTS}) ) endif () set_tests_properties (H5TEST-${test} PROPERTIES - DEPENDS H5TEST-clear-objects + FIXTURES_REQUIRED clear_objects ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) @@ -599,6 +602,7 @@ if (BUILD_SHARED_LIBS) WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST-shared ) + set_tests_properties (H5TEST-shared-clear-objects PROPERTIES FIXTURES_SETUP shared_clear_objects) foreach (test ${H5_TESTS}) if (NOT ${test} IN_LIST H5TEST_SEPARATE_TESTS) @@ -619,7 +623,7 @@ if (BUILD_SHARED_LIBS) ) endif () set_tests_properties (H5TEST-shared-${test} PROPERTIES - DEPENDS H5TEST-shared-clear-objects + FIXTURES_REQUIRED shared_clear_objects ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST-shared" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST-shared ) @@ -642,6 +646,7 @@ if (NOT CYGWIN) WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) + set_tests_properties (H5TEST-clear-cache-objects PROPERTIES FIXTURES_SETUP cache_clear_objects) if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME H5TEST-cache COMMAND $<TARGET_FILE:cache>) else () @@ -657,7 +662,7 @@ if (NOT CYGWIN) ) endif () set_tests_properties (H5TEST-cache PROPERTIES - DEPENDS H5TEST-clear-cache-objects + FIXTURES_REQUIRED cache_clear_objects ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST;HDF5TestExpress=${HDF_TEST_EXPRESS}" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) @@ -673,9 +678,10 @@ add_test ( WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) +set_tests_properties (H5TEST-clear-cache_image-objects PROPERTIES FIXTURES_SETUP cache_image_clear_objects) add_test (NAME H5TEST-cache_image COMMAND $<TARGET_FILE:cache_image>) set_tests_properties (H5TEST-cache_image PROPERTIES - DEPENDS H5TEST-clear-cache_image-objects + FIXTURES_REQUIRED cache_image_clear_objects ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST;HDF5TestExpress=${HDF_TEST_EXPRESS}" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) @@ -690,6 +696,7 @@ if (BUILD_SHARED_LIBS) WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST-shared ) + set_tests_properties (H5TEST-clear-objects PROPERTIES FIXTURES_SETUP shared_cache_clear_objects) if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME H5TEST-shared-cache COMMAND $<TARGET_FILE:cache-shared>) else () @@ -705,7 +712,7 @@ if (BUILD_SHARED_LIBS) ) endif () set_tests_properties (H5TEST-shared-cache PROPERTIES - DEPENDS H5TEST-shared-clear-cache-objects + FIXTURES_REQUIRED shared_cache_clear_objects ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST-shared;HDF5TestExpress=${HDF_TEST_EXPRESS}" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST-shared ) @@ -713,6 +720,23 @@ if (BUILD_SHARED_LIBS) endif () endif () +#-- Adding test for tcheck_version +add_test (NAME H5TEST-tcheck_version-major COMMAND $<TARGET_FILE:tcheck_version> "-tM") +set_tests_properties (H5TEST-tcheck_version-major PROPERTIES + WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST + WILL_FAIL "true" +) +add_test (NAME H5TEST-tcheck_version-minor COMMAND $<TARGET_FILE:tcheck_version> "-tm") +set_tests_properties (H5TEST-tcheck_version-minor PROPERTIES + WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST + WILL_FAIL "true" +) +add_test (NAME H5TEST-tcheck_version-release COMMAND $<TARGET_FILE:tcheck_version> "-tr") +set_tests_properties (H5TEST-tcheck_version-release PROPERTIES + WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST + WILL_FAIL "true" +) + ############################################################################## ############################################################################## @@ -723,7 +747,6 @@ endif () #--------------- # error_test # err_compat -# tcheck_version # testmeta # atomic_writer # atomic_reader @@ -733,7 +756,6 @@ endif () ############################################################################## # autotools script tests # error_test and err_compat are built at the same time as the other tests, but executed by testerror.sh. -# NOT CONVERTED tcheck_version is used by testcheck_version.sh. # NOT CONVERTED accum_swmr_reader is used by accum.c. # NOT CONVERTED atomic_writer and atomic_reader are standalone programs. # links_env is used by testlinks_env.sh @@ -756,9 +778,10 @@ add_test ( WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) +set_tests_properties (H5TEST-clear-filenotclosed-objects PROPERTIES FIXTURES_SETUP filenotclosed_clear_objects) add_test (NAME H5TEST-filenotclosed COMMAND $<TARGET_FILE:filenotclosed>) set_tests_properties (H5TEST-filenotclosed PROPERTIES - DEPENDS H5TEST-clear-filenotclosed-objects + FIXTURES_REQUIRED filenotclosed_clear_objects ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) @@ -773,6 +796,7 @@ if (HDF5_ENABLE_DEPRECATED_SYMBOLS) WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) + set_tests_properties (H5TEST-clear-err_compat-objects PROPERTIES FIXTURES_SETUP err_compat_clear_objects) add_test (NAME H5TEST-err_compat COMMAND "${CMAKE_COMMAND}" -D "TEST_PROGRAM=$<TARGET_FILE:err_compat>" -D "TEST_ARGS:STRING=" @@ -784,7 +808,7 @@ if (HDF5_ENABLE_DEPRECATED_SYMBOLS) -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) set_tests_properties (H5TEST-err_compat PROPERTIES - DEPENDS H5TEST-clear-err_compat-objects + FIXTURES_REQUIRED err_compat_clear_objects ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) @@ -799,6 +823,7 @@ add_test (NAME H5TEST-clear-error_test-objects WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) +set_tests_properties (H5TEST-clear-error_test-objects PROPERTIES FIXTURES_SETUP error_test_clear_objects) if (HDF5_USE_16_API_DEFAULT) add_test ( NAME H5TEST-error_test-SKIPPED @@ -816,7 +841,7 @@ else () -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) set_tests_properties (H5TEST-error_test PROPERTIES - DEPENDS H5TEST-clear-error_test-objects + FIXTURES_REQUIRED error_test_clear_objects ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST;HDF5_PLUGIN_PRELOAD=::" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) @@ -834,6 +859,7 @@ add_test (NAME H5TEST-clear-links_env-objects WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) +set_tests_properties (H5TEST-clear-links_env-objects PROPERTIES FIXTURES_SETUP links_env_clear_objects) add_test (NAME H5TEST-links_env COMMAND "${CMAKE_COMMAND}" -D "TEST_PROGRAM=$<TARGET_FILE:links_env>" -D "TEST_ARGS:STRING=" @@ -846,7 +872,7 @@ add_test (NAME H5TEST-links_env COMMAND "${CMAKE_COMMAND}" -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) set_tests_properties (H5TEST-links_env PROPERTIES - DEPENDS H5TEST-clear-links_env-objects + FIXTURES_REQUIRED links_env_clear_objects ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST ) @@ -869,6 +895,7 @@ if (BUILD_SHARED_LIBS) WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST-shared ) + set_tests_properties (H5TEST-shared-clear-err_compat-objects PROPERTIES FIXTURES_SETUP shared_err_compat_clear_objects) add_test (NAME H5TEST-shared-err_compat COMMAND "${CMAKE_COMMAND}" -D "TEST_PROGRAM=$<TARGET_FILE:err_compat-shared>" -D "TEST_ARGS:STRING=" @@ -880,7 +907,7 @@ if (BUILD_SHARED_LIBS) -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) set_tests_properties (H5TEST-shared-err_compat PROPERTIES - DEPENDS H5TEST-shared-clear-err_compat-objects + FIXTURES_REQUIRED shared_err_compat_clear_objects ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST-shared" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST-shared ) @@ -895,6 +922,7 @@ if (BUILD_SHARED_LIBS) WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST-shared ) + set_tests_properties (H5TEST-shared-clear-error_test-objects PROPERTIES FIXTURES_SETUP shared_error_test_clear_objects) if (HDF5_USE_16_API_DEFAULT) add_test ( NAME H5TEST-shared-error_test-SKIPPED @@ -912,7 +940,7 @@ if (BUILD_SHARED_LIBS) -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) set_tests_properties (H5TEST-shared-error_test PROPERTIES - DEPENDS H5TEST-shared-clear-error_test-objects + FIXTURES_REQUIRED shared_error_test_clear_objects ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST-shared;HDF5_PLUGIN_PRELOAD=::" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST-shared ) @@ -930,6 +958,7 @@ if (BUILD_SHARED_LIBS) WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST-shared ) + set_tests_properties (H5TEST-shared-clear-links_env-objects PROPERTIES FIXTURES_SETUP shared_links_env_clear_objects) add_test (NAME H5TEST-shared-links_env COMMAND "${CMAKE_COMMAND}" -D "TEST_PROGRAM=$<TARGET_FILE:links_env-shared>" -D "TEST_ARGS:STRING=" @@ -942,7 +971,7 @@ if (BUILD_SHARED_LIBS) -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) set_tests_properties (H5TEST-shared-links_env PROPERTIES - DEPENDS H5TEST-shared-clear-links_env-objects + FIXTURES_REQUIRED shared_links_env_clear_objects ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST-shared" WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST-shared ) @@ -982,13 +1011,60 @@ set_tests_properties (H5PLUGIN-filter_plugin PROPERTIES #) ############################################################################## -############################################################################## -### S W M R T E S T S -############################################################################## -# testflushrefresh.sh: flushrefresh -# test_usecases.sh: use_append_chunk, use_append_mchunks, use_disable_mdc_flushes -# testswmr.sh: swmr* -# testvdsswmr.sh: vds_swmr* +if (TEST_SHELL_SCRIPTS) + include (ShellTests.cmake) +endif() + +if (ENABLE_EXTENDED_TESTS) + ############################################################################## + ### S W M R T E S T S + ############################################################################## + # testflushrefresh.sh: flushrefresh + # test_usecases.sh: use_append_chunk, use_append_mchunks, use_disable_mdc_flushes + # testswmr.sh: swmr* + # testvdsswmr.sh: vds_swmr* + +# add_test (NAME H5Test-swmr_check_compat_vfd COMMAND $<TARGET_FILE:swmr_check_compat_vfd>) + +#-- Adding test for flushrefresh + file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/H5TEST/flushrefresh_test") + if (BUILD_SHARED_LIBS) + file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/H5TEST-shared/flushrefresh_test") + endif () + find_package (Perl) + if (PERL_FOUND) + add_test (NAME H5TEST-clear-testflushrefresh-objects + COMMAND ${CMAKE_COMMAND} + -E remove + flushrefresh.txt + flushrefresh.txt.err + flushrefresh.h5 + WORKING_DIRECTORY + ${HDF5_TEST_BINARY_DIR}/H5TEST/flushrefresh_test + ) + set_tests_properties (H5TEST-clear-testflushrefresh-objects PROPERTIES FIXTURES_SETUP testflushrefresh_clear_objects) + add_test (NAME H5TEST-testflushrefresh COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$<TARGET_FILE:flushrefresh>" + -D "TEST_ARGS1:STRING=flushrefresh_VERIFICATION_START" + -D "TEST_ARGS2:STRING=flushrefresh_VERIFICATION_DONE" + -D "TEST_ERR:STRING=flushrefresh_ERROR" + -D "TEST_EXPECT=0" + -D "TEST_OUTPUT=flushrefresh.out" + -D "TEST_REFERENCE=flushrefresh.txt" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/H5TEST/flushrefresh_test" + -D "PERL_SCRIPT=${HDF5_SOURCE_DIR}/bin/runbkgprog" + -D "PERL_EXECUTABLE=${PERL_EXECUTABLE}" + -P "${HDF5_TEST_SOURCE_DIR}/flushrefreshTest.cmake" + ) + set_tests_properties (H5TEST-testflushrefresh PROPERTIES + FIXTURES_REQUIRED testflushrefresh_clear_objects + ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST/flushrefresh_test" + WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST/flushrefresh_test + ) + else () + message (STATUS "Cannot execute TEST flushrefresh - perl not found") + endif () +endif() ############################################################################## ############################################################################## diff --git a/test/ShellTests.cmake b/test/ShellTests.cmake new file mode 100644 index 0000000..58dc85d --- /dev/null +++ b/test/ShellTests.cmake @@ -0,0 +1,216 @@ + +# Copyright by The HDF Group. +# All rights reserved. +# +# This file is part of HDF5. The full HDF5 copyright notice, including +# terms governing use, modification, and redistribution, is contained in +# the COPYING file, which can be found at the root of the source code +# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. +# If you do not have access to either file, you may request a copy from +# help@hdfgroup.org. +# + +############################################################################## +############################################################################## +### T E S T I N G S H E L L S C R I P T S ### +############################################################################## + +if (UNIX) + + find_program (SH_PROGRAM sh) + if (SH_PROGRAM) + + ############################################################################## + # configure scripts to test dir + ############################################################################## + find_package (Perl) + if (PERL_FOUND) + configure_file(${HDF5_TEST_SOURCE_DIR}/testflushrefresh.sh.in ${HDF5_TEST_BINARY_DIR}/H5TEST/testflushrefresh.sh @ONLY) + endif () + configure_file(${HDF5_TEST_SOURCE_DIR}/test_usecases.sh.in ${HDF5_TEST_BINARY_DIR}/H5TEST/test_usecases.sh @ONLY) + configure_file(${HDF5_TEST_SOURCE_DIR}/testswmr.sh.in ${HDF5_TEST_BINARY_DIR}/H5TEST/testswmr.sh @ONLY) + configure_file(${HDF5_TEST_SOURCE_DIR}/testvdsswmr.sh.in ${HDF5_TEST_BINARY_DIR}/H5TEST/testvdsswmr.sh @ONLY) + + ############################################################################## + # copy test programs to test dir + ############################################################################## + add_custom_command ( + TARGET swmr_check_compat_vfd + POST_BUILD + COMMAND ${CMAKE_COMMAND} + ARGS -E copy_if_different "$<TARGET_FILE:swmr_check_compat_vfd>" "${HDF5_TEST_BINARY_DIR}/H5TEST/swmr_check_compat_vfd" + ) + + add_custom_command ( + TARGET swmr_check_compat_vfd + POST_BUILD + COMMAND ${CMAKE_COMMAND} + ARGS -E copy_if_different "${HDF5_SOURCE_DIR}/bin/output_filter.sh" "${HDF5_TEST_BINARY_DIR}/H5TEST/bin/output_filter.sh" + ) + + file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/H5TEST/flushrefresh_test") + add_custom_command ( + TARGET flushrefresh + POST_BUILD + COMMAND ${CMAKE_COMMAND} + ARGS -E copy_if_different "$<TARGET_FILE:flushrefresh>" "${HDF5_TEST_BINARY_DIR}/H5TEST/flushrefresh" + ) + + #shell script creates dir + #file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/H5TEST/usecases_test") + add_custom_command ( + TARGET use_append_mchunks + POST_BUILD + COMMAND ${CMAKE_COMMAND} + ARGS -E copy_if_different "$<TARGET_FILE:use_append_mchunks>" "${HDF5_TEST_BINARY_DIR}/H5TEST/use_append_mchunks" + ) + add_custom_command ( + TARGET use_disable_mdc_flushes + POST_BUILD + COMMAND ${CMAKE_COMMAND} + ARGS -E copy_if_different "$<TARGET_FILE:use_disable_mdc_flushes>" "${HDF5_TEST_BINARY_DIR}/H5TEST/use_disable_mdc_flushes" + ) + add_custom_command ( + TARGET twriteorder + POST_BUILD + COMMAND ${CMAKE_COMMAND} + ARGS -E copy_if_different "$<TARGET_FILE:twriteorder>" "${HDF5_TEST_BINARY_DIR}/H5TEST/twriteorder" + ) + add_custom_command ( + TARGET use_append_chunk + POST_BUILD + COMMAND ${CMAKE_COMMAND} + ARGS -E copy_if_different "$<TARGET_FILE:use_append_chunk>" "${HDF5_TEST_BINARY_DIR}/H5TEST/use_append_chunk" + ) + + file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/H5TEST/swmr_test") + add_custom_command ( + TARGET swmr_generator + POST_BUILD + COMMAND ${CMAKE_COMMAND} + ARGS -E copy_if_different "$<TARGET_FILE:swmr_generator>" "${HDF5_TEST_BINARY_DIR}/H5TEST/swmr_test/swmr_generator" + ) + add_custom_command ( + TARGET swmr_start_write + POST_BUILD + COMMAND ${CMAKE_COMMAND} + ARGS -E copy_if_different "$<TARGET_FILE:swmr_start_write>" "${HDF5_TEST_BINARY_DIR}/H5TEST/swmr_test/swmr_start_write" + ) + add_custom_command ( + TARGET swmr_reader + POST_BUILD + COMMAND ${CMAKE_COMMAND} + ARGS -E copy_if_different "$<TARGET_FILE:swmr_reader>" "${HDF5_TEST_BINARY_DIR}/H5TEST/swmr_test/swmr_reader" + ) + add_custom_command ( + TARGET swmr_writer + POST_BUILD + COMMAND ${CMAKE_COMMAND} + ARGS -E copy_if_different "$<TARGET_FILE:swmr_writer>" "${HDF5_TEST_BINARY_DIR}/H5TEST/swmr_test/swmr_writer" + ) + add_custom_command ( + TARGET swmr_remove_reader + POST_BUILD + COMMAND ${CMAKE_COMMAND} + ARGS -E copy_if_different "$<TARGET_FILE:swmr_remove_reader>" "${HDF5_TEST_BINARY_DIR}/H5TEST/swmr_test/swmr_remove_reader" + ) + add_custom_command ( + TARGET swmr_remove_writer + POST_BUILD + COMMAND ${CMAKE_COMMAND} + ARGS -E copy_if_different "$<TARGET_FILE:swmr_remove_writer>" "${HDF5_TEST_BINARY_DIR}/H5TEST/swmr_test/swmr_remove_writer" + ) + add_custom_command ( + TARGET swmr_addrem_writer + POST_BUILD + COMMAND ${CMAKE_COMMAND} + ARGS -E copy_if_different "$<TARGET_FILE:swmr_addrem_writer>" "${HDF5_TEST_BINARY_DIR}/H5TEST/swmr_test/swmr_addrem_writer" + ) + add_custom_command ( + TARGET swmr_sparse_reader + POST_BUILD + COMMAND ${CMAKE_COMMAND} + ARGS -E copy_if_different "$<TARGET_FILE:swmr_sparse_reader>" "${HDF5_TEST_BINARY_DIR}/H5TEST/swmr_test/swmr_sparse_reader" + ) + add_custom_command ( + TARGET swmr_sparse_writer + POST_BUILD + COMMAND ${CMAKE_COMMAND} + ARGS -E copy_if_different "$<TARGET_FILE:swmr_sparse_writer>" "${HDF5_TEST_BINARY_DIR}/H5TEST/swmr_test/swmr_sparse_writer" + ) + + file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/H5TEST/vds_swmr_test") + add_custom_command ( + TARGET vds_swmr_gen + POST_BUILD + COMMAND ${CMAKE_COMMAND} + ARGS -E copy_if_different "$<TARGET_FILE:vds_swmr_gen>" "${HDF5_TEST_BINARY_DIR}/H5TEST/vds_swmr_gen" + ) + add_custom_command ( + TARGET vds_swmr_writer + POST_BUILD + COMMAND ${CMAKE_COMMAND} + ARGS -E copy_if_different "$<TARGET_FILE:vds_swmr_writer>" "${HDF5_TEST_BINARY_DIR}/H5TEST/vds_swmr_writer" + ) + add_custom_command ( + TARGET vds_swmr_reader + POST_BUILD + COMMAND ${CMAKE_COMMAND} + ARGS -E copy_if_different "$<TARGET_FILE:vds_swmr_reader>" "${HDF5_TEST_BINARY_DIR}/H5TEST/vds_swmr_reader" + ) + + + + ############################################################################## + ############################################################################## + ### A D D I T I O N A L T E S T S ### + ############################################################################## + ############################################################################## + # H5_CHECK_TESTS + #--------------- + # atomic_writer + # atomic_reader + # filenotclosed + # flushrefresh + ############################################################################## + # autotools script tests + # error_test and err_compat are built at the same time as the other tests, but executed by testerror.sh. + # NOT CONVERTED accum_swmr_reader is used by accum.c. + # NOT CONVERTED atomic_writer and atomic_reader are standalone programs. + # links_env is used by testlinks_env.sh + # filenotclosed is used by test_filenotclosed.sh + # NOT CONVERTED flushrefresh is used by testflushrefresh.sh. + # NOT CONVERTED use_append_chunk, use_append_mchunks and use_disable_mdc_flushes are used by test_usecases.sh + # NOT CONVERTED swmr_* files (besides swmr.c) are used by testswmr.sh. + # NOT CONVERTED vds_swmr_* files are used by testvdsswmr.sh + # NOT CONVERTED 'make check' doesn't run them directly, so they are not included in TEST_PROG. + # NOT CONVERTED Also build testmeta, which is used for timings test. It builds quickly, + # NOT CONVERTED and this lets automake keep all its test programs in one place. + ############################################################################## + + ############################################################################## + ### S W M R T E S T S + ############################################################################## + # testflushrefresh.sh: flushrefresh + # test_usecases.sh: use_append_chunk, use_append_mchunks, use_disable_mdc_flushes + # testswmr.sh: swmr* + # testvdsswmr.sh: vds_swmr* + add_test (H5SHELL-testflushrefresh ${SH_PROGRAM} ${HDF5_TEST_BINARY_DIR}/H5TEST/testflushrefresh.sh) + set_tests_properties (H5SHELL-testflushrefresh PROPERTIES + WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST + ) + add_test (H5SHELL-test_usecases ${SH_PROGRAM} ${HDF5_TEST_BINARY_DIR}/H5TEST/test_usecases.sh) + set_tests_properties (H5SHELL-test_usecases PROPERTIES + WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST + ) + add_test (H5SHELL-testswmr ${SH_PROGRAM} ${HDF5_TEST_BINARY_DIR}/H5TEST/testswmr.sh) + set_tests_properties (H5SHELL-testswmr PROPERTIES + WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST + ) + add_test (H5SHELL-testvdsswmr ${SH_PROGRAM} ${HDF5_TEST_BINARY_DIR}/H5TEST/testvdsswmr.sh) + set_tests_properties (H5SHELL-testvdsswmr PROPERTIES + WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST + ) + + endif () +endif () diff --git a/test/flushrefreshTest.cmake b/test/flushrefreshTest.cmake new file mode 100644 index 0000000..f66ee64 --- /dev/null +++ b/test/flushrefreshTest.cmake @@ -0,0 +1,172 @@ +# +# Copyright by The HDF Group. +# All rights reserved. +# +# This file is part of HDF5. The full HDF5 copyright notice, including +# terms governing use, modification, and redistribution, is contained in +# the COPYING file, which can be found at the root of the source code +# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. +# If you do not have access to either file, you may request a copy from +# help@hdfgroup.org. +# +# runTest.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) + message (FATAL_ERROR "Require TEST_PROGRAM to be defined") +endif () +if (NOT TEST_FOLDER) + message ( FATAL_ERROR "Require TEST_FOLDER to be defined") +endif () +if (NOT TEST_OUTPUT) + message (FATAL_ERROR "Require TEST_OUTPUT to be defined") +endif () +if (NOT PERL_SCRIPT) + message (STATUS "Require PERL_BIN_DIR to be defined") +endif () +if (NOT PERL_EXECUTABLE) + message (STATUS "Require PERL_EXECUTABLE to be defined") +endif () + +if (EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}) + file (REMOVE ${TEST_FOLDER}/${TEST_OUTPUT}) +endif () + +if (EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}.err) + file (REMOVE ${TEST_FOLDER}/${TEST_OUTPUT}.err) +endif () + +message (STATUS "COMMAND: ${TEST_PROGRAM} ${TEST_ARGS}") + +if (TEST_LIBRARY_DIRECTORY) + if (WIN32 AND NOT MINGW) + set (ENV{PATH} "$ENV{PATH};${TEST_LIBRARY_DIRECTORY}") + else () + set (ENV{LD_LIBRARY_PATH} "$ENV{LD_LIBRARY_PATH}:${TEST_LIBRARY_DIRECTORY}") + endif () +endif () + +if (TEST_ENV_VAR) + set (ENV{${TEST_ENV_VAR}} "${TEST_ENV_VALUE}") + #message (STATUS "ENV:${TEST_ENV_VAR}=$ENV{${TEST_ENV_VAR}}") +endif () + +message(STATUS "Background: ${PERL_EXECUTABLE} ${PERL_SCRIPT} ${TEST_PROGRAM}") +execute_process ( + COMMAND ${PERL_EXECUTABLE} ${PERL_SCRIPT} ${TEST_PROGRAM} + RESULT_VARIABLE SCRIPT_RESULT + ERROR_VARIABLE SCRIPT_ERR + OUTPUT_VARIABLE SCRIPT_OUTPUT + WORKING_DIRECTORY ${TEST_FOLDER} +) +message(STATUS "Background: ${SCRIPT_OUTPUT}") +if (NOT "${SCRIPT_RESULT}" STREQUAL "0") + message (FATAL_ERROR "Failed: The background script failed ${SCRIPT_RESULT}: ${SCRIPT_ERR}") +endif () + +set(verification_done "0") +while(verification_done LESS "1") + message(STATUS "checking first stage:${TEST_FOLDER}/${TEST_ARGS1}") + if(EXISTS ${TEST_FOLDER}/${TEST_ERR}) + # Error exit script + set(verification_done "3") + elseif(EXISTS ${TEST_FOLDER}/${TEST_ARGS1}) + file (STRINGS ${TEST_FOLDER}/${TEST_ARGS1} v1) + list (LENGTH v1 len_v1) + message(STATUS "v1:${v1} len_v1:${len_v1}") + if (NOT "${len_v1}" STREQUAL "0") + list (GET v1 0 param1) + list (GET v1 -1 param2) + endif () + file(REMOVE ${TEST_FOLDER}/${TEST_ARGS1}) + message(STATUS "PARAM1:${param1} PARAM2:${param2}") + + if(${param1} MATCHES "VERIFICATION_DONE") + set(verification_done "1") + file(WRITE ${TEST_FOLDER}/${TEST_ARGS2} "all flush verification complete") + message(STATUS "write: ${TEST_FOLDER}/${TEST_ARGS2}") + else() + message(STATUS "execute: ${TEST_PROGRAM} ${param1} ${param2}") + execute_process ( + COMMAND ${TEST_PROGRAM} ${param1} ${param2} + RESULT_VARIABLE TEST_RESULT + OUTPUT_FILE ${TEST_OUTPUT} + ERROR_FILE ${TEST_OUTPUT}.err + OUTPUT_VARIABLE TEST_OUT + ERROR_VARIABLE TEST_ERROR + WORKING_DIRECTORY ${TEST_FOLDER} + ) + message(STATUS "flush verification: ${TEST_OUT}") + if (NOT "${TEST_RESULT}" STREQUAL "0") + message (FATAL_ERROR "Failed: The flush verification failed ${TEST_RESULT}: ${TEST_ERROR}") + endif () + file(WRITE ${TEST_FOLDER}/${TEST_ARGS2} "verification flush process done") + endif() + else() + message(STATUS "waiting: ${TEST_FOLDER}/${TEST_ARGS1}") + #execute_process (COMMAND ${CMAKE_COMMAND} -E sleep 2) + endif() +endwhile() + +while(verification_done LESS "2") + message(STATUS "checking second stage:${TEST_FOLDER}/${TEST_ARGS1}") + if(EXISTS ${TEST_FOLDER}/${TEST_ERR}) + # Error exit script + set(verification_done "3") + elseif(EXISTS ${TEST_FOLDER}/${TEST_ARGS1}) + file (STRINGS ${TEST_FOLDER}/${TEST_ARGS1} v1) + list (LENGTH v1 len_v1) + message(STATUS "v1:${v1} len_v1:${len_v1}") + if (NOT "${len_v1}" STREQUAL "0") + list (GET v1 0 param1) + list (GET v1 -1 param2) + endif () + file(REMOVE ${TEST_FOLDER}/${TEST_ARGS1}) + message(STATUS "PARAM1:${param1} PARAM2:${param2}") + + if(${param1} MATCHES "VERIFICATION_DONE") + set(verification_done "2") + file(WRITE ${TEST_FOLDER}/${TEST_ARGS2} "all refresh verification complete") + message(STATUS "write: ${TEST_FOLDER}/${TEST_ARGS2}") + else() + message(STATUS "execute: ${TEST_PROGRAM} ${param1}") + execute_process ( + COMMAND ${TEST_PROGRAM} ${param1} + RESULT_VARIABLE TEST_RESULT + OUTPUT_FILE ${TEST_OUTPUT} + ERROR_FILE ${TEST_OUTPUT}.err + OUTPUT_VARIABLE TEST_OUT + ERROR_VARIABLE TEST_ERROR + WORKING_DIRECTORY ${TEST_FOLDER} + ) + message(STATUS "refresh verification: ${TEST_OUT}") + if (NOT "${TEST_RESULT}" STREQUAL "0") + message (FATAL_ERROR "Failed: The refresh verification failed ${TEST_RESULT}: ${TEST_ERROR}") + endif () + file(WRITE ${TEST_FOLDER}/${TEST_ARGS2} "refresh verifiction process done") + endif() + else() + message(STATUS "waiting: ${TEST_FOLDER}/${TEST_ARGS1}") + #execute_process (COMMAND ${CMAKE_COMMAND} -E sleep 2) + endif() +endwhile() + +message (STATUS "COMMAND Result: ${TEST_RESULT}") + +# if the return value is !=${TEST_EXPECT} bail out +if (NOT "${TEST_RESULT}" STREQUAL "${TEST_EXPECT}") + if (NOT TEST_NOERRDISPLAY) + if (EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}) + file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM) + message (STATUS "Output :\n${TEST_STREAM}") + endif () + endif () + message (FATAL_ERROR "Failed: Test program ${TEST_PROGRAM} exited != ${TEST_EXPECT}.\n${TEST_ERROR}") +endif () + +message (STATUS "COMMAND Error: ${TEST_ERROR}") + +# everything went fine... +message ("Passed") |