From 6d4d0fb13db06895fc6ea5f98ae0b79b44aa98af Mon Sep 17 00:00:00 2001 From: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Date: Wed, 20 Oct 2021 08:25:06 -0500 Subject: Move test utilities to utils/test folder (#1109) * Move test utilities to utils/test folder * Fix makefile assignment * Add new dir * add new folder * Correct copied makefile * Fix dir typo * Add missing include dir * Remove unnecessary lib link * Correct dependent dirs * Fix conditional checks * Disable test if not built * fix path to executable * Use fixture for swmr_vfd check * Add release note * Correct shell tests and c++ flag warning * Update autotools c++ warning * Fix typo --- CMakeLists.txt | 5 +-- MANIFEST | 11 +++++- c++/test/CMakeVFDTests.cmake | 33 +--------------- config/cmake/HDF5Macros.cmake | 37 +++++++++++++++++ config/cmake/HDFCXXCompilerFlags.cmake | 4 +- config/gnu-cxxflags | 4 +- config/gnu-warnings/cxx-developer-4.8 | 16 ++++++++ config/gnu-warnings/no-cxx-developer-4.8 | 9 +++++ configure.ac | 1 + hl/tools/h5watch/CMakeLists.txt | 23 ----------- hl/tools/h5watch/CMakeTests.cmake | 68 +++++++++++++++++--------------- hl/tools/h5watch/Makefile.am | 3 +- hl/tools/h5watch/swmr_check_compat_vfd.c | 55 -------------------------- hl/tools/h5watch/testh5watch.sh.in | 8 +++- release_docs/RELEASE.txt | 12 +++++- test/CMakeLists.txt | 43 ++++++++++---------- test/CMakeTests.cmake | 2 - test/CMakeVFDTests.cmake | 33 +--------------- test/Makefile.am | 14 +++++-- test/ShellTests.cmake | 9 +++-- test/swmr_check_compat_vfd.c | 53 ------------------------- test/test_usecases.sh.in | 32 ++++++++++++--- test/testflushrefresh.sh.in | 24 ++++++++--- test/testswmr.sh.in | 38 ++++++++++-------- test/testvdsswmr.sh.in | 12 ++++-- testpar/CMakeVFDTests.cmake | 34 +--------------- tools/test/h5dump/CMakeVFDTests.cmake | 19 ++------- tools/test/h5repack/CMakeVFDTests.cmake | 32 +-------------- utils/CMakeLists.txt | 9 ++++- utils/Makefile.am | 14 ++++++- utils/test/CMakeLists.txt | 35 ++++++++++++++++ utils/test/Makefile.am | 34 ++++++++++++++++ utils/test/swmr_check_compat_vfd.c | 53 +++++++++++++++++++++++++ 33 files changed, 393 insertions(+), 386 deletions(-) create mode 100644 config/gnu-warnings/cxx-developer-4.8 create mode 100644 config/gnu-warnings/no-cxx-developer-4.8 delete mode 100644 hl/tools/h5watch/swmr_check_compat_vfd.c delete mode 100644 test/swmr_check_compat_vfd.c create mode 100644 utils/test/CMakeLists.txt create mode 100644 utils/test/Makefile.am create mode 100644 utils/test/swmr_check_compat_vfd.c diff --git a/CMakeLists.txt b/CMakeLists.txt index 13f2e35..3c6df76 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1004,10 +1004,7 @@ endif () # Option to build HDF5 Utilities #----------------------------------------------------------------------------- if (EXISTS "${HDF5_SOURCE_DIR}/utils" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/utils") - option (HDF5_BUILD_UTILS "Build HDF5 Utils" ON) - if (HDF5_BUILD_UTILS) - add_subdirectory (utils) - endif () + add_subdirectory (utils) endif () #----------------------------------------------------------------------------- diff --git a/MANIFEST b/MANIFEST index bd9817f..d8867f6 100644 --- a/MANIFEST +++ b/MANIFEST @@ -173,6 +173,7 @@ ./config/gnu-warnings/cxx-4.9 ./config/gnu-warnings/cxx-5 ./config/gnu-warnings/cxx-9 +./config/gnu-warnings/cxx-developer-4.8 ./config/gnu-warnings/cxx-error-5 ./config/gnu-warnings/cxx-error-general ./config/gnu-warnings/developer-4.8 @@ -189,6 +190,7 @@ ./config/gnu-warnings/gfort-5 ./config/gnu-warnings/gfort-6 ./config/gnu-warnings/gfort-8 +./config/gnu-warnings/no-cxx-developer-4.8 ./config/gnu-warnings/no-developer-4.8 ./config/gnu-warnings/no-developer-8 ./config/gnu-warnings/no-developer-general @@ -1301,7 +1303,6 @@ ./test/stab.c ./test/swmr.c ./test/swmr_addrem_writer.c -./test/swmr_check_compat_vfd.c ./test/swmr_common.c ./test/swmr_common.h ./test/swmr_generator.c @@ -2988,6 +2989,10 @@ ./utils/mirror_vfd/mirror_server_stop.c ./utils/mirror_vfd/mirror_writer.c +# test utilities +./utils/test/Makefile.am +./utils/test/swmr_check_compat_vfd.c + # high level libraries ./hl/Makefile.am ./hl/examples/Makefile.am @@ -3099,7 +3104,6 @@ ./hl/tools/h5watch/extend_dset.c ./hl/tools/h5watch/h5watch.c ./hl/tools/h5watch/h5watchgentest.c -./hl/tools/h5watch/swmr_check_compat_vfd.c ./hl/tools/h5watch/testh5watch.sh.in # expected test output from testing h5watch @@ -3724,7 +3728,9 @@ ./tools/test/misc/vds/CMakeLists.txt ./tools/test/perform/CMakeLists.txt ./tools/test/perform/CMakeTests.cmake + ./utils/CMakeLists.txt +./utils/test/CMakeLists.txt ./utils/mirror_vfd/CMakeLists.txt # CMake-specific User Scripts @@ -3840,3 +3846,4 @@ ./tools/test/perform/Makefile.in ./utils/Makefile.in ./utils/mirror_vfd/Makefile.in +./utils/test/Makefile.in diff --git a/c++/test/CMakeVFDTests.cmake b/c++/test/CMakeVFDTests.cmake index 6a74244..d525bb5 100644 --- a/c++/test/CMakeVFDTests.cmake +++ b/c++/test/CMakeVFDTests.cmake @@ -16,37 +16,7 @@ ############################################################################## ############################################################################## -set (VFD_LIST - sec2 - stdio - core - core_paged - split - multi - family - splitter - #log - log VFD currently has file space allocation bugs -) - -if (H5_HAVE_DIRECT) - set (VFD_LIST ${VFD_LIST} direct) -endif () -if (H5_HAVE_PARALLEL) - # MPI I/O VFD is currently incompatible with too many tests in the VFD test set - # set (VFD_LIST ${VFD_LIST} mpio) -endif () -if (H5_HAVE_MIRROR_VFD) - set (VFD_LIST ${VFD_LIST} mirror) -endif () -if (H5_HAVE_ROS3_VFD) - set (VFD_LIST ${VFD_LIST} ros3) -endif () -if (H5_HAVE_LIBHDFS) - set (VFD_LIST ${VFD_LIST} hdfs) -endif () -if (H5_HAVE_WINDOWS) - set (VFD_LIST ${VFD_LIST} windows) -endif () +H5_SET_VFD_LIST() ############################################################################## ############################################################################## @@ -56,7 +26,6 @@ endif () macro (ADD_VFD_TEST vfdname resultcode) if (NOT HDF5_ENABLE_USING_MEMCHECKER) - file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/${vfdname}") add_test ( NAME CPP_VFD-${vfdname}-cpp_testhdf5-clear-objects COMMAND ${CMAKE_COMMAND} -E remove diff --git a/config/cmake/HDF5Macros.cmake b/config/cmake/HDF5Macros.cmake index 090524a..b3cf015 100644 --- a/config/cmake/HDF5Macros.cmake +++ b/config/cmake/HDF5Macros.cmake @@ -58,5 +58,42 @@ macro (H5_SET_LIB_OPTIONS libtarget libname libtype libpackage) endif () endif () endif () +endmacro () + +macro (H5_SET_VFD_LIST) + set (VFD_LIST + sec2 + stdio + core + core_paged + split + multi + family + splitter + #log - log VFD currently has file space allocation bugs + ) + + if (H5_HAVE_DIRECT) + set (VFD_LIST ${VFD_LIST} direct) + endif () + if (H5_HAVE_PARALLEL) + # MPI I/O VFD is currently incompatible with too many tests in the VFD test set + # set (VFD_LIST ${VFD_LIST} mpio) + endif () + if (H5_HAVE_MIRROR_VFD) + set (VFD_LIST ${VFD_LIST} mirror) + endif () + if (H5_HAVE_ROS3_VFD) + set (VFD_LIST ${VFD_LIST} ros3) + endif () + if (H5_HAVE_LIBHDFS) + set (VFD_LIST ${VFD_LIST} hdfs) + endif () + if (H5_HAVE_WINDOWS) + set (VFD_LIST ${VFD_LIST} windows) + endif () + foreach (vfdtest ${VFD_LIST}) + file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/${vfdtest}") + endforeach () endmacro () diff --git a/config/cmake/HDFCXXCompilerFlags.cmake b/config/cmake/HDFCXXCompilerFlags.cmake index 7bfd0bd..a5af43c 100644 --- a/config/cmake/HDFCXXCompilerFlags.cmake +++ b/config/cmake/HDFCXXCompilerFlags.cmake @@ -181,9 +181,9 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/cxx-4.8") if (HDF5_ENABLE_DEV_WARNINGS) # Use the C warnings as CXX warnings are the same - ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-4.8") + ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/cxx-developer-4.8") else () - ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-4.8") + ADD_H5_FLAGS (H5_CXXFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-cxx-developer-4.8") endif () endif () diff --git a/config/gnu-cxxflags b/config/gnu-cxxflags index 280679d..56e89bc 100644 --- a/config/gnu-cxxflags +++ b/config/gnu-cxxflags @@ -221,8 +221,8 @@ if test "X-g++" = "X-$cxx_vendor"; then if test $cxx_vers_major -ge 5 -o $cxx_vers_major -eq 4 -a $cxx_vers_minor -ge 8; then H5_CXXFLAGS="$H5_CXXFLAGS $(load_gnu_arguments cxx-4.8)" # Use the C warnings as CXX warnings are the same - DEVELOPER_WARNING_CXXFLAGS="$DEVELOPER_WARNING_CXXFLAGS $(load_gnu_arguments developer-4.8)" - NO_DEVELOPER_WARNING_CXXFLAGS="$NO_DEVELOPER_WARNING_CXXFLAGS $(load_gnu_arguments no-developer-4.8)" + DEVELOPER_WARNING_CXXFLAGS="$DEVELOPER_WARNING_CXXFLAGS $(load_gnu_arguments cxx-developer-4.8)" + NO_DEVELOPER_WARNING_CXXFLAGS="$NO_DEVELOPER_WARNING_CXXFLAGS $(load_gnu_arguments no-cxx-developer-4.8)" fi # gcc >= 4.9 diff --git a/config/gnu-warnings/cxx-developer-4.8 b/config/gnu-warnings/cxx-developer-4.8 new file mode 100644 index 0000000..e0d975f --- /dev/null +++ b/config/gnu-warnings/cxx-developer-4.8 @@ -0,0 +1,16 @@ +# developer warning flags added for GCC >= 4.5 +# +# developer warning flag added for GCC >= 4.6 +-Wsuggest-attribute=const + +# developer warning flags added for GCC >= 4.7 +-Wsuggest-attribute=noreturn +-Wsuggest-attribute=pure +# +# It's not clear that -Wvector-operation-performance warnings are +# actionable, so they are demoted to "developer" warnings. +# +-Wvector-operation-performance + +# developer warning flag added for GCC >= 4.8 +-Wsuggest-attribute=format diff --git a/config/gnu-warnings/no-cxx-developer-4.8 b/config/gnu-warnings/no-cxx-developer-4.8 new file mode 100644 index 0000000..3c3de93 --- /dev/null +++ b/config/gnu-warnings/no-cxx-developer-4.8 @@ -0,0 +1,9 @@ +# no-developer warning flag added for GCC >= 4.6 +-Wno-suggest-attribute=const + +# no-developer warning flags added for GCC >= 4.7 +-Wno-suggest-attribute=noreturn +-Wno-suggest-attribute=pure + +# no-developer warning flag added for GCC >= 4.8 +-Wno-suggest-attribute=format diff --git a/configure.ac b/configure.ac index e5f67d4..7665f8e 100644 --- a/configure.ac +++ b/configure.ac @@ -4001,6 +4001,7 @@ AC_CONFIG_FILES([src/libhdf5.settings testpar/testpflush.sh utils/Makefile utils/mirror_vfd/Makefile + utils/test/Makefile tools/Makefile tools/lib/Makefile tools/libtest/Makefile diff --git a/hl/tools/h5watch/CMakeLists.txt b/hl/tools/h5watch/CMakeLists.txt index be983ba..1ab473d 100644 --- a/hl/tools/h5watch/CMakeLists.txt +++ b/hl/tools/h5watch/CMakeLists.txt @@ -40,29 +40,6 @@ if (HDF5_ENABLE_FORMATTERS) endif () if (BUILD_TESTING AND HDF5_TEST_SWMR AND HDF5_TEST_SERIAL) - #-- Add swmr_check_compat_vfd program - set (hl_swmr_check_compat_vfd_SOURCES - ${HDF5_HL_TOOLS_H5WATCH_SOURCE_DIR}/swmr_check_compat_vfd.c - ) - add_executable (hl_swmr_check_compat_vfd ${hl_swmr_check_compat_vfd_SOURCES}) - target_compile_options(hl_swmr_check_compat_vfd PRIVATE "${HDF5_CMAKE_C_FLAGS}") - target_include_directories (hl_swmr_check_compat_vfd PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") - if (NOT ONLY_SHARED_LIBS) - TARGET_C_PROPERTIES (hl_swmr_check_compat_vfd STATIC) - target_link_libraries (hl_swmr_check_compat_vfd PRIVATE ${HDF5_LIB_TARGET}) - else () - TARGET_C_PROPERTIES (hl_swmr_check_compat_vfd SHARED) - target_link_libraries (hl_swmr_check_compat_vfd PRIVATE ${HDF5_LIBSH_TARGET}) - endif () - set_target_properties (hl_swmr_check_compat_vfd PROPERTIES FOLDER tools/hl) - - #----------------------------------------------------------------------------- - # Add Target to clang-format - #----------------------------------------------------------------------------- - if (HDF5_ENABLE_FORMATTERS) - clang_format (HDF5_HL_TOOLS_H5WATCH_hl_swmr_check_compat_vfd_FORMAT hl_swmr_check_compat_vfd) - endif () - #-- Add extend_dset program set (extend_dset_SOURCES ${HDF5_HL_TOOLS_H5WATCH_SOURCE_DIR}/extend_dset.c diff --git a/hl/tools/h5watch/CMakeTests.cmake b/hl/tools/h5watch/CMakeTests.cmake index 60c099b..b2f689b 100644 --- a/hl/tools/h5watch/CMakeTests.cmake +++ b/hl/tools/h5watch/CMakeTests.cmake @@ -149,18 +149,22 @@ add_custom_target(H5WATCH_files ALL COMMENT "Copying files needed by H5WATCH tes # Check to see if the VFD specified by the HDF5_DRIVER environment variable # supports SWMR. -set (SWMR_INCOMPAT ${hl_swmr_check_compat_vfd}) +add_test ( + NAME H5WATCH-SWMR_INCOMPAT + COMMAND swmr_check_compat_vfd +) +set_tests_properties (H5WATCH-SWMR_INCOMPAT PROPERTIES FIXTURES_SETUP swmr_vfd_check_compat) -if (NOT SWMR_INCOMPAT) # Remove any output file left over from previous test run - add_test ( - NAME H5WATCH-clearall-objects - COMMAND ${CMAKE_COMMAND} -E remove WATCH.h5 - ) - if (last_test) - set_tests_properties (H5WATCH-clearall-objects PROPERTIES DEPENDS ${last_test}) - endif () - set (last_test "H5WATCH-clearall-objects") +add_test ( + NAME H5WATCH-clearall-objects + COMMAND ${CMAKE_COMMAND} -E remove WATCH.h5 +) +set_tests_properties (H5WATCH-clearall-objects PROPERTIES FIXTURES_REQUIRED swmr_vfd_check_compat) +if (last_test) + set_tests_properties (H5WATCH-clearall-objects PROPERTIES DEPENDS ${last_test}) +endif () +set (last_test "H5WATCH-clearall-objects") ################################################################################################# # # @@ -182,32 +186,32 @@ if (NOT SWMR_INCOMPAT) # # ################################################################################################# # create the output files to be used. - add_test (NAME H5WATCH-h5watchgentest COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) - set_tests_properties (H5WATCH-h5watchgentest PROPERTIES - WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles" - DEPENDS "H5WATCH-clearall-objects" - ) - set_tests_properties (H5WATCH-h5watchgentest PROPERTIES FIXTURES_SETUP gen_test_watch) - set (last_test "H5WATCH-h5watchgentest") +add_test (NAME H5WATCH-h5watchgentest COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) +set_tests_properties (H5WATCH-h5watchgentest PROPERTIES + WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles" + DEPENDS "H5WATCH-clearall-objects" +) +set_tests_properties (H5WATCH-h5watchgentest PROPERTIES FIXTURES_SETUP gen_test_watch) +set_tests_properties (H5WATCH-h5watchgentest PROPERTIES FIXTURES_REQUIRED swmr_vfd_check_compat) +set (last_test "H5WATCH-h5watchgentest") # Test on --help options - ADD_H5_TEST (w-help1 0 --help) +ADD_H5_TEST (w-help1 0 --help) # # Tests on expected failures - ADD_H5_ERR_TEST (w-err-dset1 1 WATCH.h5) - ADD_H5_ERR_TEST (w-err-dset2 1 WATCH.h5/group/DSET_CMPD) - ADD_H5_ERR_TEST (w-err-dset-none 1 WATCH.h5/DSET_NONE) - ADD_H5_ERR_TEST (w-err-dset-nomax 1 WATCH.h5/DSET_NOMAX) - ADD_H5_ERR_TEST (w-err-file 1 ../WATCH.h5/DSET_CMPD) - ADD_H5_TEST (w-err-width 1 --width=-8 WATCH.h5/DSET_ONE) - ADD_H5_TEST (w-err-poll 1 --polling=-8 WATCH.h5/DSET_ONE) - ADD_H5_TEST (w-err-poll0 1 --polling=0 WATCH.h5/DSET_ONE) +ADD_H5_ERR_TEST (w-err-dset1 1 WATCH.h5) +ADD_H5_ERR_TEST (w-err-dset2 1 WATCH.h5/group/DSET_CMPD) +ADD_H5_ERR_TEST (w-err-dset-none 1 WATCH.h5/DSET_NONE) +ADD_H5_ERR_TEST (w-err-dset-nomax 1 WATCH.h5/DSET_NOMAX) +ADD_H5_ERR_TEST (w-err-file 1 ../WATCH.h5/DSET_CMPD) +ADD_H5_TEST (w-err-width 1 --width=-8 WATCH.h5/DSET_ONE) +ADD_H5_TEST (w-err-poll 1 --polling=-8 WATCH.h5/DSET_ONE) +ADD_H5_TEST (w-err-poll0 1 --polling=0 WATCH.h5/DSET_ONE) # # Tests on invalid field names via --fields option for a compound typed dataset: DSET_CMPD - ADD_H5_ERR_TEST (w-err-cmpd1 1 --fields=fieldx WATCH.h5/DSET_CMPD) - ADD_H5_ERR_TEST (w-err-cmpd2 1 --fields=field1,field2. WATCH.h5/DSET_CMPD) - ADD_H5_ERR_TEST (w-err-cmpd3 1 --fields=field1,field2, WATCH.h5/DSET_CMPD) - ADD_H5_ERR_TEST (w-err-cmpd4 1 --fields=field1,field2.b.k WATCH.h5/DSET_CMPD) - ADD_H5_ERR_TEST (w-err-cmpd5 1 --fields=field1 --fields=field2.b.k WATCH.h5/DSET_CMPD) +ADD_H5_ERR_TEST (w-err-cmpd1 1 --fields=fieldx WATCH.h5/DSET_CMPD) +ADD_H5_ERR_TEST (w-err-cmpd2 1 --fields=field1,field2. WATCH.h5/DSET_CMPD) +ADD_H5_ERR_TEST (w-err-cmpd3 1 --fields=field1,field2, WATCH.h5/DSET_CMPD) +ADD_H5_ERR_TEST (w-err-cmpd4 1 --fields=field1,field2.b.k WATCH.h5/DSET_CMPD) +ADD_H5_ERR_TEST (w-err-cmpd5 1 --fields=field1 --fields=field2.b.k WATCH.h5/DSET_CMPD) # -endif () diff --git a/hl/tools/h5watch/Makefile.am b/hl/tools/h5watch/Makefile.am index 5112965..13bd820 100644 --- a/hl/tools/h5watch/Makefile.am +++ b/hl/tools/h5watch/Makefile.am @@ -24,7 +24,6 @@ AM_CPPFLAGS+=-I$(top_srcdir)/src -I$(top_srcdir)/tools/lib -I$(top_srcdir)/hl/sr # These are our main targets, the tools bin_PROGRAMS=h5watch -noinst_PROGRAMS=swmr_check_compat_vfd # Add h5watch specific linker flags here h5watch_LDFLAGS = $(LT_STATIC_EXEC) $(AM_LDFLAGS) @@ -38,7 +37,7 @@ if BUILD_TESTS_CONDITIONAL TEST_SCRIPT=testh5watch.sh check_SCRIPTS=$(TEST_SCRIPT) SCRIPT_DEPEND=swmr_check_compat_vfd$(EXEEXT) extend_dset$(EXEEXT) h5watch$(EXEEXT) - noinst_PROGRAMS+=h5watchgentest extend_dset + noinst_PROGRAMS=h5watchgentest extend_dset # Add extend_dset specific preprocessor flags here # (add the main test subdirectory to the include file path) extend_dset_CPPFLAGS=$(AM_CPPFLAGS) -I$(top_srcdir)/test diff --git a/hl/tools/h5watch/swmr_check_compat_vfd.c b/hl/tools/h5watch/swmr_check_compat_vfd.c deleted file mode 100644 index b4021e4..0000000 --- a/hl/tools/h5watch/swmr_check_compat_vfd.c +++ /dev/null @@ -1,55 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * - * 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. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -/* Purpose: This is a small program that checks if the HDF5_DRIVER - * environment variable is set to a value that supports SWMR. - * - * It is intended for use in shell scripts. - */ - -#include - -#include "H5private.h" - -/* This file needs to access the file driver testing code */ -#define H5FD_FRIEND /*suppress error about including H5FDpkg */ -#define H5FD_TESTING -#include "H5FDpkg.h" /* File drivers */ - -/*------------------------------------------------------------------------- - * Function: main - * - * Purpose: Inspects the HDF5_DRIVER environment variable, which - * determines the VFD that the test harness will use with - * the majority of the tests. - * - * Return: VFD supports SWMR: EXIT_SUCCESS - * - * VFD does not support SWMR - * or failure: EXIT_FAILURE - * - *------------------------------------------------------------------------- - */ -int -main(void) -{ - char *driver = NULL; - - driver = HDgetenv(HDF5_DRIVER); - - if (H5FD__supports_swmr_test(driver)) - return EXIT_SUCCESS; - else - return EXIT_FAILURE; - -} /* end main() */ diff --git a/hl/tools/h5watch/testh5watch.sh.in b/hl/tools/h5watch/testh5watch.sh.in index 67ffcc3..04b6ef8 100644 --- a/hl/tools/h5watch/testh5watch.sh.in +++ b/hl/tools/h5watch/testh5watch.sh.in @@ -13,10 +13,16 @@ # # Tests for the h5watch tool # +bindir=@bindir@ + +# If the bindir directory is not set just use current (.). +if test -z "$bindir"; then + bindir=. +fi # Check to see if the VFD specified by the HDF5_DRIVER environment variable # supports SWMR. -./swmr_check_compat_vfd +$bindir/swmr_check_compat_vfd rc=$? if [ $rc != 0 ] ; then echo diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 8a2c496..d9a4e8e 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -47,10 +47,18 @@ New Features Configuration: ------------- + - Refactored the utils folder. + + Added subfolder test and moved the 'swmr_check_compat_vfd.c file' + from test into utils/test. Deleted the duplicate swmr_check_compat_vfd.c + file in hl/tools/h5watch folder. Also fixed vfd check options. + + (ADB - 2021/10/18) + - Changed autotools and CMake configurations to derive both compilation warnings-as-errors and warnings-only-warn configurations - from the same files, `config/*/*error*`. Removed redundant files - `config/*/*noerror*`. + from the same files, 'config/*/*error*'. Removed redundant files + 'config/*/*noerror*'. (DCY - 2021/09/29) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 1461101..37e6af6 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -357,7 +357,7 @@ set (H5_TESTS ros3 s3comms hdfs - mirror_vfd + #mirror_vfd # multiple source ntypes dangle dtransform @@ -378,6 +378,9 @@ set (H5_TESTS cmpd_dtransform event_set ) +if (HDF5_BUILD_UTILS) + set (H5_TESTS ${H5_TESTS} mirror_vfd) +endif () macro (ADD_H5_EXE file) add_executable (${file} ${HDF5_TEST_SOURCE_DIR}/${file}.c) @@ -552,30 +555,25 @@ if (HDF5_ENABLE_FORMATTERS) clang_format (HDF5_TEST_thread_id_FORMAT thread_id) endif () +if (HDF5_BUILD_UTILS) #-- Adding test for mirror_vfd add_executable (mirror_vfd ${mirror_vfd_SOURCES}) -target_include_directories (mirror_vfd PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") -if (NOT BUILD_SHARED_LIBS) - TARGET_C_PROPERTIES (mirror_vfd STATIC) - target_link_libraries (mirror_vfd PRIVATE ${HDF5_TEST_LIB_TARGET}) -else () - TARGET_C_PROPERTIES (mirror_vfd SHARED) - target_link_libraries (mirror_vfd PRIVATE ${HDF5_TEST_LIBSH_TARGET}) -endif () -set_target_properties (mirror_vfd PROPERTIES FOLDER test) - -#----------------------------------------------------------------------------- -# Add Target to clang-format -#----------------------------------------------------------------------------- -if (HDF5_ENABLE_FORMATTERS) - clang_format (HDF5_TEST_mirror_vfd_FORMAT mirror_vfd) -endif () + target_include_directories (mirror_vfd PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + if (NOT BUILD_SHARED_LIBS) + TARGET_C_PROPERTIES (mirror_vfd STATIC) + target_link_libraries (mirror_vfd PRIVATE ${HDF5_TEST_LIB_TARGET}) + else () + TARGET_C_PROPERTIES (mirror_vfd SHARED) + target_link_libraries (mirror_vfd PRIVATE ${HDF5_TEST_LIBSH_TARGET}) + endif () + set_target_properties (mirror_vfd PROPERTIES FOLDER test) -#----------------------------------------------------------------------------- -# Add Target to clang-format -#----------------------------------------------------------------------------- -if (HDF5_ENABLE_FORMATTERS) - clang_format (HDF5_TEST_event_set_FORMAT event_set) + #----------------------------------------------------------------------------- + # Add Target to clang-format + #----------------------------------------------------------------------------- + if (HDF5_ENABLE_FORMATTERS) + clang_format (HDF5_TEST_mirror_vfd_FORMAT mirror_vfd) + endif () endif () ############################################################################## @@ -617,7 +615,6 @@ endif () set (H5_SWMR_TESTS swmr_addrem_writer - swmr_check_compat_vfd swmr_generator swmr_reader swmr_remove_reader diff --git a/test/CMakeTests.cmake b/test/CMakeTests.cmake index c537f37..b2ed8e8 100644 --- a/test/CMakeTests.cmake +++ b/test/CMakeTests.cmake @@ -879,8 +879,6 @@ if (ENABLE_EXTENDED_TESTS) # testswmr.sh: swmr* # testvdsswmr.sh: vds_swmr* -# add_test (NAME H5Test-swmr_check_compat_vfd COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) - #-- Adding test for flushrefresh file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/H5TEST/flushrefresh_test") if (H5_PERL_FOUND) diff --git a/test/CMakeVFDTests.cmake b/test/CMakeVFDTests.cmake index 723595b..e557676 100644 --- a/test/CMakeVFDTests.cmake +++ b/test/CMakeVFDTests.cmake @@ -17,40 +17,9 @@ ############################################################################## # included from CMakeTests.cmake -set (VFD_LIST - sec2 - stdio - core - core_paged - split - multi - family - splitter - #log - log VFD currently has file space allocation bugs -) - -if (H5_HAVE_DIRECT) - set (VFD_LIST ${VFD_LIST} direct) -endif () -if (H5_HAVE_PARALLEL) - # MPI I/O VFD is currently incompatible with too many tests in the VFD test set - # set (VFD_LIST ${VFD_LIST} mpio) -endif () -if (H5_HAVE_MIRROR_VFD) - set (VFD_LIST ${VFD_LIST} mirror) -endif () -if (H5_HAVE_ROS3_VFD) - set (VFD_LIST ${VFD_LIST} ros3) -endif () -if (H5_HAVE_LIBHDFS) - set (VFD_LIST ${VFD_LIST} hdfs) -endif () -if (H5_HAVE_WINDOWS) - set (VFD_LIST ${VFD_LIST} windows) -endif () +H5_SET_VFD_LIST() foreach (vfdtest ${VFD_LIST}) - file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/${vfdtest}") file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/${vfdtest}/testfiles") file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/${vfdtest}/testfiles/plist_files") endforeach () diff --git a/test/Makefile.am b/test/Makefile.am index 09277b0..ff09003 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -36,8 +36,7 @@ AM_CPPFLAGS+=-I$(top_srcdir)/src -I$(top_builddir)/src # test_mirror.sh: mirror_vfd ../utils/mirror_vfd/* # test_usecases.sh: use_append_chunk, use_append_mchunks, use_disable_mdc_flushes TEST_SCRIPT = testerror.sh testlibinfo.sh testcheck_version.sh testlinks_env.sh testexternal_env.sh \ - testswmr.sh testvds_env.sh testvdsswmr.sh testflushrefresh.sh test_usecases.sh testabort_fail.sh \ - test_mirror.sh + testswmr.sh testvds_env.sh testvdsswmr.sh testflushrefresh.sh test_usecases.sh testabort_fail.sh SCRIPT_DEPEND = error_test$(EXEEXT) err_compat$(EXEEXT) links_env$(EXEEXT) \ external_env$(EXEEXT) filenotclosed$(EXEEXT) del_many_dense_attrs$(EXEEXT) \ flushrefresh$(EXEEXT) use_append_chunk$(EXEEXT) use_append_mchunks$(EXEEXT) use_disable_mdc_flushes$(EXEEXT) \ @@ -50,6 +49,10 @@ if HAVE_SHARED_CONDITIONAL SCRIPT_DEPEND += filter_plugin$(EXEEXT) vol_plugin$(EXEEXT) endif +if MIRROR_VFD_CONDITIONAL + TEST_SCRIPT += test_mirror.sh +endif + check_SCRIPTS = $(TEST_SCRIPT) # These are our main targets. They should be listed in the order to be @@ -91,12 +94,15 @@ check_PROGRAMS=$(TEST_PROG) error_test err_compat tcheck_version \ use_append_chunk use_append_chunk_mirror use_append_mchunks use_disable_mdc_flushes \ swmr_generator swmr_start_write swmr_reader swmr_writer swmr_remove_reader \ swmr_remove_writer swmr_addrem_writer swmr_sparse_reader swmr_sparse_writer \ - swmr_check_compat_vfd vds_env vds_swmr_gen vds_swmr_reader vds_swmr_writer \ - mirror_vfd + vds_env vds_swmr_gen vds_swmr_reader vds_swmr_writer if HAVE_SHARED_CONDITIONAL check_PROGRAMS+= filter_plugin vfd_plugin vol_plugin endif +if MIRROR_VFD_CONDITIONAL + check_PROGRAMS+= mirror_vfd +endif + # These programs generate test files for the tests. They don't need to be # compiled every time we want to test the library. However, putting # them in a conditional causes automake to generate rules so that they diff --git a/test/ShellTests.cmake b/test/ShellTests.cmake index 9614152..732091b 100644 --- a/test/ShellTests.cmake +++ b/test/ShellTests.cmake @@ -21,6 +21,7 @@ if (UNIX) if (SH_PROGRAM) set (srcdir ${HDF5_TEST_SOURCE_DIR}) set (bindir ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) + set (testdir ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) ############################################################################## # configure scripts to test dir ############################################################################## @@ -37,7 +38,7 @@ if (UNIX) #shell script creates dir #file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/H5TEST/swmr_test") add_custom_command ( - TARGET swmr_check_compat_vfd + TARGET accum_swmr_reader 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" @@ -46,9 +47,11 @@ if (UNIX) #shell script creates dir #file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/H5TEST/usecases_test") - file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/H5TEST/swmr_test") + #shell script creates dir + #file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/H5TEST/swmr_test") - file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/H5TEST/vds_swmr_test") + #shell script creates dir + #file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/H5TEST/vds_swmr_test") ############################################################################## ############################################################################## diff --git a/test/swmr_check_compat_vfd.c b/test/swmr_check_compat_vfd.c deleted file mode 100644 index 720c747..0000000 --- a/test/swmr_check_compat_vfd.c +++ /dev/null @@ -1,53 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * - * 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. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -/* Purpose: This is a small program that checks if the HDF5_DRIVER - * environment variable is set to a value that supports SWMR. - * - * It is intended for use in shell scripts. - */ - -#include "h5test.h" - -/* This file needs to access the file driver testing code */ -#define H5FD_FRIEND /*suppress error about including H5FDpkg */ -#define H5FD_TESTING -#include "H5FDpkg.h" /* File drivers */ - -/*------------------------------------------------------------------------- - * Function: main - * - * Purpose: Inspects the HDF5_DRIVER environment variable, which - * determines the VFD that the test harness will use with - * the majority of the tests. - * - * Return: VFD supports SWMR: EXIT_SUCCESS - * - * VFD does not support SWMR - * or failure: EXIT_FAILURE - * - *------------------------------------------------------------------------- - */ -int -main(void) -{ - char *driver = NULL; - - driver = HDgetenv(HDF5_DRIVER); - - if (H5FD__supports_swmr_test(driver)) - return EXIT_SUCCESS; - else - return EXIT_FAILURE; - -} /* end main() */ diff --git a/test/test_usecases.sh.in b/test/test_usecases.sh.in index eaa875e..3f7d5f1 100644 --- a/test/test_usecases.sh.in +++ b/test/test_usecases.sh.in @@ -21,14 +21,38 @@ # For now, it shows how to run the test cases programs. It only verifies the # exit codes are okay (0). +############################################################################### +## test variables +############################################################################### + +# Number of errors encountered during test run. +nerrors=0 + +# Define variables +verbose=yes + +############################################################################### +## Main +############################################################################### srcdir=@srcdir@ bindir=@bindir@ +testdir=@testdir@ + +# The build (current) directory might be different than the source directory. +if test -z "$srcdir"; then + srcdir=. +fi # If the bindir directory is not set just use current (.). if test -z "$bindir"; then bindir=. fi +# If the testdir directory is not set just use current (.). +if test -z "$testdir"; then + testdir=. +fi + # Check to see if the VFD specified by the HDF5_DRIVER environment variable # supports SWMR. $bindir/swmr_check_compat_vfd @@ -53,10 +77,6 @@ RESULT_SKIP="-SKIP-" USECASES_PROGRAMS="use_append_chunk use_append_mchunks" TESTNAME="Use Case" -# Define variables -nerrors=0 -verbose=yes - # Source in the output filter function definitions. . $srcdir/../bin/output_filter.sh @@ -91,7 +111,7 @@ TOOLTEST() { # Run test. TESTING $program $@ ( - $RUNSERIAL $bindir/$program "$@" + $RUNSERIAL $testdir/$program "$@" ) >$actual 2>$actual_err exit_code=$? @@ -123,7 +143,7 @@ TOOLTEST() { # the test. Running each of these tests in its own directory should eliminate # the problem. mkdir usecases_test -cp twriteorder usecases_test +cp $bindir/twriteorder usecases_test for FILE in use_*; do case "$FILE" in *.o) continue ;; ## don't copy the .o files diff --git a/test/testflushrefresh.sh.in b/test/testflushrefresh.sh.in index 83685e8..3c7f13d 100644 --- a/test/testflushrefresh.sh.in +++ b/test/testflushrefresh.sh.in @@ -58,14 +58,28 @@ fi ############################################################################### ## Main ############################################################################### +srcdir=@srcdir@ +bindir=@bindir@ +testdir=@testdir@ + # The build (current) directory might be different than the source directory. if test -z "$srcdir"; then srcdir=. fi +# If the bindir directory is not set just use current (.). +if test -z "$bindir"; then + bindir=. +fi + +# If the testdir directory is not set just use current (.). +if test -z "$testdir"; then + testdir=. +fi + # Check to see if the VFD specified by the HDF5_DRIVER environment variable # supports SWMR. -./swmr_check_compat_vfd +$bindir/swmr_check_compat_vfd rc=$? if [ $rc -ne 0 ] ; then echo @@ -83,7 +97,7 @@ fi # the test. Running each of these tests in its own directory should eliminate # the problem. mkdir -p flushrefresh_test -cp flushrefresh flushrefresh_test +cp $bindir/flushrefresh flushrefresh_test # With the --disable-shared option, flushrefresh is built in the test directory, # otherwise it is in test/.libs with a wrapper script named flushrefresh in @@ -118,7 +132,7 @@ fi # ======================== # Launch the Test Program. # ======================== -./flushrefresh & +$testdir/flushrefresh & pid_main=$! # ======================================= @@ -155,7 +169,7 @@ until [ $verification_done -eq 1 ]; do verification_done=1 echo "all flush verification complete" > $endsignal else - ./flushrefresh $param1 $param2 + $testdir/flushrefresh $param1 $param2 # Check for core dump if [ $? -gt 0 ]; then @@ -200,7 +214,7 @@ if [ $timedout -eq 0 ]; then verification_done=2 echo "all refresh verification complete" > $endsignal else - ./flushrefresh $param1 + $testdir/flushrefresh $param1 # Check for core dump if [ $? -gt 0 ]; then diff --git a/test/testswmr.sh.in b/test/testswmr.sh.in index 37e8f9c..cb60fce 100644 --- a/test/testswmr.sh.in +++ b/test/testswmr.sh.in @@ -18,6 +18,7 @@ srcdir=@srcdir@ bindir=@bindir@ +testdir=@testdir@ ############################################################################### ## test parameters @@ -103,6 +104,11 @@ if test -z "$bindir"; then bindir=. fi +# If the testdir directory is not set just use current (.). +if test -z "$testdir"; then + testdir=. +fi + # Check to see if the VFD specified by the HDF5_DRIVER environment variable # supports SWMR. $bindir/swmr_check_compat_vfd @@ -178,7 +184,7 @@ do echo "###############################################################################" # Launch the Generator without SWMR_WRITE echo launch the swmr_generator - $bindir/swmr_generator $compress $index_type + $testdir/swmr_generator $compress $index_type if test $? -ne 0; then echo generator had error nerrors=`expr $nerrors + 1` @@ -186,7 +192,7 @@ do # Launch the Generator with SWMR_WRITE echo launch the swmr_generator with SWMR_WRITE - $bindir/swmr_generator -s $compress $index_type + $testdir/swmr_generator -s $compress $index_type if test $? -ne 0; then echo generator had error nerrors=`expr $nerrors + 1` @@ -210,7 +216,7 @@ do # Launch the Writer echo launch the swmr_start_writer seed="" # Put -r command here - $bindir/swmr_start_write $compress $index_type $Nrecords $seed 2>&1 |tee swmr_writer.out & + $testdir/swmr_start_write $compress $index_type $Nrecords $seed 2>&1 |tee swmr_writer.out & pid_writer=$! $DPRINT pid_writer=$pid_writer @@ -226,7 +232,7 @@ do while [ $n -lt $Nreaders ]; do #seed="-r ${seeds[$n]}" seed="" - $bindir/swmr_reader $Nsecs_add $seed 2>&1 |tee swmr_reader.out.$n & + $testdir/swmr_reader $Nsecs_add $seed 2>&1 |tee swmr_reader.out.$n & pid_readers="$pid_readers $!" n=`expr $n + 1` done @@ -271,7 +277,7 @@ do # Launch the Generator echo launch the swmr_generator - $bindir/swmr_generator -s $compress $index_type + $testdir/swmr_generator -s $compress $index_type if test $? -ne 0; then echo generator had error nerrors=`expr $nerrors + 1` @@ -283,7 +289,7 @@ do # Launch the Writer echo launch the swmr_writer seed="" # Put -r command here - $bindir/swmr_writer -o $Nrecords $seed 2>&1 |tee swmr_writer.out & + $testdir/swmr_writer -o $Nrecords $seed 2>&1 |tee swmr_writer.out & pid_writer=$! $DPRINT pid_writer=$pid_writer @@ -298,7 +304,7 @@ do while [ $n -lt $Nreaders ]; do #seed="-r ${seeds[$n]}" seed="" - $bindir/swmr_reader $Nsecs_add $seed 2>&1 |tee swmr_reader.out.$n & + $testdir/swmr_reader $Nsecs_add $seed 2>&1 |tee swmr_reader.out.$n & pid_readers="$pid_readers $!" n=`expr $n + 1` done @@ -346,7 +352,7 @@ do # Launch the Remove Writer echo launch the swmr_remove_writer seed="" # Put -r command here - $bindir/swmr_remove_writer -o $Nrecs_rem $seed 2>&1 |tee swmr_writer.out & + $testdir/swmr_remove_writer -o $Nrecs_rem $seed 2>&1 |tee swmr_writer.out & pid_writer=$! $DPRINT pid_writer=$pid_writer @@ -361,7 +367,7 @@ do while [ $n -lt $Nreaders ]; do #seed="-r ${seeds[$n]}" seed="" - $bindir/swmr_remove_reader $Nsecs_rem $seed 2>&1 |tee swmr_reader.out.$n & + $testdir/swmr_remove_reader $Nsecs_rem $seed 2>&1 |tee swmr_reader.out.$n & pid_readers="$pid_readers $!" n=`expr $n + 1` done @@ -406,7 +412,7 @@ do # Launch the Generator echo launch the swmr_generator - $bindir/swmr_generator $compress $index_type + $testdir/swmr_generator $compress $index_type if test $? -ne 0; then echo generator had error nerrors=`expr $nerrors + 1` @@ -415,7 +421,7 @@ do # Launch the Writer (not in parallel - just to rebuild the datasets) echo launch the swmr_writer seed="" # Put -r command here - $bindir/swmr_writer $Nrecords $seed + $testdir/swmr_writer $Nrecords $seed if test $? -ne 0; then echo writer had error nerrors=`expr $nerrors + 1` @@ -427,7 +433,7 @@ do # Launch the Add/Remove Writer echo launch the swmr_addrem_writer seed="" # Put -r command here - $bindir/swmr_addrem_writer $Nrecords $seed 2>&1 |tee swmr_writer.out & + $testdir/swmr_addrem_writer $Nrecords $seed 2>&1 |tee swmr_writer.out & pid_writer=$! $DPRINT pid_writer=$pid_writer @@ -442,7 +448,7 @@ do while [ $n -lt $Nreaders ]; do #seed="-r ${seeds[$n]}" seed="" - $bindir/swmr_remove_reader $Nsecs_addrem $seed 2>&1 |tee swmr_reader.out.$n & + $testdir/swmr_remove_reader $Nsecs_addrem $seed 2>&1 |tee swmr_reader.out.$n & pid_readers="$pid_readers $!" n=`expr $n + 1` done @@ -490,7 +496,7 @@ do # created by the generator. echo launch the swmr_generator seed="" # Put -r command here - $bindir/swmr_generator $compress $index_type $seed + $testdir/swmr_generator $compress $index_type $seed if test $? -ne 0; then echo generator had error nerrors=`expr $nerrors + 1` @@ -500,7 +506,7 @@ do rm -f $WRITER_MESSAGE # Launch the Sparse writer echo launch the swmr_sparse_writer - nice -n 20 $bindir/swmr_sparse_writer $Nrecs_spa 2>&1 |tee swmr_writer.out & + nice -n 20 $testdir/swmr_sparse_writer $Nrecs_spa 2>&1 |tee swmr_writer.out & pid_writer=$! $DPRINT pid_writer=$pid_writer @@ -513,7 +519,7 @@ do echo launch $Nrdrs_spa swmr_sparse_readers while [ $n -lt $Nrdrs_spa ]; do # The sparse reader spits out a LOT of data so it's set to 'quiet' - $bindir/swmr_sparse_reader -q $Nrecs_spa 2>&1 |tee swmr_reader.out.$n & + $testdir/swmr_sparse_reader -q $Nrecs_spa 2>&1 |tee swmr_reader.out.$n & pid_readers="$pid_readers $!" n=`expr $n + 1` done diff --git a/test/testvdsswmr.sh.in b/test/testvdsswmr.sh.in index 5399903..c57cc08 100644 --- a/test/testvdsswmr.sh.in +++ b/test/testvdsswmr.sh.in @@ -18,6 +18,7 @@ srcdir=@srcdir@ bindir=@bindir@ +testdir=@testdir@ ############################################################################### ## test parameters @@ -89,6 +90,11 @@ if test -z "$bindir"; then bindir=. fi +# If the testdir directory is not set just use current (.). +if test -z "$testdir"; then + testdir=. +fi + # Check to see if the VFD specified by the HDF5_DRIVER environment variable # supports SWMR. $bindir/swmr_check_compat_vfd @@ -154,7 +160,7 @@ echo "########################################################################## # Launch the file generator echo launch the generator -$bindir/vds_swmr_gen +$testdir/vds_swmr_gen if test $? -ne 0; then echo generator had error nerrors=`expr $nerrors + 1` @@ -172,7 +178,7 @@ echo "launch the $Nwriters SWMR VDS writers (1 per source)" pid_writers="" n=0 while [ $n -lt $Nwriters ]; do - $bindir/vds_swmr_writer $n & + $testdir/vds_swmr_writer $n & pid_writers="$pid_writers $!" n=`expr $n + 1` done @@ -187,7 +193,7 @@ echo launch $Nreaders SWMR readers pid_readers="" n=0 while [ $n -lt $Nreaders ]; do - $bindir/vds_swmr_reader & + $testdir/vds_swmr_reader & pid_readers="$pid_readers $!" n=`expr $n + 1` done diff --git a/testpar/CMakeVFDTests.cmake b/testpar/CMakeVFDTests.cmake index 785c08d..4cda27b 100644 --- a/testpar/CMakeVFDTests.cmake +++ b/testpar/CMakeVFDTests.cmake @@ -15,45 +15,13 @@ ### T E S T I N G ### ############################################################################## ############################################################################## -set (VFD_LIST - sec2 - stdio - core - core_paged - split - multi - family - splitter - #log - log VFD currently has file space allocation bugs -) set (H5P_VFD_TESTS t_pflush1 t_pflush2 ) -if (H5_HAVE_DIRECT) - set (VFD_LIST ${VFD_LIST} direct) -endif () -if (H5_HAVE_PARALLEL) - set (VFD_LIST ${VFD_LIST} mpio) -endif () -if (H5_HAVE_MIRROR_VFD) - set (VFD_LIST ${VFD_LIST} mirror) -endif () -if (H5_HAVE_ROS3_VFD) - set (VFD_LIST ${VFD_LIST} ros3) -endif () -if (H5_HAVE_LIBHDFS) - set (VFD_LIST ${VFD_LIST} hdfs) -endif () -if (H5_HAVE_WINDOWS) - set (VFD_LIST ${VFD_LIST} windows) -endif () - -foreach (vfdtest ${VFD_LIST}) - file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/${vfdtest}") -endforeach () +H5_SET_VFD_LIST() macro (ADD_VFD_TEST vfdname resultcode) if (NOT HDF5_ENABLE_USING_MEMCHECKER) diff --git a/tools/test/h5dump/CMakeVFDTests.cmake b/tools/test/h5dump/CMakeVFDTests.cmake index 01834b3..6a70b85 100644 --- a/tools/test/h5dump/CMakeVFDTests.cmake +++ b/tools/test/h5dump/CMakeVFDTests.cmake @@ -16,19 +16,7 @@ ############################################################################## ############################################################################## -set (VFD_H5DUMP_LIST - sec2 - stdio - core - core_paged - split - multi - family -) - -if (H5_HAVE_DIRECT) - set (VFD_H5DUMP_LIST ${VFD_H5DUMP_LIST} direct) -endif () +H5_SET_VFD_LIST() # -------------------------------------------------------------------- # Copy all the HDF5 files from the source directory into the test directory @@ -37,8 +25,7 @@ set (HDF5_VFD_H5DUMP_FILES packedbits ) -foreach (vfdtest ${VFD_H5DUMP_LIST}) - file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/${vfdname}") +foreach (vfdtest ${VFD_LIST}) foreach (h5_tfile ${HDF5_VFD_H5DUMP_FILES}) HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/${h5_tfile}.h5" "${PROJECT_BINARY_DIR}/${vfdtest}/${h5_tfile}.h5" "HDF5_VFD_H5DUMP_files") HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/${h5_tfile}.ddl" "${PROJECT_BINARY_DIR}/${vfdtest}/${h5_tfile}.ddl" "HDF5_VFD_H5DUMP_files") @@ -79,7 +66,7 @@ endmacro () ############################################################################## # Run test with different Virtual File Driver -foreach (vfd ${VFD_H5DUMP_LIST}) +foreach (vfd ${VFD_LIST}) # test for signed/unsigned datasets ADD_VFD_H5DUMP_TEST (${vfd} packedbits 0 --enable-error-stack packedbits.h5) endforeach () diff --git a/tools/test/h5repack/CMakeVFDTests.cmake b/tools/test/h5repack/CMakeVFDTests.cmake index 4f6e51d..78d752c 100644 --- a/tools/test/h5repack/CMakeVFDTests.cmake +++ b/tools/test/h5repack/CMakeVFDTests.cmake @@ -16,36 +16,7 @@ ############################################################################## ############################################################################## -set (VFD_LIST - sec2 - stdio - core - core_paged - split - multi - family - splitter - #log - log VFD currently has file space allocation bugs -) - -if (H5_HAVE_DIRECT) - set (VFD_LIST ${VFD_LIST} direct) -endif () -if (H5_HAVE_PARALLEL) - set (VFD_LIST ${VFD_LIST} mpio) -endif () -if (H5_HAVE_MIRROR_VFD) - set (VFD_LIST ${VFD_LIST} mirror) -endif () -if (H5_HAVE_ROS3_VFD) - set (VFD_LIST ${VFD_LIST} ros3) -endif () -if (H5_HAVE_LIBHDFS) - set (VFD_LIST ${VFD_LIST} hdfs) -endif () -if (H5_HAVE_WINDOWS) - set (VFD_LIST ${VFD_LIST} windows) -endif () +H5_SET_VFD_LIST() ############################################################################## ############################################################################## @@ -55,7 +26,6 @@ endif () macro (ADD_VFD_TEST vfdname resultcode) if (NOT HDF5_ENABLE_USING_MEMCHECKER) - file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/${vfdname}") add_test ( NAME H5REPACK-${vfdname}-h5repacktest-clear-objects COMMAND ${CMAKE_COMMAND} -E remove diff --git a/utils/CMakeLists.txt b/utils/CMakeLists.txt index 2d5626e..7c263d1 100644 --- a/utils/CMakeLists.txt +++ b/utils/CMakeLists.txt @@ -1,4 +1,11 @@ cmake_minimum_required (VERSION 3.10) project (HDF5_UTILS C) -add_subdirectory (mirror_vfd) +if (BUILD_TESTING) + add_subdirectory (test) +endif () + +option (HDF5_BUILD_UTILS "Build HDF5 Utils" ON) +if (HDF5_BUILD_UTILS) + add_subdirectory (mirror_vfd) +endif () diff --git a/utils/Makefile.am b/utils/Makefile.am index 288da37..876dfb1 100644 --- a/utils/Makefile.am +++ b/utils/Makefile.am @@ -20,7 +20,19 @@ include $(top_srcdir)/config/commence.am CONFIG=ordered +if BUILD_TESTS_CONDITIONAL + TESTUTIL_DIR =test +else + TESTUTIL_DIR= +endif + +if MIRROR_VFD_CONDITIONAL + MIRROR_VFD_DIR = mirror_vfd +else + MIRROR_VFD_DIR= +endif + # All subdirectories -SUBDIRS=mirror_vfd +SUBDIRS=$(MIRROR_VFD_DIR) $(TESTUTIL_DIR) include $(top_srcdir)/config/conclude.am diff --git a/utils/test/CMakeLists.txt b/utils/test/CMakeLists.txt new file mode 100644 index 0000000..921fbd0 --- /dev/null +++ b/utils/test/CMakeLists.txt @@ -0,0 +1,35 @@ +cmake_minimum_required (VERSION 3.12) +project (HDF5_TEST C) + +################################################################################# +# Test program sources +################################################################################# + +macro (ADD_H5_EXE file) + add_executable (${file} ${HDF5_TEST_SOURCE_DIR}/${file}.c) + target_include_directories (${file} PRIVATE "${HDF5_SRC_DIR};${HDF5_SRC_BINARY_DIR};${HDF5_TEST_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") + target_compile_options(${file} PRIVATE "${HDF5_CMAKE_C_FLAGS}") + if (NOT BUILD_SHARED_LIBS) + TARGET_C_PROPERTIES (${file} STATIC) + target_link_libraries (${file} PRIVATE ${HDF5_TEST_LIB_TARGET}) + else () + TARGET_C_PROPERTIES (${file} SHARED) + target_link_libraries (${file} PRIVATE ${HDF5_TEST_LIBSH_TARGET}) + endif () + set_target_properties (${file} PROPERTIES FOLDER test) +endmacro () + +############################################################################## +### S W I M M E R T E S T U T I L S ### +############################################################################## +set (H5_UTIL_TESTS) + +if (HDF5_TEST_SWMR) + set (H5_UTIL_TESTS ${H5_UTIL_TESTS} swmr_check_compat_vfd) +endif () + +if (H5_UTIL_TESTS) + foreach (h5_test ${H5_UTIL_TESTS}) + ADD_H5_EXE(${h5_test}) + endforeach () +endif () diff --git a/utils/test/Makefile.am b/utils/test/Makefile.am new file mode 100644 index 0000000..164562f --- /dev/null +++ b/utils/test/Makefile.am @@ -0,0 +1,34 @@ +# +# Copyright by The HDF Group. +# Copyright by the Board of Trustees of the University of Illinois. +# 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. +## +## Makefile.am +## Run automake to generate a Makefile.in from this file. +# +# HDF5 Library Makefile(.in) +# + +include $(top_srcdir)/config/commence.am + +# Include src and tools/lib directories +AM_CPPFLAGS+=-I$(top_srcdir)/src -I$(top_srcdir)/test -I$(top_srcdir)/tools/lib -I$(top_srcdir)/utils/test + +# These are our main targets, the tools + +noinst_PROGRAMS=swmr_check_compat_vfd + +# Programs all depend on the hdf5 library, the tools library, and the HL +# library. +LDADD=$(LIBH5TEST) $(LIBHDF5) + +CHECK_CLEANFILES+=*.h5 + +include $(top_srcdir)/config/conclude.am diff --git a/utils/test/swmr_check_compat_vfd.c b/utils/test/swmr_check_compat_vfd.c new file mode 100644 index 0000000..720c747 --- /dev/null +++ b/utils/test/swmr_check_compat_vfd.c @@ -0,0 +1,53 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * 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. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* Purpose: This is a small program that checks if the HDF5_DRIVER + * environment variable is set to a value that supports SWMR. + * + * It is intended for use in shell scripts. + */ + +#include "h5test.h" + +/* This file needs to access the file driver testing code */ +#define H5FD_FRIEND /*suppress error about including H5FDpkg */ +#define H5FD_TESTING +#include "H5FDpkg.h" /* File drivers */ + +/*------------------------------------------------------------------------- + * Function: main + * + * Purpose: Inspects the HDF5_DRIVER environment variable, which + * determines the VFD that the test harness will use with + * the majority of the tests. + * + * Return: VFD supports SWMR: EXIT_SUCCESS + * + * VFD does not support SWMR + * or failure: EXIT_FAILURE + * + *------------------------------------------------------------------------- + */ +int +main(void) +{ + char *driver = NULL; + + driver = HDgetenv(HDF5_DRIVER); + + if (H5FD__supports_swmr_test(driver)) + return EXIT_SUCCESS; + else + return EXIT_FAILURE; + +} /* end main() */ -- cgit v0.12