diff options
author | Allen Byrne <byrn@hdfgroup.org> | 2020-10-08 14:40:18 (GMT) |
---|---|---|
committer | Allen Byrne <byrn@hdfgroup.org> | 2020-10-08 15:48:21 (GMT) |
commit | cdbe6b78f0e5dfd90b8a85beeb762b668ba29fe3 (patch) | |
tree | d2effdc8a5999cb263ec0d0f607ed36d45fd3160 /test | |
parent | 29874423bf155e23cfdc1920336c91674865f417 (diff) | |
download | hdf5-cdbe6b78f0e5dfd90b8a85beeb762b668ba29fe3.zip hdf5-cdbe6b78f0e5dfd90b8a85beeb762b668ba29fe3.tar.gz hdf5-cdbe6b78f0e5dfd90b8a85beeb762b668ba29fe3.tar.bz2 |
Merge changes from develop
Comments and whitespace
Skip file-locking and cache changes
Diffstat (limited to 'test')
-rw-r--r-- | test/accum.c | 14 | ||||
-rw-r--r-- | test/big.c | 6 | ||||
-rw-r--r-- | test/cache.c | 374 | ||||
-rw-r--r-- | test/cache_common.c | 15 | ||||
-rw-r--r-- | test/cache_tagging.c | 3 | ||||
-rw-r--r-- | test/chunk_info.c | 36 | ||||
-rw-r--r-- | test/dsets.c | 7 | ||||
-rw-r--r-- | test/dt_arith.c | 34 | ||||
-rw-r--r-- | test/dtypes.c | 14 | ||||
-rw-r--r-- | test/earray.c | 29 | ||||
-rw-r--r-- | test/farray.c | 12 | ||||
-rw-r--r-- | test/fheap.c | 30 | ||||
-rw-r--r-- | test/fillval.c | 18 | ||||
-rw-r--r-- | test/filter_plugin.c | 2 | ||||
-rw-r--r-- | test/freespace.c | 15 | ||||
-rw-r--r-- | test/gen_new_super.c | 12 | ||||
-rw-r--r-- | test/gen_nullspace.c | 22 | ||||
-rw-r--r-- | test/h5test.c | 36 | ||||
-rw-r--r-- | test/hyperslab.c | 4 | ||||
-rw-r--r-- | test/mf.c | 15 | ||||
-rw-r--r-- | test/mirror_vfd.c | 4 | ||||
-rw-r--r-- | test/ros3.c | 36 | ||||
-rw-r--r-- | test/s3comms.c | 38 | ||||
-rw-r--r-- | test/swmr.c | 10 | ||||
-rw-r--r-- | test/vfd.c | 2 |
25 files changed, 442 insertions, 346 deletions
diff --git a/test/accum.c b/test/accum.c index abd6a5e..183f955 100644 --- a/test/accum.c +++ b/test/accum.c @@ -2329,16 +2329,18 @@ accum_printf(const H5F_t *f) HDprintf("=====================================================\n"); HDprintf(" accumulator allocated size == %zu\n", accum->alloc_size); HDprintf(" accumulated data size == %zu\n", accum->size); - HDfprintf(stdout, " accumulator dirty? == %t\n", accum->dirty); + HDfprintf(stdout, " accumulator dirty? == %s\n", accum->dirty ? "TRUE" : "FALSE"); HDprintf("=====================================================\n"); - HDfprintf(stdout, " start of accumulated data, loc = %a\n", accum->loc); + HDfprintf(stdout, " start of accumulated data, loc = %" PRIuHADDR "\n", accum->loc); if (accum->dirty) { - HDfprintf(stdout, " start of dirty region, loc = %a\n", (haddr_t)(accum->loc + accum->dirty_off)); - HDfprintf(stdout, " end of dirty region, loc = %a\n", + HDfprintf(stdout, " start of dirty region, loc = %" PRIuHADDR "\n", + (haddr_t)(accum->loc + accum->dirty_off)); + HDfprintf(stdout, " end of dirty region, loc = %" PRIuHADDR "\n", (haddr_t)(accum->loc + accum->dirty_off + accum->dirty_len)); } /* end if */ - HDfprintf(stdout, " end of accumulated data, loc = %a\n", (haddr_t)(accum->loc + accum->size)); - HDfprintf(stdout, " end of accumulator allocation, loc = %a\n", + HDfprintf(stdout, " end of accumulated data, loc = %" PRIuHADDR "\n", + (haddr_t)(accum->loc + accum->size)); + HDfprintf(stdout, " end of accumulator allocation, loc = %" PRIuHADDR "\n", (haddr_t)(accum->loc + accum->alloc_size)); HDprintf("=====================================================\n"); } @@ -429,7 +429,7 @@ writer(char *filename, hid_t fapl, fsizes_t testsize, int wrt_n) for (i = 0; i < wrt_n; i++) { /* start position must be at least hs_size from the end */ hs_start[0] = randll(size2[0] - hs_size[0], i); - HDfprintf(out, "#%03d 0x%016Hx\n", i, hs_start[0]); + HDfprintf(out, "#%03d 0x%016" PRIxHSIZE "\n", i, hs_start[0]); if (H5Sselect_hyperslab(space2, H5S_SELECT_SET, hs_start, NULL, hs_size, NULL) < 0) goto error; for (j = 0; j < WRT_SIZE; j++) { @@ -524,7 +524,7 @@ reader(char *filename, hid_t fapl) break; i = (int)HDstrtol(ln + 1, &s, 10); hs_offset[0] = HDstrtoull(s, NULL, 0); - HDfprintf(stdout, "#%03d 0x%016Hx%47s", i, hs_offset[0], ""); + HDfprintf(stdout, "#%03d 0x%016" PRIxHSIZE "%47s", i, hs_offset[0], ""); HDfflush(stdout); if (H5Sselect_hyperslab(fspace, H5S_SELECT_SET, hs_offset, NULL, hs_size, NULL) < 0) @@ -605,7 +605,7 @@ usage(void) "\t-c\tFile system Checking skipped. Caution: this test generates\n" "\t\tmany big files and may fill up the file system.\n" "\t-fsize\tChange family size default to <fsize> where <fsize> is\n" - "\t\ta positive float point number. Default value is %Hu.\n" + "\t\ta positive float point number. Default value is %" PRIuHSIZE ".\n" "Examples:\n" "\tbig -fsize 2.1e9 \t# test with file size just under 2GB\n" "\tbig -fsize 2.2e9 \t# test with file size just above 2GB\n" diff --git a/test/cache.c b/test/cache.c index 8b5597d..0587aa7 100644 --- a/test/cache.c +++ b/test/cache.c @@ -2770,17 +2770,17 @@ write_permitted_check(int /*------------------------------------------------------------------------- * Function: check_insert_entry() * - * Purpose: Verify that H5C_insert_entry behaves as expected. - * Test the behaviour with different flags. + * Purpose: Verify that H5C_insert_entry behaves as expected. + * Test the behaviour with different flags. * - * This test was added primarily to test basic insert - * pinned entry functionallity, but I through in explicit - * tests for other functionallity that is tested implicitly - * elsewhere. + * This test was added primarily to test basic insert + * pinned entry functionallity, but I through in explicit + * tests for other functionallity that is tested implicitly + * elsewhere. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 8/10/06 * * Modifications: @@ -3137,14 +3137,15 @@ check_flush_cache(unsigned paged) } /* check_flush_cache() */ /*------------------------------------------------------------------------- + * * Function: check_flush_cache__empty_cache() * - * Purpose: Verify that flush_cache behaves as expected with an empty + * Purpose : Verify that flush_cache behaves as expected with an empty * cache. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 1/12/05 * * Modifications: @@ -4425,11 +4426,11 @@ check_flush_cache__multi_entry(H5F_t *file_ptr) /*------------------------------------------------------------------------- * Function: check_flush_cache__multi_entry_test() * - * Purpose: Run a multi entry flush cache test. + * Purpose : Run a multi entry flush cache test. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 1/13/05 * * Modifications: @@ -4453,7 +4454,7 @@ check_flush_cache__multi_entry_test(H5F_t *file_ptr, int test_num, unsigned int /* This gets used a lot, so lets leave it in. */ HDfprintf(stdout, "check_flush_cache__multi_entry_test: test %d\n", - test_num); + test_num); #endif /* JRM */ if (cache_ptr == NULL) { @@ -4478,6 +4479,7 @@ check_flush_cache__multi_entry_test(H5F_t *file_ptr, int test_num, unsigned int u = 0; while (pass && (u < spec_size)) { + if (((unsigned)spec[u].entry_num != u) || (spec[u].entry_type < 0) || (spec[u].entry_type >= NUMBER_OF_ENTRY_TYPES) || (spec[u].entry_index < 0) || (spec[u].entry_index > max_indices[spec[u].entry_type])) { @@ -4492,6 +4494,7 @@ check_flush_cache__multi_entry_test(H5F_t *file_ptr, int test_num, unsigned int u = 0; while (pass && (u < spec_size)) { + if (spec[u].insert_flag) { insert_entry(file_ptr, spec[u].entry_type, spec[u].entry_index, spec[u].flags); @@ -4587,6 +4590,7 @@ check_flush_cache__multi_entry_test(H5F_t *file_ptr, int test_num, unsigned int u = 0; while (pass && (u < spec_size)) { + base_addr = entries[spec[u].entry_type]; entry_ptr = &(base_addr[spec[u].entry_index]); @@ -4602,13 +4606,14 @@ check_flush_cache__multi_entry_test(H5F_t *file_ptr, int test_num, unsigned int } /* check_flush_cache__multi_entry_test() */ /*------------------------------------------------------------------------- + * * Function: check_flush_cache__pe_multi_entry_test() * - * Purpose: Run a multi entry flush cache test. + * Purpose: Run a multi entry flush cache test. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 4/5/06 * * Modifications: @@ -4658,6 +4663,7 @@ check_flush_cache__pe_multi_entry_test(H5F_t *file_ptr, int test_num, unsigned i u = 0; while (pass && (u < spec_size)) { + if (((unsigned)spec[u].entry_num != u) || (spec[u].entry_type < 0) || (spec[u].entry_type >= NUMBER_OF_ENTRY_TYPES) || (spec[u].entry_index < 0) || (spec[u].entry_index > max_indices[spec[u].entry_type]) || (spec[u].num_pins < 0) || @@ -4687,6 +4693,7 @@ check_flush_cache__pe_multi_entry_test(H5F_t *file_ptr, int test_num, unsigned i total_entry_size += entry_sizes[spec[u].entry_type]; for (j = 0; j < spec[u].num_pins; j++) { + create_pinned_entry_dependency(file_ptr, spec[u].entry_type, spec[u].entry_index, spec[u].pin_type[j], spec[u].pin_idx[j]); } @@ -4709,6 +4716,7 @@ check_flush_cache__pe_multi_entry_test(H5F_t *file_ptr, int test_num, unsigned i u = 0; while (pass && (u < spec_size)) { + base_addr = entries[spec[u].entry_type]; entry_ptr = &(base_addr[spec[u].entry_index]); @@ -4773,6 +4781,7 @@ check_flush_cache__pe_multi_entry_test(H5F_t *file_ptr, int test_num, unsigned i u = 0; while (pass && (u < spec_size)) { + base_addr = entries[spec[u].entry_type]; entry_ptr = &(base_addr[spec[u].entry_index]); @@ -7987,12 +7996,12 @@ check_flush_cache__flush_ops(H5F_t *file_ptr) /*------------------------------------------------------------------------- * Function: check_flush_cache__flush_op_test() * - * Purpose: Run a flush op flush cache test. Of the nature of - * flush operations, this is a multi-entry test. + * Purpose: Run a flush op flush cache test. Of the nature of + * flush operations, this is a multi-entry test. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 9/3/06 * * Modifications: @@ -8042,6 +8051,7 @@ check_flush_cache__flush_op_test(H5F_t *file_ptr, int test_num, unsigned int flu i = 0; while (pass && (i < spec_size)) { + if ((spec[i].entry_num != i) || (spec[i].entry_type < 0) || (spec[i].entry_type >= NUMBER_OF_ENTRY_TYPES) || (spec[i].entry_index < 0) || (spec[i].entry_index > max_indices[spec[i].entry_type]) || (spec[i].num_pins < 0) || @@ -8057,6 +8067,7 @@ check_flush_cache__flush_op_test(H5F_t *file_ptr, int test_num, unsigned int flu i = 0; while (pass && (i < check_size)) { + if ((check[i].entry_num != i) || (check[i].entry_type < 0) || (check[i].entry_type >= NUMBER_OF_ENTRY_TYPES) || (check[i].entry_index < 0) || (check[i].entry_index > max_indices[check[i].entry_type]) || @@ -8084,6 +8095,7 @@ check_flush_cache__flush_op_test(H5F_t *file_ptr, int test_num, unsigned int flu i = 0; while (pass && (i < spec_size)) { + if (spec[i].insert_flag) { insert_entry(file_ptr, spec[i].entry_type, spec[i].entry_index, spec[i].flags); @@ -8104,6 +8116,7 @@ check_flush_cache__flush_op_test(H5F_t *file_ptr, int test_num, unsigned int flu } for (j = 0; j < spec[i].num_flush_ops; j++) { + add_flush_op(spec[i].entry_type, spec[i].entry_index, spec[i].flush_ops[j].op_code, spec[i].flush_ops[j].type, spec[i].flush_ops[j].idx, spec[i].flush_ops[j].flag, spec[i].flush_ops[j].size, spec[i].flush_ops[j].order_ptr); @@ -8139,6 +8152,7 @@ check_flush_cache__flush_op_test(H5F_t *file_ptr, int test_num, unsigned int flu i = 0; while (pass && (i < spec_size)) { + base_addr = entries[spec[i].entry_type]; entry_ptr = &(base_addr[spec[i].entry_index]); @@ -8172,6 +8186,7 @@ check_flush_cache__flush_op_test(H5F_t *file_ptr, int test_num, unsigned int flu i = 0; while (pass && (i < check_size)) { + if (check[i].in_cache != entry_in_cache(cache_ptr, check[i].entry_type, check[i].entry_index)) { pass = FALSE; @@ -8315,6 +8330,7 @@ check_flush_cache__flush_op_test(H5F_t *file_ptr, int test_num, unsigned int flu i = 0; while (pass && (i < spec_size)) { + base_addr = entries[spec[i].entry_type]; entry_ptr = &(base_addr[spec[i].entry_index]); @@ -8329,6 +8345,7 @@ check_flush_cache__flush_op_test(H5F_t *file_ptr, int test_num, unsigned int flu i = 0; while (pass && (i < check_size)) { + base_addr = entries[check[i].entry_type]; entry_ptr = &(base_addr[check[i].entry_index]); @@ -8348,14 +8365,14 @@ check_flush_cache__flush_op_test(H5F_t *file_ptr, int test_num, unsigned int flu /*------------------------------------------------------------------------- * Function: check_flush_cache__flush_op_eviction_test() * - * Purpose: Verify that flush operations work as expected when an + * Purpose: Verify that flush operations work as expected when an * entry is evicted. * * Do nothing if pass is FALSE on entry. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 10/3/06 * * Modifications: @@ -12124,11 +12141,11 @@ check_flush_cache__single_entry(H5F_t *file_ptr) /*------------------------------------------------------------------------- * Function: check_flush_cache__single_entry_test() * - * Purpose: Run a single entry flush cache test. + * Purpose: Run a single entry flush cache test. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 1/12/05 * * Modifications: @@ -12194,11 +12211,13 @@ check_flush_cache__single_entry_test(H5F_t *file_ptr, int test_num, int entry_ty pass = FALSE; HDsnprintf(msg, (size_t)128, "flush with flags 0x%x failed in single entry test #%d.", flush_flags, test_num); + failure_mssg = msg; } else if ((entry_ptr->deserialized != expected_deserialized) || (entry_ptr->serialized != expected_serialized) || (entry_ptr->destroyed != expected_destroyed)) { + #if 0 /* This is useful debugging code -- lets keep it for a while */ HDfprintf(stdout, @@ -12260,11 +12279,11 @@ check_flush_cache__single_entry_test(H5F_t *file_ptr, int test_num, int entry_ty /*------------------------------------------------------------------------- * Function: check_flush_cache__pinned_single_entry_test() * - * Purpose: Run a pinned single entry flush cache test. + * Purpose: Run a pinned single entry flush cache test. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 3/28/06 * * Modifications: @@ -12357,6 +12376,7 @@ check_flush_cache__pinned_single_entry_test(H5F_t *file_ptr, int test_num, int e else if ((entry_ptr->deserialized != expected_deserialized) || (entry_ptr->serialized != expected_serialized) || (entry_ptr->destroyed != expected_destroyed)) { + #if 0 /* this is useful debugging code -- keep it around */ HDfprintf(stdout, "desrlzd = %d(%d), srlzd = %d(%d), dest = %d(%d)\n", @@ -13686,12 +13706,12 @@ check_pin_protected_entry(unsigned paged) /*------------------------------------------------------------------------- * Function: check_resize_entry() * - * Purpose: Verify that H5C_resize_entry() and H5C_unprotect() resize - * entries as expected. + * Purpose: Verify that H5C_resize_entry() and H5C_unprotect() resize + * entries as expected. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 7/7/06 * *------------------------------------------------------------------------- @@ -14125,6 +14145,7 @@ check_resize_entry(unsigned paged) HDsnprintf(msg, (size_t)128, "Unexpected cache status 8."); failure_mssg = msg; } + base_addr = entries[LARGE_ENTRY_TYPE]; entry_ptr = &(base_addr[3]); entry_size = LARGE_ENTRY_SIZE; @@ -14536,12 +14557,12 @@ check_resize_entry(unsigned paged) /*------------------------------------------------------------------------- * Function: check_evictions_enabled() * - * Purpose: Verify that H5C_get_evictions_enabled() and - * H5C_set_evictions_enabled() functions perform as expected. + * Purpose: Verify that H5C_get_evictions_enabled() and + * H5C_set_evictions_enabled() functions perform as expected. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 8/2/07 * * Modifications: @@ -15174,12 +15195,12 @@ check_evictions_enabled(unsigned paged) /*------------------------------------------------------------------------- * Function: check_flush_protected_err() * - * Purpose: Verify that an attempt to flush the cache when it contains - * a protected entry will generate an error. + * Purpose: Verify that an attempt to flush the cache when it contains + * a protected entry will generate an error. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 6/24/04 * * Modifications: @@ -16292,12 +16313,12 @@ check_move_entry_errs(unsigned paged) /*------------------------------------------------------------------------- * Function: check_resize_entry_errs() * - * Purpose: Verify that invalid calls to H5C_resize_entry() - * generates errors as expected. + * Purpose: Verify that invalid calls to H5C_resize_entry() + * generates errors as expected. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 7/7/06 * *------------------------------------------------------------------------- @@ -29797,7 +29818,7 @@ done: /*------------------------------------------------------------------------- * Function: check_flush_deps_order() * - * Purpose: Verify that the order that entries with flush dependencies + * Purpose: Verify that the order that entries with flush dependencies * is correct * * Return: 0 on success, non-zero on failure @@ -33578,25 +33599,26 @@ check_entry_deletions_during_scans(unsigned paged) } /* check_entry_deletions_during_scans() */ /*------------------------------------------------------------------------- + * * Function: cedds__expunge_dirty_entry_in_flush_test() * - * Purpose: Verify that H5C_flush_cache() can handle the removal of - * a dirty entry from the cache during its scan of the - * skip list. + * Purpose: Verify that H5C_flush_cache() can handle the removal of + * a dirty entry from the cache during its scan of the + * skip list. * - * Do this by setting up a full cache, with the last entry - * on the LRU being both dirty and having a flush operation - * that deletes the second to last entry on the LRU. Then - * flush the cache, triggering the flush of the last - * item, and thereby the deletion of the second to last item. + * Do this by setting up a full cache, with the last entry + * on the LRU being both dirty and having a flush operation + * that deletes the second to last entry on the LRU. Then + * flush the cache, triggering the flush of the last + * item, and thereby the deletion of the second to last item. * - * H5C_flush_cache() should handle this deletion gracefully. + * H5C_flush_cache() should handle this deletion gracefully. * * Do nothing if pass is FALSE on entry. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 4/4/15 * * Modifications: @@ -33710,15 +33732,15 @@ cedds__expunge_dirty_entry_in_flush_test(H5F_t *file_ptr) * are in cache with the following characteristics: * * in - * entry: cache? size: dirty? pinned? pins: flush operations: + * entry: cache? size: dirty? pinned? pins: flush operations: * - * (HET, 0) Y 16 KB Y N - expunge (HET 1) + * (HET, 0) Y 16 KB Y N - expunge (HET 1) * - * (HET, 1) Y 16 KB Y N - - + * (HET, 1) Y 16 KB Y N - - * - * (HET, 2) Y 16 KB Y N - - + * (HET, 2) Y 16 KB Y N - - * - * (HET, 3) Y 16 KB Y N - - + * (HET, 3) Y 16 KB Y N - - * * Recall that in this test bed, flush operations are excuted the * first time the associated entry is flushed, and are then @@ -33793,25 +33815,25 @@ cedds__expunge_dirty_entry_in_flush_test(H5F_t *file_ptr) /*------------------------------------------------------------------------- * Function: cedds__H5C_make_space_in_cache() * - * Purpose: Verify that H5C__make_space_in_cache() can handle the - * removal from the cache of the next item in its reverse scan - * of the LRU list. + * Purpose: Verify that H5C__make_space_in_cache() can handle the + * removal from the cache of the next item in its reverse scan + * of the LRU list. * - * Do this by setting up a full cache, with the last entry - * on the LRU being both dirty and having a flush operation - * that deleted the second to last entry on the LRU. Then - * load an additional entry, triggering the flush of the last - * item, and thereby the deletion of the second to last item. + * Do this by setting up a full cache, with the last entry + * on the LRU being both dirty and having a flush operation + * that deleted the second to last entry on the LRU. Then + * load an additional entry, triggering the flush of the last + * item, and thereby the deletion of the second to last item. * - * H5C__make_space_in_cache() should detect this deletion, and - * restart its scan of the LRU from the tail, instead of - * examining the now deleted next item up on the LRU. + * H5C__make_space_in_cache() should detect this deletion, and + * restart its scan of the LRU from the tail, instead of + * examining the now deleted next item up on the LRU. * * Do nothing if pass is FALSE on entry. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 4/4/15 * * Modifications: @@ -34154,25 +34176,25 @@ cedds__H5C_make_space_in_cache(H5F_t *file_ptr) /*------------------------------------------------------------------------- * Function: cedds__H5C__autoadjust__ageout__evict_aged_out_entries() * - * Purpose: Verify that H5C__autoadjust__ageout__evict_aged_out_entries() - * can handle the removal from the cache of the next item in - * its reverse scan of the LRU list. + * Purpose: Verify that H5C__autoadjust__ageout__evict_aged_out_entries() + * can handle the removal from the cache of the next item in + * its reverse scan of the LRU list. * - * Do this by setting up a full cache, with the last entry - * on the LRU being both dirty and having a flush operation - * that deletes the second to last entry on the LRU. Then - * access the first item in the LRU repeatedly until the - * item, and thereby the deletion of the second to last item. + * Do this by setting up a full cache, with the last entry + * on the LRU being both dirty and having a flush operation + * that deletes the second to last entry on the LRU. Then + * access the first item in the LRU repeatedly until the + * item, and thereby the deletion of the second to last item. * - * H5C__make_space_in_cache() should detect this deletion, and - * restart its scan of the LRU from the tail, instead of - * examining the now deleted next item up on the LRU. + * H5C__make_space_in_cache() should detect this deletion, and + * restart its scan of the LRU from the tail, instead of + * examining the now deleted next item up on the LRU. * * Do nothing if pass is FALSE on entry. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 4/4/15 * * Modifications: @@ -34552,86 +34574,86 @@ cedds__H5C__autoadjust__ageout__evict_aged_out_entries(H5F_t *file_ptr) /*------------------------------------------------------------------------- * Function: cedds__H5C_flush_invalidate_cache__bucket_scan() * - * Purpose: Note: We now use the index list when we scan the - * contents of the metadata cache, so in principal, - * this test is obsolete. However, even using the - * index list, restarts are possible, and must be - * handled gracefully. - * - * As it turns out, this test triggers index list - * scan restarts, and thus with minor changes is - * still a useful test. - * - * For this reason, with the exception of changing - * to check the index_scan_restart stat instead of - * hash bucket restarts, I'm leaving the test - * alone. If and when it starts to fail due to - * other changes, we can re-work it to test - * index list scan restarts explicitly. - * - * JRM -- 11/2/16 - * - * Verify that H5C_flush_invalidate_cache() can handle - * the removal from the cache of the next item in - * its scans of hash buckets. - * - * !!!!!!!!!!WARNING !!!!!!!!!! - * - * This test may fail to function correctly if the hash - * table size or hash function is altered. - * - * To setup the test, this function depends on the fact that - * H5C_flush_invalidate_cache() does alternating scans of the - * slist and the index. If this changes, the test will likely - * also cease to function correctly. - * - * The test relies on a known hash function and hash table - * size to select a set of test entries that will all hash - * to the same hash bucket -- call it the test hash bucket. - * It also relies on known behavior of the cache to place - * the entries in the test bucket in a known order. - * - * To avoid pre-mature flushes of the entries in the - * test hash bucket, all entries are initially clean, - * with the exception of the first entry which is dirty. - * It avoids premature flushing by being the parent in - * a flush dependency. The first entry in the test bucket - * also has a flush op which expunges the second entry -- - * setting up the failure. - * - * An additional dirty entry is added (which must hash - * to a different bucket, and must have a higher address - * than at least the first entry in the test hash bucket. - * This entry is the child in a flush dependency with the - * first entry in the above hash bucket, and contains - * a flush op to destroy this flush dependency. - * - * Since the first entry in the test hash bucket has a lower - * address that the other dirty entry, the scan of the - * slist encounters it first, and passes over it because - * it has a flush dependency height of 1. - * - * The scan then encounters the second dirty entry and flushes - * it -- causing it to destroy the flush dependency and thus - * reducing the flush dependency height of the first entry in - * the test hash bucket to zero. - * - * After completing a scan of the slist, - * H5C_flush_invalidate_cache() then scans the index, - * flushing all entries of flush dependency height zero. - * - * This sets up the potential error when the first entry - * in the test hash bucket is flushed -- expunging the - * second entry as a side effect. If - * H5C_flush_invalidate_cache() fails to detect this, - * it will attempt to continue its scan of the bucket with - * an entry that has been deleted from the cache. + * Purpose: Note: We now use the index list when we scan the + * contents of the metadata cache, so in principal, + * this test is obsolete. However, even using the + * index list, restarts are possible, and must be + * handled gracefully. + * + * As it turns out, this test triggers index list + * scan restarts, and thus with minor changes is + * still a useful test. + * + * For this reason, with the exception of changing + * to check the index_scan_restart stat instead of + * hash bucket restarts, I'm leaving the test + * alone. If and when it starts to fail due to + * other changes, we can re-work it to test + * index list scan restarts explicitly. + * + * JRM -- 11/2/16 + * + * Verify that H5C_flush_invalidate_cache() can handle + * the removal from the cache of the next item in + * its scans of hash buckets. + * + * !!!!!!!!!!WARNING !!!!!!!!!! + * + * This test may fail to function correctly if the hash + * table size or hash function is altered. + * + * To setup the test, this function depends on the fact that + * H5C_flush_invalidate_cache() does alternating scans of the + * slist and the index. If this changes, the test will likely + * also cease to function correctly. + * + * The test relies on a known hash function and hash table + * size to select a set of test entries that will all hash + * to the same hash bucket -- call it the test hash bucket. + * It also relies on known behavior of the cache to place + * the entries in the test bucket in a known order. + * + * To avoid pre-mature flushes of the entries in the + * test hash bucket, all entries are initially clean, + * with the exception of the first entry which is dirty. + * It avoids premature flushing by being the parent in + * a flush dependency. The first entry in the test bucket + * also has a flush op which expunges the second entry -- + * setting up the failure. + * + * An additional dirty entry is added (which must hash + * to a different bucket, and must have a higher address + * than at least the first entry in the test hash bucket. + * This entry is the child in a flush dependency with the + * first entry in the above hash bucket, and contains + * a flush op to destroy this flush dependency. + * + * Since the first entry in the test hash bucket has a lower + * address that the other dirty entry, the scan of the + * slist encounters it first, and passes over it because + * it has a flush dependency height of 1. + * + * The scan then encounters the second dirty entry and flushes + * it -- causing it to destroy the flush dependency and thus + * reducing the flush dependency height of the first entry in + * the test hash bucket to zero. + * + * After completing a scan of the slist, + * H5C_flush_invalidate_cache() then scans the index, + * flushing all entries of flush dependency height zero. + * + * This sets up the potential error when the first entry + * in the test hash bucket is flushed -- expunging the + * second entry as a side effect. If + * H5C_flush_invalidate_cache() fails to detect this, + * it will attempt to continue its scan of the bucket with + * an entry that has been deleted from the cache. * * Do nothing if pass is FALSE on entry. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 4/9/15 * * Modifications: @@ -35009,21 +35031,21 @@ check_stats(unsigned paged) /*------------------------------------------------------------------------- * Function: check_stats__smoke_check_1() * - * Purpose: Test to see if the statistics collection code is working - * more or less as expected. Do this by performing a number - * of operations in the cache, and checking to verify that - * they result in the expected statistics. + * Purpose: Test to see if the statistics collection code is working + * more or less as expected. Do this by performing a number + * of operations in the cache, and checking to verify that + * they result in the expected statistics. * - * Note that this function is not intended to be a full test - * of the statistics collection facility -- only a cursory - * check that will serve as a place holder until more complete - * tests are implemented. + * Note that this function is not intended to be a full test + * of the statistics collection facility -- only a cursory + * check that will serve as a place holder until more complete + * tests are implemented. * * Do nothing if pass is FALSE on entry. * - * Return: void + * Return: void * - * Programmer: John Mainzer + * Programmer: John Mainzer * 4/22/15 * * Modifications: diff --git a/test/cache_common.c b/test/cache_common.c index b1b69f9..d0c267f 100644 --- a/test/cache_common.c +++ b/test/cache_common.c @@ -721,9 +721,11 @@ deserialize(const void *image, size_t H5_ATTR_NDEBUG_UNUSED len, void *udata, hb else { if ((*(((const char *)image) + 2)) != (char)(idx & 0xFF)) { HDfprintf(stdout, "type = %d, idx = %d, addr = 0x%lx.\n", type, idx, (long)addr); - HDfprintf(stdout, "*image = 0x%x 0x%x 0x%x\n", (int)(*((const char *)image)), - (int)(*(((const char *)image) + 1)), (int)(*(((const char *)image) + 2))); - HDfprintf(stdout, "expected *image = 0x%x\n", (int)(idx & 0xFF), (int)((idx & 0xFF00) >> 8)); + HDfprintf(stdout, "*image = 0x%" PRIx8 " 0x%" PRIx8 " 0x%" PRIx8 "\n", + (*((const uint8_t *)image)), (*(((const uint8_t *)image) + 1)), + (*(((const uint8_t *)image) + 2))); + HDfprintf(stdout, "expected *image = 0x%02" PRIx32 "%02" PRIx32 "\n", (uint32_t)idx & 0xFF, + (((uint32_t)idx & 0xFF00) >> 8)); } /* end if */ HDassert((*((const char *)image)) == (char)(type & 0xFF)); HDassert((*(((const char *)image) + 1)) == (char)((idx & 0xFF00) >> 8)); @@ -2747,7 +2749,7 @@ expunge_entry(H5F_t *file_ptr, int32_t type, int32_t idx) * Function: flush_cache() * * Purpose: Flush the specified cache, destroying all entries if - requested. If requested, dump stats first. + * requested. If requested, dump stats first. * * Return: void * @@ -2790,6 +2792,7 @@ flush_cache(H5F_t *file_ptr, hbool_t destroy_entries, hbool_t dump_stats, hbool_ (cache_ptr->clean_index_size != 0) || (cache_ptr->dirty_index_size != 0))) { if (verbose) { + HDfprintf(stdout, "%s: unexpected il/is/cis/dis = %lld/%lld/%lld/%lld.\n", FUNC, (long long)(cache_ptr->index_len), (long long)(cache_ptr->index_size), (long long)(cache_ptr->clean_index_size), (long long)(cache_ptr->dirty_index_size)); @@ -3533,8 +3536,8 @@ unprotect_entry(H5F_t *file_ptr, int32_t type, int32_t idx, unsigned int flags) * Function: row_major_scan_forward() * * Purpose: Do a sequence of inserts, protects, unprotects, moves, - * destroys while scanning through the set of entries. If - * pass is false on entry, do nothing. + * destroys while scanning through the set of entries. If + * pass is false on entry, do nothing. * * Return: void * diff --git a/test/cache_tagging.c b/test/cache_tagging.c index b4af425..dbb7c81 100644 --- a/test/cache_tagging.c +++ b/test/cache_tagging.c @@ -345,7 +345,8 @@ evict_entries(hid_t fid) /* Evict all we can from the cache to examine full tag creation tree */ /* This function will likely return failure since the root group - * is still protected. Thus, don't check its return value. */ + * is still protected. Thus, don't check its return value. + */ H5C_flush_cache(f, H5C__FLUSH_INVALIDATE_FLAG); return 0; diff --git a/test/chunk_info.c b/test/chunk_info.c index a663e5e..7774873 100644 --- a/test/chunk_info.c +++ b/test/chunk_info.c @@ -335,8 +335,9 @@ verify_selected_chunks(hid_t dset, hid_t plist, hsize_t *start, hsize_t *end) /* Verify that read chunk is the same as the corresponding written one */ if (HDmemcmp(expected_buf[chk_index], read_buf, CHUNK_NX * CHUNK_NY) != 0) { - HDfprintf(stderr, "Read chunk differs from written chunk at offset (%d,%d)\n", offset[0], - offset[1]); + HDfprintf(stderr, + "Read chunk differs from written chunk at offset (%" PRIuHSIZE ",%" PRIuHSIZE ")\n", + offset[0], offset[1]); return FAIL; } } @@ -709,7 +710,8 @@ test_get_chunk_info_highest_v18(hid_t fapl) /* Verify that the number of chunks is NUM_CHUNKS */ if (H5Dget_num_chunks(dset, dspace, &nchunks) < 0) TEST_ERROR - VERIFY(nchunks, NUM_CHUNKS, "H5Dget_num_chunks, number of chunks"); + if (nchunks != NUM_CHUNKS) + TEST_ERROR /* Attempt to get info of a chunk from an empty dataset, verify the returned address and size in the case of H5D_ALLOC_TIME_EARLY */ @@ -718,11 +720,12 @@ test_get_chunk_info_highest_v18(hid_t fapl) ret = H5Dget_chunk_info(dset, dspace, chk_index, out_offset, &read_flt_msk, &addr, &size); if (ret < 0) TEST_ERROR + /* Because of H5D_ALLOC_TIME_EARLY, addr cannot be HADDR_UNDEF and size not 0 */ if (addr == HADDR_UNDEF) - FAIL_PUTS_ERROR(MSG_CHK_ADDR); + TEST_ERROR if (size == EMPTY_CHK_SIZE) - FAIL_PUTS_ERROR(MSG_CHK_SIZE); + TEST_ERROR chk_index = 10; reinit_vars(&read_flt_msk, &addr, &size); @@ -731,9 +734,9 @@ test_get_chunk_info_highest_v18(hid_t fapl) TEST_ERROR /* Because of H5D_ALLOC_TIME_EARLY, addr cannot be HADDR_UNDEF and size not 0 */ if (addr == HADDR_UNDEF) - FAIL_PUTS_ERROR(MSG_CHK_ADDR); + TEST_ERROR if (size == EMPTY_CHK_SIZE) - FAIL_PUTS_ERROR(MSG_CHK_SIZE); + TEST_ERROR /* Attempt to get info of a chunk given its coords from an empty dataset, verify the returned address and size */ @@ -743,9 +746,9 @@ test_get_chunk_info_highest_v18(hid_t fapl) TEST_ERROR /* Because of H5D_ALLOC_TIME_EARLY, addr cannot be HADDR_UNDEF and size not 0 */ if (addr == HADDR_UNDEF) - FAIL_PUTS_ERROR(MSG_CHK_ADDR); + TEST_ERROR if (size == 0) - FAIL_PUTS_ERROR(MSG_CHK_SIZE); + TEST_ERROR if (H5Dclose(dset) < 0) TEST_ERROR @@ -855,7 +858,8 @@ test_chunk_info_single_chunk(const char *filename, hid_t fapl) /* Get the number of chunks and verify that no chunk has been written */ if (H5Dget_num_chunks(dset, dspace, &nchunks) < 0) TEST_ERROR - VERIFY(nchunks, NO_CHUNK_WRITTEN, "H5Dget_num_chunks, number of chunks"); + if (nchunks != NO_CHUNK_WRITTEN) + TEST_ERROR /* Initialize the array of chunk data for the single chunk */ for (ii = 0; ii < NX; ii++) @@ -869,7 +873,8 @@ test_chunk_info_single_chunk(const char *filename, hid_t fapl) /* Get and verify that one chunk had been written */ if (H5Dget_num_chunks(dset, dspace, &nchunks) < 0) TEST_ERROR - VERIFY(nchunks, ONE_CHUNK_WRITTEN, "H5Dget_num_chunks, number of chunks"); + if (nchunks != ONE_CHUNK_WRITTEN) + TEST_ERROR /* Offset of the only chunk */ offset[0] = 0; @@ -2061,8 +2066,7 @@ error: * * Purpose: Tests functions related to chunk information * - * Return: Success: SUCCEED - * Failure: FAIL + * Return: EXIT_SUCCESS/EXIT_FAILURE * * Programmer: Binh-Minh Ribler * November 5, 2018 @@ -2094,18 +2098,18 @@ main(void) nerrors += test_flt_msk_with_skip_compress(fapl) < 0 ? 1 : 0; if (nerrors) - TEST_ERROR + goto error; HDprintf("All chunk query tests passed.\n"); h5_cleanup(FILENAME, fapl); - return SUCCEED; + return EXIT_SUCCESS; error: nerrors = MAX(1, nerrors); HDprintf("***** %d QUERY CHUNK INFO TEST%s FAILED! *****\n", nerrors, 1 == nerrors ? "" : "S"); - return FAIL; + return EXIT_FAILURE; } /**************************************************************************** diff --git a/test/dsets.c b/test/dsets.c index d76be02..e81a33e 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -4552,7 +4552,7 @@ test_nbit_int_size(hid_t file) if ((dset_size = H5Dget_storage_size(dataset)) < DSET_DIM1 * DSET_DIM2 * (precision / 8) || dset_size > DSET_DIM1 * DSET_DIM2 * (precision / 8) + 1 * KB) { H5_FAILED(); - HDfprintf(stdout, " Line %d: wrong dataset size: %Hu\n", __LINE__, dset_size); + HDfprintf(stdout, " Line %d: wrong dataset size: %" PRIuHSIZE "\n", __LINE__, dset_size); goto error; } @@ -4762,7 +4762,7 @@ test_nbit_flt_size(hid_t file) if ((dset_size = H5Dget_storage_size(dataset)) < DSET_DIM1 * DSET_DIM2 * (precision / 8) || dset_size > DSET_DIM1 * DSET_DIM2 * (precision / 8) + 1 * KB) { H5_FAILED(); - HDfprintf(stdout, " Line %d: wrong dataset size: %Hu\n", __LINE__, dset_size); + HDfprintf(stdout, " Line %d: wrong dataset size: %" PRIuHSIZE "\n", __LINE__, dset_size); goto error; } /* end if */ @@ -12318,6 +12318,9 @@ test_bt2_hdr_fd(const char *env_h5_driver, hid_t fapl) TESTING("Version 2 B-tree chunk index header flush dependencies handled correctly"); + /* Initialize struct */ + HDmemset(&info, 0, sizeof(info)); + /* Skip this test if SWMR I/O is not supported for the VFD specified * by the environment variable. */ diff --git a/test/dt_arith.c b/test/dt_arith.c index 2489539..466554c 100644 --- a/test/dt_arith.c +++ b/test/dt_arith.c @@ -775,7 +775,7 @@ test_particular_fp_integer(void) /* Print errors */ if (dst_c != SCHAR_MAX) { - double x = 0.; + double x = 0.0; signed char y; if (0 == fails_this_test++) @@ -819,7 +819,7 @@ test_particular_fp_integer(void) /* Print errors */ if (dst_i != fill_value) { - float x = 0.; + float x = 0.0; int y; if (0 == fails_this_test++) @@ -2783,18 +2783,18 @@ my_isnan(dtype_t type, void *val) char s[256]; if (FLT_FLOAT == type) { - float x = 0.; + float x = 0.0; HDmemcpy(&x, val, sizeof(float)); retval = (x != x); } else if (FLT_DOUBLE == type) { - double x = 0.; + double x = 0.0; HDmemcpy(&x, val, sizeof(double)); retval = (x != x); #if H5_SIZEOF_LONG_DOUBLE != H5_SIZEOF_DOUBLE && H5_SIZEOF_LONG_DOUBLE != 0 } else if (FLT_LDOUBLE == type) { - long double x = 0.; + long double x = 0.0; HDmemcpy(&x, val, sizeof(long double)); retval = (x != x); #endif @@ -2809,20 +2809,20 @@ my_isnan(dtype_t type, void *val) */ if (!retval) { if (FLT_FLOAT == type) { - float x = 0.; + float x = 0.0; HDmemcpy(&x, val, sizeof(float)); HDsnprintf(s, sizeof(s), "%g", (double)x); } else if (FLT_DOUBLE == type) { - double x = 0.; + double x = 0.0; HDmemcpy(&x, val, sizeof(double)); HDsnprintf(s, sizeof(s), "%g", x); #if H5_SIZEOF_LONG_DOUBLE != H5_SIZEOF_DOUBLE && H5_SIZEOF_LONG_DOUBLE != 0 } else if (FLT_LDOUBLE == type) { - long double x = 0.; + long double x = 0.0; HDmemcpy(&x, val, sizeof(long double)); HDsnprintf(s, sizeof(s), "%Lg", x); @@ -3283,7 +3283,7 @@ test_conv_flt_1(const char *name, int run_test, hid_t src, hid_t dst) int check_expo[2]; if (FLT_FLOAT == dst_type) { - float x = 0.; + float x = 0.0; HDmemcpy(&x, &buf[j * dst_size], sizeof(float)); if (underflow && HDfabsf(x) <= FLT_MIN && HDfabsf(hw_f) <= FLT_MIN) continue; /* all underflowed, no error */ @@ -3294,7 +3294,7 @@ test_conv_flt_1(const char *name, int run_test, hid_t src, hid_t dst) check_mant[1] = HDfrexpf(hw_f, check_expo + 1); } else if (FLT_DOUBLE == dst_type) { - double x = 0.; + double x = 0.0; HDmemcpy(&x, &buf[j * dst_size], sizeof(double)); if (underflow && HDfabs(x) <= DBL_MIN && HDfabs(hw_d) <= DBL_MIN) continue; /* all underflowed, no error */ @@ -3306,7 +3306,7 @@ test_conv_flt_1(const char *name, int run_test, hid_t src, hid_t dst) #if H5_SIZEOF_LONG_DOUBLE != 0 && (H5_SIZEOF_LONG_DOUBLE != H5_SIZEOF_DOUBLE) } else { - long double x = 0.; + long double x = 0.0; HDmemcpy(&x, &buf[j * dst_size], sizeof(long double)); /* dst is largest float, no need to check underflow. */ check_mant[0] = (double)HDfrexpl(x, check_expo + 0); @@ -3353,18 +3353,18 @@ test_conv_flt_1(const char *name, int run_test, hid_t src, hid_t dst) HDprintf(" %02x", saved[j * src_size + ENDIAN(src_size, k, sendian)]); HDprintf("%*s", (int)(3 * MAX(0, (ssize_t)dst_size - (ssize_t)src_size)), ""); if (FLT_FLOAT == src_type) { - float x = 0.; + float x = 0.0; HDmemcpy(&x, &saved[j * src_size], sizeof(float)); HDprintf(" %29.20e\n", (double)x); } else if (FLT_DOUBLE == src_type) { - double x = 0.; + double x = 0.0; HDmemcpy(&x, &saved[j * src_size], sizeof(double)); HDprintf(" %29.20e\n", x); #if H5_SIZEOF_LONG_DOUBLE != H5_SIZEOF_DOUBLE } else { - long double x = 0.; + long double x = 0.0; HDmemcpy(&x, &saved[j * src_size], sizeof(long double)); HDfprintf(stdout, " %29.20Le\n", x); #endif @@ -3375,18 +3375,18 @@ test_conv_flt_1(const char *name, int run_test, hid_t src, hid_t dst) HDprintf(" %02x", buf[j * dst_size + ENDIAN(dst_size, k, dendian)]); HDprintf("%*s", (int)(3 * MAX(0, (ssize_t)src_size - (ssize_t)dst_size)), ""); if (FLT_FLOAT == dst_type) { - float x = 0.; + float x = 0.0; HDmemcpy(&x, &buf[j * dst_size], sizeof(float)); HDprintf(" %29.20e\n", (double)x); } else if (FLT_DOUBLE == dst_type) { - double x = 0.; + double x = 0.0; HDmemcpy(&x, &buf[j * dst_size], sizeof(double)); HDprintf(" %29.20e\n", x); #if H5_SIZEOF_LONG_DOUBLE != H5_SIZEOF_DOUBLE } else { - long double x = 0.; + long double x = 0.0; HDmemcpy(&x, &buf[j * dst_size], sizeof(long double)); HDfprintf(stdout, " %29.20Le\n", x); #endif diff --git a/test/dtypes.c b/test/dtypes.c index 5fd32b7..157e3fa 100644 --- a/test/dtypes.c +++ b/test/dtypes.c @@ -5184,7 +5184,7 @@ test_conv_bitfield(void) goto error; if (buf[0] != 0xAA || buf[1] != 0xAA || buf[2] != 0 || buf[3] != 0) { H5_FAILED(); - printf(" s=0xaaaa, d=0x%02x%02x%02x%02x (test 1)\n", buf[3], buf[2], buf[1], buf[0]); + HDprintf(" s=0xaaaa, d=0x%02x%02x%02x%02x (test 1)\n", buf[3], buf[2], buf[1], buf[0]); goto error; } @@ -5205,7 +5205,7 @@ test_conv_bitfield(void) goto error; if (buf[0] != 0 || buf[1] != 0xA8 || buf[2] != 0x2A || buf[3] != 0) { H5_FAILED(); - printf(" s=0x2AA8 d=0x%02x%02x%02x%02x (test 2)\n", buf[3], buf[2], buf[1], buf[0]); + HDprintf(" s=0x2AA8 d=0x%02x%02x%02x%02x (test 2)\n", buf[3], buf[2], buf[1], buf[0]); goto error; } @@ -5221,7 +5221,7 @@ test_conv_bitfield(void) goto error; if (buf[0] != 0xff || buf[1] != 0xAB || buf[2] != 0xEA || buf[3] != 0xff) { H5_FAILED(); - printf(" s=0x2AA8 d=0x%02x%02x%02x%02x (test 3)\n", buf[3], buf[2], buf[1], buf[0]); + HDprintf(" s=0x2AA8 d=0x%02x%02x%02x%02x (test 3)\n", buf[3], buf[2], buf[1], buf[0]); goto error; } @@ -5475,7 +5475,7 @@ opaque_check(int tag_it) H5E_END_TRY; if (status >= 0) { H5_FAILED(); - printf(" opaque conversion should have failed but succeeded\n"); + HDprintf(" opaque conversion should have failed but succeeded\n"); goto error; } @@ -5488,7 +5488,7 @@ opaque_check(int tag_it) goto error; if (saved + 1 != num_opaque_conversions_g) { H5_FAILED(); - printf(" unexpected number of opaque conversions\n"); + HDprintf(" unexpected number of opaque conversions\n"); goto error; } @@ -8529,7 +8529,7 @@ int main(void) { long nerrors = 0; - hid_t fapl = -1; + hid_t fapl = H5I_INVALID_HID; /* Set the random # seed */ HDsrandom((unsigned)HDtime(NULL)); @@ -8538,7 +8538,7 @@ main(void) fapl = h5_fileaccess(); if (ALIGNMENT) - printf("Testing non-aligned conversions (ALIGNMENT=%d)....\n", ALIGNMENT); + HDprintf("Testing non-aligned conversions (ALIGNMENT=%d)....\n", ALIGNMENT); /* Do the tests */ nerrors += test_classes(); diff --git a/test/earray.c b/test/earray.c index 95ef728..79bf0f1 100644 --- a/test/earray.c +++ b/test/earray.c @@ -332,52 +332,63 @@ check_stats(const H5EA_t *ea, const earray_state_t *state) /* Compare information */ if (earray_stats.stored.max_idx_set != state->max_idx_set) { - HDfprintf(stdout, "earray_stats.stored.max_idx_set = %Hu, state->max_idx_set = %Hu\n", + HDfprintf(stdout, + "earray_stats.stored.max_idx_set = %" PRIuHSIZE ", state->max_idx_set = %" PRIuHSIZE "\n", earray_stats.stored.max_idx_set, state->max_idx_set); TEST_ERROR } /* end if */ if (earray_stats.stored.nelmts != state->nelmts) { - HDfprintf(stdout, "earray_stats.stored.nelmts = %Hu, state->nelmts = %Hu\n", + HDfprintf(stdout, "earray_stats.stored.nelmts = %" PRIuHSIZE ", state->nelmts = %" PRIuHSIZE "\n", earray_stats.stored.nelmts, state->nelmts); TEST_ERROR } /* end if */ if (earray_stats.computed.hdr_size != state->hdr_size) { - HDfprintf(stdout, "earray_stats.computed.hdr_size = %Hu, state->hdr_size = %Hu\n", + HDfprintf(stdout, + "earray_stats.computed.hdr_size = %" PRIuHSIZE ", state->hdr_size = %" PRIuHSIZE "\n", earray_stats.computed.hdr_size, state->hdr_size); TEST_ERROR } /* end if */ if (earray_stats.computed.nindex_blks != state->nindex_blks) { - HDfprintf(stdout, "earray_stats.computed.nindex_blks = %Hu, state->nindex_blks = %Hu\n", + HDfprintf(stdout, + "earray_stats.computed.nindex_blks = %" PRIuHSIZE ", state->nindex_blks = %" PRIuHSIZE "\n", earray_stats.computed.nindex_blks, state->nindex_blks); TEST_ERROR } /* end if */ if (earray_stats.computed.index_blk_size != state->index_blk_size) { - HDfprintf(stdout, "earray_stats.computed.index_blk_size = %Hu, state->index_blk_size = %Hu\n", + HDfprintf(stdout, + "earray_stats.computed.index_blk_size = %" PRIuHSIZE ", state->index_blk_size = %" PRIuHSIZE + "\n", earray_stats.computed.index_blk_size, state->index_blk_size); TEST_ERROR } /* end if */ if (earray_stats.stored.ndata_blks != state->ndata_blks) { - HDfprintf(stdout, "earray_stats.stored.ndata_blks = %Hu, state->ndata_blks = %Hu\n", + HDfprintf(stdout, + "earray_stats.stored.ndata_blks = %" PRIuHSIZE ", state->ndata_blks = %" PRIuHSIZE "\n", earray_stats.stored.ndata_blks, state->ndata_blks); TEST_ERROR } /* end if */ /* Don't compare this currently, it's very hard to compute */ #ifdef NOT_YET if (earray_stats.stored.data_blk_size != state->data_blk_size) { - HDfprintf(stdout, "earray_stats.stored.data_blk_size = %Hu, state->data_blk_size = %Hu\n", + HDfprintf(stdout, + "earray_stats.stored.data_blk_size = %" PRIuHSIZE ", state->data_blk_size = %" PRIuHSIZE + "\n", earray_stats.stored.data_blk_size, state->data_blk_size); TEST_ERROR } /* end if */ #endif /* NOT_YET */ if (earray_stats.stored.nsuper_blks != state->nsuper_blks) { - HDfprintf(stdout, "earray_stats.stored.nsuper_blks = %Hu, state->nsuper_blks = %Hu\n", + HDfprintf(stdout, + "earray_stats.stored.nsuper_blks = %" PRIuHSIZE ", state->nsuper_blks = %" PRIuHSIZE "\n", earray_stats.stored.nsuper_blks, state->nsuper_blks); TEST_ERROR } /* end if */ /* Don't compare this currently, it's very hard to compute */ #ifdef NOT_YET if (earray_stats.stored.super_blk_size != state->super_blk_size) { - HDfprintf(stdout, "earray_stats.stored.super_blk_size = %Hu, state->super_blk_size = %Hu\n", + HDfprintf(stdout, + "earray_stats.stored.super_blk_size = %" PRIuHSIZE ", state->super_blk_size = %" PRIuHSIZE + "\n", earray_stats.stored.super_blk_size, state->super_blk_size); TEST_ERROR } /* end if */ diff --git a/test/farray.c b/test/farray.c index a108512..b6a6c31 100644 --- a/test/farray.c +++ b/test/farray.c @@ -178,20 +178,20 @@ check_stats(const H5FA_t *fa, const farray_state_t *state) /* Compare information */ if (farray_stats.hdr_size != state->hdr_size) { - HDfprintf(stdout, "farray_stats.hdr_size = %Hu, state->hdr_size = %Hu\n", farray_stats.hdr_size, - state->hdr_size); + HDfprintf(stdout, "farray_stats.hdr_size = %" PRIuHSIZE ", state->hdr_size = %" PRIuHSIZE "\n", + farray_stats.hdr_size, state->hdr_size); TEST_ERROR } if (farray_stats.dblk_size != state->dblk_size) { - HDfprintf(stdout, "farray_stats.dblk_size = %Hu, state->dblk_size = %Hu\n", farray_stats.dblk_size, - state->dblk_size); + HDfprintf(stdout, "farray_stats.dblk_size = %" PRIuHSIZE ", state->dblk_size = %" PRIuHSIZE "\n", + farray_stats.dblk_size, state->dblk_size); TEST_ERROR } if (farray_stats.nelmts != state->nelmts) { - HDfprintf(stdout, "farray_stats.nelmts = %Hu, state->nelmts = %Hu\n", farray_stats.nelmts, - state->nelmts); + HDfprintf(stdout, "farray_stats.nelmts = %" PRIuHSIZE ", state->nelmts = %" PRIuHSIZE "\n", + farray_stats.nelmts, state->nelmts); TEST_ERROR } diff --git a/test/fheap.c b/test/fheap.c index 8bf1ba6..9a73cd0 100644 --- a/test/fheap.c +++ b/test/fheap.c @@ -272,43 +272,45 @@ check_stats(const H5HF_t *fh, const fheap_heap_state_t *state) if (H5HF_stat_info(fh, &heap_stats) < 0) FAIL_STACK_ERROR if (heap_stats.man_nobjs != state->man_nobjs) { - HDfprintf(stdout, "heap_stats.man_nobjs = %Hu, state->man_nobjs = %Zu\n", heap_stats.man_nobjs, - state->man_nobjs); + HDfprintf(stdout, "heap_stats.man_nobjs = %" PRIuHSIZE ", state->man_nobjs = %zu\n", + heap_stats.man_nobjs, state->man_nobjs); TEST_ERROR } /* end if */ if (heap_stats.man_size != state->man_size) { - HDfprintf(stdout, "heap_stats.man_size = %Hu, state->man_size = %Hu\n", heap_stats.man_size, - state->man_size); + HDfprintf(stdout, "heap_stats.man_size = %" PRIuHSIZE ", state->man_size = %" PRIuHSIZE "\n", + heap_stats.man_size, state->man_size); TEST_ERROR } /* end if */ if (heap_stats.man_alloc_size != state->man_alloc_size) { - HDfprintf(stdout, "heap_stats.man_alloc_size = %Hu, state->man_alloc_size = %Hu\n", + HDfprintf(stdout, + "heap_stats.man_alloc_size = %" PRIuHSIZE ", state->man_alloc_size = %" PRIuHSIZE "\n", heap_stats.man_alloc_size, state->man_alloc_size); TEST_ERROR } /* end if */ if (heap_stats.man_free_space != state->man_free_space) { - HDfprintf(stdout, "heap_stats.man_free_space = %Hu, state->man_free_space = %Hu\n", + HDfprintf(stdout, + "heap_stats.man_free_space = %" PRIuHSIZE ", state->man_free_space = %" PRIuHSIZE "\n", heap_stats.man_free_space, state->man_free_space); TEST_ERROR } /* end if */ if (heap_stats.huge_nobjs != state->huge_nobjs) { - HDfprintf(stdout, "heap_stats.huge_nobjs = %Hu, state->huge_nobjs = %Zu\n", heap_stats.huge_nobjs, - state->huge_nobjs); + HDfprintf(stdout, "heap_stats.huge_nobjs = %" PRIuHSIZE ", state->huge_nobjs = %zu\n", + heap_stats.huge_nobjs, state->huge_nobjs); TEST_ERROR } /* end if */ if (heap_stats.huge_size != state->huge_size) { - HDfprintf(stdout, "heap_stats.huge_size = %Hu, state->huge_size = %Hu\n", heap_stats.huge_size, - state->huge_size); + HDfprintf(stdout, "heap_stats.huge_size = %" PRIuHSIZE ", state->huge_size = %" PRIuHSIZE "\n", + heap_stats.huge_size, state->huge_size); TEST_ERROR } /* end if */ if (heap_stats.tiny_nobjs != state->tiny_nobjs) { - HDfprintf(stdout, "heap_stats.tiny_nobjs = %Hu, state->tiny_nobjs = %Zu\n", heap_stats.tiny_nobjs, - state->tiny_nobjs); + HDfprintf(stdout, "heap_stats.tiny_nobjs = %" PRIuHSIZE ", state->tiny_nobjs = %zu\n", + heap_stats.tiny_nobjs, state->tiny_nobjs); TEST_ERROR } /* end if */ if (heap_stats.tiny_size != state->tiny_size) { - HDfprintf(stdout, "heap_stats.tiny_size = %Hu, state->tiny_size = %Hu\n", heap_stats.tiny_size, - state->tiny_size); + HDfprintf(stdout, "heap_stats.tiny_size = %" PRIuHSIZE ", state->tiny_size = %" PRIuHSIZE "\n", + heap_stats.tiny_size, state->tiny_size); TEST_ERROR } /* end if */ diff --git a/test/fillval.c b/test/fillval.c index 2cd6989..05570f0 100644 --- a/test/fillval.c +++ b/test/fillval.c @@ -927,7 +927,8 @@ test_rdwr_cases(hid_t file, hid_t dcpl, const char *dname, void *_fillval, H5D_f H5_FAILED(); HDfprintf(stdout, "%u: Value read was not a fill value.\n", (unsigned)__LINE__); HDfprintf(stdout, - " Elmt={%Hu,%Hu,%Hu,%Hu,%Hu}, read: %u, " + " Elmt={%" PRIuHSIZE ",%" PRIuHSIZE ",%" PRIuHSIZE ",%" PRIuHSIZE ",%" PRIuHSIZE + "}, read: %u, " "Fill value: %u\n", hs_offset[0], hs_offset[1], hs_offset[2], hs_offset[3], hs_offset[4], val_rd, fillval); @@ -944,7 +945,8 @@ test_rdwr_cases(hid_t file, hid_t dcpl, const char *dname, void *_fillval, H5D_f H5_FAILED(); HDfprintf(stdout, "%u: Value read was not a fill value.\n", (unsigned)__LINE__); HDfprintf(stdout, - " Elmt={%Hu,%Hu,%Hu,%Hu,%Hu}, read: %f, %d, %f, %c" + " Elmt={%" PRIuHSIZE ",%" PRIuHSIZE ",%" PRIuHSIZE ",%" PRIuHSIZE ",%" PRIuHSIZE + "}, read: %f, %d, %f, %c" "Fill value: %f, %d, %f, %c\n", hs_offset[0], hs_offset[1], hs_offset[2], hs_offset[3], hs_offset[4], (double)rd_c.a, rd_c.x, rd_c.y, rd_c.z, (double)fill_c.a, fill_c.x, fill_c.y, @@ -986,7 +988,8 @@ test_rdwr_cases(hid_t file, hid_t dcpl, const char *dname, void *_fillval, H5D_f H5_FAILED(); HDfprintf(stdout, "%u: Value read was not a fill value.\n", (unsigned)__LINE__); HDfprintf(stdout, - " Elmt={%Hu, %Hu, %Hu, %Hu, %Hu}, read: %u, " + " Elmt={%" PRIuHSIZE ", %" PRIuHSIZE ", %" PRIuHSIZE ", %" PRIuHSIZE + ", %" PRIuHSIZE "}, read: %u, " "Fill value: %u\n", hs_offset[0], hs_offset[1], hs_offset[2], hs_offset[3], hs_offset[4], buf[u], fillval); @@ -1012,7 +1015,8 @@ test_rdwr_cases(hid_t file, hid_t dcpl, const char *dname, void *_fillval, H5D_f H5_FAILED(); HDfprintf(stdout, "%u: Value read was not a fill value.\n", (unsigned)__LINE__); HDfprintf(stdout, - " Elmt={%Hu, %Hu, %Hu, %Hu, %Hu}, read: %f, %d, %f, %c" + " Elmt={%" PRIuHSIZE ", %" PRIuHSIZE ", %" PRIuHSIZE ", %" PRIuHSIZE + ", %" PRIuHSIZE "}, read: %f, %d, %f, %c" "Fill value: %f, %d, %f, %c\n", hs_offset[0], hs_offset[1], hs_offset[2], hs_offset[3], hs_offset[4], (double)buf_c[u].a, buf_c[u].x, buf_c[u].y, buf_c[u].z, (double)fill_c.a, @@ -1437,7 +1441,8 @@ test_extend_verify_integer(unsigned lineno, const hsize_t *offset, const void *_ if (*test_val != *compare_val) { HDfprintf(stdout, "%u: Value read was not expected.\n", lineno); HDfprintf(stdout, - " Elmt = {%Hu, %Hu, %Hu, %Hu, %Hu}, read: %d, " + " Elmt = {%" PRIuHSIZE ", %" PRIuHSIZE ", %" PRIuHSIZE ", %" PRIuHSIZE ", %" PRIuHSIZE + "}, read: %d, " "expected: %d\n", offset[0], offset[1], offset[2], offset[3], offset[4], *test_val, *compare_val); goto error; @@ -1528,7 +1533,8 @@ test_extend_verify_cmpd_vl(unsigned lineno, const hsize_t *offset, const void *_ HDstrcmp(test_val->b, compare_val->b) || (test_val->y != compare_val->y)) { HDfprintf(stdout, "%u: Value read was not expected.\n", lineno); HDfprintf(stdout, - " Elmt = {%Hu, %Hu, %Hu, %Hu, %Hu}, read: {%d, '%s', '%s', %d} " + " Elmt = {%" PRIuHSIZE ", %" PRIuHSIZE ", %" PRIuHSIZE ", %" PRIuHSIZE ", %" PRIuHSIZE + "}, read: {%d, '%s', '%s', %d} " "expected: {%d, '%s', '%s', %d}\n", offset[0], offset[1], offset[2], offset[3], offset[4], test_val->x, test_val->a, test_val->b, test_val->y, compare_val->x, compare_val->a, compare_val->b, compare_val->y); diff --git a/test/filter_plugin.c b/test/filter_plugin.c index b807218..7956ab3 100644 --- a/test/filter_plugin.c +++ b/test/filter_plugin.c @@ -1053,7 +1053,7 @@ test_path_api_calls(void) /* Get the path */ if ((path_len = H5PLget(0, path, 256)) <= 0) { - HDfprintf(stderr, " get 0 len: %u : %s\n", path_len, path); + HDfprintf(stderr, " get 0 len: %zd : %s\n", path_len, path); TEST_ERROR; } if (HDstrcmp(path, "a_path_0") != 0) { diff --git a/test/freespace.c b/test/freespace.c index cf9460c..4b6f54c 100644 --- a/test/freespace.c +++ b/test/freespace.c @@ -400,22 +400,27 @@ check_stats(const H5F_t *f, const H5FS_t *frsp, frspace_state_t *state) FAIL_STACK_ERROR if (frspace_stats.tot_space != state->tot_space) { - HDfprintf(stdout, "frspace_stats.tot_space = %Hu, state->tot_space = %Zu\n", frspace_stats.tot_space, - state->tot_space); + HDfprintf(stdout, "frspace_stats.tot_space = %" PRIuHSIZE ", state->tot_space = %" PRIuHSIZE "\n", + frspace_stats.tot_space, state->tot_space); TEST_ERROR } /* end if */ if (frspace_stats.tot_sect_count != state->tot_sect_count) { - HDfprintf(stdout, "frspace_stats.tot_sect_count = %Hu, state->tot_sect_count = %Hu\n", + HDfprintf(stdout, + "frspace_stats.tot_sect_count = %" PRIuHSIZE ", state->tot_sect_count = %" PRIuHSIZE "\n", frspace_stats.tot_sect_count, state->tot_sect_count); TEST_ERROR } /* end if */ if (frspace_stats.serial_sect_count != state->serial_sect_count) { - HDfprintf(stdout, "frspace_stats.serial_sect_count = %Hu, state->serial_sect_count = %Hu\n", + HDfprintf(stdout, + "frspace_stats.serial_sect_count = %" PRIuHSIZE ", state->serial_sect_count = %" PRIuHSIZE + "\n", frspace_stats.serial_sect_count, state->serial_sect_count); TEST_ERROR } /* end if */ if (frspace_stats.ghost_sect_count != state->ghost_sect_count) { - HDfprintf(stdout, "frspace_stats.ghost_sect_count = %Hu, state->ghost_sect_count = %Hu\n", + HDfprintf(stdout, + "frspace_stats.ghost_sect_count = %" PRIuHSIZE ", state->ghost_sect_count = %" PRIuHSIZE + "\n", frspace_stats.ghost_sect_count, state->ghost_sect_count); TEST_ERROR } /* end if */ diff --git a/test/gen_new_super.c b/test/gen_new_super.c index 69bf5fa..c3c22c1 100644 --- a/test/gen_new_super.c +++ b/test/gen_new_super.c @@ -49,10 +49,10 @@ main(void) /* Create a file creation property list */ fcpl = H5Pcreate(H5P_FILE_CREATE); - assert(fcpl >= 0); + HDassert(fcpl >= 0); ret = H5Pset_istore_k(fcpl, ISTORE_IK); - assert(ret >= 0); + HDassert(ret >= 0); /* Creating a file with the non-default file creation property list should * create a version 1 superblock @@ -60,15 +60,15 @@ main(void) /* Create file with custom file creation property list */ file = H5Fcreate(TESTFILE, H5F_ACC_TRUNC, fcpl, H5P_DEFAULT); - assert(file >= 0); + HDassert(file >= 0); /* Close FCPL */ ret = H5Pclose(fcpl); - assert(ret >= 0); + HDassert(ret >= 0); /* Close file */ ret = H5Fclose(file); - assert(ret >= 0); + HDassert(ret >= 0); - return 0; + return EXIT_SUCCESS; } diff --git a/test/gen_nullspace.c b/test/gen_nullspace.c index 5205b21..9002309 100644 --- a/test/gen_nullspace.c +++ b/test/gen_nullspace.c @@ -42,42 +42,42 @@ main(void) /* Create the file */ fid = H5Fcreate(NULLFILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - assert(fid > 0); + HDassert(fid > 0); sid = H5Screate(H5S_NULL); - assert(sid > 0); + HDassert(sid > 0); /* Create dataset */ did = H5Dcreate2(fid, NULLDATASET, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - assert(did > 0); + HDassert(did > 0); /* Close the dataset */ ret = H5Dclose(did); - assert(ret >= 0); + HDassert(ret >= 0); /* Open the root group */ gid = H5Gopen2(fid, "/", H5P_DEFAULT); - assert(gid > 0); + HDassert(gid > 0); /* Create an attribute for the group */ attr = H5Acreate2(gid, NULLATTR, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT); - assert(attr > 0); + HDassert(attr > 0); /* Close attribute */ ret = H5Aclose(attr); - assert(ret >= 0); + HDassert(ret >= 0); /* Close the group */ ret = H5Gclose(gid); - assert(ret >= 0); + HDassert(ret >= 0); /* Close the dataspace */ ret = H5Sclose(sid); - assert(ret >= 0); + HDassert(ret >= 0); /* Close the file */ ret = H5Fclose(fid); - assert(ret >= 0); + HDassert(ret >= 0); - return 0; + return EXIT_SUCCESS; } diff --git a/test/h5test.c b/test/h5test.c index 3033d97..33af30d 100644 --- a/test/h5test.c +++ b/test/h5test.c @@ -2089,13 +2089,13 @@ h5_compare_file_bytes(char *f1name, char *f2name) int ret_value = 0; /* for error handling */ /* Open files for reading */ - f1ptr = HDfopen(f1name, "r"); + f1ptr = HDfopen(f1name, "rb"); if (f1ptr == NULL) { HDfprintf(stderr, "Unable to fopen() %s\n", f1name); ret_value = -1; goto done; } - f2ptr = HDfopen(f2name, "r"); + f2ptr = HDfopen(f2name, "rb"); if (f2ptr == NULL) { HDfprintf(stderr, "Unable to fopen() %s\n", f2name); ret_value = -1; @@ -2110,7 +2110,8 @@ h5_compare_file_bytes(char *f1name, char *f2name) f2size = HDftell(f2ptr); if (f1size != f2size) { - HDfprintf(stderr, "Files differ in size, %llu vs. %llu\n", f1size, f2size); + HDfprintf(stderr, "Files differ in size, %" PRIuHSIZE " vs. %" PRIuHSIZE "\n", (hsize_t)f1size, + (hsize_t)f2size); ret_value = -1; goto done; } @@ -2119,23 +2120,27 @@ h5_compare_file_bytes(char *f1name, char *f2name) HDrewind(f1ptr); HDrewind(f2ptr); for (ii = 0; ii < f1size; ii++) { - HDfread(&f1char, 1, 1, f1ptr); - HDfread(&f2char, 1, 1, f2ptr); + if (HDfread(&f1char, 1, 1, f1ptr) != 1) { + ret_value = -1; + goto done; + } + if (HDfread(&f2char, 1, 1, f2ptr) != 1) { + ret_value = -1; + goto done; + } if (f1char != f2char) { - HDfprintf(stderr, "Mismatch @ 0x%llX: 0x%X != 0x%X\n", ii, f1char, f2char); + HDfprintf(stderr, "Mismatch @ 0x%" PRIXHSIZE ": 0x%X != 0x%X\n", (hsize_t)ii, f1char, f2char); ret_value = -1; goto done; } } done: - if (f1ptr) { + if (f1ptr) HDfclose(f1ptr); - } - if (f2ptr) { + if (f2ptr) HDfclose(f2ptr); - } - return (ret_value); + return ret_value; } /* end h5_compare_file_bytes() */ /*------------------------------------------------------------------------- @@ -2220,7 +2225,7 @@ h5_duplicate_file_by_bytes(const char *orig, const char *dest) max_buf = 4096 * sizeof(char); - orig_ptr = HDfopen(orig, "r"); + orig_ptr = HDfopen(orig, "rb"); if (NULL == orig_ptr) { ret_value = -1; goto done; @@ -2230,7 +2235,7 @@ h5_duplicate_file_by_bytes(const char *orig, const char *dest) fsize = (hsize_t)HDftell(orig_ptr); HDrewind(orig_ptr); - dest_ptr = HDfopen(dest, "w"); + dest_ptr = HDfopen(dest, "wb"); if (NULL == dest_ptr) { ret_value = -1; goto done; @@ -2244,7 +2249,10 @@ h5_duplicate_file_by_bytes(const char *orig, const char *dest) } while (read_size > 0) { - HDfread(dup_buf, read_size, 1, orig_ptr); /* warning: no error-check */ + if (HDfread(dup_buf, read_size, 1, orig_ptr) != 1) { + ret_value = -1; + goto done; + } HDfwrite(dup_buf, read_size, 1, dest_ptr); fsize -= read_size; read_size = MIN(fsize, max_buf); diff --git a/test/hyperslab.c b/test/hyperslab.c index 42cdafa..43992de 100644 --- a/test/hyperslab.c +++ b/test/hyperslab.c @@ -1117,8 +1117,8 @@ test_array_offset_n_calc(size_t n, size_t x, size_t y, size_t z) /* Check computed coordinates */ for (v = 0; v < ARRAY_OFFSET_NDIMS; v++) if (coords[v] != new_coords[v]) { - HDfprintf(stderr, "coords[%u]=%Hu, new_coords[%u]=%Hu\n", (unsigned)v, coords[v], (unsigned)v, - new_coords[v]); + HDfprintf(stderr, "coords[%zu]=%" PRIuHSIZE ", new_coords[%zu]=%" PRIuHSIZE "\n", v, + coords[v], v, new_coords[v]); TEST_ERROR; } /* end if */ } /* end for */ @@ -168,22 +168,27 @@ check_stats(const H5F_t *f, const H5FS_t *frsp, H5FS_stat_t *state) FAIL_STACK_ERROR if (frspace_stats.tot_space != state->tot_space) { - HDfprintf(stdout, "frspace_stats.tot_space = %Hu, state->tot_space = %Zu\n", frspace_stats.tot_space, - state->tot_space); + HDfprintf(stdout, "frspace_stats.tot_space = %" PRIuHSIZE ", state->tot_space = %" PRIuHSIZE "\n", + frspace_stats.tot_space, state->tot_space); TEST_ERROR } /* end if */ if (frspace_stats.tot_sect_count != state->tot_sect_count) { - HDfprintf(stdout, "frspace_stats.tot_sect_count = %Hu, state->tot_sect_count = %Hu\n", + HDfprintf(stdout, + "frspace_stats.tot_sect_count = %" PRIuHSIZE ", state->tot_sect_count = %" PRIuHSIZE "\n", frspace_stats.tot_sect_count, state->tot_sect_count); TEST_ERROR } /* end if */ if (frspace_stats.serial_sect_count != state->serial_sect_count) { - HDfprintf(stdout, "frspace_stats.serial_sect_count = %Hu, state->serial_sect_count = %Hu\n", + HDfprintf(stdout, + "frspace_stats.serial_sect_count = %" PRIuHSIZE ", state->serial_sect_count = %" PRIuHSIZE + "\n", frspace_stats.serial_sect_count, state->serial_sect_count); TEST_ERROR } /* end if */ if (frspace_stats.ghost_sect_count != state->ghost_sect_count) { - HDfprintf(stdout, "frspace_stats.ghost_sect_count = %Hu, state->ghost_sect_count = %Hu\n", + HDfprintf(stdout, + "frspace_stats.ghost_sect_count = %" PRIuHSIZE ", state->ghost_sect_count = %" PRIuHSIZE + "\n", frspace_stats.ghost_sect_count, state->ghost_sect_count); TEST_ERROR } /* end if */ diff --git a/test/mirror_vfd.c b/test/mirror_vfd.c index 416a338..325999b 100644 --- a/test/mirror_vfd.c +++ b/test/mirror_vfd.c @@ -2341,7 +2341,7 @@ test_vanishing_datasets(void) TEST_ERROR; } if (group_info.nlinks > 0) { - HDfprintf(stderr, "links in rw file: %d\n", group_info.nlinks); + HDfprintf(stderr, "links in rw file: %" PRIuHSIZE "\n", group_info.nlinks); HDfflush(stderr); TEST_ERROR; } @@ -2356,7 +2356,7 @@ test_vanishing_datasets(void) TEST_ERROR; } if (group_info.nlinks > 0) { - HDfprintf(stderr, "links in wo file: %d\n", group_info.nlinks); + HDfprintf(stderr, "links in wo file: %" PRIuHSIZE "\n", group_info.nlinks); HDfflush(stderr); TEST_ERROR; } diff --git a/test/ros3.c b/test/ros3.c index 856160d..7ecba0e 100644 --- a/test/ros3.c +++ b/test/ros3.c @@ -193,15 +193,21 @@ * *---------------------------------------------------------------------------- */ +static inline void +jserr_long(long expected, long actual, const char *reason) +{ + if (reason != NULL) { + HDprintf("%s\n", reason); + } + else { + HDprintf(" ! Expected %ld\n ! Actual %ld\n", expected, actual); + } +} + #define JSERR_LONG(expected, actual, reason) \ { \ JSFAILED_AT() \ - if (reason != NULL) { \ - HDprintf("%s\n", (reason)); \ - } \ - else { \ - HDprintf(" ! Expected %ld\n ! Actual %ld\n", (long)(expected), (long)(actual)); \ - } \ + jserr_long((long)(expected), (long)(actual), (reason)); \ } /*---------------------------------------------------------------------------- @@ -232,15 +238,21 @@ * *---------------------------------------------------------------------------- */ +static inline void +jserr_str(const char *expected, const char *actual, const char *reason) +{ + if (reason != NULL) { + HDprintf("%s\n", reason); + } + else { + HDprintf("!!! Expected:\n%s\n!!!Actual:\n%s\n", expected, actual); + } +} + #define JSERR_STR(expected, actual, reason) \ { \ JSFAILED_AT() \ - if ((reason) != NULL) { \ - HDprintf("%s\n", (reason)); \ - } \ - else { \ - HDprintf("!!! Expected:\n%s\n!!!Actual:\n%s\n", (expected), (actual)); \ - } \ + jserr_str((expected), (actual), (reason)); \ } #ifdef JSVERIFY_EXP_ACT diff --git a/test/s3comms.c b/test/s3comms.c index 73d59a4..862914e 100644 --- a/test/s3comms.c +++ b/test/s3comms.c @@ -181,15 +181,21 @@ * *---------------------------------------------------------------------------- */ +static inline void +jserr_long(long expected, long actual, const char *reason) +{ + if (reason != NULL) { + HDprintf("%s\n", reason); + } + else { + HDprintf(" ! Expected %ld\n ! Actual %ld\n", expected, actual); + } +} + #define JSERR_LONG(expected, actual, reason) \ { \ JSFAILED_AT() \ - if (reason != NULL) { \ - HDprintf("%s\n", (reason)); \ - } \ - else { \ - HDprintf(" ! Expected %ld\n ! Actual %ld\n", (long)(expected), (long)(actual)); \ - } \ + jserr_long((long)(expected), (long)(actual), reason); \ } /*---------------------------------------------------------------------------- @@ -220,15 +226,21 @@ * *---------------------------------------------------------------------------- */ +static inline void +jserr_str(const char *expected, const char *actual, const char *reason) +{ + if (reason != NULL) { + HDprintf("%s\n", reason); + } + else { + HDprintf("!!! Expected:\n%s\n!!!Actual:\n%s\n", expected, actual); + } +} + #define JSERR_STR(expected, actual, reason) \ { \ JSFAILED_AT() \ - if ((reason) != NULL) { \ - HDprintf("%s\n", (reason)); \ - } \ - else { \ - HDprintf("!!! Expected:\n%s\n!!!Actual:\n%s\n", (expected), (actual)); \ - } \ + jserr_str((expected), (actual), (reason)); \ } #ifdef JSVERIFY_EXP_ACT @@ -2218,7 +2230,7 @@ test_signing_key(void) NULL) JSVERIFY(0, strncmp((const char *)cases[i].exp, (const char *)key, SHA256_DIGEST_LENGTH), - cases[i].exp) + (const char *)cases[i].exp) free(key); key = NULL; diff --git a/test/swmr.c b/test/swmr.c index df52037..44f4277 100644 --- a/test/swmr.c +++ b/test/swmr.c @@ -5575,7 +5575,7 @@ test_file_lock_swmr_concur(hid_t in_fapl) } /* Open the test file */ - H5E_BEGIN_TRY { child_fid = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT); } + H5E_BEGIN_TRY { child_fid = H5Fopen(filename, H5F_ACC_RDWR, fapl); } H5E_END_TRY; /* Should fail */ @@ -5900,7 +5900,7 @@ test_file_lock_swmr_concur(hid_t in_fapl) FAIL_STACK_ERROR /* Open the test file */ - if ((fid = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) + if ((fid = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) FAIL_STACK_ERROR /* Notify child process */ @@ -6092,7 +6092,7 @@ test_file_lock_env_var(hid_t in_fapl) /* Child process */ - hid_t child_fid; /* File ID */ + hid_t child_fid = H5I_INVALID_HID; /* File ID */ int child_notify = 0; /* Close unused write end for out_pdf */ @@ -6103,7 +6103,7 @@ test_file_lock_env_var(hid_t in_fapl) while (child_notify != 1) { if (HDread(out_pdf[0], &child_notify, sizeof(int)) < 0) HDexit(EXIT_FAILURE); - } /* end while */ + } /* Open the test file */ if ((child_fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) @@ -7013,7 +7013,7 @@ error: } H5E_END_TRY; - return -1; + return 1; } /* test_multiple_same() */ @@ -3336,7 +3336,7 @@ main(void) nerrors += test_stdio() < 0 ? 1 : 0; nerrors += test_windows() < 0 ? 1 : 0; nerrors += test_ros3() < 0 ? 1 : 0; -/* nerrors += test_splitter() < 0 ? 1 : 0; */ + /* nerrors += test_splitter() < 0 ? 1 : 0; */ if (nerrors) { HDprintf("***** %d Virtual File Driver TEST%s FAILED! *****\n", nerrors, nerrors > 1 ? "S" : ""); |