Skip to content

Commit

Permalink
VFD SWMR: Minor fixes (#771)
Browse files Browse the repository at this point in the history
* Fixes missing C99 format specifiers in page_buffer test

* Warning and other misc fixes in VFD SWMR accept. tests

* Committing clang-format changes

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
derobins and github-actions[bot] authored Jun 18, 2021
1 parent a00ad2b commit 79c2a90
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 32 deletions.
20 changes: 11 additions & 9 deletions test/page_buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -2557,7 +2557,7 @@ test_stats_collection(hid_t orig_fapl, const char *env_h5_drvr)
if ((f->shared->page_buf->accesses[0] != 10) || (f->shared->page_buf->accesses[1] != 16) ||
(f->shared->page_buf->accesses[2] != 0)) {

HDfprintf(stderr, "accesses[] = {%d, %d, %d}. {10, 16, 0} expected\n",
HDfprintf(stderr, "accesses[] = {%" PRId64 ", %" PRId64 ", %" PRId64 "}. {10, 16, 0} expected\n",
f->shared->page_buf->accesses[0], f->shared->page_buf->accesses[1],
f->shared->page_buf->accesses[2]);
TEST_ERROR;
Expand All @@ -2567,35 +2567,37 @@ test_stats_collection(hid_t orig_fapl, const char *env_h5_drvr)
if ((f->shared->page_buf->bypasses[0] != 0) || (f->shared->page_buf->bypasses[1] != 1) ||
(f->shared->page_buf->bypasses[2] != 1)) {

HDfprintf(stderr, "bypasses[] = {%d, %d, %d}. {0, 1, 1} expected\n", f->shared->page_buf->bypasses[0],
f->shared->page_buf->bypasses[1], f->shared->page_buf->bypasses[2]);
HDfprintf(stderr, "bypasses[] = {%" PRId64 ", %" PRId64 ", %" PRId64 "}. {0, 1, 1} expected\n",
f->shared->page_buf->bypasses[0], f->shared->page_buf->bypasses[1],
f->shared->page_buf->bypasses[2]);
TEST_ERROR;
}

if ((f->shared->page_buf->hits[0] != 0) || (f->shared->page_buf->hits[1] != 4) ||
(f->shared->page_buf->hits[2] != 0)) {

HDfprintf(stderr, "hits[] = {%d, %d, %d}. {0, 4, 0} expected\n", f->shared->page_buf->hits[0],
f->shared->page_buf->hits[1], f->shared->page_buf->hits[2]);
HDfprintf(stderr, "hits[] = {%" PRId64 ", %" PRId64 ", %" PRId64 "}. {0, 4, 0} expected\n",
f->shared->page_buf->hits[0], f->shared->page_buf->hits[1], f->shared->page_buf->hits[2]);
TEST_ERROR;
}

/* was 9, 16. 0 -- review this */
if ((f->shared->page_buf->misses[0] != 10) || (f->shared->page_buf->misses[1] != 16) ||
(f->shared->page_buf->misses[2] != 0)) {

HDfprintf(stderr, "misses[] = {%d, %d, %d}. {10, 16, 0} expected\n", f->shared->page_buf->misses[0],
f->shared->page_buf->misses[1], f->shared->page_buf->misses[2]);
HDfprintf(stderr, "misses[] = {%" PRId64 ", %" PRId64 ", %" PRId64 "}. {10, 16, 0} expected\n",
f->shared->page_buf->misses[0], f->shared->page_buf->misses[1],
f->shared->page_buf->misses[2]);
TEST_ERROR;
}

/* was 7, 9, 0 -- review this */
if ((f->shared->page_buf->evictions[0] != 9) || (f->shared->page_buf->evictions[1] != 9) ||
(f->shared->page_buf->evictions[2] != 0)) {

HDfprintf(stderr, "evictions[] = {%d, %d, %d}. {%d, %d, 0} expected\n",
HDfprintf(stderr, "evictions[] = {%" PRId64 ", %" PRId64 ", %" PRId64 "}. {7, 9, 0} expected\n",
f->shared->page_buf->evictions[0], f->shared->page_buf->evictions[1],
f->shared->page_buf->evictions[2], 7, 9);
f->shared->page_buf->evictions[2]);
TEST_ERROR;
}

Expand Down
13 changes: 8 additions & 5 deletions test/vfd_swmr_attrdset_writer.c
Original file line number Diff line number Diff line change
Expand Up @@ -1097,7 +1097,8 @@ modify_attr(const state_t *s, hid_t did, unsigned int which)
TEST_ERROR;
}

if ((val = HDmalloc(sizeof("9999999999"))) == NULL) {
/* Needs to fit "%u %c", below */
if ((val = HDmalloc(10 + 3)) == NULL) {
HDprintf("HDmalloc failed\n");
TEST_ERROR;
}
Expand Down Expand Up @@ -1319,8 +1320,9 @@ verify_add_or_modify_attr(unsigned action, hid_t did, char *attr_name, unsigned
char vl_which[sizeof("attr-9999999999")];
char * read_vl_which = NULL;
bool is_vl = false;
hid_t aid, atid;
bool ret;
hid_t aid = H5I_INVALID_HID;
hid_t atid = H5I_INVALID_HID;
bool ret = FALSE;

HDassert(did != badhid);
HDassert(action == ADD_ATTR || action == MODIFY_ATTR);
Expand Down Expand Up @@ -1761,9 +1763,10 @@ np_reader_no_verification(const state_t *s, np_state_t *np, H5F_vfd_swmr_config_
int
main(int argc, char **argv)
{
hid_t fapl, fcpl;
hid_t fapl = H5I_INVALID_HID;
hid_t fcpl = H5I_INVALID_HID;
unsigned step;
bool writer;
bool writer = FALSE;
state_t s;
const char * personality;
H5F_vfd_swmr_config_t config;
Expand Down
6 changes: 3 additions & 3 deletions test/vfd_swmr_dsetops_writer.c
Original file line number Diff line number Diff line change
Expand Up @@ -1647,9 +1647,9 @@ np_confirm_verify_notify(int fd, unsigned step, const state_t *s, np_state_t *np
int
main(int argc, char **argv)
{
hid_t fapl, fcpl;
unsigned step;
bool writer;
hid_t fapl = H5I_INVALID_HID;
hid_t fcpl = H5I_INVALID_HID;
bool writer = FALSE;
state_t s;
const char * personality;
H5F_vfd_swmr_config_t config;
Expand Down
2 changes: 1 addition & 1 deletion test/vfd_swmr_group_writer.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#ifndef H5_HAVE_WIN32_API

#define READER_WAIT_TICKS 3
#define VS_ATTR_NAME_LEN 21
#define VS_ATTR_NAME_LEN 27

typedef struct {
hid_t file, filetype, one_by_one_sid;
Expand Down
20 changes: 10 additions & 10 deletions test/vfd_swmr_remove_reader.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
/* Local Variables */
/*******************/

static hid_t symbol_tid = -1;
static hid_t symbol_tid = H5I_INVALID_HID;

/********************/
/* Local Prototypes */
Expand Down Expand Up @@ -78,8 +78,8 @@ static void usage(void);
static int
check_dataset(hid_t fid, hid_t dapl, unsigned verbose, const char *sym_name, symbol_t *record, hid_t rec_sid)
{
hid_t dsid; /* Dataset ID */
hid_t file_sid; /* Dataset's space ID */
hid_t dsid = H5I_INVALID_HID; /* Dataset ID */
hid_t file_sid = H5I_INVALID_HID; /* Dataset's space ID */
hssize_t snpoints; /* Number of elements in dataset */
hsize_t start[2] = {0, 0}, count[2] = {1, 1}; /* Hyperslab selection values */

Expand Down Expand Up @@ -215,13 +215,13 @@ read_records(const char *filename, unsigned verbose, unsigned long nseconds, uns
time_t curr_time; /* Current time */
symbol_info_t ** sym_com = NULL; /* Pointers to array of common dataset IDs */
symbol_info_t ** sym_rand = NULL; /* Pointers to array of random dataset IDs */
hid_t dapl;
hid_t mem_sid; /* Memory dataspace ID */
hid_t fid; /* SWMR test file ID */
hid_t fapl; /* File access property list */
symbol_t record; /* The record to add to the dataset */
unsigned v; /* Local index variable */
H5F_vfd_swmr_config_t *config = NULL; /* Configuration for VFD SWMR */
hid_t dapl = H5I_INVALID_HID;
hid_t mem_sid = H5I_INVALID_HID; /* Memory dataspace ID */
hid_t fid = H5I_INVALID_HID; /* SWMR test file ID */
hid_t fapl = H5I_INVALID_HID; /* File access property list */
symbol_t record; /* The record to add to the dataset */
unsigned v; /* Local index variable */
H5F_vfd_swmr_config_t *config = NULL; /* Configuration for VFD SWMR */

HDassert(filename);
HDassert(nseconds != 0);
Expand Down
11 changes: 7 additions & 4 deletions test/vfd_swmr_sparse_reader.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
/* Local Variables */
/*******************/

static hid_t symbol_tid = (-1);
static hid_t symbol_tid = H5I_INVALID_HID;

/********************/
/* Local Prototypes */
Expand Down Expand Up @@ -116,7 +116,9 @@ check_dataset(hid_t fid, unsigned verbose, const symbol_info_t *symbol, symbol_t

/* Emit informational message */
if (verbose)
HDfprintf(stderr, "READER: Symbol = '%s', nrecords = %Hu, name = %s, location = %Hu, %Hu\n",
HDfprintf(stderr,
"READER: Symbol = '%s', nrecords = %" PRIuHSIZE ", name = %s, location = %" PRIuHSIZE
", %" PRIuHSIZE "\n",
symbol->name, symbol->nrecords, symbol->name, start[0], start[1]);

/* Read record from dataset */
Expand All @@ -128,8 +130,9 @@ check_dataset(hid_t fid, unsigned verbose, const symbol_info_t *symbol, symbol_t
if (record->rec_id != start[1]) {
HDfprintf(stderr, "*** READER: ERROR ***\n");
HDfprintf(stderr, "Incorrect record value!\n");
HDfprintf(stderr, "Symbol = '%s', location = %Hu, %Hu, record->rec_id = %" PRIu64 "\n", symbol->name,
start[0], start[1], record->rec_id);
HDfprintf(stderr,
"Symbol = '%s', location = %" PRIuHSIZE ", %" PRIuHSIZE ", record->rec_id = %" PRIu64 "\n",
symbol->name, start[0], start[1], record->rec_id);
goto error;
} /* end if */

Expand Down

0 comments on commit 79c2a90

Please sign in to comment.