diff options
-rw-r--r-- | test/testvfdswmr.sh.in | 2 | ||||
-rw-r--r-- | test/vfd_swmr_addrem_writer.c | 42 | ||||
-rw-r--r-- | test/vfd_swmr_bigset_writer.c | 8 | ||||
-rw-r--r-- | test/vfd_swmr_common.c | 73 | ||||
-rw-r--r-- | test/vfd_swmr_common.h | 41 | ||||
-rw-r--r-- | test/vfd_swmr_generator.c | 42 | ||||
-rw-r--r-- | test/vfd_swmr_group_writer.c | 7 | ||||
-rw-r--r-- | test/vfd_swmr_reader.c | 48 | ||||
-rw-r--r-- | test/vfd_swmr_remove_reader.c | 28 | ||||
-rw-r--r-- | test/vfd_swmr_remove_writer.c | 45 | ||||
-rw-r--r-- | test/vfd_swmr_sparse_reader.c | 34 | ||||
-rw-r--r-- | test/vfd_swmr_sparse_writer.c | 45 | ||||
-rw-r--r-- | test/vfd_swmr_vlstr_reader.c | 9 | ||||
-rw-r--r-- | test/vfd_swmr_vlstr_writer.c | 9 | ||||
-rw-r--r-- | test/vfd_swmr_writer.c | 47 | ||||
-rw-r--r-- | test/vfd_swmr_zoo_writer.c | 8 |
16 files changed, 177 insertions, 311 deletions
diff --git a/test/testvfdswmr.sh.in b/test/testvfdswmr.sh.in index b492667..f50051e 100644 --- a/test/testvfdswmr.sh.in +++ b/test/testvfdswmr.sh.in @@ -168,7 +168,7 @@ for index_type in "-i ea" "-i b2" do # Try without compression, only; uncomment "-c 5" to try with compression. - for compress in "" #"-c 5" + for compress in "" "-c 5" do echo echo "** Loop testing parameters: $index_type $compress" diff --git a/test/vfd_swmr_addrem_writer.c b/test/vfd_swmr_addrem_writer.c index 2b93926..ad651e6 100644 --- a/test/vfd_swmr_addrem_writer.c +++ b/test/vfd_swmr_addrem_writer.c @@ -37,6 +37,7 @@ #include "h5test.h" #include "vfd_swmr_common.h" +#include "swmr_common.h" /****************/ /* Local Macros */ @@ -83,10 +84,6 @@ open_skeleton(const char *filename, unsigned verbose) HDassert(filename); - /* Create file access property list */ - if((fapl = h5_fileaccess()) < 0) - goto error; - if ((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0) errx(EXIT_FAILURE, "%s.%d: H5Pcreate failed", __func__, __LINE__); @@ -94,32 +91,15 @@ open_skeleton(const char *filename, unsigned verbose) H5D_CHUNK_CACHE_W0_DEFAULT) < 0) errx(EXIT_FAILURE, "H5Pset_chunk_cache failed"); - /* Set to use the latest library format */ - if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) - goto error; - - /* - * Set up to open the file with VFD SWMR configured. - */ - - /* Enable page buffering */ - if(H5Pset_page_buffer_size(fapl, 4096, 0, 0) < 0) - goto error; - /* Allocate memory for the configuration structure */ if((config = calloc(1, sizeof(*config))) == NULL) goto error; - config->version = H5F__CURR_VFD_SWMR_CONFIG_VERSION; - config->tick_len = 4; - config->max_lag = 5; - config->writer = TRUE; - config->md_pages_reserved = 128; - esnprintf(config->md_file_path, sizeof(config->md_file_path), - "./rw-shadow"); + /* config, tick_len, max_lag, writer, flush_raw_data, md_pages_reserved, md_file_path */ + init_vfd_swmr_config(config, 4, 5 , TRUE, FALSE, 128, "./rw-shadow"); - /* Enable VFD SWMR configuration */ - if(H5Pset_vfd_swmr_config(fapl, config) < 0) + /* use_latest_format, use_vfd_swmr, only_meta_page, config */ + if((fapl = vfd_swmr_create_fapl(TRUE, TRUE, FALSE, config)) < 0) goto error; /* Open the file */ @@ -298,12 +278,6 @@ addrem_records(hid_t fid, unsigned verbose, unsigned long nops, unsigned long fl /* Check for counter being reached */ if(0 == op_to_flush) { -#ifdef TEMP_OUT - /* Flush contents of file */ - if(H5Fflush(fid, H5F_SCOPE_GLOBAL) < 0) - return -1; -#endif /* TEMP_OUT */ - /* Reset flush counter */ op_to_flush = flush_count; } /* end if */ @@ -453,17 +427,17 @@ int main(int argc, const char *argv[]) /* Emit informational message */ if(verbose) { HDfprintf(stderr, "WRITER: Opening skeleton file: %s\n", - COMMON_FILENAME); + VFD_SWMR_FILENAME); } /* Open file skeleton */ - if((fid = open_skeleton(COMMON_FILENAME, verbose)) < 0) { + if((fid = open_skeleton(VFD_SWMR_FILENAME, verbose)) < 0) { HDfprintf(stderr, "WRITER: Error opening skeleton file!\n"); HDexit(1); } /* end if */ /* Send a message to indicate "H5Fopen" is complete--releasing the file lock */ - h5_send_message(WRITER_MESSAGE, NULL, NULL); + h5_send_message(VFD_SWMR_WRITER_MESSAGE, NULL, NULL); /* Emit informational message */ if(verbose) diff --git a/test/vfd_swmr_bigset_writer.c b/test/vfd_swmr_bigset_writer.c index 98824b5..d99d8e3 100644 --- a/test/vfd_swmr_bigset_writer.c +++ b/test/vfd_swmr_bigset_writer.c @@ -1134,14 +1134,18 @@ main(int argc, char **argv) for (i = 0; i < NELMTS(s.file); i++) { hid_t fapl; + H5F_vfd_swmr_config_t config; if (s.vds != vds_multi && i > 0) { s.file[i] = s.file[0]; continue; } - fapl = vfd_swmr_create_fapl(s.writer, true, s.use_vfd_swmr, - "./bigset-shadow-%zu", i); + /* config, tick_len, max_lag, writer, flush_raw_data, md_pages_reserved, md_file_path */ + init_vfd_swmr_config(&config, 4, 7, s.writer, FALSE, 128, "./bigset-shadow-%zu", i); + + /* use_latest_format, use_vfd_swmr, only_meta_page, config */ + fapl = vfd_swmr_create_fapl(true, s.use_vfd_swmr, true, &config); if (fapl < 0) errx(EXIT_FAILURE, "vfd_swmr_create_fapl"); diff --git a/test/vfd_swmr_common.c b/test/vfd_swmr_common.c index b986b31..043b7ed 100644 --- a/test/vfd_swmr_common.c +++ b/test/vfd_swmr_common.c @@ -23,6 +23,7 @@ #include "h5test.h" #include "vfd_swmr_common.h" +#include "swmr_common.h" static const hid_t badhid = H5I_INVALID_HID; @@ -227,16 +228,45 @@ await_signal(hid_t fid) } } +/* Revised support routines that can be used for all VFD SWMR integration tests + */ +/* Initialize fields in config with the input parameters */ +void +init_vfd_swmr_config(H5F_vfd_swmr_config_t *config, uint32_t tick_len, uint32_t max_lag, hbool_t writer, + hbool_t flush_raw_data, uint32_t md_pages_reserved, const char *md_file_fmtstr, ...) +{ + va_list ap; + + memset(config, 0, sizeof(H5F_vfd_swmr_config_t)); + + config->version = H5F__CURR_VFD_SWMR_CONFIG_VERSION; + config->pb_expansion_threshold = 0; + + config->tick_len = tick_len; + config->max_lag = max_lag; + config->writer = writer; + config->flush_raw_data = flush_raw_data; + config->md_pages_reserved = md_pages_reserved; + + va_start(ap, md_file_fmtstr); + evsnprintf(config->md_file_path, sizeof(config->md_file_path), + md_file_fmtstr, ap); + va_end(ap); + +} /* init_vfd_swmr_config() */ + /* Perform common VFD SWMR configuration on the file-access property list: * configure page buffering, set reasonable VFD SWMR defaults. */ +/* Set up the file-access property list: + * --configure for latest format or not + * --configure page buffering with only_meta_pages or not + * --configure for VFD SWMR or not + */ hid_t -vfd_swmr_create_fapl(bool writer, bool only_meta_pages, bool use_vfd_swmr, - const char *mdfile_fmtstr, ...) +vfd_swmr_create_fapl(bool use_latest_format, bool use_vfd_swmr, bool only_meta_pages, H5F_vfd_swmr_config_t *config) { - H5F_vfd_swmr_config_t config; hid_t fapl; - va_list ap; /* Create file access property list */ if((fapl = h5_fileaccess()) < 0) { @@ -244,41 +274,32 @@ vfd_swmr_create_fapl(bool writer, bool only_meta_pages, bool use_vfd_swmr, return badhid; } - /* FOR NOW: set to use latest format, the "old" parameter is not used */ - if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) { - warnx("H5Pset_libver_bounds"); - return badhid; + if(use_latest_format) { + if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) { + warnx("H5Pset_libver_bounds"); + return badhid; + } } - /* - * Set up to open the file with VFD SWMR configured. - */ - /* Enable page buffering */ if(H5Pset_page_buffer_size(fapl, 4096, only_meta_pages ? 100 : 0, 0) < 0) { warnx("H5Pset_page_buffer_size"); return badhid; } - memset(&config, 0, sizeof(config)); - - config.version = H5F__CURR_VFD_SWMR_CONFIG_VERSION; - config.tick_len = 4; - config.max_lag = 7; - config.writer = writer; - config.md_pages_reserved = 128; - va_start(ap, mdfile_fmtstr); - evsnprintf(config.md_file_path, sizeof(config.md_file_path), - mdfile_fmtstr, ap); - va_end(ap); - + /* + * Set up to open the file with VFD SWMR configured. + */ /* Enable VFD SWMR configuration */ - if(use_vfd_swmr && H5Pset_vfd_swmr_config(fapl, &config) < 0) { + if(use_vfd_swmr && H5Pset_vfd_swmr_config(fapl, config) < 0) { warnx("H5Pset_vfd_swmr_config"); return badhid; } + return fapl; -} + +} /* vfd_swmr_create_fapl() */ + /* Fetch a variable from the environment and parse it for unsigned long * content. Return 0 if the variable is not present, -1 if it is present diff --git a/test/vfd_swmr_common.h b/test/vfd_swmr_common.h index 51e8c80..a4bf50e 100644 --- a/test/vfd_swmr_common.h +++ b/test/vfd_swmr_common.h @@ -30,15 +30,10 @@ */ #define MAX_SIZE_CHANGE 10 -#define NLEVELS 5 /* # of datasets in the SWMR test file */ - -#define NMAPPING 9 - -#define COMMON_FILENAME "vfd_swmr_data.h5" /* SWMR test file name */ -#define DTYPE_SIZE 150 /* Data size in opaque type */ +#define VFD_SWMR_FILENAME "vfd_swmr_data.h5" /* SWMR test file name */ /* The message sent by writer that the file open is done--releasing the file lock */ -#define WRITER_MESSAGE "VFD_SWMR_WRITER_MESSAGE" +#define VFD_SWMR_WRITER_MESSAGE "VFD_SWMR_WRITER_MESSAGE" /************/ /* Typedefs */ @@ -49,19 +44,6 @@ typedef struct _estack_state { void *edata; } estack_state_t; -/* Information about a symbol/dataset */ -typedef struct { - char *name; /* Dataset name for symbol */ - hid_t dsid; /* Dataset ID for symbol */ - hsize_t nrecords; /* Number of records for the symbol */ -} symbol_info_t; - -/* A symbol's record */ -typedef struct { - uint64_t rec_id; /* ID for this record (unique in symbol) */ - uint8_t info[DTYPE_SIZE]; /* "Other" information for this record */ -} symbol_t; - typedef enum _testsel { TEST_NONE = 0 , TEST_NULL @@ -71,8 +53,6 @@ typedef enum _testsel { /********************/ /* Global Variables */ /********************/ -H5TEST_DLLVAR symbol_info_t *symbol_info[NLEVELS]; -H5TEST_DLLVAR unsigned symbol_count[NLEVELS]; /**************/ /* Prototypes */ @@ -87,18 +67,19 @@ H5TEST_DLL estack_state_t estack_get_state(void); H5TEST_DLL estack_state_t disable_estack(void); H5TEST_DLL void restore_estack(estack_state_t); -H5TEST_DLL symbol_info_t * choose_dataset(unsigned *, unsigned *); -H5TEST_DLL hid_t create_symbol_datatype(void); -H5TEST_DLL int generate_name(char *name_buf, unsigned level, unsigned count); -H5TEST_DLL int generate_symbols(void); -H5TEST_DLL int shutdown_symbols(void); -H5TEST_DLL int print_metadata_retries_info(hid_t fid); H5TEST_DLL void block_signals(sigset_t *); H5TEST_DLL void restore_signals(sigset_t *); H5TEST_DLL void await_signal(hid_t); -H5TEST_DLL hid_t vfd_swmr_create_fapl(bool, bool, bool, const char *, ...) - H5_ATTR_FORMAT(printf, 4, 5); + +H5TEST_DLL hid_t +vfd_swmr_create_fapl(bool use_latest_format, bool use_vfd_swmr, bool only_meta_pages, + H5F_vfd_swmr_config_t *config); + +H5TEST_DLL void +init_vfd_swmr_config(H5F_vfd_swmr_config_t *config, uint32_t tick_len, uint32_t max_lag, hbool_t writer, + hbool_t flush_raw_data, uint32_t md_pages_reserved, const char *md_file_fmtstr, ...) + H5_ATTR_FORMAT(printf, 7, 8); H5TEST_DLL void dbgf(int, const char *, ...) H5_ATTR_FORMAT(printf, 2, 3); H5TEST_DLL void evsnprintf(char *, size_t, const char *, va_list); diff --git a/test/vfd_swmr_generator.c b/test/vfd_swmr_generator.c index f0d043c..a1cc26f 100644 --- a/test/vfd_swmr_generator.c +++ b/test/vfd_swmr_generator.c @@ -28,6 +28,7 @@ #include "h5test.h" #include "vfd_swmr_common.h" +#include "swmr_common.h" /* * This file needs to access testing codefrom the H5O package. @@ -106,15 +107,6 @@ gen_skeleton(const char *filename, hbool_t verbose, hbool_t vfd_swmr_write, HDassert(filename); HDassert(index_type); - /* Create file access property list */ - if((fapl = h5_fileaccess()) < 0) - return -1; - - /* Set to use the latest format with the latest chunk indexing */ - /* FOR NOW: the parameter vfd_swmr_write is not used here as in swmr_generator.c */ - if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) - return -1; - /* There are two chunk indexes tested here. * With one unlimited dimension, we get the extensible array index * type, with two unlimited dimensions, we get a v2 B-tree. @@ -135,29 +127,21 @@ gen_skeleton(const char *filename, hbool_t verbose, hbool_t vfd_swmr_write, */ if(vfd_swmr_write) { - /* Set file space strategy to paged aggregation in fcpl */ - if(H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, FALSE, 1) < 0) - return -1; - - /* Enable page buffering in fapl */ - if(H5Pset_page_buffer_size(fapl, 4096, 0, 0) < 0) - return -1; - /* Allocate memory for the VFD SWMR configuration structure */ if((config = HDcalloc(1, sizeof(*config))) == NULL) return -1; - config->version = H5F__CURR_VFD_SWMR_CONFIG_VERSION; - config->tick_len = 4; - config->max_lag = 10; - config->writer = TRUE; - config->md_pages_reserved = 128; - HDstrcpy(config->md_file_path, "generator-shadow"); + /* config, tick_len, max_lag, writer, flush_raw_data, md_pages_reserved, md_file_path */ + init_vfd_swmr_config(config, 4, 10 , vfd_swmr_write, FALSE, 128, "generator-shadow"); + } - /* Enable VFD SWMR configuration in fapl */ - if(H5Pset_vfd_swmr_config(fapl, config) < 0) - return -1; - } + /* use_latest_format, use_vfd_swmr, only_meta_page, config */ + if((fapl = vfd_swmr_create_fapl(TRUE, vfd_swmr_write, FALSE, config)) < 0) + return -1; + + /* Set file space strategy to paged aggregation in fcpl */ + if(H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, FALSE, 1) < 0) + return -1; /* Create the file with VFD SWMR write configured */ if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0) @@ -387,10 +371,10 @@ int main(int argc, const char *argv[]) /* Emit informational message */ if(verbose) - HDfprintf(stderr, "Generating skeleton file: %s\n", COMMON_FILENAME); + HDfprintf(stderr, "Generating skeleton file: %s\n", VFD_SWMR_FILENAME); /* Generate file skeleton */ - if(gen_skeleton(COMMON_FILENAME, verbose, vfd_swmr_write, comp_level, index_type, random_seed) < 0) { + if(gen_skeleton(VFD_SWMR_FILENAME, verbose, vfd_swmr_write, comp_level, index_type, random_seed) < 0) { HDfprintf(stderr, "Error generating skeleton file!\n"); HDexit(1); } /* end if */ diff --git a/test/vfd_swmr_group_writer.c b/test/vfd_swmr_group_writer.c index 66ff114..ede4594 100644 --- a/test/vfd_swmr_group_writer.c +++ b/test/vfd_swmr_group_writer.c @@ -272,6 +272,7 @@ main(int argc, char **argv) bool writer; state_t s; const char *personality; + H5F_vfd_swmr_config_t config; state_init(&s, argc, argv); @@ -288,7 +289,11 @@ main(int argc, char **argv) "unknown personality, expected vfd_swmr_group_{reader,writer}"); } - fapl = vfd_swmr_create_fapl(writer, true, s.use_vfd_swmr, "./group-shadow"); + /* config, tick_len, max_lag, writer, flush_raw_data, md_pages_reserved, md_file_path */ + init_vfd_swmr_config(&config, 4, 7, writer, FALSE, 128, "./group-shadow"); + + /* use_latest_format, use_vfd_swmr, only_meta_page, config */ + fapl = vfd_swmr_create_fapl(true, s.use_vfd_swmr, true, &config); if (fapl < 0) errx(EXIT_FAILURE, "vfd_swmr_create_fapl"); diff --git a/test/vfd_swmr_reader.c b/test/vfd_swmr_reader.c index 5f61102..0b9132e 100644 --- a/test/vfd_swmr_reader.c +++ b/test/vfd_swmr_reader.c @@ -31,6 +31,7 @@ #include "h5test.h" #include "vfd_swmr_common.h" +#include "swmr_common.h" /********************/ /* Local Prototypes */ @@ -317,9 +318,18 @@ read_records(const char *filename, hbool_t verbose, FILE *verbose_file, start_time = HDtime(NULL); curr_time = start_time; - /* Create file access property list */ - if((fapl = h5_fileaccess()) < 0) { - fprintf(stderr, "%s.%d: h5_fileaccess failed\n", __func__, __LINE__); + /* Allocate memory for the configuration structure */ + if((config = (H5F_vfd_swmr_config_t *)HDcalloc(1, sizeof(H5F_vfd_swmr_config_t))) == NULL) { + fprintf(stderr, "%s.%d: malloc failed\n", __func__, __LINE__); + goto error; + } + + /* config, tick_len, max_lag, writer, flush_raw_data, md_pages_reserved, md_file_path */ + init_vfd_swmr_config(config, 4, 5 , FALSE, FALSE, 128, "./rw-shadow"); + + /* use_latest_format, use_vfd_swmr, only_meta_page, config */ + if((fapl = vfd_swmr_create_fapl(FALSE, TRUE, FALSE, config)) < 0) { + fprintf(stderr, "%s.%d: vfd_swmr_create_fapl failed\n", __func__, __LINE__); goto error; } @@ -332,36 +342,6 @@ read_records(const char *filename, hbool_t verbose, FILE *verbose_file, H5Pset_fapl_log(fapl, verbose_name, H5FD_LOG_ALL, (size_t)(512 * 1024 * 1024)); } /* end if */ - /* - * Set up to open the file with VFD SWMR configured. - */ - /* Enable page buffering */ - if(H5Pset_page_buffer_size(fapl, 4096, 0, 0) < 0) { - fprintf(stderr, "%s.%d: H5Pset_page_buffer_size failed\n", - __func__, __LINE__); - goto error; - } - - /* Allocate memory for the configuration structure */ - if((config = (H5F_vfd_swmr_config_t *)HDcalloc(1, sizeof(H5F_vfd_swmr_config_t))) == NULL) { - fprintf(stderr, "%s.%d: malloc failed\n", __func__, __LINE__); - goto error; - } - - config->version = H5F__CURR_VFD_SWMR_CONFIG_VERSION; - config->tick_len = 4; - config->max_lag = 5; - config->writer = FALSE; - config->md_pages_reserved = 128; - HDstrcpy(config->md_file_path, "./rw-shadow"); - - /* Enable VFD SWMR configuration */ - if(H5Pset_vfd_swmr_config(fapl, config) < 0) { - fprintf(stderr, "%s.%d: H5Pset_vfd_swmr_config failed\n", - __func__, __LINE__); - goto error; - } - /* Loop over reading records until [at least] the correct # of seconds have passed */ while(curr_time < (time_t)(start_time + (time_t)nseconds)) { @@ -647,7 +627,7 @@ int main(int argc, const char *argv[]) } /* Reading records from datasets */ - if(read_records(COMMON_FILENAME, verbose, verbose_file, random_seed, (unsigned long)nseconds, (unsigned)poll_time, (unsigned)ncommon, (unsigned)nrandom) < 0) { + if(read_records(VFD_SWMR_FILENAME, verbose, verbose_file, random_seed, (unsigned long)nseconds, (unsigned)poll_time, (unsigned)ncommon, (unsigned)nrandom) < 0) { HDfprintf(stderr, "READER: Error reading records from datasets (random_seed = %u)!\n", random_seed); HDexit(1); } /* end if */ diff --git a/test/vfd_swmr_remove_reader.c b/test/vfd_swmr_remove_reader.c index f56fce3..c4eaba2 100644 --- a/test/vfd_swmr_remove_reader.c +++ b/test/vfd_swmr_remove_reader.c @@ -32,6 +32,7 @@ #include "h5test.h" #include "vfd_swmr_common.h" +#include "swmr_common.h" /*******************/ /* Local Variables */ @@ -297,31 +298,18 @@ read_records(const char *filename, unsigned verbose, unsigned long nseconds, start_time = HDtime(NULL); curr_time = start_time; - /* Create file access property list */ - if((fapl = h5_fileaccess()) < 0) - goto error; - - /* - * Set up to open the file with VFD SWMR configured. - */ - /* Enable page buffering */ - if(H5Pset_page_buffer_size(fapl, 4096, 0, 0) < 0) - goto error; - /* Allocate memory for the configuration structure */ if((config = HDcalloc(1, sizeof(*config))) == NULL) goto error; - config->version = H5F__CURR_VFD_SWMR_CONFIG_VERSION; - config->tick_len = 4; - config->max_lag = 5; - config->writer = FALSE; - config->md_pages_reserved = 128; - HDstrcpy(config->md_file_path, "./rw-shadow"); + /* config, tick_len, max_lag, writer, flush_raw_data, md_pages_reserved, md_file_path */ + init_vfd_swmr_config(config, 4, 5 , FALSE, FALSE, 128, "./rw-shadow"); - /* Enable VFD SWMR configuration */ - if(H5Pset_vfd_swmr_config(fapl, config) < 0) + /* use_latest_format, use_vfd_swmr, only_meta_page, config */ + if((fapl = vfd_swmr_create_fapl(FALSE, TRUE, FALSE, config)) < 0) { + fprintf(stderr, "%s.%d: vfd_swmr_create_fapl failed\n", __func__, __LINE__); goto error; + } /* Loop over reading records until [at least] the correct # of seconds have passed */ while(curr_time < (time_t)(start_time + (time_t)nseconds)) { @@ -567,7 +555,7 @@ int main(int argc, const char *argv[]) return -1; /* Reading records from datasets */ - if(read_records(COMMON_FILENAME, verbose, (unsigned long)nseconds, (unsigned)poll_time, (unsigned)ncommon, (unsigned)nrandom) < 0) { + if(read_records(VFD_SWMR_FILENAME, verbose, (unsigned long)nseconds, (unsigned)poll_time, (unsigned)ncommon, (unsigned)nrandom) < 0) { HDfprintf(stderr, "READER: Error reading records from datasets!\n"); HDexit(1); } /* end if */ diff --git a/test/vfd_swmr_remove_writer.c b/test/vfd_swmr_remove_writer.c index ae64ff0..9ec5b98 100644 --- a/test/vfd_swmr_remove_writer.c +++ b/test/vfd_swmr_remove_writer.c @@ -34,6 +34,7 @@ #include "h5test.h" #include "vfd_swmr_common.h" +#include "swmr_common.h" /****************/ /* Local Macros */ @@ -83,35 +84,15 @@ open_skeleton(const char *filename, unsigned verbose, HDassert(filename); - /* Create file access property list */ - if((fapl = h5_fileaccess()) < 0) + /* Allocate memory for the configuration structure */ + if((config = (H5F_vfd_swmr_config_t *)HDcalloc(1, sizeof(H5F_vfd_swmr_config_t))) == NULL) goto error; - /* FOR NOW: set to use latest format, the "old" parameter is not used */ - if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) - goto error; - - /* - * Set up to open the file with VFD SWMR configured. - */ - - /* Enable page buffering */ - if(H5Pset_page_buffer_size(fapl, 4096, 0, 0) < 0) - goto error; + /* config, tick_len, max_lag, writer, flush_raw_data, md_pages_reserved, md_file_path */ + init_vfd_swmr_config(config, 4, 5 , TRUE, FALSE, 128, "./rw-shadow"); - /* Allocate memory for the configuration structure */ - if((config = (H5F_vfd_swmr_config_t *)HDcalloc(1, sizeof(H5F_vfd_swmr_config_t))) == NULL) - goto error; - - config->version = H5F__CURR_VFD_SWMR_CONFIG_VERSION; - config->tick_len = 4; - config->max_lag = 5; - config->writer = TRUE; - config->md_pages_reserved = 128; - HDstrcpy(config->md_file_path, "./rw-shadow"); - - /* Enable VFD SWMR configuration */ - if(H5Pset_vfd_swmr_config(fapl, config) < 0) + /* use_latest_format, use_vfd_swmr, only_meta_page, config */ + if((fapl = vfd_swmr_create_fapl(TRUE, TRUE, FALSE, config)) < 0) goto error; /* Open the file */ @@ -224,12 +205,6 @@ remove_records(hid_t fid, unsigned verbose, unsigned long nshrinks, unsigned lon /* Check for counter being reached */ if(0 == shrink_to_flush) { -#ifdef TEMP_OUT - /* Flush contents of file */ - if(H5Fflush(fid, H5F_SCOPE_GLOBAL) < 0) - return -1; -#endif - /* Reset flush counter */ shrink_to_flush = flush_count; } /* end if */ @@ -376,17 +351,17 @@ int main(int argc, const char *argv[]) /* Emit informational message */ if(verbose) { HDfprintf(stderr, "WRITER: Opening skeleton file: %s\n", - COMMON_FILENAME); + VFD_SWMR_FILENAME); } /* Open file skeleton */ - if((fid = open_skeleton(COMMON_FILENAME, verbose, old)) < 0) { + if((fid = open_skeleton(VFD_SWMR_FILENAME, verbose, old)) < 0) { HDfprintf(stderr, "WRITER: Error opening skeleton file!\n"); HDexit(1); } /* end if */ /* Send a message to indicate "H5Fopen" is complete--releasing the file lock */ - h5_send_message(WRITER_MESSAGE, NULL, NULL); + h5_send_message(VFD_SWMR_WRITER_MESSAGE, NULL, NULL); /* Emit informational message */ if(verbose) diff --git a/test/vfd_swmr_sparse_reader.c b/test/vfd_swmr_sparse_reader.c index 4f87ac5..3f07dc9 100644 --- a/test/vfd_swmr_sparse_reader.c +++ b/test/vfd_swmr_sparse_reader.c @@ -34,6 +34,7 @@ #include "h5test.h" #include "vfd_swmr_common.h" +#include "swmr_common.h" /****************/ /* Local Macros */ @@ -200,33 +201,20 @@ read_records(const char *filename, unsigned verbose, unsigned long nrecords, HDassert(filename); HDassert(poll_time != 0); - /* Create file access property list */ - if((fapl = h5_fileaccess()) < 0) - goto error; - - if(H5Pset_fclose_degree(fapl, H5F_CLOSE_SEMI) < 0) - goto error; - - /* - * Set up to open the file with VFD SWMR configured. - */ - /* Enable page buffering */ - if(H5Pset_page_buffer_size(fapl, 4096, 0, 0) < 0) - goto error; - /* Allocate memory for the configuration structure */ if((config = HDcalloc(1, sizeof(H5F_vfd_swmr_config_t))) == NULL) goto error; - config->version = H5F__CURR_VFD_SWMR_CONFIG_VERSION; - config->tick_len = 4; - config->max_lag = 5; - config->writer = FALSE; - config->md_pages_reserved = 128; - HDstrcpy(config->md_file_path, "./rw-shadow"); + /* config, tick_len, max_lag, writer, flush_raw_data, md_pages_reserved, md_file_path */ + init_vfd_swmr_config(config, 4, 5 , FALSE, FALSE, 128, "./rw-shadow"); - /* Enable VFD SWMR configuration */ - if(H5Pset_vfd_swmr_config(fapl, config) < 0) + /* use_latest_format, use_vfd_swmr, only_meta_page, config */ + if((fapl = vfd_swmr_create_fapl(FALSE, TRUE, FALSE, config)) < 0) { + fprintf(stderr, "%s.%d: vfd_swmr_create_fapl failed\n", __func__, __LINE__); + goto error; + } + + if(H5Pset_fclose_degree(fapl, H5F_CLOSE_SEMI) < 0) goto error; /* Emit informational message */ @@ -506,7 +494,7 @@ int main(int argc, const char *argv[]) } /* Reading records from datasets */ - if(read_records(COMMON_FILENAME, verbose, (unsigned long) nrecords, (unsigned)poll_time, (unsigned)reopen_count) < 0) { + if(read_records(VFD_SWMR_FILENAME, verbose, (unsigned long) nrecords, (unsigned)poll_time, (unsigned)reopen_count) < 0) { HDfprintf(stderr, "READER: Error reading records from datasets!\n"); HDexit(1); } /* end if */ diff --git a/test/vfd_swmr_sparse_writer.c b/test/vfd_swmr_sparse_writer.c index 509a62c..a431aee 100644 --- a/test/vfd_swmr_sparse_writer.c +++ b/test/vfd_swmr_sparse_writer.c @@ -33,6 +33,7 @@ #include "h5test.h" #include "vfd_swmr_common.h" +#include "swmr_common.h" /****************/ /* Local Macros */ @@ -83,35 +84,15 @@ open_skeleton(const char *filename, unsigned verbose) HDassert(filename); - /* Create file access property list */ - if((fapl = h5_fileaccess()) < 0) + /* Allocate memory for the configuration structure */ + if((config = (H5F_vfd_swmr_config_t *)HDcalloc(1, sizeof(H5F_vfd_swmr_config_t))) == NULL) goto error; - /* Set to use the latest library format */ - if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) - goto error; - - /* - * Set up to open the file with VFD SWMR configured. - */ - - /* Enable page buffering */ - if(H5Pset_page_buffer_size(fapl, 4096, 0, 0) < 0) - goto error; + /* config, tick_len, max_lag, writer, flush_raw_data, md_pages_reserved, md_file_path */ + init_vfd_swmr_config(config, 4, 5 , TRUE, FALSE, 128, "./rw-shadow"); - /* Allocate memory for the configuration structure */ - if((config = (H5F_vfd_swmr_config_t *)HDcalloc(1, sizeof(H5F_vfd_swmr_config_t))) == NULL) - goto error; - - config->version = H5F__CURR_VFD_SWMR_CONFIG_VERSION; - config->tick_len = 4; - config->max_lag = 5; - config->writer = TRUE; - config->md_pages_reserved = 128; - HDstrcpy(config->md_file_path, "./rw-shadow"); - - /* Enable VFD SWMR configuration */ - if(H5Pset_vfd_swmr_config(fapl, config) < 0) + /* use_latest_format, use_vfd_swmr, only_meta_page, config */ + if((fapl = vfd_swmr_create_fapl(TRUE, TRUE, FALSE, config)) < 0) goto error; /* Open the file */ @@ -288,12 +269,6 @@ add_records(hid_t fid, unsigned verbose, unsigned long nrecords, unsigned long f /* Check for counter being reached */ if(0 == rec_to_flush) { -#ifdef TEMP_OUT - /* Flush contents of file */ - if(H5Fflush(fid, H5F_SCOPE_GLOBAL) < 0) - return -1; -#endif - /* Reset flush counter */ rec_to_flush = flush_count; } /* end if */ @@ -438,17 +413,17 @@ int main(int argc, const char *argv[]) /* Emit informational message */ if(verbose) { HDfprintf(stderr, "WRITER: Opening skeleton file: %s\n", - COMMON_FILENAME); + VFD_SWMR_FILENAME); } /* Open file skeleton */ - if((fid = open_skeleton(COMMON_FILENAME, verbose)) < 0) { + if((fid = open_skeleton(VFD_SWMR_FILENAME, verbose)) < 0) { HDfprintf(stderr, "WRITER: Error opening skeleton file!\n"); HDexit(1); } /* end if */ /* Send a message to indicate "H5Fopen" is complete--releasing the file lock */ - h5_send_message(WRITER_MESSAGE, NULL, NULL); + h5_send_message(VFD_SWMR_WRITER_MESSAGE, NULL, NULL); /* Emit informational message */ if(verbose) diff --git a/test/vfd_swmr_vlstr_reader.c b/test/vfd_swmr_vlstr_reader.c index e78f36b..e75af35 100644 --- a/test/vfd_swmr_vlstr_reader.c +++ b/test/vfd_swmr_vlstr_reader.c @@ -94,6 +94,7 @@ main(int argc, char **argv) const struct timespec delay = {.tv_sec = 0, .tv_nsec = millisec_in_nanosecs * 11 / 10}; testsel_t sel = TEST_NONE; + H5F_vfd_swmr_config_t config; assert(H5T_C_S1 != badhid); @@ -135,8 +136,12 @@ main(int argc, char **argv) if (argc > 0) errx(EXIT_FAILURE, "unexpected command-line arguments"); - fapl = vfd_swmr_create_fapl(false, sel == TEST_OOB, use_vfd_swmr, - "./vlstr-shadow"); + /* config, tick_len, max_lag, writer, flush_raw_data, md_pages_reserved, md_file_path */ + init_vfd_swmr_config(&config, 4, 7, false, FALSE, 128, "./vlstr-shadow"); + + /* use_latest_format, use_vfd_swmr, only_meta_page, config */ + fapl = vfd_swmr_create_fapl(true, use_vfd_swmr, sel == TEST_OOB, &config); + if (fapl < 0) errx(EXIT_FAILURE, "vfd_swmr_create_fapl"); diff --git a/test/vfd_swmr_vlstr_writer.c b/test/vfd_swmr_vlstr_writer.c index d635b7a..17e7d83 100644 --- a/test/vfd_swmr_vlstr_writer.c +++ b/test/vfd_swmr_vlstr_writer.c @@ -155,6 +155,7 @@ main(int argc, char **argv) const struct timespec delay = {.tv_sec = 0, .tv_nsec = 1000 * 1000 * 1000 / 10}; testsel_t sel = TEST_NONE; + H5F_vfd_swmr_config_t config; assert(H5T_C_S1 != badhid); @@ -202,8 +203,12 @@ main(int argc, char **argv) if (argc > 0) errx(EXIT_FAILURE, "unexpected command-line arguments"); - fapl = vfd_swmr_create_fapl(true, sel == TEST_OOB, use_vfd_swmr, - "./vlstr-shadow"); + /* config, tick_len, max_lag, writer, flush_raw_data, md_pages_reserved, md_file_path */ + init_vfd_swmr_config(&config, 4, 7, true, FALSE, 128, "./vlstr-shadow"); + + /* use_latest_format, use_vfd_swmr, only_meta_page, config */ + fapl = vfd_swmr_create_fapl(true, use_vfd_swmr, sel == TEST_OOB, &config); + if (fapl < 0) errx(EXIT_FAILURE, "vfd_swmr_create_fapl"); diff --git a/test/vfd_swmr_writer.c b/test/vfd_swmr_writer.c index 1538ef3..be45a68 100644 --- a/test/vfd_swmr_writer.c +++ b/test/vfd_swmr_writer.c @@ -33,6 +33,7 @@ #include "h5test.h" #include "vfd_swmr_common.h" +#include "swmr_common.h" /********************/ /* Local Prototypes */ @@ -84,12 +85,15 @@ open_skeleton(const char *filename, hbool_t verbose, FILE *verbose_file, HDassert(filename); - /* Create file access property list */ - if((fapl = h5_fileaccess()) < 0) + /* Allocate memory for the configuration structure */ + if((config = (H5F_vfd_swmr_config_t *)HDcalloc(1, sizeof(H5F_vfd_swmr_config_t))) == NULL) return -1; - /* FOR NOW: set to use latest format, the "old" parameter is not used */ - if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) + /* config, tick_len, max_lag, writer, flush_raw_data, md_pages_reserved, md_file_path */ + init_vfd_swmr_config(config, 4, 5 , TRUE, FALSE, 128, "./rw-shadow"); + + /* use_latest_format, use_vfd_swmr, only_meta_page, config */ + if((fapl = vfd_swmr_create_fapl(TRUE, TRUE, FALSE, config)) < 0) return -1; if(use_log_vfd) { @@ -100,29 +104,6 @@ open_skeleton(const char *filename, hbool_t verbose, FILE *verbose_file, H5Pset_fapl_log(fapl, verbose_name, H5FD_LOG_ALL, (size_t)(512 * 1024 * 1024)); } /* end if */ - /* - * Set up to open the file with VFD SWMR configured. - */ - - /* Enable page buffering */ - if(H5Pset_page_buffer_size(fapl, 4096, 0, 0) < 0) - return -1; - - /* Allocate memory for the configuration structure */ - if((config = (H5F_vfd_swmr_config_t *)HDcalloc(1, sizeof(H5F_vfd_swmr_config_t))) == NULL) - return -1; - - config->version = H5F__CURR_VFD_SWMR_CONFIG_VERSION; - config->tick_len = 4; - config->max_lag = 5; - config->writer = TRUE; - config->md_pages_reserved = 128; - HDstrcpy(config->md_file_path, "./rw-shadow"); - - /* Enable VFD SWMR configuration */ - if(H5Pset_vfd_swmr_config(fapl, config) < 0) - return -1; - /* Open the file with VFD SWMR configured */ if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) return -1; @@ -246,12 +227,6 @@ add_records(hid_t fid, hbool_t verbose, FILE *verbose_file, /* Check for counter being reached */ if(0 == rec_to_flush) { -#ifdef TEMP_OUT - /* Flush contents of file */ - if(H5Fflush(fid, H5F_SCOPE_GLOBAL) < 0) - return -1; -#endif /* TEMP_OUT */ - /* Reset flush counter */ rec_to_flush = flush_count; } /* end if */ @@ -402,17 +377,17 @@ main(int argc, char * const *argv) /* Emit informational message */ if(verbose) { HDfprintf(verbose_file, "WRITER: Opening skeleton file: %s\n", - COMMON_FILENAME); + VFD_SWMR_FILENAME); } /* Open file skeleton */ - if((fid = open_skeleton(COMMON_FILENAME, verbose, verbose_file, random_seed, old)) < 0) { + if((fid = open_skeleton(VFD_SWMR_FILENAME, verbose, verbose_file, random_seed, old)) < 0) { HDfprintf(stderr, "WRITER: Error opening skeleton file!\n"); HDexit(1); } /* end if */ /* Send a message to indicate "H5Fopen" is complete--releasing the file lock */ - h5_send_message(WRITER_MESSAGE, NULL, NULL); + h5_send_message(VFD_SWMR_WRITER_MESSAGE, NULL, NULL); /* Emit informational message */ if(verbose) diff --git a/test/vfd_swmr_zoo_writer.c b/test/vfd_swmr_zoo_writer.c index 860c4f9..c98b2e1 100644 --- a/test/vfd_swmr_zoo_writer.c +++ b/test/vfd_swmr_zoo_writer.c @@ -231,6 +231,7 @@ main(int argc, char **argv) const char *personality = strstr(progname, "vfd_swmr_zoo_"); estack_state_t es; char step = 'b'; + H5F_vfd_swmr_config_t vfd_swmr_config; if (personality != NULL && strcmp(personality, "vfd_swmr_zoo_writer") == 0) writer = wait_for_signal = true; @@ -290,7 +291,12 @@ main(int argc, char **argv) if (argc > 0) errx(EXIT_FAILURE, "unexpected command-line arguments"); - fapl = vfd_swmr_create_fapl(writer, true, use_vfd_swmr, "./zoo-shadow"); + /* config, tick_len, max_lag, writer, flush_raw_data, md_pages_reserved, md_file_path */ + init_vfd_swmr_config(&vfd_swmr_config, 4, 7, writer, FALSE, 128, "./zoo-shadow"); + + /* ? turn off use latest format argument via 1st argument? since later on it reset to early format */ + /* use_latest_format, use_vfd_swmr, only_meta_page, config */ + fapl = vfd_swmr_create_fapl(true, use_vfd_swmr, true, &vfd_swmr_config); if (use_vfd_swmr && H5Pget_vfd_swmr_config(fapl, &swmr_config) < 0) errx(EXIT_FAILURE, "H5Pget_vfd_swmr_config"); |