From cb5e1ead29a66dcfdb7bee6e65ed76a9a93a3f9b Mon Sep 17 00:00:00 2001 From: David Young Date: Mon, 23 Mar 2020 14:55:07 -0500 Subject: Let tests provide a "hook" that runs after each step in create_zoo(). Provide a hook in vfd_swmr_zoo_writer that calls H5Fvfd_swmr_end_tick(). --- test/Makefile.am | 2 +- test/genall5.c | 1 + test/genall5.h | 6 ++++++ test/stubs.c | 25 +++++++++++++++++++++++++ test/vfd_swmr_zoo_writer.c | 7 +++++++ 5 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 test/stubs.c diff --git a/test/Makefile.am b/test/Makefile.am index 85350fb..58b2190 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -146,7 +146,7 @@ else noinst_LTLIBRARIES=libh5test.la endif -libh5test_la_SOURCES=h5test.c testframe.c cache_common.c swmr_common.c external_common.c vfd_swmr_common.c +libh5test_la_SOURCES=h5test.c testframe.c cache_common.c swmr_common.c external_common.c stubs.c vfd_swmr_common.c # Use libhd5test.la to compile all of the tests LDADD=libh5test.la $(LIBHDF5) diff --git a/test/genall5.c b/test/genall5.c index 4390238..0904e9a 100644 --- a/test/genall5.c +++ b/test/genall5.c @@ -3192,6 +3192,7 @@ tend_zoo(hid_t fid, const char *base_path, int proc_num, bool skip_varlen, !create_or_validate_selection(fid, full_path, proc_num, i, skip_varlen, false)) break; + zoo_create_hook(fid); if (!create_or_validate_selection(fid, full_path, proc_num, i, skip_varlen, true)) break; diff --git a/test/genall5.h b/test/genall5.h index d3ed6aa..10f621b 100644 --- a/test/genall5.h +++ b/test/genall5.h @@ -51,3 +51,9 @@ void vrfy_ds_cpt_i(hid_t fid, const char *dset_name, hbool_t write_data); void ds_ctg_v(hid_t fid, const char *dset_name, hbool_t write_data); void vrfy_ds_ctg_v(hid_t fid, const char *dset_name, hbool_t write_data); +/* Individual tests can override zoo_create_hook(), which is called + * after each step of create_zoo(). The `hid_t` argument identifies + * the file where the step was performed. The test library provides a + * default implementation of zoo_create_hook() that does nothing. + */ +void zoo_create_hook(hid_t); diff --git a/test/stubs.c b/test/stubs.c new file mode 100644 index 0000000..c04f1ba --- /dev/null +++ b/test/stubs.c @@ -0,0 +1,25 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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://support.hdfgroup.org/ftp/HDF5/releases. * + * If you do not have access to either file, you may request a copy from * + * help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#include "h5test.h" +#include "genall5.h" + +/* The default, do-nothing implementation of zoo_create_hook(), which + * is called after each create_zoo() step. + */ +void +zoo_create_hook(hid_t H5_ATTR_UNUSED fid) +{ + return; +} + diff --git a/test/vfd_swmr_zoo_writer.c b/test/vfd_swmr_zoo_writer.c index ad2288f..f09c57e 100644 --- a/test/vfd_swmr_zoo_writer.c +++ b/test/vfd_swmr_zoo_writer.c @@ -53,6 +53,13 @@ print_cache_hits(H5C_t *cache) dbgf(3, "\n"); } +void +zoo_create_hook(hid_t fid) +{ + dbgf(3, "%s: enter\n", __func__); + H5Fvfd_swmr_end_tick(fid); +} + static void usage(const char *progname) { -- cgit v0.12