diff options
author | Dana Robinson <derobins@hdfgroup.org> | 2020-10-24 00:13:05 (GMT) |
---|---|---|
committer | Dana Robinson <derobins@hdfgroup.org> | 2020-10-24 00:13:05 (GMT) |
commit | ca3659a01427cd58e5fddb57349b7030e5cb2dcd (patch) | |
tree | 5633c0b4bb7b5174518d27b33db43228c1c538d0 | |
parent | f9679de85c9de96603d448950da5e1f2c18b4494 (diff) | |
download | hdf5-ca3659a01427cd58e5fddb57349b7030e5cb2dcd.zip hdf5-ca3659a01427cd58e5fddb57349b7030e5cb2dcd.tar.gz hdf5-ca3659a01427cd58e5fddb57349b7030e5cb2dcd.tar.bz2 |
HD prefix updates in src/ and test/
Adds missing HD prefixes to API calls in src and test.
Adds some extra processing to bin/checkposix to keep the noise
levels down when running the script (not comprehensive).
67 files changed, 445 insertions, 361 deletions
diff --git a/bin/checkposix b/bin/checkposix index 233d15c..c29c290 100755 --- a/bin/checkposix +++ b/bin/checkposix @@ -44,7 +44,27 @@ foreach $arg (@ARGV) { # # If a user specifies one file, process it no matter what so people # can inspect files we normally skip (like H5system.c). + + $ignore = 0; + + # Ignored files in src/ if($#ARGV gt 0 and $filename =~ /H5FDmulti|H5FDstdio|H5VLpassthru|H5system|H5detect|H5make_libsettings/) { + $ignore = 1; + } + # Ignored atomic test files in test/ + if($#ARGV gt 0 and $filename =~ /atomic_reader|atomic_writer/) { + $ignore = 1; + } + # Ignored filter plugins in test/ + if($#ARGV gt 0 and $filename =~ /^filter_plugin\d_/) { + $ignore = 1; + } + # Ignored generators in test/ + if($#ARGV gt 0 and $filename =~ /^gen_/) { + $ignore = 1; + } + + if($ignore) { print "$filename is exempt from using Standard library macro wrappers\n"; next; } @@ -95,13 +115,13 @@ foreach $arg (@ARGV) { # These are really HDF5 functions/macros even though they don't # start with `h' or `H'. - next if $name =~ /^FUNC_(ENTER|LEAVE)(_(NO)?API|_PACKAGE|_STATIC)?(_NOFS|_NOCLEAR|_NOINIT)?(_NOFUNC|_TAG)?$/; + next if $name =~ /^FUNC_(ENTER|LEAVE)(_(NO)?API|_PACKAGE|_STATIC)?(_NOFS|_NOCLEAR|_NOINIT|_NOPUSH)?(_NOFUNC|_TAG)?$/; next if $name =~ /^(BEGIN|END)_FUNC$/; next if $name =~ /^U?INT(8|16|32|64)(ENCODE|DECODE)(_VAR)?$/; next if $name =~ /^CI_(PRINT_STATS|INC_SRC|INC_DST)$/; next if $name =~ /^(ABS|ADDR_OVERFLOW|ALL_MEMBERS|BOUND|CONSTR|DETECT_[I|F|M]|DOWN)$/; next if $name =~ /^(MIN3?|MAX3?|NELMTS|POWER_OF_TWO|REGION_OVERFLOW)$/; - next if $name =~ /^(UNIQUE_MEMBERS|S_ISDIR)$/; + next if $name =~ /^(SIZE_OVERFLOW|UNIQUE_MEMBERS|S_ISDIR)$/; next if $name =~ /^addr_defined$/; # These functions/macros are exempt. @@ -140,15 +160,38 @@ foreach $arg (@ARGV) { next if $name =~ /^(pow_fun|round_fun|abs_fun|lround_fun|llround_fun)$/; } + # This is a macro parameter in H5Rint.c. Ignore it in this file. + if($filename =~ /H5Rint/) { + next if $name =~ /^(func)$/; + } + + # Internal calls in the HDFS VFD (H5FDhdfs.c). Ignore it in this file. + if($filename =~ /H5FDhdfs/) { + next if $name =~ /^(hdfs)/; + } + + # Macros, etc. from the mirror VFD (H5FDmirror.c). Ignore in this file. + if($filename =~ /H5FDmirror/) { + next if $name =~ /^(LOG)/; + next if $name =~ /^(BSWAP_64|is_host_little_endian)$/; + } + + # These are things in H5FDs3comms.c and H5FDros3.c. Ignore them in these files. + if($filename =~ /H5FDs3comms|H5FDros3/) { + next if $name =~ /^(curl_|curlwritecallback|gmnow)/; + next if $name =~ /^(ros3_|ROS3_|S3COMMS_)/; + next if $name =~ /^(EVP_sha256|SHA256|ISO8601NOW)$/; + } + # TESTING (not comprehensive - just noise reduction) # Test macros and functions (testhdf5.h) next if $name =~ /^(AddTest|TestErrPrintf|TestSummary|TestCleanup|TestShutdown)$/; next if $name =~ /^(CHECK|CHECK_PTR|CHECK_PTR_NULL|CHECK_PTR_EQ|CHECK_I)$/; - next if $name =~ /^(VERIFY|VERIFY_STR|VERIFY|TYPE|MESSAGE|ERROR)$/; + next if $name =~ /^(VERIFY|VERIFY_STR|VERIFY_TYPE|MESSAGE|ERROR)$/; # Test macros and functions (h5test.h) - next if $name =~ /^(TESTING|PASSED|SKIPPED|FAIL_PUTS_ERROR|FAIL_STACK_ERROR|TEST_ERROR)$/; + next if $name =~ /^(TESTING|PASSED|SKIPPED|PUTS_ERROR|FAIL_PUTS_ERROR|FAIL_STACK_ERROR|TEST_ERROR|AT)$/; next if $name =~ /^(GetTestExpress)$/; # Ignore functions that start with test_ or check_ @@ -158,9 +201,49 @@ foreach $arg (@ARGV) { # Ignore functions that start with h5_ next if $name =~ /^h5_/; + # Ignore process completed status + next if $name =~ /(WIFEXITED|WEXITSTATUS|WIFSIGNALED|WTERMSIG|WCOREDUMP|WIFSTOPPED|WSTOPSIG)/; + # Ignore usage functions next if $name =~ /^usage$/; + # Ignore callbacks + next if $name =~ /(_cb\d?)$/; + + # Specific tests (not even remotely comprehensive) + + # accum test code + if($filename =~ /accum/) { + next if $name =~ /^(accum_)/; + } + + # cache test code + if($filename =~ /cache/) { + next if $name =~ /(_entry|_entries|_cache|_check|_dependency|_status|_op)$/; + next if $name =~ /^(verify_|smoke_check_|row_major_|col_major_)/; + next if $name =~ /^(resize_configs_are_equal|CACHE_ERROR)$/ + } + + # Splitter VFD test code. Ignore in vfd.c. + if($filename =~ /vfd/) { + next if $name =~ /^(SPLITTER_|splitter_)/; + next if $name =~ /(_splitter_)/; + next if $name =~ /^(file_exists)$/; + } + + # S3 VFD test code. Ignore in ros3.c and s3comms.c. + # HDFS VFD test code. Ignore in hdfs.c. + if($filename =~ /ros3|s3comms|hdfs/) { + next if $name =~ /^(JSVERIFY|JSFAILED_|JSERR_|jserr_|FAIL_)/; + next if $name =~ /^(curl_)/; + next if $name =~ /^(S3COMMS_FORMAT_CREDENTIAL|ISO8601NOW|gmnow)$/; + } + + # VDS test code. Ignore in vds.c. + if($filename =~ /vds/) { + next if $name =~ /^(vds_)/; + } + print "$filename:$.: $name\n"; } diff --git a/src/H5FDs3comms.c b/src/H5FDs3comms.c index 2ac27d0..42586ff 100644 --- a/src/H5FDs3comms.c +++ b/src/H5FDs3comms.c @@ -1925,7 +1925,7 @@ H5FD__s3comms_load_aws_creds_from_file(FILE *file, const char *profile_name, cha }; char *const setting_pointers[] = { aws_region, - key_id, + access_key, }; unsigned setting_count = 3; @@ -1951,7 +1951,7 @@ H5FD__s3comms_load_aws_creds_from_file(FILE *file, const char *profile_name, cha for (buffer_i = 0; buffer_i < 128; buffer_i++) buffer[buffer_i] = 0; - line_buffer = fgets(line_buffer, 128, file); + line_buffer = HDfgets(line_buffer, 128, file); if (line_buffer == NULL) /* reached end of file */ goto done; } while (HDstrncmp(line_buffer, profile_line, HDstrlen(profile_line))); @@ -1963,7 +1963,7 @@ H5FD__s3comms_load_aws_creds_from_file(FILE *file, const char *profile_name, cha buffer[buffer_i] = 0; /* collect a line from file */ - line_buffer = fgets(line_buffer, 128, file); + line_buffer = HDfgets(line_buffer, 128, file); if (line_buffer == NULL) goto done; /* end of file */ @@ -2062,9 +2062,9 @@ H5FD_s3comms_load_aws_profile(const char *profile_name, char *key_id_out, char * #endif #ifdef H5_HAVE_WIN32_API - ret = HDsnprintf(awspath, 117, "%s/.aws/", getenv("USERPROFILE")); + ret = HDsnprintf(awspath, 117, "%s/.aws/", HDgetenv("USERPROFILE")); #else - ret = HDsnprintf(awspath, 117, "%s/.aws/", getenv("HOME")); + ret = HDsnprintf(awspath, 117, "%s/.aws/", HDgetenv("HOME")); #endif if (ret < 0 || (size_t)ret >= 117) HGOTO_ERROR(H5E_ARGS, H5E_CANTCOPY, FAIL, "unable to format home-aws path") diff --git a/src/H5Tdbg.c b/src/H5Tdbg.c index 5d0c5cd..758430b 100644 --- a/src/H5Tdbg.c +++ b/src/H5Tdbg.c @@ -120,9 +120,9 @@ H5T__print_stats(H5T_path_t H5_ATTR_UNUSED *path, int H5_ATTR_UNUSED *nprint /*i HDfprintf(H5DEBUG(T), " %-16s %10" PRIdHSIZE " %10u %8s %8s %8s %10s\n", path->name, path->stats.nelmts, path->stats.ncalls, timestrs.user, timestrs.system, timestrs.elapsed, bandwidth); - free(timestrs.user); - free(timestrs.system); - free(timestrs.elapsed); + HDfree(timestrs.user); + HDfree(timestrs.system); + HDfree(timestrs.elapsed); } #endif diff --git a/src/H5VLnative_object.c b/src/H5VLnative_object.c index ac717b0..81ff5ea 100644 --- a/src/H5VLnative_object.c +++ b/src/H5VLnative_object.c @@ -338,7 +338,7 @@ H5VL__native_object_specific(void *obj, const H5VL_loc_params_t *loc_params, /* Lookup object */ case H5VL_OBJECT_LOOKUP: { - H5O_token_t *token = va_arg(arguments, H5O_token_t *); + H5O_token_t *token = HDva_arg(arguments, H5O_token_t *); HDassert(token); @@ -175,9 +175,9 @@ H5Z_term_package(void) H5Z_stat_table_g[i].stats[dir].errors, timestrs.user, timestrs.system, timestrs.elapsed, bandwidth); next: - free(timestrs.user); - free(timestrs.system); - free(timestrs.elapsed); + HDfree(timestrs.user); + HDfree(timestrs.system); + HDfree(timestrs.elapsed); } /* end for */ } /* end for */ } /* end if */ diff --git a/test/accum.c b/test/accum.c index 183f955..0b9fbad 100644 --- a/test/accum.c +++ b/test/accum.c @@ -2243,7 +2243,7 @@ test_swmr_write_big(hbool_t newest_format) char *const new_argv[] = {swmr_reader, NULL}; /* Run the reader */ status = HDexecv(SWMR_READER, new_argv); - HDprintf("errno from execv = %s\n", strerror(errno)); + HDprintf("errno from execv = %s\n", HDstrerror(errno)); FAIL_STACK_ERROR; } /* end if */ diff --git a/test/btree2.c b/test/btree2.c index 4391a3b..42f9a61 100644 --- a/test/btree2.c +++ b/test/btree2.c @@ -10023,14 +10023,14 @@ main(void) if (nerrors) goto error; - puts("All v2 B-tree tests passed."); + HDputs("All v2 B-tree tests passed."); h5_cleanup(FILENAME, fapl); return 0; error: - puts("*** TESTS FAILED ***"); + HDputs("*** TESTS FAILED ***"); H5E_BEGIN_TRY { H5Pclose(fapl); } H5E_END_TRY; diff --git a/test/cache_api.c b/test/cache_api.c index acdb4ba..143cc71 100644 --- a/test/cache_api.c +++ b/test/cache_api.c @@ -1216,9 +1216,9 @@ mdc_api_call_smoke_check(int express_test, unsigned paged, hid_t fcpl_id) /* do random reads on all datasets */ n = 0; while ((pass) && (n < NUM_RANDOM_ACCESSES)) { - m = rand() % NUM_DSETS; - i = (rand() % (DSET_SIZE / CHUNK_SIZE)) * CHUNK_SIZE; - j = (rand() % (DSET_SIZE / CHUNK_SIZE)) * CHUNK_SIZE; + m = HDrand() % NUM_DSETS; + i = (HDrand() % (DSET_SIZE / CHUNK_SIZE)) * CHUNK_SIZE; + j = (HDrand() % (DSET_SIZE / CHUNK_SIZE)) * CHUNK_SIZE; /* select on disk hyperslab */ offset[0] = (hsize_t)i; /*offset of hyperslab in file*/ @@ -1328,8 +1328,8 @@ mdc_api_call_smoke_check(int express_test, unsigned paged, hid_t fcpl_id) m = 0; n = 0; while ((pass) && (n < NUM_RANDOM_ACCESSES)) { - i = (rand() % (DSET_SIZE / CHUNK_SIZE)) * CHUNK_SIZE; - j = (rand() % (DSET_SIZE / CHUNK_SIZE)) * CHUNK_SIZE; + i = (HDrand() % (DSET_SIZE / CHUNK_SIZE)) * CHUNK_SIZE; + j = (HDrand() % (DSET_SIZE / CHUNK_SIZE)) * CHUNK_SIZE; /* select on disk hyperslab */ offset[0] = (hsize_t)i; /*offset of hyperslab in file*/ diff --git a/test/chunk_info.c b/test/chunk_info.c index 99b5b1e..f45a4dd 100644 --- a/test/chunk_info.c +++ b/test/chunk_info.c @@ -421,7 +421,7 @@ verify_idx_nchunks(hid_t dset, hid_t dspace, H5D_chunk_index_t exp_idx_type, hsi /* Ensure the correct chunk indexing scheme is used */ if (idx_type != exp_idx_type) { char msg[256]; - sprintf(msg, "Should be using %s.\n", index_type_str(idx_type)); + HDsprintf(msg, "Should be using %s.\n", index_type_str(idx_type)); FAIL_PUTS_ERROR(msg); } @@ -542,7 +542,7 @@ test_get_chunk_info_highest_v18(hid_t fapl) #ifdef H5_HAVE_FILTER_DEFLATE /* Allocate input (compressed) buffer */ - inbuf = malloc(z_dst_nbytes); + inbuf = HDmalloc(z_dst_nbytes); /* Set chunk size to the compressed chunk size and the chunk point to the compressed data chunk */ @@ -554,20 +554,20 @@ test_get_chunk_info_highest_v18(hid_t fapl) /* Check for various zlib errors */ if (Z_BUF_ERROR == ret) { - fprintf(stderr, "overflow"); + HDfprintf(stderr, "overflow"); TEST_ERROR } else if (Z_MEM_ERROR == ret) { - fprintf(stderr, "deflate memory error"); + HDfprintf(stderr, "deflate memory error"); TEST_ERROR } else if (Z_OK != ret) { - fprintf(stderr, "other deflate error"); + HDfprintf(stderr, "other deflate error"); TEST_ERROR } #else /* Allocate input (non-compressed) buffer */ - inbuf = malloc(CHK_SIZE); + inbuf = HDmalloc(CHK_SIZE); HDmemcpy(inbuf, direct_buf, CHK_SIZE); #endif /* end H5_HAVE_FILTER_DEFLATE */ @@ -1638,7 +1638,7 @@ test_basic_query(hid_t fapl) TEST_ERROR /* Remove the test file */ - remove(filename); + HDremove(filename); PASSED(); return SUCCEED; @@ -2040,7 +2040,7 @@ test_flt_msk_with_skip_compress(hid_t fapl) TEST_ERROR /* Remove the test file */ - remove(filename); + HDremove(filename); PASSED(); return SUCCEED; diff --git a/test/cmpd_dset.c b/test/cmpd_dset.c index 6e5dd07..37217e7 100644 --- a/test/cmpd_dset.c +++ b/test/cmpd_dset.c @@ -302,7 +302,7 @@ test_compound(char *filename, hid_t fapl) s1[i].c[1] != s2[i].c[1] || s1[i].c[2] != s2[i].c[2] || s1[i].c[3] != s2[i].c[3] || s1[i].d != s2[i].d || s1[i].e != s2[i].e) { H5_FAILED(); - puts(" Incorrect values read from the file"); + HDputs(" Incorrect values read from the file"); goto error; } } @@ -339,7 +339,7 @@ test_compound(char *filename, hid_t fapl) s1[i].c[1] != s3[i].c[1] || s1[i].c[2] != s3[i].c[2] || s1[i].c[3] != s3[i].c[3] || s1[i].d != s3[i].d || s1[i].e != s3[i].e) { H5_FAILED(); - puts(" Incorrect values read from the file"); + HDputs(" Incorrect values read from the file"); goto error; } } @@ -369,7 +369,7 @@ test_compound(char *filename, hid_t fapl) for (i = 0; i < NX * NY; i++) { if (s1[i].b != s4[i].b || s1[i].d != s4[i].d) { H5_FAILED(); - puts(" Incorrect values read from the file"); + HDputs(" Incorrect values read from the file"); goto error; } } @@ -413,7 +413,7 @@ test_compound(char *filename, hid_t fapl) s1[i].c[1] != s5[i].c[1] || s1[i].c[2] != s5[i].c[2] || s1[i].c[3] != s5[i].c[3] || s1[i].d != s5[i].d || s1[i].e != s5[i].e) { H5_FAILED(); - puts(" Incorrect values read from the file"); + HDputs(" Incorrect values read from the file"); goto error; } } @@ -423,7 +423,7 @@ test_compound(char *filename, hid_t fapl) if (s5[i].pre != 1000 + 4 * i || s5[i].mid1 != 1001 + 4 * i || s5[i].mid2 != 1002 + 4 * i || s5[i].post != 1003 + 4 * i) { H5_FAILED(); - puts(" Memory values were clobbered"); + HDputs(" Memory values were clobbered"); goto error; } } @@ -482,7 +482,7 @@ test_compound(char *filename, hid_t fapl) s1[i].c[1] != s6[i].c[1] || s1[i].c[2] != s6[i].c[2] || s1[i].c[3] != s6[i].c[3] || s1[i].d != s6[i].d || s1[i].e != s6[i].e) { H5_FAILED(); - puts(" Incorrect values read from the file"); + HDputs(" Incorrect values read from the file"); goto error; } } @@ -492,7 +492,7 @@ test_compound(char *filename, hid_t fapl) if (s6[i].pre != 1000 + 4 * i || s6[i].mid1 != 1001 + 4 * i || s6[i].mid2 != 1002 + 4 * i || s6[i].post != 1003 + 4 * i) { H5_FAILED(); - puts(" Memory values were clobbered"); + HDputs(" Memory values were clobbered"); goto error; } } @@ -561,7 +561,7 @@ test_compound(char *filename, hid_t fapl) s2[i].c[1] != s1[i].c[1] || s2[i].c[2] != s1[i].c[2] || s2[i].c[3] != s1[i].c[3] || s2[i].d != s1[i].d || s2[i].e != s1[i].e) { H5_FAILED(); - puts(" Incorrect values read from file"); + HDputs(" Incorrect values read from file"); goto error; } } @@ -590,7 +590,7 @@ test_compound(char *filename, hid_t fapl) /* Read the dataset */ s8 = (s1_t *)HDcalloc((size_t)(h_size[0] * h_size[1]), sizeof(s1_t)); - assert(s8); + HDassert(s8); if (H5Dread(dataset, s1_tid, s8_m_sid, s8_f_sid, H5P_DEFAULT, s8) < 0) { goto error; } @@ -604,7 +604,7 @@ test_compound(char *filename, hid_t fapl) if (ps8->a != ps1->a || ps8->b != ps1->b || ps8->c[0] != ps1->c[0] || ps8->c[1] != ps1->c[1] || ps8->c[2] != ps1->c[2] || ps8->c[3] != ps1->c[3] || ps8->d != ps1->d || ps8->e != ps1->e) { H5_FAILED(); - puts(" Incorrect values read from file"); + HDputs(" Incorrect values read from file"); goto error; } } @@ -643,7 +643,7 @@ test_compound(char *filename, hid_t fapl) ps2->c[1] != ps1->c[1] || ps2->c[2] != ps1->c[2] || ps2->c[3] != ps1->c[3] || ps2->d != ps1->d || ps2->e != ps1->e) { H5_FAILED(); - puts(" Memory values clobbered"); + HDputs(" Memory values clobbered"); goto error; } } @@ -652,7 +652,7 @@ test_compound(char *filename, hid_t fapl) ps2->c[1] != (unsigned)(-1) || ps2->c[2] != (unsigned)(-1) || ps2->c[3] != (unsigned)(-1) || ps2->d != (unsigned)(-1) || ps2->e != (unsigned)(-1)) { H5_FAILED(); - puts(" Incorrect values read from file"); + HDputs(" Incorrect values read from file"); goto error; } } @@ -691,7 +691,7 @@ test_compound(char *filename, hid_t fapl) ps5->c[2] != ps1->c[2] || ps5->c[3] != ps1->c[3] || ps5->mid2 != (unsigned)(-1) || ps5->d != ps1->d || ps5->e != ps1->e || ps5->post != (unsigned)(-1)) { H5_FAILED(); - puts(" Memory values clobbered"); + HDputs(" Memory values clobbered"); goto error; } } @@ -702,7 +702,7 @@ test_compound(char *filename, hid_t fapl) ps5->c[3] != (unsigned)(-1) || ps5->mid2 != (unsigned)(-1) || ps5->d != (unsigned)(-1) || ps5->e != (unsigned)(-1) || ps5->post != (unsigned)(-1)) { H5_FAILED(); - puts(" Incorrect values read from file"); + HDputs(" Incorrect values read from file"); goto error; } } @@ -723,7 +723,7 @@ test_compound(char *filename, hid_t fapl) h_size[0] = 2 * NX / 3 - f_offset[0]; h_size[1] = 2 * NY / 3 - f_offset[1]; s11 = (s4_t *)HDmalloc((size_t)h_size[0] * (size_t)h_size[1] * sizeof(s4_t)); - assert(s11); + HDassert(s11); /* Initialize */ for (i = 0; i < h_size[0] * h_size[1]; i++) { @@ -751,7 +751,7 @@ test_compound(char *filename, hid_t fapl) ps1->c[1] != 8 * (i * NY + j) + 3 || ps1->c[2] != 8 * (i * NY + j) + 4 || ps1->c[3] != 8 * (i * NY + j) + 5 || ps1->e != 8 * (i * NY + j) + 7) { H5_FAILED(); - puts(" Write clobbered values"); + HDputs(" Write clobbered values"); goto error; } @@ -759,14 +759,14 @@ test_compound(char *filename, hid_t fapl) j < f_offset[1] + h_size[1]) { if (ps1->b != (unsigned)(-1) || ps1->d != (unsigned)(-1)) { H5_FAILED(); - puts(" Wrong values written or read"); + HDputs(" Wrong values written or read"); goto error; } } else { if (ps1->b != 8 * (i * NY + j) + 1 || ps1->d != 8 * (i * NY + j) + 6) { H5_FAILED(); - puts(" Write clobbered values"); + HDputs(" Write clobbered values"); goto error; } } @@ -792,7 +792,7 @@ test_compound(char *filename, hid_t fapl) return 0; error: - puts("*** DATASET TESTS FAILED ***"); + HDputs("*** DATASET TESTS FAILED ***"); /* Release resources */ if (s1) @@ -1669,7 +1669,7 @@ test_hdf5_dst_subset(char *filename, hid_t fapl) return 0; error: - puts("*** DATASET TESTS FAILED ***"); + HDputs("*** DATASET TESTS FAILED ***"); return 1; } @@ -1684,7 +1684,7 @@ error: for (_i = 0; _i < PACK_NMEMBS; _i++) \ HDprintf(" %d", order[_i]); \ HDprintf("\n Inner compound order = %d, location = %d\n", sub_cmpd_order, order[sub_cmpd_order]); \ - fflush(stdout); \ + HDfflush(stdout); \ goto error; \ } @@ -1719,7 +1719,7 @@ test_pack_ooo(void) * the compound */ unsigned i, j; /* Indices */ - HDsrand((unsigned)time(NULL)); + HDsrand((unsigned)HDtime(NULL)); /* Initialize "free_order" array to indicate that all slots in order are * free */ @@ -2233,7 +2233,7 @@ main(int argc, char *argv[]) /* Turn off optimized compound converter? */ if (argc > 1) { - if (argc > 2 || strcmp("--noopt", argv[1])) { + if (argc > 2 || HDstrcmp("--noopt", argv[1])) { HDfprintf(stderr, "usage: %s [--noopt]\n", argv[0]); HDexit(EXIT_FAILURE); } diff --git a/test/dangle.c b/test/dangle.c index 4728923..d7c7dfc 100644 --- a/test/dangle.c +++ b/test/dangle.c @@ -660,7 +660,7 @@ main(void) int nerrors = 0; /* Run tests w/weak file close */ - puts("Testing dangling objects with weak file close:"); + HDputs("Testing dangling objects with weak file close:"); nerrors += test_dangle_dataset(H5F_CLOSE_WEAK); nerrors += test_dangle_group(H5F_CLOSE_WEAK); nerrors += test_dangle_datatype1(H5F_CLOSE_WEAK); @@ -668,7 +668,7 @@ main(void) nerrors += test_dangle_attribute(H5F_CLOSE_WEAK); /* Run tests w/semi file close */ - puts("Testing dangling objects with semi file close:"); + HDputs("Testing dangling objects with semi file close:"); nerrors += test_dangle_dataset(H5F_CLOSE_SEMI); nerrors += test_dangle_group(H5F_CLOSE_SEMI); nerrors += test_dangle_datatype1(H5F_CLOSE_SEMI); @@ -676,7 +676,7 @@ main(void) nerrors += test_dangle_attribute(H5F_CLOSE_SEMI); /* Run tests w/strong file close */ - puts("Testing dangling objects with strong file close:"); + HDputs("Testing dangling objects with strong file close:"); nerrors += test_dangle_dataset(H5F_CLOSE_STRONG); nerrors += test_dangle_group(H5F_CLOSE_STRONG); nerrors += test_dangle_datatype1(H5F_CLOSE_STRONG); @@ -689,11 +689,11 @@ main(void) /* Check for errors */ if (nerrors) goto error; - puts("All dangling ID tests passed."); + HDputs("All dangling ID tests passed."); return 0; error: - puts("***** DANGLING ID TESTS FAILED *****"); + HDputs("***** DANGLING ID TESTS FAILED *****"); return 1; } diff --git a/test/direct_chunk.c b/test/direct_chunk.c index 388f2cc..00fc06f 100644 --- a/test/direct_chunk.c +++ b/test/direct_chunk.c @@ -2320,7 +2320,7 @@ main(void) need_comma = TRUE; } /* end if */ HDprintf(":\n"); - fflush(stdout); + HDfflush(stdout); nerrors += test_single_chunk(config); } /* end for */ diff --git a/test/dsets.c b/test/dsets.c index 8a4332d..a7b67ef 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -375,13 +375,13 @@ test_create(hid_t file) dims[0] = 256; dims[1] = 512; space = H5Screate_simple(2, dims, NULL); - assert(space >= 0); + HDassert(space >= 0); /* Create a small data space for compact dataset */ small_dims[0] = 16; small_dims[1] = 8; small_space = H5Screate_simple(2, small_dims, NULL); - assert(space >= 0); + HDassert(space >= 0); /* * Create a dataset using the default dataset creation properties. We're @@ -447,13 +447,13 @@ test_create(hid_t file) * layout. */ create_parms = H5Pcreate(H5P_DATASET_CREATE); - assert(create_parms >= 0); + HDassert(create_parms >= 0); /* Attempt to create a dataset with invalid chunk sizes */ csize[0] = dims[0] * 2; csize[1] = dims[1] * 2; status = H5Pset_chunk(create_parms, 2, csize); - assert(status >= 0); + HDassert(status >= 0); H5E_BEGIN_TRY { dataset = H5Dcreate2(file, DSET_CHUNKED_NAME, H5T_NATIVE_DOUBLE, space, H5P_DEFAULT, create_parms, @@ -469,7 +469,7 @@ test_create(hid_t file) csize[0] = 5; csize[1] = 100; status = H5Pset_chunk(create_parms, 2, csize); - assert(status >= 0); + HDassert(status >= 0); dataset = H5Dcreate2(file, DSET_CHUNKED_NAME, H5T_NATIVE_DOUBLE, space, H5P_DEFAULT, create_parms, H5P_DEFAULT); @@ -491,11 +491,11 @@ test_create(hid_t file) * Create a compact dataset, then close it. */ create_parms = H5Pcreate(H5P_DATASET_CREATE); - assert(create_parms >= 0); + HDassert(create_parms >= 0); status = H5Pset_layout(create_parms, H5D_COMPACT); - assert(status >= 0); + HDassert(status >= 0); status = H5Pset_alloc_time(create_parms, H5D_ALLOC_TIME_EARLY); - assert(status >= 0); + HDassert(status >= 0); dataset = H5Dcreate2(file, DSET_COMPACT_NAME, H5T_NATIVE_DOUBLE, small_space, H5P_DEFAULT, create_parms, H5P_DEFAULT); @@ -567,7 +567,7 @@ test_simple_io(const char *env_h5_drvr, hid_t fapl) /* Create a small conversion buffer to test strip mining */ tconv_buf = HDmalloc((size_t)1000); xfer = H5Pcreate(H5P_DATASET_XFER); - assert(xfer >= 0); + HDassert(xfer >= 0); if (H5Pset_buffer(xfer, (size_t)1000, tconv_buf, NULL) < 0) goto error; @@ -4336,9 +4336,9 @@ test_nbit_compound_3(hid_t file) /* Check that the values read are the same as the values written */ for (i = 0; i < (size_t)size[0]; i++) { - if (new_data[i].i != orig_data[i].i || strcmp(new_data[i].str, orig_data[i].str) != 0 || - strcmp(new_data[i].vl_str, orig_data[i].vl_str) != 0 || new_data[i].v.len != orig_data[i].v.len || - new_data[i].r != orig_data[i].r) { + if (new_data[i].i != orig_data[i].i || HDstrcmp(new_data[i].str, orig_data[i].str) != 0 || + HDstrcmp(new_data[i].vl_str, orig_data[i].vl_str) != 0 || + new_data[i].v.len != orig_data[i].v.len || new_data[i].r != orig_data[i].r) { H5_FAILED(); HDprintf(" Read different values than written.\n"); HDprintf(" At index %lu\n", (unsigned long)i); @@ -7832,7 +7832,7 @@ test_random_chunks_real(const char *testname, hbool_t early_alloc, hid_t fapl) TESTING(testname); - assert(NPOINTS < 100); + HDassert(NPOINTS < 100); h5_fixname(FILENAME[6], fapl, filename, sizeof filename); @@ -8354,13 +8354,13 @@ test_deprec(hid_t file) dims[0] = 256; dims[1] = 512; space = H5Screate_simple(2, dims, NULL); - assert(space >= 0); + HDassert(space >= 0); /* Create a small data space for compact dataset */ small_dims[0] = 16; small_dims[1] = 8; small_space = H5Screate_simple(2, small_dims, NULL); - assert(space >= 0); + HDassert(space >= 0); /* * Create a dataset using the default dataset creation properties. We're @@ -8413,7 +8413,7 @@ test_deprec(hid_t file) * layout. */ create_parms = H5Pcreate(H5P_DATASET_CREATE); - assert(create_parms >= 0); + HDassert(create_parms >= 0); /* Add the deflate filter, if available */ #if defined H5_HAVE_FILTER_DEFLATE @@ -8449,7 +8449,7 @@ test_deprec(hid_t file) csize[0] = dims[0] * 2; csize[1] = dims[1] * 2; status = H5Pset_chunk(create_parms, 2, csize); - assert(status >= 0); + HDassert(status >= 0); H5E_BEGIN_TRY { dataset = H5Dcreate1(file, DSET_DEPREC_NAME_CHUNKED, H5T_NATIVE_DOUBLE, space, create_parms); @@ -8464,7 +8464,7 @@ test_deprec(hid_t file) csize[0] = 5; csize[1] = 100; status = H5Pset_chunk(create_parms, 2, csize); - assert(status >= 0); + HDassert(status >= 0); if ((dataset = H5Dcreate1(file, DSET_DEPREC_NAME_CHUNKED, H5T_NATIVE_DOUBLE, space, create_parms)) < 0) goto error; @@ -8489,11 +8489,11 @@ test_deprec(hid_t file) * Create a compact dataset, then close it. */ create_parms = H5Pcreate(H5P_DATASET_CREATE); - assert(create_parms >= 0); + HDassert(create_parms >= 0); status = H5Pset_layout(create_parms, H5D_COMPACT); - assert(status >= 0); + HDassert(status >= 0); status = H5Pset_alloc_time(create_parms, H5D_ALLOC_TIME_EARLY); - assert(status >= 0); + HDassert(status >= 0); if ((dataset = H5Dcreate1(file, DSET_DEPREC_NAME_COMPACT, H5T_NATIVE_DOUBLE, small_space, create_parms)) < 0) diff --git a/test/dt_arith.c b/test/dt_arith.c index 466554c..7b2274c 100644 --- a/test/dt_arith.c +++ b/test/dt_arith.c @@ -359,7 +359,7 @@ static int without_hardware_g = 0; \ for (n = 0; n < 2; n++) { \ if (n == 1) { \ - memset(value, 0, SRC_SIZE * sizeof(unsigned char)); \ + HDmemset(value, 0, SRC_SIZE * sizeof(unsigned char)); \ /* -0 */ \ H5T__bit_set(value, (size_t)(SRC_PREC - 1), (size_t)1, TRUE); \ CHANGE_ORDER(value, SRC_ORDR, SRC_SIZE); /*change order for big endian*/ \ @@ -566,7 +566,7 @@ generates_sigfpe(void) HDfflush(stdout); HDfflush(stderr); - if ((pid = fork()) < 0) { + if ((pid = HDfork()) < 0) { HDperror("fork"); HDexit(EXIT_FAILURE); } @@ -580,7 +580,7 @@ generates_sigfpe(void) HDexit(EXIT_SUCCESS); } - while (pid != waitpid(pid, &status, 0)) + while (pid != HDwaitpid(pid, &status, 0)) /*void*/; if (WIFEXITED(status) && 0 == WEXITSTATUS(status)) { HDputs("Floating-point overflow cases will be tested."); @@ -2388,7 +2388,7 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst) } /* Make certain that there isn't some weird number of destination bits */ - assert(dst_nbits % 8 == 0); + HDassert(dst_nbits % 8 == 0); /* Are the two results the same? */ for (k = (dst_size - (dst_nbits / 8)); k < dst_size; k++) @@ -2945,12 +2945,12 @@ test_conv_flt_1(const char *name, int run_test, hid_t src, hid_t dst) */ HDfflush(stdout); HDfflush(stderr); - if ((child_pid = fork()) < 0) { + if ((child_pid = HDfork()) < 0) { HDperror("fork"); return 1; } else if (child_pid > 0) { - while (child_pid != waitpid(child_pid, &status, 0)) /*void*/ + while (child_pid != HDwaitpid(child_pid, &status, 0)) /*void*/ ; if (WIFEXITED(status) && 255 == WEXITSTATUS(status)) { return 0; /*child exit after catching SIGFPE*/ @@ -3019,7 +3019,7 @@ test_conv_flt_1(const char *name, int run_test, hid_t src, hid_t dst) if (sizeof(float) == sizeof(double)) HDputs("Sizeof(float)==sizeof(double) - some tests may not be sensible."); if (OTHER == src_type || OTHER == dst_type) { - if (!strcmp(name, "noop")) + if (!HDstrcmp(name, "noop")) HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions", name, src_type_name, dst_type_name); else if (run_test == TEST_SPECIAL) @@ -3038,7 +3038,7 @@ test_conv_flt_1(const char *name, int run_test, hid_t src, hid_t dst) goto error; } else { - if (!strcmp(name, "noop")) + if (!HDstrcmp(name, "noop")) HDsnprintf(str, sizeof(str), "Testing %s %s -> %s conversions", name, src_type_name, dst_type_name); else if (run_test == TEST_SPECIAL) @@ -4347,7 +4347,7 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst) } /* Make certain that there isn't some weird number of destination bits */ - assert(dst_nbits % 8 == 0); + HDassert(dst_nbits % 8 == 0); /* For Intel machines, the size of "long double" is 12 bytes, precision * is 80 bits; for AMD processors, the size of "long double" is 16 bytes, @@ -5006,7 +5006,7 @@ run_fp_tests(const char *name) { int nerrors = 0; - if (!strcmp(name, "noop")) { + if (!HDstrcmp(name, "noop")) { nerrors += test_conv_flt_1("noop", TEST_NOOP, H5T_NATIVE_FLOAT, H5T_NATIVE_FLOAT); nerrors += test_conv_flt_1("noop", TEST_NOOP, H5T_NATIVE_DOUBLE, H5T_NATIVE_DOUBLE); #if H5_SIZEOF_LONG_DOUBLE != 0 @@ -5243,7 +5243,7 @@ run_fp_int_conv(const char *name) #endif #if H5_SIZEOF_LONG_LONG != H5_SIZEOF_LONG - if (!strcmp(name, "hw")) { /* Hardware conversion */ + if (!HDstrcmp(name, "hw")) { /* Hardware conversion */ nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_FLOAT, H5T_NATIVE_LLONG); nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_DOUBLE, H5T_NATIVE_LLONG); } diff --git a/test/dtypes.c b/test/dtypes.c index bb9bb2e..184c099 100644 --- a/test/dtypes.c +++ b/test/dtypes.c @@ -1891,7 +1891,7 @@ test_compound_9(void) goto error; } /* end if */ - if (rdata.i1 != wdata.i1 || rdata.i2 != wdata.i2 || strcmp(rdata.str, wdata.str)) { + if (rdata.i1 != wdata.i1 || rdata.i2 != wdata.i2 || HDstrcmp(rdata.str, wdata.str)) { H5_FAILED(); AT(); HDprintf("incorrect read data\n"); @@ -2097,7 +2097,7 @@ test_compound_10(void) t1 = rdata[i].text.p; t2 = wdata[i].text.p; - if (strcmp((char *)t1, (char *)t2)) { + if (HDstrcmp((char *)t1, (char *)t2)) { H5_FAILED(); AT(); HDprintf("incorrect VL read data\n"); @@ -2502,7 +2502,7 @@ test_compound_12(void) H5E_END_TRY; if (ret >= 0) { H5_FAILED(); - puts(" Tries to cut off the last member. Should have failed."); + HDputs(" Tries to cut off the last member. Should have failed."); goto error; } @@ -3054,7 +3054,7 @@ test_compound_14(void) goto error; } /* end if */ - if (rdata1.c1 != wdata1.c1 || rdata1.c2 != wdata1.c2 || strcmp(rdata1.str, wdata1.str)) { + if (rdata1.c1 != wdata1.c1 || rdata1.c2 != wdata1.c2 || HDstrcmp(rdata1.str, wdata1.str)) { H5_FAILED(); AT(); HDprintf("incorrect read data\n"); @@ -3885,7 +3885,7 @@ test_query(void) HDprintf("Can't get name for enum member\n"); goto error; } /* end if */ - if (strcmp("YELLOW", enum_name)) { + if (HDstrcmp("YELLOW", enum_name)) { H5_FAILED(); HDprintf("Incorrect name for enum member\n"); goto error; diff --git a/test/earray.c b/test/earray.c index 79bf0f1..4ef79ee 100644 --- a/test/earray.c +++ b/test/earray.c @@ -759,7 +759,7 @@ test_create(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t H5_ATTR_UNUSE } #else /* NDEBUG */ SKIPPED(); - puts(" Not tested when assertions are disabled"); + HDputs(" Not tested when assertions are disabled"); #endif /* NDEBUG */ /* @@ -2427,12 +2427,12 @@ main(void) switch (curr_test) { /* "Normal" testing parameters */ case EARRAY_TEST_NORMAL: - puts("Testing with normal parameters"); + HDputs("Testing with normal parameters"); break; /* "Re-open array" testing parameters */ case EARRAY_TEST_REOPEN: - puts("Testing with reopen array flag set"); + HDputs("Testing with reopen array flag set"); tparam.reopen_array = EARRAY_TEST_REOPEN; break; @@ -2461,31 +2461,31 @@ main(void) switch (curr_iter) { /* "Forward" testing parameters */ case EARRAY_ITER_FW: - puts("Testing with forward iteration"); + HDputs("Testing with forward iteration"); tparam.eiter = &ea_iter_fw; break; /* "Reverse" testing parameters */ case EARRAY_ITER_RV: - puts("Testing with reverse iteration"); + HDputs("Testing with reverse iteration"); tparam.eiter = &ea_iter_rv; break; /* "Random" testing parameters */ case EARRAY_ITER_RND: - puts("Testing with random iteration"); + HDputs("Testing with random iteration"); tparam.eiter = &ea_iter_rnd; break; /* "Random #2" testing parameters */ case EARRAY_ITER_RND2: - puts("Testing with random #2 iteration"); + HDputs("Testing with random #2 iteration"); tparam.eiter = &ea_iter_rnd2; break; /* "Cyclic" testing parameters */ case EARRAY_ITER_CYC: - puts("Testing with cyclic iteration"); + HDputs("Testing with cyclic iteration"); tparam.eiter = &ea_iter_cyc; break; diff --git a/test/enum.c b/test/enum.c index eafce72..4a13358 100644 --- a/test/enum.c +++ b/test/enum.c @@ -768,11 +768,11 @@ main(void) if (nerrors) goto error; - puts("All enum tests passed."); + HDputs("All enum tests passed."); h5_cleanup(FILENAME, fapl); return 0; error: - puts("*** ENUM TESTS FAILED ***"); + HDputs("*** ENUM TESTS FAILED ***"); return 1; } diff --git a/test/external.c b/test/external.c index 376204a..d106555 100644 --- a/test/external.c +++ b/test/external.c @@ -476,12 +476,12 @@ __add_external_files(hid_t dcpl_id, unsigned int n_external_files, off_t offset, for (i = 0; i < n_external_files; i++) { if (HDsnprintf(exname, AEF_EXNAME_MAX_LEN, "ext%d.data", i + 1) > AEF_EXNAME_MAX_LEN) { HDfprintf(stderr, "External file %d overflows name buffer\n", i + 1); - fflush(stderr); + HDfflush(stderr); return -1; } if (H5Pset_external(dcpl_id, exname, offset, max_ext_size) < 0) { HDfprintf(stderr, "Problem adding external file %s\n", exname); - fflush(stderr); + HDfflush(stderr); return -1; } } diff --git a/test/farray.c b/test/farray.c index b6a6c31..46889a3 100644 --- a/test/farray.c +++ b/test/farray.c @@ -483,7 +483,7 @@ test_create(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t H5_ATTR_UNUSE } #else /* NDEBUG */ SKIPPED(); - puts(" Not tested when assertions are disabled"); + HDputs(" Not tested when assertions are disabled"); #endif /* NDEBUG */ /* diff --git a/test/filenotclosed.c b/test/filenotclosed.c index 13ce9fd..330224d 100644 --- a/test/filenotclosed.c +++ b/test/filenotclosed.c @@ -80,7 +80,7 @@ main(void) contig_addr_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi")); if (!contig_addr_vfd) { SKIPPED(); - puts(" Temporary skipped for a spilt/multi driver"); + HDputs(" Temporary skipped for a spilt/multi driver"); HDexit(EXIT_SUCCESS); } diff --git a/test/fillval.c b/test/fillval.c index 05570f0..2decbfa 100644 --- a/test/fillval.c +++ b/test/fillval.c @@ -201,7 +201,7 @@ test_getset(void) H5E_END_TRY; if (fill_i != 0) { H5_FAILED(); - puts(" H5Pget_fill_value() should return default 0"); + HDputs(" H5Pget_fill_value() should return default 0"); goto error; } @@ -220,8 +220,8 @@ test_getset(void) goto error; if (fill_ss.v1 != fill_ss_rd.v1 || fill_ss.v2 != fill_ss_rd.v2) { H5_FAILED(); - puts(" Failed to get fill value using same data type that was "); - puts(" used to set the fill value."); + HDputs(" Failed to get fill value using same data type that was "); + HDputs(" used to set the fill value."); goto error; } @@ -232,8 +232,8 @@ test_getset(void) goto error; if (fill_ss.v1 != fill_si.v1 || fill_ss.v2 != fill_si.v2) { H5_FAILED(); - puts(" Failed to get fill value using a data type other than what"); - puts(" was used to set the fill value."); + HDputs(" Failed to get fill value using a data type other than what"); + HDputs(" was used to set the fill value."); goto error; } @@ -246,7 +246,7 @@ test_getset(void) goto error; if (fill_si.v1 != fill_ss.v1 || fill_si.v2 != fill_ss.v2) { H5_FAILED(); - puts(" Resetting the fill value was unsuccessful."); + HDputs(" Resetting the fill value was unsuccessful."); goto error; } @@ -662,12 +662,12 @@ test_create(hid_t fapl, const char *base_name, H5D_layout_t layout) goto error; if (alloc_time != H5D_ALLOC_TIME_LATE) { H5_FAILED(); - puts(" Got non-H5D_ALLOC_TIME_LATE space allocation time."); + HDputs(" Got non-H5D_ALLOC_TIME_LATE space allocation time."); HDprintf(" Got %d\n", alloc_time); } if (fill_time != H5D_FILL_TIME_ALLOC) { H5_FAILED(); - puts(" Got non-H5D_FILL_TIME_ALLOC fill value write time."); + HDputs(" Got non-H5D_FILL_TIME_ALLOC fill value write time."); HDprintf(" Got %d\n", fill_time); } if (H5Dclose(dset3) < 0) @@ -682,7 +682,7 @@ test_create(hid_t fapl, const char *base_name, H5D_layout_t layout) goto error; if (layout == H5D_CONTIGUOUS && allocation != H5D_SPACE_STATUS_NOT_ALLOCATED) { H5_FAILED(); - puts(" Got allocated space instead of unallocated."); + HDputs(" Got allocated space instead of unallocated."); HDprintf(" Got %d\n", allocation); goto error; } @@ -694,12 +694,12 @@ test_create(hid_t fapl, const char *base_name, H5D_layout_t layout) goto error; if (alloc_time != H5D_ALLOC_TIME_LATE) { H5_FAILED(); - puts(" Got non-H5D_ALLOC_TIME_LATE space allocation time."); + HDputs(" Got non-H5D_ALLOC_TIME_LATE space allocation time."); HDprintf(" Got %d\n", alloc_time); } if (fill_time != H5D_FILL_TIME_NEVER) { H5_FAILED(); - puts(" Got non-H5D_FILL_TIME_NEVER fill value write time."); + HDputs(" Got non-H5D_FILL_TIME_NEVER fill value write time."); HDprintf(" Got %d\n", fill_time); } if (H5Dclose(dset4) < 0) @@ -717,7 +717,7 @@ test_create(hid_t fapl, const char *base_name, H5D_layout_t layout) if (!H5_FLT_ABS_EQUAL(rd_c.a, 0) || !H5_DBL_ABS_EQUAL(rd_c.y, fill_ctype.y) || rd_c.x != 0 || rd_c.z != '\0') { H5_FAILED(); - puts(" Got wrong fill value"); + HDputs(" Got wrong fill value"); HDprintf(" Got rd_c.a=%f, rd_c.y=%f and rd_c.x=%d, rd_c.z=%c\n", (double)rd_c.a, rd_c.y, rd_c.x, rd_c.z); } @@ -746,14 +746,14 @@ test_create(hid_t fapl, const char *base_name, H5D_layout_t layout) goto error; if (alloc_time != H5D_ALLOC_TIME_EARLY) { H5_FAILED(); - puts(" Got non-H5D_ALLOC_TIME_EARLY space allocation time."); + HDputs(" Got non-H5D_ALLOC_TIME_EARLY space allocation time."); HDprintf(" Got %d\n", alloc_time); } if (H5Pget_fill_time(dcpl, &fill_time) < 0) goto error; if (fill_time != H5D_FILL_TIME_NEVER) { H5_FAILED(); - puts(" Got non-H5D_FILL_TIME_NEVER fill value write time."); + HDputs(" Got non-H5D_FILL_TIME_NEVER fill value write time."); HDprintf(" Got %d\n", fill_time); } if (H5Dclose(dset5) < 0) @@ -786,14 +786,14 @@ test_create(hid_t fapl, const char *base_name, H5D_layout_t layout) goto error; if (alloc_time != H5D_ALLOC_TIME_EARLY) { H5_FAILED(); - puts(" Got non-H5D_ALLOC_TIME_EARLY space allocation time."); + HDputs(" Got non-H5D_ALLOC_TIME_EARLY space allocation time."); HDprintf(" Got %d\n", alloc_time); } if (H5Pget_fill_time(dcpl, &fill_time) < 0) goto error; if (fill_time != H5D_FILL_TIME_ALLOC) { H5_FAILED(); - puts(" Got non-H5D_FILL_TIME_ALLOC fill value write time."); + HDputs(" Got non-H5D_FILL_TIME_ALLOC fill value write time."); HDprintf(" Got %d\n", fill_time); } if (H5Dclose(dset6) < 0) @@ -811,7 +811,7 @@ test_create(hid_t fapl, const char *base_name, H5D_layout_t layout) if (!H5_FLT_ABS_EQUAL(rd_c.a, 0) || !H5_DBL_ABS_EQUAL(rd_c.y, fill_ctype.y) || rd_c.x != 0 || rd_c.z != '\0') { H5_FAILED(); - puts(" Got wrong fill value"); + HDputs(" Got wrong fill value"); HDprintf(" Got rd_c.a=%f, rd_c.y=%f and rd_c.x=%d, rd_c.z=%c\n", (double)rd_c.a, rd_c.y, rd_c.x, rd_c.z); } @@ -1649,7 +1649,7 @@ test_extend_cases(hid_t file, hid_t _dcpl, const char *dset_name, hsize_t *ch_si } /* end if */ else { /* Sanity check */ - assert(dtype_class == H5T_COMPOUND); + HDassert(dtype_class == H5T_COMPOUND); /* Initialize specific values for this datatype */ val_size = sizeof(comp_vl_datatype); @@ -1701,7 +1701,7 @@ test_extend_cases(hid_t file, hid_t _dcpl, const char *dset_name, hsize_t *ch_si } /* end for */ /* Check for overflow */ - assert((nelmts * val_size) == (hsize_t)((size_t)(nelmts * val_size))); + HDassert((nelmts * val_size) == (hsize_t)((size_t)(nelmts * val_size))); /* Allocate & initialize buffer */ buf = HDmalloc((size_t)(nelmts * val_size)); @@ -2141,7 +2141,7 @@ test_extend(hid_t fapl, const char *base_name, H5D_layout_t layout) */ if (H5D_CONTIGUOUS == layout) { SKIPPED(); - puts(" Not implemented yet -- needs H5S_SELECT_DIFF operator"); + HDputs(" Not implemented yet -- needs H5S_SELECT_DIFF operator"); goto skip; } #endif @@ -2259,7 +2259,7 @@ test_compatible(void) goto error; if (dims[0] != 8 || dims[1] != 8) { H5_FAILED(); - puts(" Got a different dimension size than what was set."); + HDputs(" Got a different dimension size than what was set."); HDprintf(" Got dims[0]=%ld, dims[1]=%ld, set 8x8\n", (long)dims[0], (long)dims[1]); goto error; } @@ -2271,7 +2271,7 @@ test_compatible(void) goto error; if (val_rd != 0) { H5_FAILED(); - puts(" Got a different value than what was set."); + HDputs(" Got a different value than what was set."); HDprintf(" Got %ld, set 0\n", (long)val_rd); goto error; } @@ -2312,7 +2312,7 @@ test_compatible(void) goto error; if (dims[0] != 8 || dims[1] != 8) { H5_FAILED(); - puts(" Got a different dimension size than what was set."); + HDputs(" Got a different dimension size than what was set."); HDprintf(" Got dims[0]=%ld, dims[1]=%ld, set 8x8\n", (long)dims[0], (long)dims[1]); goto error; } @@ -2324,7 +2324,7 @@ test_compatible(void) goto error; if (val_rd != fill_val) { H5_FAILED(); - puts(" Got a different value than what was set."); + HDputs(" Got a different value than what was set."); HDprintf(" Got %ld, set %ld\n", (long)val_rd, (long)fill_val); goto error; } @@ -2659,11 +2659,11 @@ main(int argc, char *argv[]) if (argc >= 2) { test_contig = test_chunk = test_compact = 0; for (argno = 1; argno < argc; argno++) { - if (!strcmp(argv[argno], "contiguous")) + if (!HDstrcmp(argv[argno], "contiguous")) test_contig = 1; - else if (!strcmp(argv[argno], "chunked")) + else if (!HDstrcmp(argv[argno], "chunked")) test_chunk = 1; - else if (!strcmp(argv[argno], "compact")) + else if (!HDstrcmp(argv[argno], "compact")) test_compact = 1; else { HDfprintf(stderr, "usage: %s [contiguous] [chunked] [compact]\n", argv[0]); @@ -2693,11 +2693,11 @@ main(int argc, char *argv[]) /* Set the FAPL for the type of format */ if (new_format) { - puts("\nTesting with new file format:"); + HDputs("\nTesting with new file format:"); my_fapl = fapl2; } /* end if */ else { - puts("Testing with old file format:"); + HDputs("Testing with old file format:"); my_fapl = fapl; } /* end else */ diff --git a/test/filter_fail.c b/test/filter_fail.c index dca9a20..d7f784c 100644 --- a/test/filter_fail.c +++ b/test/filter_fail.c @@ -171,7 +171,7 @@ test_filter_write(char *file_name, hid_t my_fapl, hbool_t cache_enabled) H5E_END_TRY; if (ret >= 0) { H5_FAILED(); - puts(" Data writing is supposed to fail because the chunk can't be written to file."); + HDputs(" Data writing is supposed to fail because the chunk can't be written to file."); TEST_ERROR } } @@ -189,7 +189,7 @@ test_filter_write(char *file_name, hid_t my_fapl, hbool_t cache_enabled) H5E_END_TRY; if (ret >= 0) { H5_FAILED(); - puts(" Dataset is supposed to fail because the chunk can't be flushed to file."); + HDputs(" Dataset is supposed to fail because the chunk can't be flushed to file."); TEST_ERROR } } diff --git a/test/gen_cross.c b/test/gen_cross.c index 37c6dcf..030cc65 100644 --- a/test/gen_cross.c +++ b/test/gen_cross.c @@ -928,7 +928,7 @@ create_deflate_dsets_float(hid_t fid, hid_t fsid, hid_t msid) #else /* H5_HAVE_FILTER_DEFLATE */ const char *not_supported = "Deflate filter is not enabled. Can't create the dataset."; - puts(not_supported); + HDputs(not_supported); #endif /* H5_HAVE_FILTER_DEFLATE */ return 0; diff --git a/test/gen_filters.c b/test/gen_filters.c index 502e041..0d107a9 100644 --- a/test/gen_filters.c +++ b/test/gen_filters.c @@ -243,12 +243,12 @@ main(void) if (nerrors) goto error; - printf("All tests passed.\n"); + HDprintf("All tests passed.\n"); return 0; error: nerrors = MAX(1, nerrors); - printf("***** %d GEN_FILTERS FAILURES *****\n", nerrors); + HDprintf("***** %d GEN_FILTERS FAILURES *****\n", nerrors); return 1; } diff --git a/test/getname.c b/test/getname.c index 61feee6..0cf9768 100644 --- a/test/getname.c +++ b/test/getname.c @@ -3787,7 +3787,7 @@ main(void) if (nerrors) goto error; - puts("All getname tests passed."); + HDputs("All getname tests passed."); h5_cleanup(FILENAME, fapl); @@ -3797,7 +3797,7 @@ error: H5E_BEGIN_TRY { H5Fclose(file_id); } H5E_END_TRY; - puts("***** GET NAME TESTS FAILED *****"); + HDputs("***** GET NAME TESTS FAILED *****"); return 1; } diff --git a/test/gheap.c b/test/gheap.c index 51e1dd2..1a8a4c0 100644 --- a/test/gheap.c +++ b/test/gheap.c @@ -42,9 +42,9 @@ nerrors++; \ if (nerrors <= GHEAP_REPEATED_ERR_LIM) { \ H5_FAILED(); \ - puts(MSG); \ + HDputs(MSG); \ if (nerrors == GHEAP_REPEATED_ERR_LIM) \ - puts(" Suppressing further errors..."); \ + HDputs(" Suppressing further errors..."); \ } /* end if */ \ } /* end GHEAP_REPEATED_ERR */ @@ -226,7 +226,7 @@ test_2(hid_t fapl) HDputs(" Unable to read object"); nerrors++; } - else if (memcmp(in, out, size)) { + else if (HDmemcmp(in, out, size)) { H5_FAILED(); HDputs(" Value read doesn't match value written"); nerrors++; diff --git a/test/hdfs.c b/test/hdfs.c index ee66314..701df47 100644 --- a/test/hdfs.c +++ b/test/hdfs.c @@ -303,7 +303,7 @@ *---------------------------------------------------------------------------- */ #define JSVERIFY_STR(expected, actual, reason) \ - if (strcmp((actual), (expected)) != 0) { \ + if (HDstrcmp((actual), (expected)) != 0) { \ JSERR_STR((expected), (actual), (reason)); \ goto error; \ } /* JSVERIFY_STR */ @@ -348,7 +348,7 @@ *---------------------------------------------------------------------------- */ #define JSVERIFY_STR(actual, expected, reason) \ - if (strcmp((actual), (expected)) != 0) { \ + if (HDstrcmp((actual), (expected)) != 0) { \ JSERR_STR((expected), (actual), (reason)); \ goto error; \ } /* JSVERIFY_STR */ @@ -414,8 +414,8 @@ test_fapl_config_validation(void) #ifndef H5_HAVE_LIBHDFS TESTING("HDFS fapl configuration validation"); SKIPPED(); - puts(" HDFS VFD is not enabled"); - fflush(stdout); + HDputs(" HDFS VFD is not enabled"); + HDfflush(stdout); return 0; #else @@ -620,8 +620,8 @@ test_hdfs_fapl(void) #ifndef H5_HAVE_LIBHDFS TESTING("HDFS fapl "); SKIPPED(); - puts(" HDFS VFD is not enabled"); - fflush(stdout); + HDputs(" HDFS VFD is not enabled"); + HDfflush(stdout); return 0; #else @@ -703,8 +703,8 @@ test_vfd_open(void) #ifndef H5_HAVE_LIBHDFS TESTING("HDFS VFD-level open"); SKIPPED(); - puts(" HDFS VFD is not enabled"); - fflush(stdout); + HDputs(" HDFS VFD is not enabled"); + HDfflush(stdout); return 0; #else @@ -956,8 +956,8 @@ test_eof_eoa(void) #ifndef H5_HAVE_LIBHDFS TESTING("HDFS eof/eoa gets and sets"); SKIPPED(); - puts(" HDFS VFD is not enabled"); - fflush(stdout); + HDputs(" HDFS VFD is not enabled"); + HDfflush(stdout); return 0; #else @@ -1066,8 +1066,8 @@ test_H5FDread_without_eoa_set_fails(void) #ifndef H5_HAVE_LIBHDFS TESTING("HDFS VFD read-eoa temporal coupling library limitation"); SKIPPED(); - puts(" HDFS VFD is not enabled"); - fflush(stdout); + HDputs(" HDFS VFD is not enabled"); + HDfflush(stdout); return 0; #else @@ -1165,8 +1165,8 @@ test_read(void) #ifndef H5_HAVE_LIBHDFS TESTING("HDFS VFD read/range-gets"); SKIPPED(); - puts(" HDFS VFD is not enabled"); - fflush(stdout); + HDputs(" HDFS VFD is not enabled"); + HDfflush(stdout); return 0; #else @@ -1376,8 +1376,8 @@ test_noops_and_autofails(void) #ifndef H5_HAVE_LIBHDFS TESTING("HDFS VFD always-fail and no-op routines"); SKIPPED(); - puts(" HDFS VFD is not enabled"); - fflush(stdout); + HDputs(" HDFS VFD is not enabled"); + HDfflush(stdout); return 0; #else @@ -1528,8 +1528,8 @@ test_H5F_integration(void) #ifndef H5_HAVE_LIBHDFS TESTING("HDFS file access through HD5F library (H5F API)"); SKIPPED(); - puts(" HDFS VFD is not enabled"); - fflush(stdout); + HDputs(" HDFS VFD is not enabled"); + HDfflush(stdout); return 0; #else @@ -1597,7 +1597,7 @@ error: #if HDFS_TEST_DEBUG HDprintf("\nerror!"); - fflush(stdout); + HDfflush(stdout); #endif /* HDFS_TEST_DEBUG */ if (fapl_id >= 0) { diff --git a/test/hyperslab.c b/test/hyperslab.c index 43992de..5c7b78f 100644 --- a/test/hyperslab.c +++ b/test/hyperslab.c @@ -177,7 +177,7 @@ test_fill(size_t nx, size_t ny, size_t nz, size_t di, size_t dj, size_t dk, size } /* end else */ HDsprintf(s, "Testing hyperslab fill %-11s variable hyperslab", dim); HDprintf("%-70s", s); - fflush(stdout); + HDfflush(stdout); /* Allocate array */ if (NULL == (dst = (uint8_t *)HDcalloc((size_t)1, nx * ny * nz))) @@ -366,7 +366,7 @@ test_copy(int mode, size_t nx, size_t ny, size_t nz, size_t di, size_t dj, size_ HDsprintf(s, "Testing hyperslab copy %-11s %s", dim, sub); HDprintf("%-70s", s); - fflush(stdout); + HDfflush(stdout); /* * Allocate arrays @@ -575,7 +575,7 @@ test_multifill(size_t nx) hsize_t i, j; HDprintf("%-70s", "Testing multi-byte fill value"); - fflush(stdout); + HDfflush(stdout); /* Initialize the source and destination */ if (NULL == (src = (struct a_struct *)HDmalloc(nx * sizeof(*src)))) @@ -687,7 +687,7 @@ test_endian(size_t nx) hsize_t i, j; HDprintf("%-70s", "Testing endian conversion by stride"); - fflush(stdout); + HDfflush(stdout); /* Initialize arrays */ if (NULL == (src = (uint8_t *)HDmalloc(nx * 4))) @@ -773,7 +773,7 @@ test_transpose(size_t nx, size_t ny) HDsprintf(s, "Testing 2d transpose by stride %4lux%-lud", (unsigned long)nx, (unsigned long)ny); HDprintf("%-70s", s); - fflush(stdout); + HDfflush(stdout); /* Initialize */ if (NULL == (src = (int *)HDmalloc(nx * ny * sizeof(*src)))) @@ -872,7 +872,7 @@ test_sub_super(size_t nx, size_t ny) HDsprintf(s, "Testing image sampling %4lux%-4lu to %4lux%-4lu ", (unsigned long)(2 * nx), (unsigned long)(2 * ny), (unsigned long)nx, (unsigned long)ny); HDprintf("%-70s", s); - fflush(stdout); + HDfflush(stdout); /* Initialize */ if (NULL == (full = (uint8_t *)HDmalloc(4 * nx * ny))) @@ -922,7 +922,7 @@ test_sub_super(size_t nx, size_t ny) HDsprintf(s, "Testing image sampling %4lux%-4lu to %4lux%-4lu ", (unsigned long)nx, (unsigned long)ny, (unsigned long)(2 * nx), (unsigned long)(2 * ny)); HDprintf("%-70s", s); - fflush(stdout); + HDfflush(stdout); /* Setup stride */ size[0] = nx; diff --git a/test/istore.c b/test/istore.c index a724359..c600c31 100644 --- a/test/istore.c +++ b/test/istore.c @@ -619,13 +619,13 @@ main(int argc, char *argv[]) else { int i; for (i = 1, size_of_test = 0; i < argc; i++) { - if (!strcmp(argv[i], "small")) { + if (!HDstrcmp(argv[i], "small")) { size_of_test |= TEST_SMALL; } - else if (!strcmp(argv[i], "medium")) { + else if (!HDstrcmp(argv[i], "medium")) { size_of_test |= TEST_MEDIUM; } - else if (!strcmp(argv[i], "large")) { + else if (!HDstrcmp(argv[i], "large")) { size_of_test |= TEST_LARGE; } else { diff --git a/test/lheap.c b/test/lheap.c index 17e3082..27e025e 100644 --- a/test/lheap.c +++ b/test/lheap.c @@ -103,7 +103,7 @@ main(void) if (j > 4) buf[j] = '\0'; - if (UFAIL == (obj[i] = H5HL_insert(f, heap, strlen(buf) + 1, buf))) { + if (UFAIL == (obj[i] = H5HL_insert(f, heap, HDstrlen(buf) + 1, buf))) { H5_FAILED(); H5Eprint2(H5E_DEFAULT, stdout); goto error; @@ -155,7 +155,7 @@ main(void) goto error; } - if (strcmp(s, buf)) { + if (HDstrcmp(s, buf)) { H5_FAILED(); HDprintf(" i=%d, heap offset=%lu\n", i, (unsigned long)(obj[i])); HDprintf(" got: \"%s\"\n", s); diff --git a/test/links.c b/test/links.c index 43cd83d..f0932dc 100644 --- a/test/links.c +++ b/test/links.c @@ -14138,7 +14138,7 @@ UD_cb_create(const char *link_name, hid_t loc_group, const void *udata, size_t u if (lcpl_id < 0) TEST_ERROR - if (HDstrcmp(link_name, UD_CB_LINK_NAME) && strcmp(link_name, NEW_UD_CB_LINK_NAME)) + if (HDstrcmp(link_name, UD_CB_LINK_NAME) && HDstrcmp(link_name, NEW_UD_CB_LINK_NAME)) TEST_ERROR if (HDstrcmp((const char *)udata, UD_CB_TARGET)) TEST_ERROR @@ -14165,7 +14165,7 @@ UD_cb_traverse(const char *link_name, hid_t cur_group, const void *udata, size_t if (udata_size > 0 && !udata) TEST_ERROR - if (HDstrcmp(link_name, UD_CB_LINK_NAME) && strcmp(link_name, NEW_UD_CB_LINK_NAME)) + if (HDstrcmp(link_name, UD_CB_LINK_NAME) && HDstrcmp(link_name, NEW_UD_CB_LINK_NAME)) TEST_ERROR if (HDstrcmp((const char *)udata, UD_CB_TARGET)) TEST_ERROR @@ -14537,7 +14537,7 @@ lapl_udata(hid_t fapl, hbool_t new_format) TEST_ERROR /* Now use the same ud link to access group_b */ - strcpy(group_b_name, "group_b"); + HDstrcpy(group_b_name, "group_b"); if (H5Pset(plist_id, DEST_PROP_NAME, group_b_name) < 0) TEST_ERROR @@ -14851,7 +14851,7 @@ ud_link_errors(hid_t fapl, hbool_t new_format) H5E_END_TRY; /* Create a user-defined link to the group. */ - strcpy(group_name, "/group"); + HDstrcpy(group_name, "/group"); if (H5Lcreate_ud(fid, "/ud_link", (H5L_type_t)UD_CBFAIL_TYPE, &group_name, HDstrlen(group_name) + 1, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR diff --git a/test/links_env.c b/test/links_env.c index 0e5d1c0..2cfa3fa 100644 --- a/test/links_env.c +++ b/test/links_env.c @@ -112,7 +112,7 @@ external_link_env(hid_t fapl, hbool_t new_format) /* Should be able to find the target file from pathnames set via HDF5_EXT_PREFIX */ if (gid < 0) { H5_FAILED(); - puts(" Should have found the file in tmp_links_env directory."); + HDputs(" Should have found the file in tmp_links_env directory."); goto error; } @@ -6112,7 +6112,7 @@ test_mf_bug1(const char *env_h5_drvr, hid_t fapl) /* Free memb_name */ for (mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++) - free(memb_name[mt]); + HDfree(memb_name[mt]); } /* end else */ /* Close memb_fapl */ @@ -7685,7 +7685,7 @@ set_multi_split(hid_t fapl, hsize_t pagesize, hbool_t is_multi_or_split) /* Free memb_name */ for (mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++) - free(memb_name[mt]); + HDfree(memb_name[mt]); return 0; @@ -8841,7 +8841,7 @@ test_page_alignment(const char *env_h5_drvr, hid_t fapl) /* Free memb_name */ for (mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++) - free(memb_name[mt]); + HDfree(memb_name[mt]); /* Close memb_fapl */ if (H5Pclose(memb_fapl) < 0) diff --git a/test/mirror_vfd.c b/test/mirror_vfd.c index 325999b..43141e0 100644 --- a/test/mirror_vfd.c +++ b/test/mirror_vfd.c @@ -63,8 +63,8 @@ static unsigned int g_verbosity = DEFAULT_VERBOSITY; #define LOGPRINT(lvl, ...) \ do { \ if ((lvl) <= g_verbosity) { \ - fprintf(g_log_stream, __VA_ARGS__); \ - fflush(g_log_stream); \ + HDfprintf(g_log_stream, __VA_ARGS__); \ + HDfflush(g_log_stream); \ } \ } while (0) @@ -150,7 +150,7 @@ _populate_filepath(const char *dirname, const char *_basename, hid_t fapl_id, ch } if (HDsnprintf(_path, H5FD_SPLITTER_PATH_MAX, "%s%s%s", dirname, - (dirname[strlen(dirname)] == '/') ? "" : "/", /* slash iff needed */ + (dirname[HDstrlen(dirname)] == '/') ? "" : "/", /* slash iff needed */ _basename) > H5FD_SPLITTER_PATH_MAX) { TEST_ERROR; } diff --git a/test/mtime.c b/test/mtime.c index c28b81a..a8ad6ae 100644 --- a/test/mtime.c +++ b/test/mtime.c @@ -147,7 +147,7 @@ main(void) H5_FAILED(); /* If this fails, examine H5Omtime.c. Modification time is very * system dependent (e.g., on Windows DST must be hardcoded). */ - puts(" Old modification time incorrect"); + HDputs(" Old modification time incorrect"); goto error; } if (H5Fclose(file) < 0) diff --git a/test/objcopy.c b/test/objcopy.c index 383bd05..876e7de 100644 --- a/test/objcopy.c +++ b/test/objcopy.c @@ -4494,7 +4494,7 @@ test_copy_dataset_compressed(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid #ifndef H5_HAVE_FILTER_DEFLATE SKIPPED(); - puts(" Deflation filter not available"); + HDputs(" Deflation filter not available"); #else /* H5_HAVE_FILTER_DEFLATE */ /* set initial data values */ for (i = 0; i < DIM_SIZE_1; i++) @@ -4919,7 +4919,7 @@ test_copy_dataset_no_edge_filt(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, h #ifndef H5_HAVE_FILTER_DEFLATE SKIPPED(); - puts(" Deflation filter not available"); + HDputs(" Deflation filter not available"); #else /* H5_HAVE_FILTER_DEFLATE */ /* set initial data values */ for (i = 0; i < DIM_SIZE_1; i++) @@ -7273,7 +7273,7 @@ test_copy_dataset_compressed_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, #ifndef H5_HAVE_FILTER_DEFLATE SKIPPED(); - puts(" Deflation filter not available"); + HDputs(" Deflation filter not available"); #else /* H5_HAVE_FILTER_DEFLATE */ /* set initial data values */ for (i = 0; i < DIM_SIZE_1; i++) { diff --git a/test/page_buffer.c b/test/page_buffer.c index ca33872..abbae32 100644 --- a/test/page_buffer.c +++ b/test/page_buffer.c @@ -349,7 +349,7 @@ set_multi_split(const char *env_h5_drvr, hid_t fapl, hsize_t pagesize) /* Free memb_name */ for (mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++) - free(memb_name[mt]); + HDfree(memb_name[mt]); } /* end if */ diff --git a/test/pool.c b/test/pool.c index 05304e5..ef2a627 100644 --- a/test/pool.c +++ b/test/pool.c @@ -784,11 +784,11 @@ main(void) if (nerrors) goto error; - puts("All memory pool tests passed."); + HDputs("All memory pool tests passed."); return 0; error: - puts("*** TESTS FAILED ***"); + HDputs("*** TESTS FAILED ***"); return 1; } diff --git a/test/ros3.c b/test/ros3.c index 7ecba0e..654082b 100644 --- a/test/ros3.c +++ b/test/ros3.c @@ -318,7 +318,7 @@ jserr_str(const char *expected, const char *actual, const char *reason) *---------------------------------------------------------------------------- */ #define JSVERIFY_STR(expected, actual, reason) \ - if (strcmp((actual), (expected)) != 0) { \ + if (HDstrcmp((actual), (expected)) != 0) { \ JSERR_STR((expected), (actual), (reason)); \ goto error; \ } /* JSVERIFY_STR */ @@ -363,7 +363,7 @@ jserr_str(const char *expected, const char *actual, const char *reason) *---------------------------------------------------------------------------- */ #define JSVERIFY_STR(actual, expected, reason) \ - if (strcmp((actual), (expected)) != 0) { \ + if (HDstrcmp((actual), (expected)) != 0) { \ JSERR_STR((expected), (actual), (reason)); \ goto error; \ } /* JSVERIFY_STR */ @@ -560,8 +560,8 @@ test_fapl_config_validation(void) if (FALSE == s3_test_bucket_defined) { SKIPPED(); - puts(" environment variable HDF5_ROS3_TEST_BUCKET_URL not defined"); - fflush(stdout); + HDputs(" environment variable HDF5_ROS3_TEST_BUCKET_URL not defined"); + HDfflush(stdout); return 0; } @@ -835,8 +835,8 @@ test_vfd_open(void) if (FALSE == s3_test_bucket_defined) { SKIPPED(); - puts(" environment variable HDF5_ROS3_TEST_BUCKET_URL not defined"); - fflush(stdout); + HDputs(" environment variable HDF5_ROS3_TEST_BUCKET_URL not defined"); + HDfflush(stdout); return 0; } @@ -969,15 +969,15 @@ test_eof_eoa(void) if (s3_test_credentials_loaded == 0) { SKIPPED(); - puts(" s3 credentials are not loaded"); - fflush(stdout); + HDputs(" s3 credentials are not loaded"); + HDfflush(stdout); return 0; } if (FALSE == s3_test_bucket_defined) { SKIPPED(); - puts(" environment variable HDF5_ROS3_TEST_BUCKET_URL not defined"); - fflush(stdout); + HDputs(" environment variable HDF5_ROS3_TEST_BUCKET_URL not defined"); + HDfflush(stdout); return 0; } @@ -1077,15 +1077,15 @@ test_H5FDread_without_eoa_set_fails(void) if (s3_test_credentials_loaded == 0) { SKIPPED(); - puts(" s3 credentials are not loaded"); - fflush(stdout); + HDputs(" s3 credentials are not loaded"); + HDfflush(stdout); return 0; } if (FALSE == s3_test_bucket_defined) { SKIPPED(); - puts(" environment variable HDF5_ROS3_TEST_BUCKET_URL not defined"); - fflush(stdout); + HDputs(" environment variable HDF5_ROS3_TEST_BUCKET_URL not defined"); + HDfflush(stdout); return 0; } @@ -1248,15 +1248,15 @@ test_read(void) if (s3_test_credentials_loaded == 0) { SKIPPED(); - puts(" s3 credentials are not loaded"); - fflush(stdout); + HDputs(" s3 credentials are not loaded"); + HDfflush(stdout); return 0; } if (FALSE == s3_test_bucket_defined) { SKIPPED(); - puts(" environment variable HDF5_ROS3_TEST_BUCKET_URL not defined"); - fflush(stdout); + HDputs(" environment variable HDF5_ROS3_TEST_BUCKET_URL not defined"); + HDfflush(stdout); return 0; } @@ -1389,8 +1389,8 @@ test_noops_and_autofails(void) if (FALSE == s3_test_bucket_defined) { SKIPPED(); - puts(" environment variable HDF5_ROS3_TEST_BUCKET_URL not defined"); - fflush(stdout); + HDputs(" environment variable HDF5_ROS3_TEST_BUCKET_URL not defined"); + HDfflush(stdout); return 0; } @@ -1515,15 +1515,15 @@ test_cmp(void) if (s3_test_credentials_loaded == 0) { SKIPPED(); - puts(" s3 credentials are not loaded"); - fflush(stdout); + HDputs(" s3 credentials are not loaded"); + HDfflush(stdout); return 0; } if (FALSE == s3_test_bucket_defined) { SKIPPED(); - puts(" environment variable HDF5_ROS3_TEST_BUCKET_URL not defined"); - fflush(stdout); + HDputs(" environment variable HDF5_ROS3_TEST_BUCKET_URL not defined"); + HDfflush(stdout); return 0; } @@ -1636,15 +1636,15 @@ test_H5F_integration(void) if (s3_test_credentials_loaded == 0) { SKIPPED(); - puts(" s3 credentials are not loaded"); - fflush(stdout); + HDputs(" s3 credentials are not loaded"); + HDfflush(stdout); return 0; } if (FALSE == s3_test_bucket_defined) { SKIPPED(); - puts(" environment variable HDF5_ROS3_TEST_BUCKET_URL not defined"); - fflush(stdout); + HDputs(" environment variable HDF5_ROS3_TEST_BUCKET_URL not defined"); + HDfflush(stdout); return 0; } @@ -1691,7 +1691,7 @@ error: * CLEANUP * ***********/ HDprintf("\nerror!"); - fflush(stdout); + HDfflush(stdout); if (fapl_id >= 0) { H5E_BEGIN_TRY { (void)H5Pclose(fapl_id); } diff --git a/test/s3comms.c b/test/s3comms.c index 862914e..c6173fd 100644 --- a/test/s3comms.c +++ b/test/s3comms.c @@ -311,7 +311,7 @@ jserr_str(const char *expected, const char *actual, const char *reason) *---------------------------------------------------------------------------- */ #define JSVERIFY_STR(expected, actual, reason) \ - if (strcmp((actual), (expected)) != 0) { \ + if (HDstrcmp((actual), (expected)) != 0) { \ JSERR_STR((expected), (actual), (reason)); \ goto error; \ } /* JSVERIFY_STR */ @@ -359,7 +359,7 @@ jserr_str(const char *expected, const char *actual, const char *reason) *---------------------------------------------------------------------------- */ #define JSVERIFY_STR(actual, expected, reason) \ - if (strcmp((actual), (expected)) != 0) { \ + if (HDstrcmp((actual), (expected)) != 0) { \ JSERR_STR((expected), (actual), (reason)); \ goto error; \ } /* JSVERIFY_STR */ @@ -1281,10 +1281,10 @@ test_HMAC_SHA256(void) cases[i].msg); if (cases[i].ret == SUCCEED) { #ifdef VERBOSE - if (0 != strncmp(cases[i].exp, dest, HDstrlen(cases[i].exp))) { + if (0 != HDstrncmp(cases[i].exp, dest, HDstrlen(cases[i].exp))) { /* print out how wrong things are, and then fail */ - dest = (char *)realloc(dest, cases[i].dest_size + 1); + dest = (char *)HDrealloc(dest, cases[i].dest_size + 1); HDassert(dest != NULL); dest[cases[i].dest_size] = 0; HDfprintf(stdout, "ERROR:\n!!! \"%s\"\n != \"%s\"\n", cases[i].exp, dest); @@ -1293,17 +1293,17 @@ test_HMAC_SHA256(void) #else /* VERBOSE not defined */ /* simple pass/fail test */ - JSVERIFY(0, strncmp(cases[i].exp, dest, HDstrlen(cases[i].exp)), NULL); + JSVERIFY(0, HDstrncmp(cases[i].exp, dest, HDstrlen(cases[i].exp)), NULL); #endif /* VERBOSE */ } - free(dest); + HDfree(dest); } PASSED(); return 0; error: - free(dest); + HDfree(dest); return -1; } /* end test_HMAC_SHA256() */ @@ -1369,9 +1369,9 @@ test_nlowercase(void) JSVERIFY(SUCCEED, H5FD_s3comms_nlowercase(dest, cases[i].in, cases[i].len), cases[i].in) if (cases[i].len > 0) { - JSVERIFY(0, strncmp(dest, cases[i].exp, cases[i].len), NULL) + JSVERIFY(0, HDstrncmp(dest, cases[i].exp, cases[i].len), NULL) } - free(dest); + HDfree(dest); } /* end for each testcase */ JSVERIFY(FAIL, H5FD_s3comms_nlowercase(NULL, cases[0].in, cases[0].len), "null distination should fail") @@ -1380,7 +1380,7 @@ test_nlowercase(void) return 0; error: - free(dest); + HDfree(dest); return -1; } /* end test_nlowercase() */ @@ -1741,7 +1741,7 @@ test_percent_encode_char(void) JSVERIFY(SUCCEED, H5FD_s3comms_percent_encode_char(dest, (const unsigned char)cases[i].c, &dest_len), NULL) JSVERIFY(cases[i].exp_len, dest_len, NULL) - JSVERIFY(0, strncmp(dest, cases[i].exp, dest_len), NULL) + JSVERIFY(0, HDstrncmp(dest, cases[i].exp, dest_len), NULL) JSVERIFY_STR(cases[i].exp, dest, NULL) } @@ -1780,8 +1780,8 @@ test_s3r_get_filesize(void) */ if (FALSE == s3_test_bucket_defined) { SKIPPED(); - puts(" environment variable HDF5_ROS3_TEST_BUCKET_URL not defined"); - fflush(stdout); + HDputs(" environment variable HDF5_ROS3_TEST_BUCKET_URL not defined"); + HDfflush(stdout); return 0; } @@ -1840,14 +1840,14 @@ test_s3r_open(void) if (s3_test_credentials_loaded == 0) { SKIPPED(); - puts(" s3 credentials are not loaded"); - fflush(stdout); + HDputs(" s3 credentials are not loaded"); + HDfflush(stdout); return 0; } if (FALSE == s3_test_bucket_defined) { SKIPPED(); - puts(" environment variable HDF5_ROS3_TEST_BUCKET_URL not defined"); - fflush(stdout); + HDputs(" environment variable HDF5_ROS3_TEST_BUCKET_URL not defined"); + HDfflush(stdout); return 0; } @@ -1873,7 +1873,7 @@ test_s3r_open(void) FAIL_IF(purl->port == NULL); FAIL_IF(5 < HDsnprintf(purl->port, 5, "9000")) } - else if (strcmp(purl->port, "9000") != 0) { + else if (HDstrcmp(purl->port, "9000") != 0) { FAIL_IF(5 < HDsnprintf(purl->port, 5, "9000")) } else { @@ -2044,8 +2044,8 @@ test_s3r_read(void) */ if (FALSE == s3_test_bucket_defined) { SKIPPED(); - puts(" environment variable HDF5_ROS3_TEST_BUCKET_URL not defined"); - fflush(stdout); + HDputs(" environment variable HDF5_ROS3_TEST_BUCKET_URL not defined"); + HDfflush(stdout); return 0; } @@ -2105,7 +2105,7 @@ test_s3r_read(void) JSVERIFY(SUCCEED, H5FD_s3comms_s3r_read(handle, (haddr_t)6370, (size_t)0, buffer), NULL) JSVERIFY( 0, - strncmp( + HDstrncmp( buffer, "And my soul from out that shadow that lies floating on the floor\nShall be lifted—nevermore!\n", 94), @@ -2122,7 +2122,7 @@ test_s3r_read(void) H5FD_s3comms_s3r_read(handle, (haddr_t)6400, (size_t)100, /* 6400+100 > 6464 */ buffer), NULL) - JSVERIFY(0, strcmp("", buffer), NULL) + JSVERIFY(0, HDstrcmp("", buffer), NULL) /************************ * read starts past eof * @@ -2132,14 +2132,14 @@ test_s3r_read(void) H5FD_s3comms_s3r_read(handle, (haddr_t)1200699, /* 1200699 > 6464 */ (size_t)100, buffer), NULL) - JSVERIFY(0, strcmp("", buffer), NULL) + JSVERIFY(0, HDstrcmp("", buffer), NULL) /********************** * read starts on eof * **********************/ JSVERIFY(FAIL, H5FD_s3comms_s3r_read(handle, (haddr_t)6464, (size_t)0, buffer), NULL) - JSVERIFY(0, strcmp("", buffer), NULL) + JSVERIFY(0, HDstrcmp("", buffer), NULL) /************* * TEAR DOWN * @@ -2229,10 +2229,10 @@ test_signing_key(void) JSVERIFY(SUCCEED, H5FD_s3comms_signing_key(key, cases[i].secret_key, cases[i].region, cases[i].when), NULL) - JSVERIFY(0, strncmp((const char *)cases[i].exp, (const char *)key, SHA256_DIGEST_LENGTH), + JSVERIFY(0, HDstrncmp((const char *)cases[i].exp, (const char *)key, SHA256_DIGEST_LENGTH), (const char *)cases[i].exp) - free(key); + HDfree(key); key = NULL; } @@ -2255,7 +2255,7 @@ test_signing_key(void) JSVERIFY(FAIL, H5FD_s3comms_signing_key(key, cases[0].secret_key, cases[0].region, NULL), "time string cannot be NULL") - free(key); + HDfree(key); key = NULL; PASSED(); @@ -2263,7 +2263,7 @@ test_signing_key(void) error: if (key != NULL) { - free(key); + HDfree(key); } return -1; @@ -2411,9 +2411,9 @@ test_trim(void) JSVERIFY(SUCCEED, H5FD_s3comms_trim(dest, str, cases[i].in_len, &dest_len), NULL) JSVERIFY(cases[i].exp_len, dest_len, cases[i].in) if (dest_len > 0) { - JSVERIFY(0, strncmp(cases[i].exp, dest, dest_len), cases[i].exp) + JSVERIFY(0, HDstrncmp(cases[i].exp, dest, dest_len), cases[i].exp) } - free(str); + HDfree(str); str = NULL; } /* end for each testcase */ @@ -2424,9 +2424,9 @@ test_trim(void) HDassert(str == NULL); str = (char *)HDmalloc(sizeof(char *) * 11); HDassert(str != NULL); - memcpy(str, "some text ", 11); /* string with null terminator */ + HDmemcpy(str, "some text ", 11); /* string with null terminator */ JSVERIFY(FAIL, H5FD_s3comms_trim(NULL, str, 10, &dest_len), "destination for trim cannot be NULL"); - free(str); + HDfree(str); str = NULL; PASSED(); @@ -2434,7 +2434,7 @@ test_trim(void) error: if (str != NULL) { - free(str); + HDfree(str); } return -1; @@ -2525,9 +2525,9 @@ test_uriencode(void) H5FD_s3comms_uriencode(dest, cases[i].str, str_len, cases[i].encode_slash, &dest_written), NULL); JSVERIFY(HDstrlen(cases[i].expected), dest_written, NULL) - JSVERIFY(0, strncmp(dest, cases[i].expected, dest_written), cases[i].expected); + JSVERIFY(0, HDstrncmp(dest, cases[i].expected, dest_written), cases[i].expected); - free(dest); + HDfree(dest); dest = NULL; } /* end for each testcase */ @@ -2543,7 +2543,7 @@ test_uriencode(void) JSVERIFY(FAIL, H5FD_s3comms_uriencode(dest, NULL, 5, false, &dest_written), "source string cannot be NULL"); - free(dest); + HDfree(dest); dest = NULL; PASSED(); @@ -2551,7 +2551,7 @@ test_uriencode(void) error: if (dest != NULL) { - free(dest); + HDfree(dest); } return -1; diff --git a/test/set_extent.c b/test/set_extent.c index 133ba48..2ad4fd5 100644 --- a/test/set_extent.c +++ b/test/set_extent.c @@ -2621,7 +2621,7 @@ test_random_rank4_vl(hid_t fapl, hid_t dcpl, hbool_t do_fillvalue, hbool_t disab TEST_ERROR if (H5Treclaim(type, mspace, H5P_DEFAULT, wbuf) < 0) TEST_ERROR - free(fill_value.p); + HDfree(fill_value.p); if (H5Sclose(mspace) < 0) TEST_ERROR if (H5Pclose(my_dcpl) < 0) diff --git a/test/tarray.c b/test/tarray.c index ba0982f..d278f51 100644 --- a/test/tarray.c +++ b/test/tarray.c @@ -2222,5 +2222,5 @@ test_array(void) void cleanup_array(void) { - remove(FILENAME); + HDremove(FILENAME); } /* end cleanup_array() */ diff --git a/test/tcoords.c b/test/tcoords.c index e92bdde..a52851d 100644 --- a/test/tcoords.c +++ b/test/tcoords.c @@ -87,10 +87,10 @@ test_singleEnd_selElements(hid_t file, hbool_t is_chunked) } /* Construct dataset's name */ - memset(dset_name, 0, (size_t)NAME_LEN); - strcat(dset_name, SINGLE_END_DSET); + HDmemset(dset_name, 0, (size_t)NAME_LEN); + HDstrcat(dset_name, SINGLE_END_DSET); if (is_chunked) - strcat(dset_name, "_chunked"); + HDstrcat(dset_name, "_chunked"); did = H5Dcreate2(file, dset_name, H5T_NATIVE_INT, sid, H5P_DEFAULT, plid, H5P_DEFAULT); CHECK(did, FAIL, "H5Dcreate2"); @@ -259,10 +259,10 @@ test_singleEnd_selHyperslab(hid_t file, hbool_t is_chunked) hsize_t mem3_block[4] = {1, 3, 6, 1}; /* Construct dataset's name */ - memset(dset_name, 0, NAME_LEN); - strcat(dset_name, SINGLE_END_DSET); + HDmemset(dset_name, 0, NAME_LEN); + HDstrcat(dset_name, SINGLE_END_DSET); if (is_chunked) - strcat(dset_name, "_chunked"); + HDstrcat(dset_name, "_chunked"); /* Dataspace for the dataset in file */ sid = H5Screate_simple(4, da_dims, da_dims); @@ -436,10 +436,10 @@ test_multiple_ends(hid_t file, hbool_t is_chunked) } /* Construct dataset's name */ - memset(dset_name, 0, NAME_LEN); - strcat(dset_name, MULTI_ENDS_SEL_HYPER_DSET); + HDmemset(dset_name, 0, NAME_LEN); + HDstrcat(dset_name, MULTI_ENDS_SEL_HYPER_DSET); if (is_chunked) - strcat(dset_name, "_chunked"); + HDstrcat(dset_name, "_chunked"); did = H5Dcreate2(file, dset_name, H5T_NATIVE_INT, sid, H5P_DEFAULT, plid, H5P_DEFAULT); CHECK(did, FAIL, "H5Dcreate2"); @@ -687,5 +687,5 @@ test_coords(void) void cleanup_coords(void) { - remove(FILENAME); + HDremove(FILENAME); } diff --git a/test/testframe.c b/test/testframe.c index 22f694e..bf6a0e8 100644 --- a/test/testframe.c +++ b/test/testframe.c @@ -442,15 +442,15 @@ GetTestExpress(void) /* set it here for now. Should be done in something like h5test_init(). */ if (TestExpress == -1) { - env_val = getenv("HDF5TestExpress"); + env_val = HDgetenv("HDF5TestExpress"); if (env_val == NULL) SetTestExpress(1); - else if (strcmp(env_val, "0") == 0) + else if (HDstrcmp(env_val, "0") == 0) SetTestExpress(0); - else if (strcmp(env_val, "1") == 0) + else if (HDstrcmp(env_val, "1") == 0) SetTestExpress(1); - else if (strcmp(env_val, "2") == 0) + else if (HDstrcmp(env_val, "2") == 0) SetTestExpress(2); else SetTestExpress(3); @@ -521,7 +521,7 @@ ParseTestVerbosity(char *argv) else if (*argv == 'h') SetTestVerbosity(VERBO_HI); else - SetTestVerbosity(atoi(argv)); + SetTestVerbosity(HDatoi(argv)); } /* diff --git a/test/testhdf5.c b/test/testhdf5.c index 152719a..ab79f28 100644 --- a/test/testhdf5.c +++ b/test/testhdf5.c @@ -82,7 +82,7 @@ main(int argc, char *argv[]) TestSummary(); /* Clean up test files, if allowed */ - if (GetTestCleanup() && !getenv("HDF5_NOCLEANUP")) + if (GetTestCleanup() && !HDgetenv("HDF5_NOCLEANUP")) TestCleanup(); /* Release test infrastructure */ diff --git a/test/testmeta.c b/test/testmeta.c index fee1954..c3044a6 100644 --- a/test/testmeta.c +++ b/test/testmeta.c @@ -83,7 +83,7 @@ main(void) for (i = 0; i < NEXTARRAYS; i++) { /* Create dataset */ - sprintf(name, "/ExtArray%06d", i); + HDsprintf(name, "/ExtArray%06d", i); dataset_id = H5Dcreate2(file_id, name, H5T_NATIVE_FLOAT, dataspace_id, H5P_DEFAULT, prop_id, H5P_DEFAULT); @@ -103,7 +103,7 @@ main(void) /* Removed print statement as it would lock system resources on Windows */ /* * HDprintf("\rWriting Object #%d of %d", j+1, NDATAOBJECTS); - * fflush(stdout); + * HDfflush(stdout); */ floatval = (float)j; diff --git a/test/tfile.c b/test/tfile.c index 2d42cc5..a0bceac 100644 --- a/test/tfile.c +++ b/test/tfile.c @@ -4195,7 +4195,7 @@ set_multi_split(hid_t fapl, hsize_t pagesize, hbool_t split) /* Free memb_name */ for (mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++) - free(memb_name[mt]); + HDfree(memb_name[mt]); return 0; diff --git a/test/tgenprop.c b/test/tgenprop.c index 910153c..c1d9cac 100644 --- a/test/tgenprop.c +++ b/test/tgenprop.c @@ -2172,5 +2172,5 @@ test_genprop(void) void cleanup_genprop(void) { - remove(FILENAME); + HDremove(FILENAME); } diff --git a/test/th5o.c b/test/th5o.c index 8885eb4..8b67159 100644 --- a/test/th5o.c +++ b/test/th5o.c @@ -1767,5 +1767,5 @@ test_h5o(void) void cleanup_h5o(void) { - remove(TEST_FILENAME); + HDremove(TEST_FILENAME); } diff --git a/test/th5s.c b/test/th5s.c index 07cb0ab..04ac2e6 100644 --- a/test/th5s.c +++ b/test/th5s.c @@ -1936,7 +1936,7 @@ test_h5s_encode_irregular_hyper(H5F_libver_t low, H5F_libver_t high) break; default: - assert(0); + HDassert(0); break; } @@ -3400,9 +3400,9 @@ test_h5s(void) void cleanup_h5s(void) { - remove(DATAFILE); - remove(NULLFILE); - remove(BASICFILE); - remove(ZEROFILE); - remove(VERBFNAME); + HDremove(DATAFILE); + HDremove(NULLFILE); + HDremove(BASICFILE); + HDremove(ZEROFILE); + HDremove(VERBFNAME); } diff --git a/test/thread_id.c b/test/thread_id.c index ce60893..d8ddaf8 100644 --- a/test/thread_id.c +++ b/test/thread_id.c @@ -73,7 +73,7 @@ pthread_barrier_init(pthread_barrier_t *barrier, const pthread_barrierattr_t *at if (attr != NULL) return EINVAL; - memset(barrier, 0, sizeof(*barrier)); + HDmemset(barrier, 0, sizeof(*barrier)); barrier->count = count; @@ -96,7 +96,7 @@ barrier_lock(pthread_barrier_t *barrier) int rc; if ((rc = pthread_mutex_lock(&barrier->mtx)) != 0) { - my_errx(EXIT_FAILURE, "%s: pthread_mutex_lock: %s", __func__, strerror(rc)); + my_errx(EXIT_FAILURE, "%s: pthread_mutex_lock: %s", __func__, HDstrerror(rc)); } } @@ -106,7 +106,7 @@ barrier_unlock(pthread_barrier_t *barrier) int rc; if ((rc = pthread_mutex_unlock(&barrier->mtx)) != 0) { - my_errx(EXIT_FAILURE, "%s: pthread_mutex_unlock: %s", __func__, strerror(rc)); + my_errx(EXIT_FAILURE, "%s: pthread_mutex_unlock: %s", __func__, HDstrerror(rc)); } } @@ -203,16 +203,16 @@ atomic_printf(const char *fmt, ...) va_list ap; ssize_t nprinted, nwritten; - va_start(ap, fmt); - nprinted = vsnprintf(buf, sizeof(buf), fmt, ap); - va_end(ap); + HDva_start(ap, fmt); + nprinted = HDvsnprintf(buf, sizeof(buf), fmt, ap); + HDva_end(ap); if (nprinted == -1) my_err(EXIT_FAILURE, "%s.%d: vsnprintf", __func__, __LINE__); else if (nprinted >= (ssize_t)sizeof(buf)) my_errx(EXIT_FAILURE, "%s.%d: vsnprintf overflowed", __func__, __LINE__); - nwritten = write(STDOUT_FILENO, buf, (size_t)nprinted); + nwritten = HDwrite(STDOUT_FILENO, buf, (size_t)nprinted); if (nwritten < nprinted) { my_errx(EXIT_FAILURE, "%s.%d: write error or short write", __func__, __LINE__); } diff --git a/test/timer.c b/test/timer.c index e907655..24f3245 100644 --- a/test/timer.c +++ b/test/timer.c @@ -146,7 +146,7 @@ test_timer_system_user(void) */ if (timer.initial.system < (double)0.0f || timer.initial.user < (double)0.0f) { SKIPPED(); - printf("NOTE: No suitable way to get system/user times on this platform.\n"); + HDprintf("NOTE: No suitable way to get system/user times on this platform.\n"); return 0; } @@ -383,7 +383,7 @@ main(void) h5_reset(); - printf("Testing platform-independent timer functionality.\n"); + HDprintf("Testing platform-independent timer functionality.\n"); nerrors += test_time_formatting() < 0 ? 1 : 0; nerrors += test_timer_system_user() < 0 ? 1 : 0; @@ -391,11 +391,12 @@ main(void) nerrors += test_timer_functionality() < 0 ? 1 : 0; if (nerrors) { - printf("***** %d platform-independent timer TEST%s FAILED! *****\n", nerrors, nerrors > 1 ? "S" : ""); + HDprintf("***** %d platform-independent timer TEST%s FAILED! *****\n", nerrors, + nerrors > 1 ? "S" : ""); return 1; } else { - printf("All platform-independent timer tests passed.\n"); + HDprintf("All platform-independent timer tests passed.\n"); return 0; } } diff --git a/test/titerate.c b/test/titerate.c index bcf19b9..050dcec 100644 --- a/test/titerate.c +++ b/test/titerate.c @@ -966,7 +966,7 @@ find_err_msg_cb(unsigned H5_ATTR_UNUSED n, const H5E_error2_t *err_desc, void *_ return H5_ITER_ERROR; /* If the searched error message is found, stop the iteration */ - if (err_desc->desc != NULL && strcmp(err_desc->desc, searched_err->message) == 0) { + if (err_desc->desc != NULL && HDstrcmp(err_desc->desc, searched_err->message) == 0) { searched_err->found = true; status = H5_ITER_STOP; } diff --git a/test/tmisc.c b/test/tmisc.c index a6db198..2d842be 100644 --- a/test/tmisc.c +++ b/test/tmisc.c @@ -2837,7 +2837,7 @@ test_misc16(void) if (HDstrlen(wdata[i]) != HDstrlen(rdata[i])) { TestErrPrintf( "Line %u: VL data length don't match!, strlen(wdata[%d])=%d, strlen(rdata[%d])=%d\n", - (unsigned)__LINE__, (int)i, (int)strlen(wdata[i]), (int)i, (int)strlen(rdata[i])); + (unsigned)__LINE__, (int)i, (int)HDstrlen(wdata[i]), (int)i, (int)HDstrlen(rdata[i])); continue; } /* end if */ if (HDstrcmp(wdata[i], rdata[i]) != 0) { @@ -2922,7 +2922,7 @@ test_misc17(void) if (HDstrlen(wdata[i]) != HDstrlen(rdata[i])) { TestErrPrintf( "Line %u: VL data length don't match!, strlen(wdata[%d])=%d, strlen(rdata[%d])=%d\n", - (unsigned)__LINE__, (int)i, (int)strlen(wdata[i]), (int)i, (int)strlen(rdata[i])); + (unsigned)__LINE__, (int)i, (int)HDstrlen(wdata[i]), (int)i, (int)HDstrlen(rdata[i])); continue; } /* end if */ if (HDstrcmp(wdata[i], rdata[i]) != 0) { diff --git a/test/trefer_deprec.c b/test/trefer_deprec.c index 6191526..d2a403f 100644 --- a/test/trefer_deprec.c +++ b/test/trefer_deprec.c @@ -1406,9 +1406,9 @@ test_reference_group(void) /* Create bottom dataset */ did = H5Dcreate2(gid, DSETNAME2, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - assert(did > 0); + HDassert(did > 0); ret = H5Dclose(did); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Gclose(gid); CHECK(ret, FAIL, "H5Gclose"); diff --git a/test/tselect.c b/test/tselect.c index f40b2b9..2aeba77 100644 --- a/test/tselect.c +++ b/test/tselect.c @@ -5239,7 +5239,7 @@ test_select_hyper_union_stagger(void) CHECK(error, FAIL, "H5Fclose"); /* Initialize intput buffer */ - memset(data_out, 0, 7 * 7 * sizeof(int)); + HDmemset(data_out, 0, 7 * 7 * sizeof(int)); /* Open file */ file_id = H5Fopen(FILENAME, H5F_ACC_RDONLY, H5P_DEFAULT); @@ -5537,7 +5537,7 @@ test_select_hyper_valid_combination(void) /* Output message about test being performed */ MESSAGE(6, ("Testing Selection Combination Validity\n")); - assert(SPACE9_DIM2 >= POINT1_NPOINTS); + HDassert(SPACE9_DIM2 >= POINT1_NPOINTS); /* Create dataspace for single point selection */ single_pt_sid = H5Screate_simple(SPACE9_RANK, dims2D, NULL); @@ -8377,7 +8377,7 @@ test_shape_same(void) /* Output message about test being performed */ MESSAGE(6, ("Testing Same Shape Comparisons\n")); - assert(SPACE9_DIM2 >= POINT1_NPOINTS); + HDassert(SPACE9_DIM2 >= POINT1_NPOINTS); /* Create dataspace for "all" selection */ all_sid = H5Screate_simple(SPACE9_RANK, dims, NULL); @@ -14648,7 +14648,7 @@ test_internal_consistency(void) /* Output message about test being performed */ MESSAGE(6, ("Testing Consistency of Internal States\n")); - assert(SPACE9_DIM2 >= POINT1_NPOINTS); + HDassert(SPACE9_DIM2 >= POINT1_NPOINTS); /* Create dataspace for "all" selection */ all_sid = H5Screate_simple(SPACE9_RANK, dims, NULL); diff --git a/test/ttsafe.c b/test/ttsafe.c index d2085b9..2b98ded 100644 --- a/test/ttsafe.c +++ b/test/ttsafe.c @@ -134,7 +134,7 @@ main(int argc, char *argv[]) TestSummary(); /* Clean up test files, if allowed */ - if (GetTestCleanup() && !getenv("HDF5_NOCLEANUP")) + if (GetTestCleanup() && !HDgetenv("HDF5_NOCLEANUP")) TestCleanup(); /* Release test infrastructure */ diff --git a/test/ttsafe_cancel.c b/test/ttsafe_cancel.c index 1e40c58..2ec9a20 100644 --- a/test/ttsafe_cancel.c +++ b/test/ttsafe_cancel.c @@ -65,46 +65,46 @@ tts_cancel(void) /* make thread scheduling global */ ret = pthread_attr_init(&attribute); - assert(ret == 0); + HDassert(ret == 0); #ifdef H5_HAVE_SYSTEM_SCOPE_THREADS ret = pthread_attr_setscope(&attribute, PTHREAD_SCOPE_SYSTEM); - assert(ret == 0); + HDassert(ret == 0); #endif /* H5_HAVE_SYSTEM_SCOPE_THREADS */ /* Initialize mutex & condition variables */ ret = pthread_mutex_init(&mutex, NULL); - assert(ret == 0); + HDassert(ret == 0); ret = pthread_cond_init(&cond, NULL); - assert(ret == 0); + HDassert(ret == 0); /* * Create a hdf5 file using H5F_ACC_TRUNC access, default file * creation plist and default file access plist */ cancel_file = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - assert(cancel_file >= 0); + HDassert(cancel_file >= 0); ret = pthread_create(&childthread, &attribute, tts_cancel_thread, NULL); - assert(ret == 0); + HDassert(ret == 0); tts_cancel_barrier(); ret = pthread_cancel(childthread); - assert(ret == 0); + HDassert(ret == 0); dataset = H5Dopen2(cancel_file, DATASETNAME, H5P_DEFAULT); - assert(dataset >= 0); + HDassert(dataset >= 0); ret = H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &buffer); - assert(ret >= 0); + HDassert(ret >= 0); if (buffer != 11) TestErrPrintf("operation unsuccessful with value at %d instead of 11\n", buffer); ret = H5Dclose(dataset); - assert(ret >= 0); + HDassert(ret >= 0); ret = H5Fclose(cancel_file); - assert(ret >= 0); + HDassert(ret >= 0); /* Destroy the thread attribute */ ret = pthread_attr_destroy(&attribute); - assert(ret == 0); + HDassert(ret == 0); } /* end tts_cancel() */ void * diff --git a/test/ttsafe_dcreate.c b/test/ttsafe_dcreate.c index cedafd0..a5a22be 100644 --- a/test/ttsafe_dcreate.c +++ b/test/ttsafe_dcreate.c @@ -140,7 +140,7 @@ tts_dcreate_creator(void *_thread_data) hsize_t dimsf[1]; /* dataset dimensions */ struct thread_info thread_data; - memcpy(&thread_data, _thread_data, sizeof(struct thread_info)); + HDmemcpy(&thread_data, _thread_data, sizeof(struct thread_info)); /* define dataspace for dataset */ dimsf[0] = 1; diff --git a/test/tunicode.c b/test/tunicode.c index 28f819b..2fed891 100644 --- a/test/tunicode.c +++ b/test/tunicode.c @@ -532,7 +532,7 @@ test_attrname(hid_t fid, const char *string) CHECK(attr_id, FAIL, "H5Acreate2"); size = H5Aget_name(attr_id, (size_t)MAX_STRING_LENGTH, read_buf); CHECK(size, FAIL, "H5Aget_name"); - ret = strcmp(read_buf, string); + ret = HDstrcmp(read_buf, string); VERIFY(ret, 0, "strcmp"); read_buf[0] = '\0'; @@ -541,7 +541,7 @@ test_attrname(hid_t fid, const char *string) CHECK(ret, FAIL, "H5Awrite"); ret = H5Aread(attr_id, dtype_id, read_buf); CHECK(ret, FAIL, "H5Aread"); - ret = strcmp(read_buf, string); + ret = HDstrcmp(read_buf, string); VERIFY(ret, 0, "strcmp"); /* Clean up */ @@ -682,7 +682,7 @@ test_enum(hid_t H5_ATTR_UNUSED fid, const char *string) VERIFY(val, E1_WHITE, "H5Tenum_valueof"); ret = H5Tenum_nameof(type_id, &val, readbuf, (size_t)MAX_STRING_LENGTH); CHECK(ret, FAIL, "H5Tenum_nameof"); - ret = strcmp(readbuf, string); + ret = HDstrcmp(readbuf, string); VERIFY(ret, 0, "strcmp"); /* Close the datatype */ @@ -709,7 +709,7 @@ test_opaque(hid_t H5_ATTR_UNUSED fid, const char *string) /* Read the tag back. */ read_buf = H5Tget_tag(type_id); - ret = strcmp(read_buf, string); + ret = HDstrcmp(read_buf, string); VERIFY(ret, 0, "H5Tget_tag"); H5free_memory(read_buf); diff --git a/test/tvlstr.c b/test/tvlstr.c index c8e65b5..c2d2f2d 100644 --- a/test/tvlstr.c +++ b/test/tvlstr.c @@ -203,7 +203,7 @@ test_vlstrings_basic(void) for (i = 0; i < SPACE1_DIM1; i++) { if (HDstrlen(wdata[i]) != HDstrlen(rdata[i])) { TestErrPrintf("VL data length don't match!, strlen(wdata[%d])=%d, strlen(rdata[%d])=%d\n", (int)i, - (int)strlen(wdata[i]), (int)i, (int)HDstrlen(rdata[i])); + (int)HDstrlen(wdata[i]), (int)i, (int)HDstrlen(rdata[i])); continue; } /* end if */ if (HDstrcmp(wdata[i], rdata[i]) != 0) { @@ -307,7 +307,7 @@ test_vlstrings_special(void) for (i = 0; i < SPACE1_DIM1; i++) { if (HDstrlen(wdata[i]) != HDstrlen(rdata[i])) { TestErrPrintf("VL data length don't match!, strlen(wdata[%d])=%d, strlen(rdata[%d])=%d\n", (int)i, - (int)strlen(wdata[i]), (int)i, (int)HDstrlen(rdata[i])); + (int)HDstrlen(wdata[i]), (int)i, (int)HDstrlen(rdata[i])); continue; } /* end if */ if ((wdata[i] == NULL && rdata[i] != NULL) || (rdata[i] == NULL && wdata[i] != NULL)) { @@ -536,7 +536,7 @@ test_compact_vlstring(void) for (i = 0; i < SPACE1_DIM1; i++) { if (HDstrlen(wdata[i]) != HDstrlen(rdata[i])) { TestErrPrintf("VL data length don't match!, strlen(wdata[%d])=%d, strlen(rdata[%d])=%d\n", (int)i, - (int)strlen(wdata[i]), (int)i, (int)HDstrlen(rdata[i])); + (int)HDstrlen(wdata[i]), (int)i, (int)HDstrlen(rdata[i])); continue; } /* end if */ if (HDstrcmp(wdata[i], rdata[i]) != 0) { diff --git a/test/tvltypes.c b/test/tvltypes.c index 50cfbd7..47b28d3 100644 --- a/test/tvltypes.c +++ b/test/tvltypes.c @@ -2676,13 +2676,13 @@ test_vltypes_fill_value(void) } break; case H5D_VIRTUAL: - assert(0 && "Invalid layout type!"); + HDassert(0 && "Invalid layout type!"); break; case H5D_LAYOUT_ERROR: case H5D_NLAYOUTS: default: - assert(0 && "Unknown layout type!"); + HDassert(0 && "Unknown layout type!"); break; } /* end switch */ @@ -2784,13 +2784,13 @@ test_vltypes_fill_value(void) break; case H5D_VIRTUAL: - assert(0 && "Invalid layout type!"); + HDassert(0 && "Invalid layout type!"); break; case H5D_LAYOUT_ERROR: case H5D_NLAYOUTS: default: - assert(0 && "Unknown layout type!"); + HDassert(0 && "Unknown layout type!"); break; } /* end switch */ @@ -2969,13 +2969,13 @@ test_vltypes_fill_value(void) break; case H5D_VIRTUAL: - assert(0 && "Invalid layout type!"); + HDassert(0 && "Invalid layout type!"); break; case H5D_LAYOUT_ERROR: case H5D_NLAYOUTS: default: - assert(0 && "Unknown layout type!"); + HDassert(0 && "Unknown layout type!"); break; } /* end switch */ @@ -3241,5 +3241,5 @@ test_vltypes(void) void cleanup_vltypes(void) { - remove(FILENAME); + HDremove(FILENAME); } diff --git a/test/twriteorder.c b/test/twriteorder.c index 83a615c..9c8a145 100644 --- a/test/twriteorder.c +++ b/test/twriteorder.c @@ -141,21 +141,21 @@ parse_option(int argc, char *const argv[]) HDexit(EXIT_SUCCESS); break; case 'b': /* number of planes to write/read */ - if ((blocksize_g = atoi(optarg)) <= 0) { + if ((blocksize_g = HDatoi(optarg)) <= 0) { HDfprintf(stderr, "bad blocksize %s, must be a positive integer\n", optarg); usage(progname_g); Hgoto_error(-1); }; break; case 'n': /* number of planes to write/read */ - if ((nlinkedblock_g = atoi(optarg)) < 2) { + if ((nlinkedblock_g = HDatoi(optarg)) < 2) { HDfprintf(stderr, "bad number of linked blocks %s, must be greater than 1.\n", optarg); usage(progname_g); Hgoto_error(-1); }; break; case 'p': /* number of planes to write/read */ - if ((part_size_g = atoi(optarg)) <= 0) { + if ((part_size_g = HDatoi(optarg)) <= 0) { HDfprintf(stderr, "bad partition size %s, must be a positive integer\n", optarg); usage(progname_g); Hgoto_error(-1); @@ -404,7 +404,7 @@ main(int argc, char *argv[]) Hgoto_error(1); }; }; - mypid = getpid(); + mypid = HDgetpid(); /* ============= */ /* launch reader */ @@ -440,7 +440,7 @@ main(int argc, char *argv[]) /* If readwrite, collect exit code of child process */ /* ================================================ */ if (launch_g == UC_READWRITE) { - if ((tmppid = waitpid(childpid, &child_status, child_wait_option)) < 0) { + if ((tmppid = HDwaitpid(childpid, &child_status, child_wait_option)) < 0) { HDperror("waitpid"); Hgoto_error(1); } diff --git a/test/unlink.c b/test/unlink.c index 8129cc9..2f68a69 100644 --- a/test/unlink.c +++ b/test/unlink.c @@ -575,7 +575,7 @@ test_filespace(hid_t fapl) size_t rdcc_nbytes; double rdcc_w0; - puts("Testing file space gets reused:"); + HDputs("Testing file space gets reused:"); /* Open file */ h5_fixname(FILENAME[4], fapl, filename, sizeof filename); diff --git a/test/use_append_mchunks.c b/test/use_append_mchunks.c index 0b2c409..94adfb0 100644 --- a/test/use_append_mchunks.c +++ b/test/use_append_mchunks.c @@ -165,12 +165,12 @@ main(int argc, char *argv[]) /* Fork process */ /* ============ */ if (UC_opts.launch == UC_READWRITE) { - if ((childpid = fork()) < 0) { - perror("fork"); + if ((childpid = HDfork()) < 0) { + HDperror("fork"); Hgoto_error(1); } } - mypid = getpid(); + mypid = HDgetpid(); /* ============= */ /* launch reader */ @@ -239,8 +239,8 @@ main(int argc, char *argv[]) /* If readwrite, collect exit code of child process */ /* ================================================ */ if (UC_opts.launch == UC_READWRITE) { - if ((tmppid = waitpid(childpid, &child_status, child_wait_option)) < 0) { - perror("waitpid"); + if ((tmppid = HDwaitpid(childpid, &child_status, child_wait_option)) < 0) { + HDperror("waitpid"); Hgoto_error(1); } diff --git a/test/use_common.c b/test/use_common.c index ccebd0b..7a3c95a 100644 --- a/test/use_common.c +++ b/test/use_common.c @@ -68,7 +68,7 @@ parse_option(int argc, char *const argv[], options_t *opts) switch (c) { case 'h': usage(opts->progname); - exit(EXIT_SUCCESS); + HDexit(EXIT_SUCCESS); break; case 'f': /* usecase data file name */ opts->filename = HDstrdup(optarg); @@ -2201,9 +2201,9 @@ test_ros3(void) /* need a macro to compare instances of H5FD_ros3_fapl_t */ if ((test_ros3_fa.version != ros3_fa_0.version) || (test_ros3_fa.authenticate != ros3_fa_0.authenticate) || - (strcmp(test_ros3_fa.aws_region, ros3_fa_0.aws_region) != 0) || - (strcmp(test_ros3_fa.secret_id, ros3_fa_0.secret_id) != 0) || - (strcmp(test_ros3_fa.secret_key, ros3_fa_0.secret_key) != 0)) + (HDstrcmp(test_ros3_fa.aws_region, ros3_fa_0.aws_region) != 0) || + (HDstrcmp(test_ros3_fa.secret_id, ros3_fa_0.secret_id) != 0) || + (HDstrcmp(test_ros3_fa.secret_key, ros3_fa_0.secret_key) != 0)) TEST_ERROR; h5_fixname(FILENAME[10], fapl_id, filename, sizeof(filename)); @@ -2252,7 +2252,7 @@ error: AT(); \ HDfprintf(stderr, mesg); \ H5Eprint2(H5E_DEFAULT, stderr); \ - fflush(stderr); \ + HDfflush(stderr); \ ret_value = -1; \ goto done; \ } @@ -2464,7 +2464,7 @@ run_splitter_test(const struct splitter_dataset_def *data, hbool_t ignore_wo_err } /* Verify existence of logfile if appropriate */ - logfile = fopen(vfd_config->log_file_path, "r"); + logfile = HDfopen(vfd_config->log_file_path, "r"); if ((TRUE == provide_logfile_path && NULL == logfile) || (FALSE == provide_logfile_path && NULL != logfile)) { SPLITTER_TEST_FAULT("no logfile when one was expected\n"); @@ -2485,7 +2485,7 @@ done: } if (logfile != NULL) - fclose(logfile); + HDfclose(logfile); HDfree(vfd_config); HDfree(filename_rw); |