From b2e1a59c73a0b5272047ed4a803e04d92f86015c Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Wed, 11 May 2022 16:32:32 -0700 Subject: Check for parallel HDF5 before running SWMR acceptance tests (#1764) --- test/test_vfd_swmr.sh.in | 9 ++--- utils/test/CMakeLists.txt | 4 +-- utils/test/Makefile.am | 2 +- utils/test/vfd_swmr_check_compat_vfd.c | 66 ++++++++++++++++++++++++++++++++++ 4 files changed, 74 insertions(+), 7 deletions(-) create mode 100644 utils/test/vfd_swmr_check_compat_vfd.c diff --git a/test/test_vfd_swmr.sh.in b/test/test_vfd_swmr.sh.in index 2135aef..3c4d9b4 100644 --- a/test/test_vfd_swmr.sh.in +++ b/test/test_vfd_swmr.sh.in @@ -152,14 +152,15 @@ catch_out_err_and_rc() # Check to see if the VFD specified by the HDF5_DRIVER environment variable # supports SWMR. -$utils_testdir/swmr_check_compat_vfd +$utils_testdir/vfd_swmr_check_compat_vfd rc=$? if [ $rc -ne 0 ] ; then echo - echo "The VFD specified by the HDF5_DRIVER environment variable" - echo "does not support SWMR." + echo "Either the VFD specified by the HDF5_DRIVER environment variable" + echo "does not support SWMR or this is parallel HDF5, which does not" + echo "support VFD SWMR due to a lack of page buffer support." echo - echo "SWMR acceptance tests skipped" + echo "VFD SWMR acceptance tests skipped" echo exit 0 fi diff --git a/utils/test/CMakeLists.txt b/utils/test/CMakeLists.txt index 921fbd0..001fbea 100644 --- a/utils/test/CMakeLists.txt +++ b/utils/test/CMakeLists.txt @@ -20,12 +20,12 @@ macro (ADD_H5_EXE file) endmacro () ############################################################################## -### S W I M M E R T E S T U T I L S ### +### S W M 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) + set (H5_UTIL_TESTS ${H5_UTIL_TESTS} swmr_check_compat_vfd vfd_swmr_check_compat_vfd) endif () if (H5_UTIL_TESTS) diff --git a/utils/test/Makefile.am b/utils/test/Makefile.am index 164562f..ee0a1e2 100644 --- a/utils/test/Makefile.am +++ b/utils/test/Makefile.am @@ -23,7 +23,7 @@ AM_CPPFLAGS+=-I$(top_srcdir)/src -I$(top_srcdir)/test -I$(top_srcdir)/tools/lib # These are our main targets, the tools -noinst_PROGRAMS=swmr_check_compat_vfd +noinst_PROGRAMS=swmr_check_compat_vfd vfd_swmr_check_compat_vfd # Programs all depend on the hdf5 library, the tools library, and the HL # library. diff --git a/utils/test/vfd_swmr_check_compat_vfd.c b/utils/test/vfd_swmr_check_compat_vfd.c new file mode 100644 index 0000000..daecaad --- /dev/null +++ b/utils/test/vfd_swmr_check_compat_vfd.c @@ -0,0 +1,66 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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 also checks for parallel HDF5, where page buffering + * is disabled and thus can't be used for VFD 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. + * + * Also checks for parallel HDF5, which does not support + * VFD SWMR. + * + * Return: VFD supports SWMR: EXIT_SUCCESS + * + * VFD does not support SWMR + * or failure: EXIT_FAILURE + * + *------------------------------------------------------------------------- + */ +int +main(void) +{ +#ifdef H5_HAVE_PARALLEL + + return EXIT_FAILURE; + +#else + + char *driver = NULL; + + driver = HDgetenv(HDF5_DRIVER); + + if (H5FD__supports_swmr_test(driver)) + return EXIT_SUCCESS; + else + return EXIT_FAILURE; + +#endif + +} /* end main() */ -- cgit v0.12