From 69b2061d68aa85c8925c15a334fc5c3fb12e377f Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Tue, 2 Mar 2021 06:42:50 -0800 Subject: HD prefix and hbool_t changes in test/vfd_swmr.c --- test/vfd_swmr.c | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/test/vfd_swmr.c b/test/vfd_swmr.c index b140813..321f85f 100644 --- a/test/vfd_swmr.c +++ b/test/vfd_swmr.c @@ -835,7 +835,7 @@ decisleep(uint32_t tenths) struct timespec delay = {.tv_sec = tenths / 10, .tv_nsec = tenths * 100 * 1000 * 1000}; - while (nanosleep(&delay, &delay) == -1 && errno == EINTR) + while (HDnanosleep(&delay, &delay) == -1 && errno == EINTR) ; // do nothing } @@ -948,7 +948,7 @@ test_writer_md(void) decisleep(my_config->tick_len); /* Create a chunked dataset */ - sprintf(dname, "dset %d", i); + HDsprintf(dname, "dset %d", i); if((did = H5Dcreate2(fid, dname, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR @@ -981,7 +981,7 @@ test_writer_md(void) decisleep(my_config->tick_len); /* Open the dataset */ - sprintf(dname, "dset %d", i); + HDsprintf(dname, "dset %d", i); if((did = H5Dopen2(fid, dname, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR @@ -1015,7 +1015,7 @@ test_writer_md(void) decisleep(my_config->tick_len); /* Open the dataset */ - sprintf(dname, "dset %d", i); + HDsprintf(dname, "dset %d", i); if((did = H5Dopen2(fid, dname, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR @@ -1503,7 +1503,7 @@ test_reader_md_concur(void) decisleep(config_writer->tick_len); /* Create a chunked dataset */ - sprintf(dname, "dset %d", i); + HDsprintf(dname, "dset %d", i); if((did = H5Dcreate2(fid_writer, dname, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR @@ -1581,7 +1581,7 @@ test_reader_md_concur(void) decisleep(config_writer->tick_len); /* Open the dataset */ - sprintf(dname, "dset %d", i); + HDsprintf(dname, "dset %d", i); if((did = H5Dopen2(fid_writer, dname, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR @@ -1636,7 +1636,7 @@ test_reader_md_concur(void) decisleep(config_writer->tick_len); /* Open the dataset */ - sprintf(dname, "dset %d", i); + HDsprintf(dname, "dset %d", i); if((did = H5Dopen2(fid_writer, dname, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR @@ -1690,7 +1690,7 @@ test_reader_md_concur(void) decisleep(config_writer->tick_len); /* Open the dataset */ - sprintf(dname, "dset %d", i); + HDsprintf(dname, "dset %d", i); if((did = H5Dopen2(fid_writer, dname, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR @@ -3071,7 +3071,7 @@ test_shadow_index_lookup(void) char vector[8]; unsigned seed = 1; unsigned i, j, failj = UINT_MAX; - bool have_failj = false; + hbool_t have_failj = FALSE; unsigned long tmpl; char *ostate; const char *seedvar = "H5_SHADOW_INDEX_SEED"; @@ -3085,7 +3085,7 @@ test_shadow_index_lookup(void) nerrors = 1; goto out; case 0: - seed = (unsigned int)time(NULL); + seed = (unsigned int)HDtime(NULL); break; default: seed = (unsigned int)tmpl; @@ -3101,55 +3101,55 @@ test_shadow_index_lookup(void) break; default: failj = (unsigned int)tmpl; - have_failj = true; + have_failj = TRUE; break; } ostate = initstate(seed, vector, _arraycount(vector)); - size[5] = (uint32_t)(1024 + random() % (16 * 1024 * 1024 - 1024)); + size[5] = (uint32_t)(1024 + HDrandom() % (16 * 1024 * 1024 - 1024)); for (i = 0; i < _arraycount(size); i++) { uint32_t cursize = size[i]; const uint64_t modulus = UINT64_MAX / MAX(1, cursize); uint64_t pageno; - assert(modulus > 1); // so that modulus - 1 > 0, below + HDassert(modulus > 1); // so that modulus - 1 > 0, below - idx = (cursize == 0) ? NULL : calloc(cursize, sizeof(*idx)); + idx = (cursize == 0) ? NULL : HDcalloc(cursize, sizeof(*idx)); if (idx == NULL && cursize != 0) { - fprintf(stderr, "couldn't allocate %" PRIu32 " indices\n", + HDfprintf(stderr, "couldn't allocate %" PRIu32 " indices\n", cursize); - exit(EXIT_FAILURE); + HDexit(EXIT_FAILURE); } - for (pageno = (uint64_t)random() % modulus, j = 0; + for (pageno = (uint64_t)HDrandom() % modulus, j = 0; j < cursize; - j++, pageno += 1 + (uint64_t)random() % (modulus - 1)) { + j++, pageno += 1 + (uint64_t)HDrandom() % (modulus - 1)) { idx[j].hdf5_page_offset = pageno; } for (j = 0; j < cursize; j++) { H5FD_vfd_swmr_idx_entry_t *found; found = vfd_swmr_pageno_to_mdf_idx_entry(idx, cursize, - idx[j].hdf5_page_offset, false); + idx[j].hdf5_page_offset, FALSE); if ((have_failj && failj == j) || found != &idx[j]) break; } if (j < cursize) { - printf("\nshadow-index entry %d lookup, pageno %" PRIu64 + HDprintf("\nshadow-index entry %d lookup, pageno %" PRIu64 ", index size %" PRIu32 ", seed %u", j, idx[j].hdf5_page_offset, cursize, seed); nerrors++; } if (idx != NULL) - free(idx); + HDfree(idx); } (void)setstate(ostate); out: if (nerrors == 0) PASSED(); else - printf(" FAILED\n"); + HDprintf(" FAILED\n"); return nerrors; } -- cgit v0.12