summaryrefslogtreecommitdiffstats
path: root/hl/tools/h5watch
diff options
context:
space:
mode:
Diffstat (limited to 'hl/tools/h5watch')
-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/extend_dset.c6
-rw-r--r--hl/tools/h5watch/h5watch.c14
-rw-r--r--hl/tools/h5watch/swmr_check_compat_vfd.c55
-rw-r--r--hl/tools/h5watch/testh5watch.sh.in7
7 files changed, 49 insertions, 127 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/extend_dset.c b/hl/tools/h5watch/extend_dset.c
index 282f5c2..7756506 100644
--- a/hl/tools/h5watch/extend_dset.c
+++ b/hl/tools/h5watch/extend_dset.c
@@ -83,7 +83,7 @@ extend_dset_two(const char *file, char *dname, int action1, int action2)
size_t dtype_size; /* size of the dataset's datatype */
unsigned num_elmts; /* number of elements in the dataset */
int * ibuf = NULL; /* buffer for storing retrieved elements (integer) */
- set_t * cbuf = NULL; /* buffer for storing retrieved elemnets (compound) */
+ set_t * cbuf = NULL; /* buffer for storing retrieved elements (compound) */
/* Allocate memory */
if (NULL == (ibuf = (int *)HDcalloc(TEST_BUF_SIZE, sizeof(int))))
@@ -237,7 +237,7 @@ extend_dset_one(const char *file, char *dname, int action)
hsize_t count[1]; /* dimension sizes of appended data */
size_t dtype_size; /* size of the dataset's datatype */
int * ibuf = NULL; /* buffer for storing retrieved elements (integer) */
- set_t * cbuf = NULL; /* buffer for storing retrieved elemnets (compound) */
+ set_t * cbuf = NULL; /* buffer for storing retrieved elements (compound) */
/* Allocate memory */
if (NULL == (ibuf = (int *)HDcalloc(TEST_BUF_SIZE, sizeof(int))))
@@ -392,7 +392,7 @@ error:
***********************************************************************
*/
int
-main(int argc, const char *argv[])
+main(int argc, char *argv[])
{
char *dname = NULL;
char *fname = NULL;
diff --git a/hl/tools/h5watch/h5watch.c b/hl/tools/h5watch/h5watch.c
index afbc31d..5a6fe6f 100644
--- a/hl/tools/h5watch/h5watch.c
+++ b/hl/tools/h5watch/h5watch.c
@@ -51,7 +51,7 @@ static herr_t process_cmpd_fields(hid_t fid, char *dsetname);
static herr_t check_dataset(hid_t fid, char *dsetname);
static void leave(int ret);
static void usage(const char *prog);
-static void parse_command_line(int argc, const char *argv[]);
+static void parse_command_line(int argc, const char *const *argv);
/*
* Command-line options: The user can only specify long-named parameters.
@@ -174,9 +174,9 @@ doprint(hid_t did, const hsize_t *start, const hsize_t *block, int rank)
} /* end else */
/* Floating point types should display full precision */
- sprintf(fmt_float, "%%1.%dg", FLT_DIG);
+ snprintf(fmt_float, sizeof(fmt_float), "%%1.%dg", FLT_DIG);
info.fmt_float = fmt_float;
- sprintf(fmt_double, "%%1.%dg", DBL_DIG);
+ snprintf(fmt_double, sizeof(fmt_double), "%%1.%dg", DBL_DIG);
info.fmt_double = fmt_double;
info.dset_format = "DSET-%s ";
@@ -665,7 +665,7 @@ usage(const char *prog)
*-------------------------------------------------------------------------
*/
static void
-parse_command_line(int argc, const char *argv[])
+parse_command_line(int argc, const char *const *argv)
{
int opt; /* Command line option */
int tmp;
@@ -790,7 +790,7 @@ catch_signal(int H5_ATTR_UNUSED signo)
*-------------------------------------------------------------------------
*/
int
-main(int argc, const char *argv[])
+main(int argc, char *argv[])
{
char drivername[50]; /* VFD name */
char *fname = NULL; /* File name */
@@ -819,7 +819,7 @@ main(int argc, const char *argv[])
}
/* parse command line options */
- parse_command_line(argc, argv);
+ parse_command_line(argc, (const char *const *)argv);
if (argc <= H5_optind) {
error_msg("missing dataset name\n");
@@ -921,7 +921,7 @@ main(int argc, const char *argv[])
}
}
- /* If everything is fine, start monitoring the datset */
+ /* If everything is fine, start monitoring the dataset */
if (h5tools_getstatus() != EXIT_FAILURE)
if (monitor_dataset(fid, dname) < 0)
h5tools_setstatus(EXIT_FAILURE);
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 a2340bf..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..0432384 100644
--- a/hl/tools/h5watch/testh5watch.sh.in
+++ b/hl/tools/h5watch/testh5watch.sh.in
@@ -13,10 +13,11 @@
#
# Tests for the h5watch tool
#
+utils_testdir=@abs_top_builddir@/@H5_UTILS_TEST_BUILDDIR@
# Check to see if the VFD specified by the HDF5_DRIVER environment variable
# supports SWMR.
-./swmr_check_compat_vfd
+$utils_testdir/swmr_check_compat_vfd
rc=$?
if [ $rc != 0 ] ; then
echo
@@ -66,10 +67,6 @@ fi
nerrors=0
verbose=yes
-# The build (current) directory might be different than the source directory.
-if test -z "$srcdir"; then
- srcdir=.
-fi
test -d ../testfiles || mkdir ../testfiles
# Print a line-line message left justified in a field of 70 characters