diff options
author | github-actions <41898282+github-actions[bot]@users.noreply.github.com> | 2021-08-12 16:43:22 (GMT) |
---|---|---|
committer | github-actions <41898282+github-actions[bot]@users.noreply.github.com> | 2021-08-12 16:43:22 (GMT) |
commit | 139142cb79aa3e0ba0f2275654f8edd8376302fe (patch) | |
tree | fcfdefc636ac6e160fb91bf35d9691bbe71c1571 /test | |
parent | 4a35f8480b29a1b55ccec81f4a0df9e776b76070 (diff) | |
download | hdf5-139142cb79aa3e0ba0f2275654f8edd8376302fe.zip hdf5-139142cb79aa3e0ba0f2275654f8edd8376302fe.tar.gz hdf5-139142cb79aa3e0ba0f2275654f8edd8376302fe.tar.bz2 |
Committing clang-format changes
Diffstat (limited to 'test')
-rw-r--r-- | test/vfd_swmr_attrdset_writer.c | 45 | ||||
-rw-r--r-- | test/vfd_swmr_dsetchks_writer.c | 121 | ||||
-rw-r--r-- | test/vfd_swmr_dsetops_writer.c | 147 |
3 files changed, 170 insertions, 143 deletions
diff --git a/test/vfd_swmr_attrdset_writer.c b/test/vfd_swmr_attrdset_writer.c index e10184f..67eeb2c 100644 --- a/test/vfd_swmr_attrdset_writer.c +++ b/test/vfd_swmr_attrdset_writer.c @@ -150,16 +150,16 @@ static bool open_dset_real(hid_t fid, hid_t *did, const char *name, unsigned *ma unsigned *min_dense); static bool close_dsets(const dsets_state_t *ds); -static bool perform_dsets_operations(state_t *s, dsets_state_t *ds, - H5F_vfd_swmr_config_t *config, np_state_t *np); +static bool perform_dsets_operations(state_t *s, dsets_state_t *ds, H5F_vfd_swmr_config_t *config, + np_state_t *np); static bool attr_dsets_action(unsigned action, const state_t *s, const dsets_state_t *ds, unsigned which); static bool attr_action(unsigned action, const state_t *s, hid_t did, unsigned which); static bool add_attr(const state_t *s, hid_t did, unsigned int which); static bool modify_attr(const state_t *s, hid_t did, unsigned int which); static bool delete_attr(hid_t did, unsigned int which); -static bool verify_dsets_operations(state_t *s, dsets_state_t *ds, - H5F_vfd_swmr_config_t *config, np_state_t *np); +static bool verify_dsets_operations(state_t *s, dsets_state_t *ds, H5F_vfd_swmr_config_t *config, + np_state_t *np); static bool verify_attr_dsets_action(unsigned action, const state_t *s, const dsets_state_t *ds, unsigned which); static bool verify_attr_action(unsigned action, hid_t did, unsigned which); @@ -226,8 +226,8 @@ state_init(state_t *s, int argc, char **argv) { unsigned long tmp; int ch; - const hsize_t dims = 1; - char *tfile = NULL; + const hsize_t dims = 1; + char * tfile = NULL; char * end; *s = ALL_HID_INITIALIZER; @@ -919,12 +919,12 @@ error: * DELETE_ATTR : -d <dattrs> option */ static bool -perform_dsets_operations(state_t *s, dsets_state_t *ds, H5F_vfd_swmr_config_t *config, np_state_t *np) +perform_dsets_operations(state_t *s, dsets_state_t *ds, H5F_vfd_swmr_config_t *config, np_state_t *np) { - unsigned step; - bool result; - unsigned dd; - bool ret = true; + unsigned step; + bool result; + unsigned dd; + bool ret = true; for (step = 0; step < s->asteps; step++) { dbgf(2, "Adding attribute %d\n", step); @@ -956,9 +956,9 @@ perform_dsets_operations(state_t *s, dsets_state_t *ds, H5F_vfd_swmr_config_t *c TEST_ERROR; } } - } + } - if (s->dattrs) { + if (s->dattrs) { /* Need to sync up writer/reader before moving onto the next phase */ if (s->use_np && !np_writer(true, 0, s, np, config)) { @@ -1282,11 +1282,11 @@ error: * --not appliable for -m option */ static bool -verify_dsets_operations(state_t *s, dsets_state_t *ds, H5F_vfd_swmr_config_t *config, np_state_t *np) +verify_dsets_operations(state_t *s, dsets_state_t *ds, H5F_vfd_swmr_config_t *config, np_state_t *np) { - unsigned step; - bool result; - unsigned dd; + unsigned step; + bool result; + unsigned dd; /* Start verifying addition */ for (step = 0; step < s->asteps; step++) { @@ -1536,10 +1536,11 @@ verify_add_or_modify_attr(unsigned action, hid_t did, char *attr_name, unsigned HDprintf("HDmalloc failed\n"); TEST_ERROR; } - } else { + } + else { if (action == MODIFY_ATTR) tmp_val = which + 1; - else + else tmp_val = which; } @@ -2031,18 +2032,16 @@ main(int argc, char **argv) } if (writer) { - if(!perform_dsets_operations(&s, &ds, &config, &np)) { + if (!perform_dsets_operations(&s, &ds, &config, &np)) { HDprintf("perform_dsets_operations() failed\n"); TEST_ERROR; } - } else { - if(!verify_dsets_operations(&s, &ds, &config, &np)) { + if (!verify_dsets_operations(&s, &ds, &config, &np)) { HDprintf("verify_dsets_operations() failed\n"); TEST_ERROR; } - } if (!close_dsets(&ds)) { diff --git a/test/vfd_swmr_dsetchks_writer.c b/test/vfd_swmr_dsetchks_writer.c index d39ebf8..d264ca9 100644 --- a/test/vfd_swmr_dsetchks_writer.c +++ b/test/vfd_swmr_dsetchks_writer.c @@ -167,8 +167,8 @@ static void setup_selection(unsigned action, unsigned which, const state_t *s, c static void check_set_edge_block(const state_t *s, const dsets_state_t *ds, unsigned i, unsigned j, hsize_t *block); static void check_set_partial_block(unsigned action, const hsize_t *dims, hsize_t *block, hsize_t *start); -static bool write_chunks(unsigned action, hid_t did, hid_t tid, hsize_t *start, hsize_t *stride, hsize_t *count, - hsize_t *block); +static bool write_chunks(unsigned action, hid_t did, hid_t tid, hsize_t *start, hsize_t *stride, + hsize_t *count, hsize_t *block); static bool write_dset_single(unsigned action, const state_t *s, const dsets_state_t *ds); static bool dsets_extent(unsigned action, const state_t *s, const dsets_state_t *ds); @@ -177,9 +177,10 @@ static bool dset_extent_real(unsigned action, hid_t did, const hsize_t *chunk_di static bool verify_dsets_operations(state_t *s, dsets_state_t *ds, H5F_vfd_swmr_config_t *config, np_state_t *np, bool fileclosed); -static bool verify_dsets_chunks(unsigned action, const state_t *s, const dsets_state_t *ds, unsigned which, bool fileclosed); +static bool verify_dsets_chunks(unsigned action, const state_t *s, const dsets_state_t *ds, unsigned which, + bool fileclosed); static bool verify_chunks(unsigned action, hid_t did, hid_t tid, hsize_t *start, hsize_t *stride, - hsize_t *count, hsize_t *block, bool fileclosed, bool flush_raw_data); + hsize_t *count, hsize_t *block, bool fileclosed, bool flush_raw_data); static bool verify_dset_single(unsigned action, const state_t *s, const dsets_state_t *ds, bool fileclosed); static bool verify_dsets_extent(unsigned action, const state_t *s, const dsets_state_t *ds, unsigned which); @@ -191,13 +192,13 @@ static void usage(const char *progname) { HDfprintf(stderr, - "usage: %s \n" - " [-s] [-i] [-f] [-e] [-r]\n" - " [-m rows] [-n cols]\n" - " [-g gwrites] [-p pwrites] [-t twrites] [-l lwrites]\n" - " [-x xincrs] [-y decrs]\n" - " [-u nticks] [-c csteps] [-U] [-S] [-N] [-q] [-b] [-o]\n", - progname); + "usage: %s \n" + " [-s] [-i] [-f] [-e] [-r]\n" + " [-m rows] [-n cols]\n" + " [-g gwrites] [-p pwrites] [-t twrites] [-l lwrites]\n" + " [-x xincrs] [-y decrs]\n" + " [-u nticks] [-c csteps] [-U] [-S] [-N] [-q] [-b] [-o]\n", + progname); HDfprintf( stderr, @@ -265,13 +266,13 @@ state_init(state_t *s, int argc, char **argv) { unsigned long tmp; int ch; - char *tfile = NULL; + char * tfile = NULL; char * end; *s = ALL_HID_INITIALIZER; if (H5_basename(argv[0], &tfile) < 0) { - HDprintf("H5_basename failed\n"); + HDprintf("H5_basename failed\n"); TEST_ERROR } @@ -321,7 +322,7 @@ state_init(state_t *s, int argc, char **argv) s->use_vfd_swmr = false; break; - case 'U': /* Disable flush of raw data */ + case 'U': /* Disable flush of raw data */ s->flush_raw_data = false; break; @@ -1182,7 +1183,7 @@ check_set_partial_block(unsigned action, const hsize_t *chunk_dims, hsize_t *blo */ static bool write_chunks(unsigned action, hid_t did, hid_t tid, hsize_t *start, hsize_t *stride, hsize_t *count, - hsize_t *block) + hsize_t *block) { hid_t sid = badhid; hid_t mem_sid = badhid; @@ -1415,7 +1416,8 @@ error: * --DECR_EXT: verify the decrease to dataset dimensions sizes */ static bool -verify_dsets_operations(state_t *s, dsets_state_t *ds, H5F_vfd_swmr_config_t *config, np_state_t *np, bool fileclosed) +verify_dsets_operations(state_t *s, dsets_state_t *ds, H5F_vfd_swmr_config_t *config, np_state_t *np, + bool fileclosed) { unsigned step; unsigned allowed_writes; @@ -1435,7 +1437,7 @@ verify_dsets_operations(state_t *s, dsets_state_t *ds, H5F_vfd_swmr_config_t *co } /* Wait for a few ticks for the update to happen */ - if (!fileclosed) + if (!fileclosed) decisleep(config->tick_len * s->update_interval); result = verify_dset_single(GWRITES, s, ds, fileclosed); @@ -1443,7 +1445,8 @@ verify_dsets_operations(state_t *s, dsets_state_t *ds, H5F_vfd_swmr_config_t *co if (s->use_np && !np_reader(result, 0, s, np)) { HDprintf("np_reader() for verifying addition failed\n"); TEST_ERROR; - } else if (!result) + } + else if (!result) TEST_ERROR; } @@ -1453,11 +1456,11 @@ verify_dsets_operations(state_t *s, dsets_state_t *ds, H5F_vfd_swmr_config_t *co if (s->pwrites || s->lwrites) { dbgf(2, "Verify single partial chunk write to dataset with single index; only verify 1 write\n"); - if(s->use_np && !np_confirm_verify_notify(np->fd_writer_to_reader, 0, s, np)) { + if (s->use_np && !np_confirm_verify_notify(np->fd_writer_to_reader, 0, s, np)) { HDprintf("np_confirm_verify_notify() verify/notify not in sync failed\n"); TEST_ERROR; } - + /* Wait for a few ticks for the update to happen */ if (!fileclosed) decisleep(config->tick_len * s->update_interval); @@ -1467,7 +1470,8 @@ verify_dsets_operations(state_t *s, dsets_state_t *ds, H5F_vfd_swmr_config_t *co if (s->use_np && !np_reader(result, 0, s, np)) { HDprintf("np_reader() for verifying addition failed\n"); TEST_ERROR; - } if (!result) + } + if (!result) TEST_ERROR; } } @@ -1490,7 +1494,7 @@ verify_dsets_operations(state_t *s, dsets_state_t *ds, H5F_vfd_swmr_config_t *co } /* Wait for a few ticks for the update to happen */ - if(!fileclosed) + if (!fileclosed) decisleep(config->tick_len * s->update_interval); result = verify_dsets_chunks(GWRITES, s, ds, step, fileclosed); @@ -1498,7 +1502,8 @@ verify_dsets_operations(state_t *s, dsets_state_t *ds, H5F_vfd_swmr_config_t *co if (s->use_np && !np_reader(result, step, s, np)) { HDprintf("np_reader() for verification failed\n"); TEST_ERROR; - } else if (!result) + } + else if (!result) TEST_ERROR; } } @@ -1518,7 +1523,7 @@ verify_dsets_operations(state_t *s, dsets_state_t *ds, H5F_vfd_swmr_config_t *co } /* Wait for a few ticks for the update to happen */ - if(!fileclosed) + if (!fileclosed) decisleep(config->tick_len * s->update_interval); result = verify_dsets_chunks(PWRITES, s, ds, step, fileclosed); @@ -1526,7 +1531,8 @@ verify_dsets_operations(state_t *s, dsets_state_t *ds, H5F_vfd_swmr_config_t *co if (s->use_np && !np_reader(result, step, s, np)) { HDprintf("np_reader() for verification failed\n"); TEST_ERROR; - } else if (!result) + } + else if (!result) TEST_ERROR; } } @@ -1546,7 +1552,7 @@ verify_dsets_operations(state_t *s, dsets_state_t *ds, H5F_vfd_swmr_config_t *co } /* Wait for a few ticks for the update to happen */ - if(!fileclosed) + if (!fileclosed) decisleep(config->tick_len * s->update_interval); result = verify_dsets_chunks(TWRITES, s, ds, step, fileclosed); @@ -1554,7 +1560,8 @@ verify_dsets_operations(state_t *s, dsets_state_t *ds, H5F_vfd_swmr_config_t *co if (s->use_np && !np_reader(result, step, s, np)) { HDprintf("np_reader() for verification failed\n"); TEST_ERROR; - } else if (!result) + } + else if (!result) TEST_ERROR; } } @@ -1575,7 +1582,7 @@ verify_dsets_operations(state_t *s, dsets_state_t *ds, H5F_vfd_swmr_config_t *co } /* Wait for a few ticks for the update to happen */ - if(!fileclosed) + if (!fileclosed) decisleep(config->tick_len * s->update_interval); result = verify_dsets_chunks(LWRITES, s, ds, step, fileclosed); @@ -1583,7 +1590,8 @@ verify_dsets_operations(state_t *s, dsets_state_t *ds, H5F_vfd_swmr_config_t *co if (s->use_np && !np_reader(result, step, s, np)) { HDprintf("np_reader() for verification failed\n"); TEST_ERROR; - } else if (!result) + } + else if (!result) TEST_ERROR; } } @@ -1607,7 +1615,8 @@ verify_dsets_operations(state_t *s, dsets_state_t *ds, H5F_vfd_swmr_config_t *co if (s->use_np && !np_reader(result, step, s, np)) { HDprintf("np_reader() for failed\n"); TEST_ERROR; - } else if (!result) + } + else if (!result) TEST_ERROR; } } @@ -1627,10 +1636,11 @@ verify_dsets_operations(state_t *s, dsets_state_t *ds, H5F_vfd_swmr_config_t *co result = verify_dsets_extent(DECR_EXT, s, ds, step + 1); - if (s->use_np && !np_reader(result, step, s, np)) { + if (s->use_np && !np_reader(result, step, s, np)) { HDprintf("np_reader() for verification failed\n"); TEST_ERROR; - } else if (!result) + } + else if (!result) TEST_ERROR; } } @@ -1652,7 +1662,8 @@ error: * LWRITEs: verify `which` write that covers multiple partial chunks */ static bool -verify_dsets_chunks(unsigned action, const state_t *s, const dsets_state_t *ds, unsigned which, bool fileclosed) +verify_dsets_chunks(unsigned action, const state_t *s, const dsets_state_t *ds, unsigned which, + bool fileclosed) { hsize_t start[2] = {0, 0}; hsize_t stride[2] = {0, 0}; @@ -1665,28 +1676,32 @@ verify_dsets_chunks(unsigned action, const state_t *s, const dsets_state_t *ds, setup_selection(action, which, s, ds, start, stride, count, block); if (s->implicit_index) { - if (!verify_chunks(action, ds->implicit_did, s->filetype, start, stride, count, block, fileclosed, s->flush_raw_data)) { + if (!verify_chunks(action, ds->implicit_did, s->filetype, start, stride, count, block, fileclosed, + s->flush_raw_data)) { HDprintf("verify_chunks() to dataset with implicit index failed\n"); TEST_ERROR; } } if (s->fa_index) { - if (!verify_chunks(action, ds->fa_did, s->filetype, start, stride, count, block, fileclosed, s->flush_raw_data)) { + if (!verify_chunks(action, ds->fa_did, s->filetype, start, stride, count, block, fileclosed, + s->flush_raw_data)) { HDprintf("verify_chunks() to dataset with fixed array index failed\n"); TEST_ERROR; } } if (s->ea_index) { - if (!verify_chunks(action, ds->ea_did, s->filetype, start, stride, count, block, fileclosed, s->flush_raw_data)) { + if (!verify_chunks(action, ds->ea_did, s->filetype, start, stride, count, block, fileclosed, + s->flush_raw_data)) { HDprintf("verify_chunks() to dataset with extensible array index failed\n"); TEST_ERROR; } } if (s->bt2_index) { - if (!verify_chunks(action, ds->bt2_did, s->filetype, start, stride, count, block, fileclosed, s->flush_raw_data)) { + if (!verify_chunks(action, ds->bt2_did, s->filetype, start, stride, count, block, fileclosed, + s->flush_raw_data)) { HDprintf("verify_chunks() to dataset with bt2 index failed\n"); TEST_ERROR; } @@ -1705,7 +1720,7 @@ error: */ static bool verify_chunks(unsigned action, hid_t did, hid_t tid, hsize_t *start, hsize_t *stride, hsize_t *count, - hsize_t *block, bool fileclosed, bool flush_raw_data) + hsize_t *block, bool fileclosed, bool flush_raw_data) { hid_t mem_sid = badhid; hid_t sid = badhid; @@ -1751,7 +1766,7 @@ verify_chunks(unsigned action, hid_t did, hid_t tid, hsize_t *start, hsize_t *st /* Verify the data read in `rbuf` is as the fill value expected */ for (i = 0; i < block[0] * block[1]; i++) { - if(flush_raw_data || fileclosed) { + if (flush_raw_data || fileclosed) { if (action == GWRITES || action == TWRITES) { if (rbuf[i] != FILL_FULL) { HDprintf("Invalid value for dataset for GWRITES/TWRITES: %d\n", rbuf[i]); @@ -1765,7 +1780,8 @@ verify_chunks(unsigned action, hid_t did, hid_t tid, hsize_t *start, hsize_t *st TEST_ERROR; } } - } else { /* No flush && not closing file */ + } + else { /* No flush && not closing file */ if (action == GWRITES || action == TWRITES) { if (rbuf[i] != FILL_FULL && rbuf[i] != FILL_INIT) { HDprintf("Invalid value for dataset for GWRITES/TWRITES\n"); @@ -1937,7 +1953,8 @@ verify_dset_single(unsigned action, const state_t *s, const dsets_state_t *ds, b if (action == PWRITES) check_set_partial_block(action, block, block, start); - if (!verify_chunks(action, ds->single_did, s->filetype, start, stride, count, block, fileclosed, s->flush_raw_data)) { + if (!verify_chunks(action, ds->single_did, s->filetype, start, stride, count, block, fileclosed, + s->flush_raw_data)) { HDprintf("verify_read_dset() to dataset with single index failed\n"); TEST_ERROR; } @@ -2186,7 +2203,7 @@ closing_on_noflush(bool writer, state_t *s, dsets_state_t *ds, H5F_vfd_swmr_conf { HDassert(s->use_np); - if(writer) { + if (writer) { if (!close_dsets(ds)) { HDprintf("close_dsets() failed\n"); TEST_ERROR; @@ -2210,8 +2227,8 @@ closing_on_noflush(bool writer, state_t *s, dsets_state_t *ds, H5F_vfd_swmr_conf HDprintf("np_close() failed\n"); TEST_ERROR; } - - } else { + } + else { /* Wait for a few ticks for the file to close in writer */ decisleep(config->tick_len * s->update_interval); @@ -2229,10 +2246,10 @@ closing_on_noflush(bool writer, state_t *s, dsets_state_t *ds, H5F_vfd_swmr_conf /* Turn off named pipes */ s->use_np = false; - + /* Verify the dataset again without named pipes */ dbgf(2, "Reader verifies data after writer closes the file (flush of raw data is disabled)\n"); - if(!verify_dsets_operations(s, ds, config, np, true)) { + if (!verify_dsets_operations(s, ds, config, np, true)) { HDprintf("verify_dsets_operations() failed\n"); TEST_ERROR } @@ -2247,7 +2264,6 @@ closing_on_noflush(bool writer, state_t *s, dsets_state_t *ds, H5F_vfd_swmr_conf HDprintf("H5Fclose failed\n"); TEST_ERROR; } - } return true; @@ -2354,16 +2370,17 @@ main(int argc, char **argv) TEST_ERROR; } - /* When flush of raw data is disabled, special handling is performed + /* When flush of raw data is disabled, special handling is performed * via closing_on_noflush() when closing the file. - * Nothing needs to be done for -x or -y options + * Nothing needs to be done for -x or -y options * (increase and decrease dataset dimension sizes). */ - if(!s.flush_raw_data && !s.xincrs && !s.ydecrs && s.use_np) { + if (!s.flush_raw_data && !s.xincrs && !s.ydecrs && s.use_np) { - if(!closing_on_noflush(writer, &s, &ds, &config, &np)) + if (!closing_on_noflush(writer, &s, &ds, &config, &np)) TEST_ERROR - } else { + } + else { if (!close_dsets(&ds)) { HDprintf("close_dsets() failed\n"); diff --git a/test/vfd_swmr_dsetops_writer.c b/test/vfd_swmr_dsetops_writer.c index 0b346f6..f98843d 100644 --- a/test/vfd_swmr_dsetops_writer.c +++ b/test/vfd_swmr_dsetops_writer.c @@ -54,11 +54,11 @@ typedef struct { bool chunked; /* -k option: create chunked datasets with 5 indexing types */ unsigned int rows; /* -m <rows> option for contiguous and/or chunked datasets */ unsigned int cols; /* -n <cols option for contiguous and/or chunked datasets */ - unsigned int swrites; /* -s <swrites> option: sequential writes to contiguous and/or chunked datasets */ - unsigned int rwrites; /* -r <rwrites> option: random writes to contiguous and/or chunked datasets */ - unsigned int lwrites; /* -l <lwrites> option: hyperslab writes to contiguous and/or chunked datasets */ - unsigned int wwrites; /* -w <wwrites> option: modify raw data to contiguous and/or chunked datasets */ - unsigned int lastwrite; /* The last operation (-s, -r, -l or -w) performed. */ + unsigned int swrites; /* -s <swrites> option: sequential writes to contiguous and/or chunked datasets */ + unsigned int rwrites; /* -r <rwrites> option: random writes to contiguous and/or chunked datasets */ + unsigned int lwrites; /* -l <lwrites> option: hyperslab writes to contiguous and/or chunked datasets */ + unsigned int wwrites; /* -w <wwrites> option: modify raw data to contiguous and/or chunked datasets */ + unsigned int lastwrite; /* The last operation (-s, -r, -l or -w) performed. */ } state_t; /* Initializations for state_t */ @@ -67,9 +67,9 @@ typedef struct { { \ .filename = "", .file = H5I_INVALID_HID, .filetype = H5T_NATIVE_UINT32, \ .update_interval = READER_WAIT_TICKS, .csteps = 1, .use_np = true, .use_vfd_swmr = true, \ - .flush_raw_data = true, .compact = false, .compact_write = false, \ - .compact_elmts = MAX_COMPACT_ELMS, .contig = false, .rows = 10, .cols = 5, .swrites = 0, \ - .rwrites = 0, .lwrites = 0, .wwrites = 0, .lastwrite = 0 \ + .flush_raw_data = true, .compact = false, .compact_write = false, .compact_elmts = MAX_COMPACT_ELMS, \ + .contig = false, .rows = 10, .cols = 5, .swrites = 0, .rwrites = 0, .lwrites = 0, .wwrites = 0, \ + .lastwrite = 0 \ } /* Structure to hold info for different dataset types */ @@ -135,7 +135,8 @@ static bool open_dset_real(const state_t *s, hid_t *did, hid_t *sid, const char static bool close_dsets(const dsets_state_t *ds); static bool close_dset_real(hid_t did, hid_t sid); -static bool perform_dsets_operations(state_t *s, dsets_state_t *ds, H5F_vfd_swmr_config_t *config, np_state_t *np); +static bool perform_dsets_operations(state_t *s, dsets_state_t *ds, H5F_vfd_swmr_config_t *config, + np_state_t *np); static bool dsets_action(unsigned action, const state_t *s, const dsets_state_t *ds, unsigned step); static bool dset_setup(unsigned action, unsigned which, const state_t *s, hsize_t *start, hsize_t *stride, hsize_t *count, hsize_t *block, hid_t *mem_sid, unsigned int **buf); @@ -143,15 +144,18 @@ static bool write_dset(hid_t did, hid_t tid, hid_t mem_sid, hid_t file_sid, hsiz hsize_t *count, hsize_t *block, unsigned int *buf); static bool write_dset_compact(const state_t *s, const dsets_state_t *ds); -static bool verify_dsets_operations(state_t *s, dsets_state_t *ds, - H5F_vfd_swmr_config_t *config, np_state_t *np, bool fileclosed); -static bool verify_dsets_action(unsigned action, const state_t *s, const dsets_state_t *ds, - unsigned which, bool fileclosed); -static bool verify_dset(hid_t did, hid_t tid, hid_t mem_sid, hid_t file_sid, hsize_t *start, hsize_t *stride, - size_t *count, hsize_t *block, unsigned int *vbuf, bool fileclosed, bool flush_raw_data); -static bool verify_dset_compact(const state_t *s, const dsets_state_t *ds, bool fileclosed, bool flush_raw_data); +static bool verify_dsets_operations(state_t *s, dsets_state_t *ds, H5F_vfd_swmr_config_t *config, + np_state_t *np, bool fileclosed); +static bool verify_dsets_action(unsigned action, const state_t *s, const dsets_state_t *ds, unsigned which, + bool fileclosed); +static bool verify_dset(hid_t did, hid_t tid, hid_t mem_sid, hid_t file_sid, hsize_t *start, hsize_t *stride, + size_t *count, hsize_t *block, unsigned int *vbuf, bool fileclosed, + bool flush_raw_data); +static bool verify_dset_compact(const state_t *s, const dsets_state_t *ds, bool fileclosed, + bool flush_raw_data); -static bool closing_on_noflush(bool writer, state_t *s, dsets_state_t *ds, H5F_vfd_swmr_config_t *config, np_state_t *np); +static bool closing_on_noflush(bool writer, state_t *s, dsets_state_t *ds, H5F_vfd_swmr_config_t *config, + np_state_t *np); static const hid_t badhid = H5I_INVALID_HID; @@ -257,7 +261,7 @@ state_init(state_t *s, int argc, char **argv) s->chunked = true; break; - case 'U': /* Disable flush of raw data */ + case 'U': /* Disable flush of raw data */ s->flush_raw_data = false; break; @@ -351,7 +355,8 @@ state_init(state_t *s, int argc, char **argv) goto error; } - /* Enable sequential/random/hyperslab/raw data writes (-s/-r/-l/-w) without contiguous/chunked dataset (-g/-k) */ + /* Enable sequential/random/hyperslab/raw data writes (-s/-r/-l/-w) without contiguous/chunked dataset + * (-g/-k) */ if ((s->swrites || s->rwrites || s->lwrites || s->wwrites) && !(s->contig || s->chunked)) { HDprintf("Enable sequential/random/hypuerslab/raw data writes without contiguous/chunked dataset\n"); usage(s->progname); @@ -863,11 +868,11 @@ perform_dsets_operations(state_t *s, dsets_state_t *ds, H5F_vfd_swmr_config_t *c { unsigned step; bool result; - + /* Perform writes to the whole compact dataset */ if (s->compact) { - if(s->compact_write) { + if (s->compact_write) { dbgf(2, "Writes all to compact dataset\n"); result = write_dset_compact(s, ds); @@ -948,9 +953,8 @@ perform_dsets_operations(state_t *s, dsets_state_t *ds, H5F_vfd_swmr_config_t *c } } } - } - + return true; error: @@ -1190,7 +1194,8 @@ error: * --MODIFY_DATA: raw data modifications */ static bool -verify_dsets_operations(state_t *s, dsets_state_t *ds, H5F_vfd_swmr_config_t *config, np_state_t *np, bool fileclosed) +verify_dsets_operations(state_t *s, dsets_state_t *ds, H5F_vfd_swmr_config_t *config, np_state_t *np, + bool fileclosed) { unsigned step; bool result; @@ -1198,7 +1203,7 @@ verify_dsets_operations(state_t *s, dsets_state_t *ds, H5F_vfd_swmr_config_t *co /* Start verifying data written to the compact dataset */ if (s->compact) { - if(s->compact_write) { + if (s->compact_write) { dbgf(2, "Verify writes to compact dataset\n"); if (s->use_np && !np_confirm_verify_notify(np->fd_writer_to_reader, 0, s, np)) { @@ -1207,7 +1212,7 @@ verify_dsets_operations(state_t *s, dsets_state_t *ds, H5F_vfd_swmr_config_t *co } /* Wait for a few ticks for the update to happen */ - if(!fileclosed) + if (!fileclosed) decisleep(config->tick_len * s->update_interval); result = verify_dset_compact(s, ds, fileclosed, config->flush_raw_data); @@ -1215,7 +1220,8 @@ verify_dsets_operations(state_t *s, dsets_state_t *ds, H5F_vfd_swmr_config_t *co if (s->use_np && !np_reader(result, 0, s, np)) { HDprintf("np_reader() for verifying addition failed\n"); TEST_ERROR; - } else if (!result) + } + else if (!result) TEST_ERROR; } } @@ -1238,7 +1244,7 @@ verify_dsets_operations(state_t *s, dsets_state_t *ds, H5F_vfd_swmr_config_t *co } /* Wait for a few ticks for the update to happen */ - if(!fileclosed) + if (!fileclosed) decisleep(config->tick_len * s->update_interval); result = verify_dsets_action(SEQ_WRITE, s, ds, step, fileclosed); @@ -1246,7 +1252,8 @@ verify_dsets_operations(state_t *s, dsets_state_t *ds, H5F_vfd_swmr_config_t *co if (s->use_np && !np_reader(result, step, s, np)) { HDprintf("np_reader() for verifying addition failed\n"); TEST_ERROR; - } else if (!result) + } + else if (!result) TEST_ERROR; } } @@ -1273,7 +1280,7 @@ verify_dsets_operations(state_t *s, dsets_state_t *ds, H5F_vfd_swmr_config_t *co } /* Wait for a few ticks for the update to happen */ - if(!fileclosed) + if (!fileclosed) decisleep(config->tick_len * s->update_interval); result = verify_dsets_action(RANDOM_WRITE, s, ds, newstep, fileclosed); @@ -1281,7 +1288,8 @@ verify_dsets_operations(state_t *s, dsets_state_t *ds, H5F_vfd_swmr_config_t *co if (s->use_np && !np_reader(result, step, s, np)) { HDprintf("np_reader() for verifying addition failed\n"); TEST_ERROR; - } else if (!result) + } + else if (!result) TEST_ERROR; } } @@ -1302,7 +1310,7 @@ verify_dsets_operations(state_t *s, dsets_state_t *ds, H5F_vfd_swmr_config_t *co } /* Wait for a few ticks for the update to happen */ - if(!fileclosed) + if (!fileclosed) decisleep(config->tick_len * s->update_interval); result = verify_dsets_action(HYPER_WRITE, s, ds, k, fileclosed); @@ -1310,7 +1318,8 @@ verify_dsets_operations(state_t *s, dsets_state_t *ds, H5F_vfd_swmr_config_t *co if (s->use_np && !np_reader(result, step, s, np)) { HDprintf("np_reader() for verifying addition failed\n"); TEST_ERROR; - } else if (!result) + } + else if (!result) TEST_ERROR; } } @@ -1330,7 +1339,7 @@ verify_dsets_operations(state_t *s, dsets_state_t *ds, H5F_vfd_swmr_config_t *co } /* Wait for a few ticks for the update to happen */ - if(!fileclosed) + if (!fileclosed) decisleep(config->tick_len * s->update_interval); result = verify_dsets_action(MODIFY_DATA, s, ds, step, fileclosed); @@ -1338,7 +1347,8 @@ verify_dsets_operations(state_t *s, dsets_state_t *ds, H5F_vfd_swmr_config_t *co if (s->use_np && !np_reader(result, step, s, np)) { HDprintf("np_reader() for verifying addition failed\n"); TEST_ERROR; - } else if (!result) + } + else if (!result) TEST_ERROR; } } @@ -1360,7 +1370,8 @@ error: * MODIFY_DATA: `which` raw data modification */ static bool -verify_dsets_action(unsigned action, const state_t *s, const dsets_state_t *ds, unsigned which, bool fileclosed) +verify_dsets_action(unsigned action, const state_t *s, const dsets_state_t *ds, unsigned which, + bool fileclosed) { hsize_t start[2]; hsize_t stride[2]; @@ -1377,8 +1388,8 @@ verify_dsets_action(unsigned action, const state_t *s, const dsets_state_t *ds, /* Verify the data read for the contiguous dataset */ if (s->contig) { - if (!verify_dset(ds->contig_did, s->filetype, mem_sid, ds->contig_sid, start, stride, count, - block, vbuf, fileclosed, s->flush_raw_data)) { + if (!verify_dset(ds->contig_did, s->filetype, mem_sid, ds->contig_sid, start, stride, count, block, + vbuf, fileclosed, s->flush_raw_data)) { HDprintf("verify_dset() to contiguous dataset failed\n"); TEST_ERROR; } @@ -1387,32 +1398,32 @@ verify_dsets_action(unsigned action, const state_t *s, const dsets_state_t *ds, /* Verify the data read for the chunked datasets */ if (s->chunked) { - if (!verify_dset(ds->single_did, s->filetype, mem_sid, ds->single_sid, start, stride, count, - block, vbuf, fileclosed, s->flush_raw_data)) { + if (!verify_dset(ds->single_did, s->filetype, mem_sid, ds->single_sid, start, stride, count, block, + vbuf, fileclosed, s->flush_raw_data)) { HDprintf("verify_dset() to chunked dataset: single index dataset failed\n"); TEST_ERROR; } if (!verify_dset(ds->implicit_did, s->filetype, mem_sid, ds->implicit_sid, start, stride, count, - block, vbuf, fileclosed, s->flush_raw_data)) { + block, vbuf, fileclosed, s->flush_raw_data)) { HDprintf("verify_dset() to chunked dataset: implicit index dataset failed\n"); TEST_ERROR; } - if (!verify_dset(ds->fa_did, s->filetype, mem_sid, ds->fa_sid, start, stride, count, block, - vbuf, fileclosed, s->flush_raw_data)) { + if (!verify_dset(ds->fa_did, s->filetype, mem_sid, ds->fa_sid, start, stride, count, block, vbuf, + fileclosed, s->flush_raw_data)) { HDprintf("verify_dset() to chunked dataset: fa index dataset failed\n"); TEST_ERROR; } - if (!verify_dset(ds->ea_did, s->filetype, mem_sid, ds->ea_sid, start, stride, count, block, - vbuf, fileclosed, s->flush_raw_data)) { + if (!verify_dset(ds->ea_did, s->filetype, mem_sid, ds->ea_sid, start, stride, count, block, vbuf, + fileclosed, s->flush_raw_data)) { HDprintf("verify_dset() to chunked dataset: ea index dataset failed\n"); TEST_ERROR; } - if (!verify_dset(ds->bt2_did, s->filetype, mem_sid, ds->bt2_sid, start, stride, count, block, - vbuf, fileclosed, s->flush_raw_data)) { + if (!verify_dset(ds->bt2_did, s->filetype, mem_sid, ds->bt2_sid, start, stride, count, block, vbuf, + fileclosed, s->flush_raw_data)) { HDprintf("verify_dset() to chunked dataset: bt2 index dataset failed\n"); TEST_ERROR; } @@ -1431,14 +1442,13 @@ error: } /* verify_dsets_action() */ - /* * Verify the data read from the dataset is as expected. * `vbuf` contains the data expected from the read. */ static bool verify_dset(hid_t did, hid_t tid, hid_t mem_sid, hid_t file_sid, hsize_t *start, hsize_t *stride, - hsize_t *count, hsize_t *block, unsigned int *vbuf, bool fileclosed, bool flush_raw_data) + hsize_t *count, hsize_t *block, unsigned int *vbuf, bool fileclosed, bool flush_raw_data) { unsigned int *rbuf = NULL; unsigned i; @@ -1469,11 +1479,12 @@ verify_dset(hid_t did, hid_t tid, hid_t mem_sid, hid_t file_sid, hsize_t *start, /* Verify the data read in `rbuf` is as `vbuf` */ for (i = 0; i < count[1]; i++) { - if(flush_raw_data || fileclosed) { + if (flush_raw_data || fileclosed) { if (rbuf[i] != vbuf[i]) TEST_ERROR; - } else { /* No flush && not closing file */ - if (rbuf[i] != vbuf[i] && rbuf[0] != 0) /* FILL VALUE ?? */ + } + else { /* No flush && not closing file */ + if (rbuf[i] != vbuf[i] && rbuf[0] != 0) /* FILL VALUE ?? */ TEST_ERROR; } } @@ -1516,15 +1527,15 @@ verify_dset_compact(const state_t *s, const dsets_state_t *ds, bool fileclosed, } for (i = 0; i < s->compact_elmts; i++) { - if(flush_raw_data || fileclosed) { + if (flush_raw_data || fileclosed) { if (rbuf[i] != (i + 1)) { HDprintf("Invalid value for compact dataset element\n"); TEST_ERROR; } - } else { /* No flush && not closing file */ + } + else { /* No flush && not closing file */ if (rbuf[i] != (i + 1) && rbuf[0] != 0) /* FILL VALUE ?? */ TEST_ERROR; - } } @@ -1658,7 +1669,7 @@ np_writer(bool result, unsigned step, const state_t *s, np_state_t *np, H5F_vfd_ goto error; } } - else { /* The action succeeds */ + else { /* The action succeeds */ /* At communication interval, notify the reader and wait for its response */ if (step % s->csteps == 0) { /* Bump up the value of notify to tell the reader to start reading */ @@ -1769,14 +1780,14 @@ error: * Notify the reader that the file is closed * Reader: * Confirm the message from the writer that the file is closed - * Verify the data + * Verify the data */ static bool closing_on_noflush(bool writer, state_t *s, dsets_state_t *ds, H5F_vfd_swmr_config_t *config, np_state_t *np) { HDassert(s->use_np); - if(writer) { + if (writer) { if (!close_dsets(ds)) { HDprintf("close_dsets() failed\n"); TEST_ERROR; @@ -1800,8 +1811,8 @@ closing_on_noflush(bool writer, state_t *s, dsets_state_t *ds, H5F_vfd_swmr_conf HDprintf("np_close() failed\n"); TEST_ERROR; } - - } else { + } + else { /* Wait for a few ticks for the file to close in writer ?? need to this or not? */ decisleep(config->tick_len * s->update_interval); @@ -1819,10 +1830,10 @@ closing_on_noflush(bool writer, state_t *s, dsets_state_t *ds, H5F_vfd_swmr_conf /* Turn off named pipes */ s->use_np = false; - + /* Verify the dataset again without named pipes */ dbgf(2, "Reader verifies data after writer closes the file (flush of raw data is disabled)\n"); - if(!verify_dsets_operations(s, ds, config, np, true)) { + if (!verify_dsets_operations(s, ds, config, np, true)) { HDprintf("verify_dsets_operations() failed\n"); TEST_ERROR } @@ -1837,7 +1848,6 @@ closing_on_noflush(bool writer, state_t *s, dsets_state_t *ds, H5F_vfd_swmr_conf HDprintf("H5Fclose failed\n"); TEST_ERROR; } - } return true; @@ -1923,14 +1933,14 @@ main(int argc, char **argv) if (writer) { - if(!perform_dsets_operations(&s, &ds, &config, &np)) { + if (!perform_dsets_operations(&s, &ds, &config, &np)) { HDprintf("perform_dsets_operations() failed\n"); TEST_ERROR; } } else { - if(!verify_dsets_operations(&s, &ds, &config, &np, false)) { + if (!verify_dsets_operations(&s, &ds, &config, &np, false)) { HDprintf("perform_dsets_operations() failed\n"); TEST_ERROR; } @@ -1946,11 +1956,12 @@ main(int argc, char **argv) TEST_ERROR; } - if(!s.flush_raw_data && s.use_np) { + if (!s.flush_raw_data && s.use_np) { - if(!closing_on_noflush(writer, &s, &ds, &config, &np)) + if (!closing_on_noflush(writer, &s, &ds, &config, &np)) TEST_ERROR - } else { + } + else { if (!close_dsets(&ds)) { HDprintf("close_dsets() failed\n"); |