summaryrefslogtreecommitdiffstats
path: root/hl
diff options
context:
space:
mode:
authorAllen Byrne <50328838+byrnHDF@users.noreply.github.com>2021-10-20 13:25:06 (GMT)
committerGitHub <noreply@github.com>2021-10-20 13:25:06 (GMT)
commit6d4d0fb13db06895fc6ea5f98ae0b79b44aa98af (patch)
treec64c4f80838302fe4291028f65ab40c9b91900dd /hl
parentc196bf98eb7fe71c262e88b0227ea81906b9dbcf (diff)
downloadhdf5-6d4d0fb13db06895fc6ea5f98ae0b79b44aa98af.zip
hdf5-6d4d0fb13db06895fc6ea5f98ae0b79b44aa98af.tar.gz
hdf5-6d4d0fb13db06895fc6ea5f98ae0b79b44aa98af.tar.bz2
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
Diffstat (limited to 'hl')
-rw-r--r--hl/tools/h5watch/CMakeLists.txt23
-rw-r--r--hl/tools/h5watch/CMakeTests.cmake68
-rw-r--r--hl/tools/h5watch/Makefile.am3
-rw-r--r--hl/tools/h5watch/swmr_check_compat_vfd.c55
-rw-r--r--hl/tools/h5watch/testh5watch.sh.in8
5 files changed, 44 insertions, 113 deletions
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};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${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} $<TARGET_FILE:h5watchgentest>)
- 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} $<TARGET_FILE:h5watchgentest>)
+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 <stdlib.h>
-
-#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