From c60ceb8c08b6c5472bd79ebf2464b2409a398919 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Sun, 4 Aug 2019 15:19:04 -0500 Subject: Merge reconciliation and VFD test fixes --- MANIFEST | 1 + examples/h5_extend_write.c | 6 +- test/cache_image.c | 6 +- test/dsets.c | 519 +++++++++++++++++----------------- test/error_test.c | 54 ++-- test/flush2.c | 8 +- test/gheap.c | 26 +- test/h5test.c | 2 - test/mf.c | 1 - tools/src/h5dump/h5dump.c | 1 - tools/src/h5ls/h5ls.c | 1 - tools/src/h5stat/h5stat.c | 13 +- tools/test/h5dump/CMakeTests.cmake | 10 + tools/test/h5dump/CMakeVFDTests.cmake | 91 ++++++ tools/test/h5dump/h5dumpgentest.c | 12 +- tools/test/misc/CMakeLists.txt | 18 +- 16 files changed, 438 insertions(+), 331 deletions(-) create mode 100644 tools/test/h5dump/CMakeVFDTests.cmake diff --git a/MANIFEST b/MANIFEST index 594f4bc..83c03a5 100644 --- a/MANIFEST +++ b/MANIFEST @@ -3393,6 +3393,7 @@ ./tools/test/h5dump/CMakeTestsPBITS.cmake ./tools/test/h5dump/CMakeTestsXML.cmake ./tools/test/h5dump/CMakeTestsVDS.cmake +./tools/test/h5dump/CMakeVFDTests.cmake ./tools/src/h5format_convert/CMakeLists.txt ./tools/test/h5format_convert/CMakeLists.txt ./tools/test/h5format_convert/CMakeTests.cmake diff --git a/examples/h5_extend_write.c b/examples/h5_extend_write.c index f3f6077..4abda30 100644 --- a/examples/h5_extend_write.c +++ b/examples/h5_extend_write.c @@ -163,9 +163,9 @@ main (void) /* * Resulting dataset * - * 1 1 1 3 3 - * 1 1 1 3 3 - * 1 1 1 0 0 + * 1 1 1 3 3 + * 1 1 1 3 3 + * 1 1 1 0 0 * 2 0 0 0 0 * 2 0 0 0 0 * 2 0 0 0 0 diff --git a/test/cache_image.c b/test/cache_image.c index f8252ac..9150836 100644 --- a/test/cache_image.c +++ b/test/cache_image.c @@ -93,7 +93,6 @@ static unsigned evict_on_close_test(hbool_t single_file_vfd); #define DSET_SIZE (40 * CHUNK_SIZE) #define MAX_NUM_DSETS 256 - static void create_datasets(hid_t file_id, int min_dset, int max_dset) { @@ -4486,7 +4485,6 @@ cache_image_smoke_check_4(hbool_t single_file_vfd) if ( show_progress ) HDfprintf(stdout, "%s:L3 cp = %d, max_dset = %d, pass = %d.\n", fcn_name, cp + 2, max_dset, pass); - } /* end while */ cp += 3; @@ -5111,8 +5109,8 @@ cache_image_smoke_check_5(hbool_t single_file_vfd) * extension message has been deleted. */ i = min_group; - while ( ( pass ) && ( i <= max_group ) ) { - sprintf(process_group_name, "/process_%d", i); + while ( ( pass ) && ( i <= max_group ) ) { + sprintf(process_group_name, "/process_%d", i); validate_zoo(file_id, process_group_name, i++); } diff --git a/test/dsets.c b/test/dsets.c index 5976df5..50a6907 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -88,7 +88,6 @@ const char *FILENAME[] = { #define OHMIN_FILENAME_A "ohdr_min_a" - #define FILENAME_BUF_SIZE 1024 #define KB 1024 @@ -401,7 +400,7 @@ test_create(hid_t file) } H5E_END_TRY; if(dataset >= 0) { H5_FAILED(); - puts(" Library allowed overwrite of existing dataset."); + HDputs(" Library allowed overwrite of existing dataset."); goto error; } @@ -423,7 +422,7 @@ test_create(hid_t file) } H5E_END_TRY; if(dataset >= 0) { H5_FAILED(); - puts(" Opened a non-existent dataset."); + HDputs(" Opened a non-existent dataset."); goto error; } @@ -445,7 +444,7 @@ test_create(hid_t file) } H5E_END_TRY; if(dataset >= 0) { H5_FAILED(); - puts(" Opened a dataset with incorrect chunking parameters."); + HDputs(" Opened a dataset with incorrect chunking parameters."); goto error; } @@ -566,8 +565,8 @@ test_simple_io(const char *env_h5_drvr, hid_t fapl) for(j = 0; j < DSET_DIM2; j++) { if(points[i][j] != check[i][j]) { H5_FAILED(); - printf(" Read different values than written.\n"); - printf(" At index %d,%d\n", i, j); + HDprintf(" Read different values than written.\n"); + HDprintf(" At index %d,%d\n", i, j); goto error; } } @@ -590,8 +589,8 @@ test_simple_io(const char *env_h5_drvr, hid_t fapl) for(j = 0; j < DSET_DIM2; j++) { if(points[i][j] != rdata[i][j]) { H5_FAILED(); - printf(" Read different values than written.\n"); - printf(" At index %d,%d\n", i, j); + HDprintf(" Read different values than written.\n"); + HDprintf(" At index %d,%d\n", i, j); goto error; } } @@ -605,7 +604,7 @@ test_simple_io(const char *env_h5_drvr, hid_t fapl) } /* end if */ else { SKIPPED(); - puts(" Current VFD doesn't support continuous address space"); + HDputs(" Current VFD doesn't support continuous address space"); } /* end else */ return SUCCEED; @@ -699,8 +698,8 @@ test_userblock_offset(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) for(j = 0; j < DSET_DIM2; j++) { if(points[i][j] != rdata[i][j]) { H5_FAILED(); - printf(" Read different values than written.\n"); - printf(" At index %d,%d\n", i, j); + HDprintf(" Read different values than written.\n"); + HDprintf(" At index %d,%d\n", i, j); goto error; } } @@ -713,7 +712,7 @@ test_userblock_offset(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) } /* end if */ else { SKIPPED(); - puts(" Current VFD doesn't support continuous address space"); + HDputs(" Current VFD doesn't support continuous address space"); } /* end else */ return SUCCEED; @@ -814,10 +813,10 @@ test_compact_io(hid_t fapl) for(j = 0; j < 8; j++) if(rbuf[i][j] != wbuf[i][j]) { H5_FAILED(); - printf(" Read different values than written.\n"); - printf(" At index %d,%d\n", i, j); - printf(" wbuf[%d][%d]=%d\n", i, j, wbuf[i][j]); - printf(" rbuf[%d][%d]=%d\n", i, j, rbuf[i][j]); + HDprintf(" Read different values than written.\n"); + HDprintf(" At index %d,%d\n", i, j); + HDprintf(" wbuf[%d][%d]=%d\n", i, j, wbuf[i][j]); + HDprintf(" rbuf[%d][%d]=%d\n", i, j, rbuf[i][j]); goto error; } /* end */ @@ -872,10 +871,10 @@ test_compact_io(hid_t fapl) for(j = 0; j < 8; j++) if(rbuf[i][j] != wbuf[i][j]) { H5_FAILED(); - printf(" Read different values than written.\n"); - printf(" At index %d,%d\n", i, j); - printf(" wbuf[%d][%d]=%d\n", i, j, wbuf[i][j]); - printf(" rbuf[%d][%d]=%d\n", i, j, rbuf[i][j]); + HDprintf(" Read different values than written.\n"); + HDprintf(" At index %d,%d\n", i, j); + HDprintf(" wbuf[%d][%d]=%d\n", i, j, wbuf[i][j]); + HDprintf(" rbuf[%d][%d]=%d\n", i, j, rbuf[i][j]); goto error; } /* end */ @@ -1013,8 +1012,8 @@ test_max_compact(hid_t fapl) for(u = 0; u < compact_size; u++) if(rbuf[u] != wbuf[u]) { H5_FAILED(); - printf(" Read different values than written.\n"); - printf(" At index %u\n", (unsigned)u); + HDprintf(" Read different values than written.\n"); + HDprintf(" At index %u\n", (unsigned)u); goto error; } /* end if */ @@ -1313,7 +1312,7 @@ test_conv_buffer(hid_t fid) } H5E_END_TRY; if(status >= 0) { H5_FAILED(); - puts(" Library shouldn't allow conversion buffer too small"); + HDputs(" Library shouldn't allow conversion buffer too small"); goto error; } @@ -1338,7 +1337,7 @@ test_conv_buffer(hid_t fid) HDfree(cf); HDfree(cfrR); - puts(" PASSED"); + HDputs(" PASSED"); return SUCCEED; error: @@ -1415,7 +1414,7 @@ test_tconv(hid_t file) in[4 * i + 2] != out[4 * i + 1] || in[4 * i + 3] != out[4 * i + 0]) { H5_FAILED(); - puts(" Read with byte order conversion failed."); + HDputs(" Read with byte order conversion failed."); goto error; } } @@ -1425,7 +1424,7 @@ test_tconv(hid_t file) HDfree(out); HDfree(in); - puts(" PASSED"); + HDputs(" PASSED"); return SUCCEED; error: @@ -1771,7 +1770,7 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl, int if_fletcher32, /* Check if all the filters are available */ if(H5Pall_filters_avail(dcpl)!=TRUE) { H5_FAILED(); - printf(" Line %d: Incorrect filter availability\n",__LINE__); + HDprintf(" Line %d: Incorrect filter availability\n",__LINE__); goto error; } /* end if */ @@ -1794,8 +1793,8 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl, int if_fletcher32, for(j=0; j<(size_t)size[1]; j++) { if(0!=check[i][j]) { H5_FAILED(); - printf(" Read a non-zero value.\n"); - printf(" At index %lu,%lu\n", + HDprintf(" Read a non-zero value.\n"); + HDprintf(" At index %lu,%lu\n", (unsigned long)i, (unsigned long)j); goto error; } @@ -1860,10 +1859,10 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl, int if_fletcher32, for(j=0; j HDpow(10.0F, -3.0F)) { H5_FAILED(); - printf(" Read different values than written.\n"); - printf(" At index %lu,%lu\n", (unsigned long)i, (unsigned long)j); + HDprintf(" Read different values than written.\n"); + HDprintf(" At index %lu,%lu\n", (unsigned long)i, (unsigned long)j); goto error; } } @@ -4931,8 +4930,8 @@ test_scaleoffset_float_2(hid_t file) for(j=0; j<(size_t)size[1]; j++) { if(HDfabs(new_data[0][j]-orig_data[0][j]) > HDpow(10.0F, -3.0F)) { H5_FAILED(); - printf(" Read different values than written.\n"); - printf(" At index %lu,%lu\n", (unsigned long)0, (unsigned long)j); + HDprintf(" Read different values than written.\n"); + HDprintf(" At index %lu,%lu\n", (unsigned long)0, (unsigned long)j); goto error; } } @@ -5042,8 +5041,8 @@ test_scaleoffset_double(hid_t file) for(j=0; j<(size_t)size[1]; j++) { if(HDfabs(new_data[i][j]-orig_data[i][j]) > HDpow(10.0F, -7.0F)) { H5_FAILED(); - printf(" Read different values than written.\n"); - printf(" At index %lu,%lu\n", (unsigned long)i, (unsigned long)j); + HDprintf(" Read different values than written.\n"); + HDprintf(" At index %lu,%lu\n", (unsigned long)i, (unsigned long)j); goto error; } } @@ -5173,8 +5172,8 @@ test_scaleoffset_double_2(hid_t file) for(j=0; j<(size_t)size[1]; j++) { if(HDfabs(new_data[0][j]-orig_data[0][j]) > HDpow(10.0F, -7.0F)) { H5_FAILED(); - printf(" Read different values than written.\n"); - printf(" At index %lu,%lu\n", (unsigned long)0, (unsigned long)j); + HDprintf(" Read different values than written.\n"); + HDprintf(" At index %lu,%lu\n", (unsigned long)0, (unsigned long)j); goto error; } } @@ -5240,7 +5239,7 @@ test_multiopen (hid_t file) if(H5Sget_simple_extent_dims(space, tmp_size, NULL) < 0) goto error; if(cur_size[0] != tmp_size[0]) { H5_FAILED(); - printf(" Got %d instead of %d!\n", (int)tmp_size[0], (int)cur_size[0]); + HDprintf(" Got %d instead of %d!\n", (int)tmp_size[0], (int)cur_size[0]); goto error; } /* end if */ @@ -5402,30 +5401,30 @@ test_can_apply(hid_t file) /* Create dcpl with special filter */ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) { H5_FAILED(); - printf(" Line %d: Can't create dcpl\n",__LINE__); + HDprintf(" Line %d: Can't create dcpl\n",__LINE__); goto error; } /* end if */ if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0) { H5_FAILED(); - printf(" Line %d: Can't set chunk sizes\n",__LINE__); + HDprintf(" Line %d: Can't set chunk sizes\n",__LINE__); goto error; } /* end if */ if(H5Zregister (H5Z_CAN_APPLY_TEST) < 0) { H5_FAILED(); - printf(" Line %d: Can't register 'can apply' filter\n",__LINE__); + HDprintf(" Line %d: Can't register 'can apply' filter\n",__LINE__); goto error; } /* The filter is mandate. */ if(H5Pset_filter(dcpl, H5Z_FILTER_CAN_APPLY_TEST, 0, (size_t)0, NULL) < 0) { H5_FAILED(); - printf(" Line %d: Can't set bogus filter\n",__LINE__); + HDprintf(" Line %d: Can't set bogus filter\n",__LINE__); goto error; } /* Create the data space */ if((sid = H5Screate_simple(2, dims, NULL)) < 0) { H5_FAILED(); - printf(" Line %d: Can't open dataspace\n",__LINE__); + HDprintf(" Line %d: Can't open dataspace\n",__LINE__); goto error; } /* end if */ @@ -5437,7 +5436,7 @@ test_can_apply(hid_t file) } H5E_END_TRY; if(dsid >=0) { H5_FAILED(); - printf(" Line %d: Shouldn't have created dataset!\n",__LINE__); + HDprintf(" Line %d: Shouldn't have created dataset!\n",__LINE__); H5Dclose(dsid); goto error; } /* end if */ @@ -5448,7 +5447,7 @@ test_can_apply(hid_t file) } H5E_END_TRY; if(dsid >=0) { H5_FAILED(); - printf(" Line %d: Shouldn't have created dataset!\n",__LINE__); + HDprintf(" Line %d: Shouldn't have created dataset!\n",__LINE__); H5Dclose(dsid); goto error; } /* end if */ @@ -5456,42 +5455,42 @@ test_can_apply(hid_t file) /* Create new dataset */ if((dsid = H5Dcreate2(file, DSET_CAN_APPLY_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) { H5_FAILED(); - printf(" Line %d: Can't create dataset\n",__LINE__); + HDprintf(" Line %d: Can't create dataset\n",__LINE__); goto error; } /* end if */ /* Write data */ if(H5Dwrite(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0) { H5_FAILED(); - printf(" Line %d: Error writing dataset data\n",__LINE__); + HDprintf(" Line %d: Error writing dataset data\n",__LINE__); goto error; } /* end if */ /* Flush the file (to clear the cache) */ if(H5Fflush(file, H5F_SCOPE_GLOBAL) < 0) { H5_FAILED(); - printf(" Line %d: Error flushing file\n",__LINE__); + HDprintf(" Line %d: Error flushing file\n",__LINE__); goto error; } /* end if */ /* Query the dataset's size on disk */ if((dset_size=H5Dget_storage_size(dsid))==0) { H5_FAILED(); - printf(" Line %d: Error querying dataset size\n",__LINE__); + HDprintf(" Line %d: Error querying dataset size\n",__LINE__); goto error; } /* end if */ /* Verify that the size indicates data is uncompressed */ if((H5Tget_size(H5T_NATIVE_INT)*dims[0]*dims[1])!=dset_size) { H5_FAILED(); - printf(" Line %d: Incorrect dataset size: %lu\n",__LINE__,(unsigned long)dset_size); + HDprintf(" Line %d: Incorrect dataset size: %lu\n",__LINE__,(unsigned long)dset_size); goto error; } /* end if */ /* Read data */ if(H5Dread(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, check) < 0) { H5_FAILED(); - printf(" Line %d: Error reading dataset data\n",__LINE__); + HDprintf(" Line %d: Error reading dataset data\n",__LINE__); goto error; } /* end if */ @@ -5501,10 +5500,10 @@ test_can_apply(hid_t file) for(j=0; j<(size_t)dims[1]; j++) { if(points[i][j] != check[i][j]) { H5_FAILED(); - printf(" Line %d: Read different values than written.\n",__LINE__); - printf(" At index %lu,%lu\n", (unsigned long)(i), (unsigned long)(j)); - printf(" At original: %d\n",points[i][j]); - printf(" At returned: %d\n",check[i][j]); + HDprintf(" Line %d: Read different values than written.\n",__LINE__); + HDprintf(" At index %lu,%lu\n", (unsigned long)(i), (unsigned long)(j)); + HDprintf(" At original: %d\n",points[i][j]); + HDprintf(" At returned: %d\n",check[i][j]); goto error; } /* end if */ } /* end for */ @@ -5513,21 +5512,21 @@ test_can_apply(hid_t file) /* Close dataset */ if(H5Dclose(dsid) < 0) { H5_FAILED(); - printf(" Line %d: Can't close dataset\n",__LINE__); + HDprintf(" Line %d: Can't close dataset\n",__LINE__); goto error; } /* end if */ /* Close dataspace */ if(H5Sclose(sid) < 0) { H5_FAILED(); - printf(" Line %d: Can't close dataspace\n",__LINE__); + HDprintf(" Line %d: Can't close dataspace\n",__LINE__); goto error; } /* end if */ /* Close dataset creation property list */ if(H5Pclose(dcpl) < 0) { H5_FAILED(); - printf(" Line %d: Can't close dcpl\n",__LINE__); + HDprintf(" Line %d: Can't close dcpl\n",__LINE__); goto error; } /* end if */ @@ -5585,72 +5584,72 @@ test_can_apply2(hid_t file) /* Create dcpl with special filter */ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) { H5_FAILED(); - printf(" Line %d: Can't create dcpl\n",__LINE__); + HDprintf(" Line %d: Can't create dcpl\n",__LINE__); goto error; } /* end if */ if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0) { H5_FAILED(); - printf(" Line %d: Can't set chunk sizes\n",__LINE__); + HDprintf(" Line %d: Can't set chunk sizes\n",__LINE__); goto error; } /* end if */ if(H5Zregister (H5Z_CAN_APPLY_TEST2) < 0) { H5_FAILED(); - printf(" Line %d: Can't register 'can apply' filter\n",__LINE__); + HDprintf(" Line %d: Can't register 'can apply' filter\n",__LINE__); goto error; } /* The filter is optional. */ if(H5Pset_filter(dcpl, H5Z_FILTER_CAN_APPLY_TEST2, H5Z_FLAG_OPTIONAL, (size_t)0, NULL) < 0) { H5_FAILED(); - printf(" Line %d: Can't set bogus filter\n",__LINE__); + HDprintf(" Line %d: Can't set bogus filter\n",__LINE__); goto error; } /* Create the data space */ if((sid = H5Screate_simple(2, dims, NULL)) < 0) { H5_FAILED(); - printf(" Line %d: Can't open dataspace\n",__LINE__); + HDprintf(" Line %d: Can't open dataspace\n",__LINE__); goto error; } /* end if */ /* Create new dataset */ if((dsid = H5Dcreate2(file, DSET_CAN_APPLY_NAME2, H5T_NATIVE_DOUBLE, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) { H5_FAILED(); - printf(" Line %d: Can't create dataset\n",__LINE__); + HDprintf(" Line %d: Can't create dataset\n",__LINE__); goto error; } /* end if */ /* Write data */ if(H5Dwrite(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0) { H5_FAILED(); - printf(" Line %d: Error writing dataset data\n",__LINE__); + HDprintf(" Line %d: Error writing dataset data\n",__LINE__); goto error; } /* end if */ /* Flush the file (to clear the cache) */ if(H5Fflush(file, H5F_SCOPE_GLOBAL) < 0) { H5_FAILED(); - printf(" Line %d: Error flushing file\n",__LINE__); + HDprintf(" Line %d: Error flushing file\n",__LINE__); goto error; } /* end if */ /* Query the dataset's size on disk */ if((dset_size=H5Dget_storage_size(dsid))==0) { H5_FAILED(); - printf(" Line %d: Error querying dataset size\n",__LINE__); + HDprintf(" Line %d: Error querying dataset size\n",__LINE__); goto error; } /* end if */ /* Verify that the size indicates data is uncompressed */ if((H5Tget_size(H5T_NATIVE_DOUBLE)*dims[0]*dims[1])!=dset_size) { H5_FAILED(); - printf(" Line %d: Incorrect dataset size: %lu\n",__LINE__,(unsigned long)dset_size); + HDprintf(" Line %d: Incorrect dataset size: %lu\n",__LINE__,(unsigned long)dset_size); goto error; } /* end if */ /* Read data */ if(H5Dread(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, check) < 0) { H5_FAILED(); - printf(" Line %d: Error reading dataset data\n",__LINE__); + HDprintf(" Line %d: Error reading dataset data\n",__LINE__); goto error; } /* end if */ @@ -5660,10 +5659,10 @@ test_can_apply2(hid_t file) for(j=0; j<(size_t)dims[1]; j++) { if(points[i][j] != check[i][j]) { H5_FAILED(); - printf(" Line %d: Read different values than written.\n",__LINE__); - printf(" At index %lu,%lu\n", (unsigned long)(i), (unsigned long)(j)); - printf(" At original: %d\n",points[i][j]); - printf(" At returned: %d\n",check[i][j]); + HDprintf(" Line %d: Read different values than written.\n",__LINE__); + HDprintf(" At index %lu,%lu\n", (unsigned long)(i), (unsigned long)(j)); + HDprintf(" At original: %d\n",points[i][j]); + HDprintf(" At returned: %d\n",check[i][j]); goto error; } /* end if */ } /* end for */ @@ -5672,21 +5671,21 @@ test_can_apply2(hid_t file) /* Close dataset */ if(H5Dclose(dsid) < 0) { H5_FAILED(); - printf(" Line %d: Can't close dataset\n",__LINE__); + HDprintf(" Line %d: Can't close dataset\n",__LINE__); goto error; } /* end if */ /* Close dataspace */ if(H5Sclose(sid) < 0) { H5_FAILED(); - printf(" Line %d: Can't close dataspace\n",__LINE__); + HDprintf(" Line %d: Can't close dataspace\n",__LINE__); goto error; } /* end if */ /* Close dataset creation property list */ if(H5Pclose(dcpl) < 0) { H5_FAILED(); - printf(" Line %d: Can't close dcpl\n",__LINE__); + HDprintf(" Line %d: Can't close dcpl\n",__LINE__); goto error; } /* end if */ @@ -5742,19 +5741,19 @@ file) /* Create the data space */ if((sid = H5Screate_simple(2, dims, NULL)) < 0) { H5_FAILED(); - printf(" Line %d: Can't open dataspace\n",__LINE__); + HDprintf(" Line %d: Can't open dataspace\n",__LINE__); goto error; } /* end if */ /* Create dcpl with special filter */ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) { H5_FAILED(); - printf(" Line %d: Can't create dcpl\n",__LINE__); + HDprintf(" Line %d: Can't create dcpl\n",__LINE__); goto error; } /* end if */ if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0) { H5_FAILED(); - printf(" Line %d: Can't set chunk sizes\n",__LINE__); + HDprintf(" Line %d: Can't set chunk sizes\n",__LINE__); goto error; } /* end if */ @@ -5765,7 +5764,7 @@ file) } H5E_END_TRY; if(ret>=0) { H5_FAILED(); - printf(" Line %d: Shouldn't be able to set szip filter\n",__LINE__); + HDprintf(" Line %d: Shouldn't be able to set szip filter\n",__LINE__); goto error; } @@ -5776,7 +5775,7 @@ file) } H5E_END_TRY; if(ret>=0) { H5_FAILED(); - printf(" Line %d: Shouldn't be able to set szip filter\n",__LINE__); + HDprintf(" Line %d: Shouldn't be able to set szip filter\n",__LINE__); goto error; } @@ -5784,7 +5783,7 @@ file) szip_pixels_per_block=2; if(H5Pset_szip (dcpl, szip_options_mask, szip_pixels_per_block) < 0) { H5_FAILED(); - printf(" Line %d: Can't set szip filter\n",__LINE__); + HDprintf(" Line %d: Can't set szip filter\n",__LINE__); goto error; } @@ -5796,47 +5795,47 @@ file) } H5E_END_TRY; if(dsid <=0) { H5_FAILED(); - printf(" Line %d: Should have created dataset!\n",__LINE__); + HDprintf(" Line %d: Should have created dataset!\n",__LINE__); goto error; } /* end if */ /* Close dataset */ if(H5Dclose(dsid) < 0) { H5_FAILED(); - printf(" Line %d: Can't close dataset\n",__LINE__); + HDprintf(" Line %d: Can't close dataset\n",__LINE__); goto error; } /* end if */ /* Close dataspace */ if(H5Sclose(sid) < 0) { H5_FAILED(); - printf(" Line %d: Can't close dataspace\n",__LINE__); + HDprintf(" Line %d: Can't close dataspace\n",__LINE__); goto error; } /* end if */ /* Close dataset creation property list */ if(H5Pclose(dcpl) < 0) { H5_FAILED(); - printf(" Line %d: Can't close dcpl\n",__LINE__); + HDprintf(" Line %d: Can't close dcpl\n",__LINE__); goto error; } /* end if */ /* Create another data space */ if((sid = H5Screate_simple(2, dims2, NULL)) < 0) { H5_FAILED(); - printf(" Line %d: Can't open dataspace\n",__LINE__); + HDprintf(" Line %d: Can't open dataspace\n",__LINE__); goto error; } /* end if */ /* Create dcpl with special filter */ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) { H5_FAILED(); - printf(" Line %d: Can't create dcpl\n",__LINE__); + HDprintf(" Line %d: Can't create dcpl\n",__LINE__); goto error; } /* end if */ if(H5Pset_chunk(dcpl, 2, chunk_dims2) < 0) { H5_FAILED(); - printf(" Line %d: Can't set chunk sizes\n",__LINE__); + HDprintf(" Line %d: Can't set chunk sizes\n",__LINE__); goto error; } /* end if */ @@ -5844,7 +5843,7 @@ file) szip_pixels_per_block=32; if(H5Pset_szip (dcpl, szip_options_mask, szip_pixels_per_block) < 0) { H5_FAILED(); - printf(" Line %d: Can't set szip filter\n",__LINE__); + HDprintf(" Line %d: Can't set szip filter\n",__LINE__); goto error; } @@ -5855,7 +5854,7 @@ file) } H5E_END_TRY; if(dsid >=0) { H5_FAILED(); - printf(" Line %d: Shouldn't have created dataset!\n",__LINE__); + HDprintf(" Line %d: Shouldn't have created dataset!\n",__LINE__); H5Dclose(dsid); goto error; } /* end if */ @@ -5863,14 +5862,14 @@ file) /* Close dataspace */ if(H5Sclose(sid) < 0) { H5_FAILED(); - printf(" Line %d: Can't close dataspace\n",__LINE__); + HDprintf(" Line %d: Can't close dataspace\n",__LINE__); goto error; } /* end if */ /* Close dataset creation property list */ if(H5Pclose(dcpl) < 0) { H5_FAILED(); - printf(" Line %d: Can't close dcpl\n",__LINE__); + HDprintf(" Line %d: Can't close dcpl\n",__LINE__); goto error; } /* end if */ @@ -5878,11 +5877,11 @@ file) PASSED(); } else { SKIPPED(); - puts(" Szip encoding is not enabled."); + HDputs(" Szip encoding is not enabled."); } #else /* H5_HAVE_FILTER_SZIP */ SKIPPED(); - puts(" Szip filter is not enabled."); + HDputs(" Szip filter is not enabled."); #endif /* H5_HAVE_FILTER_SZIP */ return SUCCEED; @@ -5948,57 +5947,57 @@ test_set_local(hid_t fapl) /* Open file */ if((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) { H5_FAILED(); - printf(" Line %d: Can't open file\n",__LINE__); + HDprintf(" Line %d: Can't open file\n",__LINE__); goto error; } /* Create dcpl with special filter */ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) { H5_FAILED(); - printf(" Line %d: Can't create dcpl\n",__LINE__); + HDprintf(" Line %d: Can't create dcpl\n",__LINE__); goto error; } /* end if */ if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0) { H5_FAILED(); - printf(" Line %d: Can't set chunk sizes\n",__LINE__); + HDprintf(" Line %d: Can't set chunk sizes\n",__LINE__); goto error; } /* end if */ if(H5Zregister (H5Z_SET_LOCAL_TEST) < 0) { H5_FAILED(); - printf(" Line %d: Can't register 'set local' filter\n",__LINE__); + HDprintf(" Line %d: Can't register 'set local' filter\n",__LINE__); goto error; } if(H5Pset_filter(dcpl, H5Z_FILTER_SET_LOCAL_TEST, 0, (size_t)BOGUS2_PERM_NPARMS, cd_values) < 0) { H5_FAILED(); - printf(" Line %d: Can't set bogus2 filter\n",__LINE__); + HDprintf(" Line %d: Can't set bogus2 filter\n",__LINE__); goto error; } /* Create the data space */ if((sid = H5Screate_simple(2, dims, NULL)) < 0) { H5_FAILED(); - printf(" Line %d: Can't open dataspace\n",__LINE__); + HDprintf(" Line %d: Can't open dataspace\n",__LINE__); goto error; } /* end if */ /* Create new dataset */ if((dsid = H5Dcreate2(file, DSET_SET_LOCAL_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) { H5_FAILED(); - printf(" Line %d: Can't create dataset\n",__LINE__); + HDprintf(" Line %d: Can't create dataset\n",__LINE__); goto error; } /* end if */ /* Write data */ if(H5Dwrite(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0) { H5_FAILED(); - printf(" Line %d: Error writing dataset data\n",__LINE__); + HDprintf(" Line %d: Error writing dataset data\n",__LINE__); goto error; } /* end if */ /* Close dataset */ if(H5Dclose(dsid) < 0) { H5_FAILED(); - printf(" Line %d: Can't close dataset\n",__LINE__); + HDprintf(" Line %d: Can't close dataset\n",__LINE__); goto error; } /* end if */ @@ -6006,77 +6005,77 @@ test_set_local(hid_t fapl) /* (Shouldn't get modified by output filter) */ if((dsid = H5Dcreate2(file, DSET_SET_LOCAL_NAME_2, H5T_NATIVE_DOUBLE, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) { H5_FAILED(); - printf(" Line %d: Can't create dataset\n",__LINE__); + HDprintf(" Line %d: Can't create dataset\n",__LINE__); goto error; } /* end if */ /* Write data */ if(H5Dwrite(dsid, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, points_dbl) < 0) { H5_FAILED(); - printf(" Line %d: Error writing dataset data\n",__LINE__); + HDprintf(" Line %d: Error writing dataset data\n",__LINE__); goto error; } /* end if */ /* Close dataset */ if(H5Dclose(dsid) < 0) { H5_FAILED(); - printf(" Line %d: Can't close dataset\n",__LINE__); + HDprintf(" Line %d: Can't close dataset\n",__LINE__); goto error; } /* end if */ /* Close dataspace */ if(H5Sclose(sid) < 0) { H5_FAILED(); - printf(" Line %d: Can't close dataspace\n", __LINE__); + HDprintf(" Line %d: Can't close dataspace\n", __LINE__); goto error; } /* end if */ /* Close dataset creation property list */ if(H5Pclose(dcpl) < 0) { H5_FAILED(); - printf(" Line %d: Can't close dcpl\n", __LINE__); + HDprintf(" Line %d: Can't close dcpl\n", __LINE__); goto error; } /* end if */ /* Close file (flushes & empties cache) */ if(H5Fclose(file) < 0) { H5_FAILED(); - printf(" Line %d: Can't close file\n", __LINE__); + HDprintf(" Line %d: Can't close file\n", __LINE__); goto error; } /* end if */ /* Open file */ if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) { H5_FAILED(); - printf(" Line %d: Can't open file\n", __LINE__); + HDprintf(" Line %d: Can't open file\n", __LINE__); goto error; } /* Re-open dataset */ if((dsid = H5Dopen2(file, DSET_SET_LOCAL_NAME, H5P_DEFAULT)) < 0) { H5_FAILED(); - printf(" Line %d: Can't open dataset\n", __LINE__); + HDprintf(" Line %d: Can't open dataset\n", __LINE__); goto error; } /* end if */ /* Query the dataset's size on disk */ if((dset_size = H5Dget_storage_size(dsid)) == 0) { H5_FAILED(); - printf(" Line %d: Error querying dataset size\n", __LINE__); + HDprintf(" Line %d: Error querying dataset size\n", __LINE__); goto error; } /* end if */ /* Verify that the size indicates data is uncompressed */ if((H5Tget_size(H5T_NATIVE_INT) * dims[0] * dims[1]) != dset_size) { H5_FAILED(); - printf(" Line %d: Incorrect dataset size: %lu\n", __LINE__, (unsigned long)dset_size); + HDprintf(" Line %d: Incorrect dataset size: %lu\n", __LINE__, (unsigned long)dset_size); goto error; } /* end if */ /* Read data */ if(H5Dread(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, check) < 0) { H5_FAILED(); - printf(" Line %d: Error reading dataset data\n", __LINE__); + HDprintf(" Line %d: Error reading dataset data\n", __LINE__); goto error; } /* end if */ @@ -6086,10 +6085,10 @@ test_set_local(hid_t fapl) for(j=0; j=0) { H5_FAILED(); - printf(" Line %d: Shouldn't have deleted filter!\n",__LINE__); + HDprintf(" Line %d: Shouldn't have deleted filter!\n",__LINE__); goto error; } /* end if */ @@ -6468,7 +6467,7 @@ test_filter_delete(hid_t file) } H5E_END_TRY; if(ret >=0) { H5_FAILED(); - printf(" Line %d: Shouldn't have deleted filter!\n",__LINE__); + HDprintf(" Line %d: Shouldn't have deleted filter!\n",__LINE__); goto error; } /* end if */ @@ -6566,7 +6565,7 @@ auxread_fdata(hid_t fid, const char *name) if(nelmts) { buf = (void *)HDmalloc((size_t)(nelmts * msize)); if(buf == NULL) { - printf( "cannot read into memory\n" ); + HDprintf( "cannot read into memory\n" ); goto error; } if(H5Dread(dset_id, mtype_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) @@ -6965,13 +6964,13 @@ test_missing_chunk(hid_t file) for(u=0; u=5) { if(rdata[u]!=911) { - printf(" Line %d: Incorrect value, rdata[%u]=%d\n",__LINE__,(unsigned)u,rdata[u]); + HDprintf(" Line %d: Incorrect value, rdata[%u]=%d\n",__LINE__,(unsigned)u,rdata[u]); TEST_ERROR; } /* end if */ } /* end if */ else { if(rdata[u]!=wdata[u]) { - printf(" Line %d: Incorrect value, wdata[%u]=%d, rdata[%u]=%d\n",__LINE__,(unsigned)u,wdata[u],(unsigned)u,rdata[u]); + HDprintf(" Line %d: Incorrect value, wdata[%u]=%d, rdata[%u]=%d\n",__LINE__,(unsigned)u,wdata[u],(unsigned)u,rdata[u]); TEST_ERROR; } /* end if */ } /* end else */ @@ -6983,14 +6982,14 @@ test_missing_chunk(hid_t file) if((i % 10) >= 5 || (j % 10) >= 5) { if(rdata2[i][j] != 911) { - printf(" Line %d: Incorrect value, rdata2[%u][%u] = %d\n", + HDprintf(" Line %d: Incorrect value, rdata2[%u][%u] = %d\n", __LINE__,(unsigned)i, (unsigned)j, rdata2[i][j]); TEST_ERROR; } /* end if */ } /* end if */ else { if(rdata2[i][j] != wdata2[i][j]) { - printf(" Line %d: Incorrect value, wdata2[%u][%u] = %d, rdata2[%u][%u] = %d\n", + HDprintf(" Line %d: Incorrect value, wdata2[%u][%u] = %d, rdata2[%u][%u] = %d\n", __LINE__,(unsigned)i, (unsigned)j, wdata2[i][j],(unsigned)i, (unsigned)j, rdata2[i][j]); TEST_ERROR; } /* end if */ @@ -7154,8 +7153,8 @@ test_random_chunks_real(const char *testname, hbool_t early_alloc, hid_t fapl) /* Verify that written and read data are the same */ for(i = 0; i < NPOINTS; i++) if(rbuf[i] != wbuf[i]){ - printf(" Line %d: Incorrect value, wbuf[%u]=%d, rbuf[%u]=%d\n",__LINE__,(unsigned)i,wbuf[i],(unsigned)i,rbuf[i]); - printf(" coord[%u] = {%lu, %lu}\n", (unsigned)i, (unsigned long)coord[i][0], (unsigned long)coord[i][1]); + HDprintf(" Line %d: Incorrect value, wbuf[%u]=%d, rbuf[%u]=%d\n",__LINE__,(unsigned)i,wbuf[i],(unsigned)i,rbuf[i]); + HDprintf(" coord[%u] = {%lu, %lu}\n", (unsigned)i, (unsigned long)coord[i][0], (unsigned long)coord[i][1]); TEST_ERROR; } /* end if */ @@ -7261,7 +7260,7 @@ test_random_chunks_real(const char *testname, hbool_t early_alloc, hid_t fapl) /* Verify that written and read data are the same */ for(i = 0; i < NPOINTS; i++) if(rbuf[i] != wbuf[i]){ - printf(" Line %d: Incorrect value, wbuf[%u]=%d, rbuf[%u]=%d\n",__LINE__,(unsigned)i,wbuf[i],(unsigned)i,rbuf[i]); + HDprintf(" Line %d: Incorrect value, wbuf[%u]=%d, rbuf[%u]=%d\n",__LINE__,(unsigned)i,wbuf[i],(unsigned)i,rbuf[i]); TEST_ERROR; } /* end if */ @@ -7367,7 +7366,7 @@ test_random_chunks_real(const char *testname, hbool_t early_alloc, hid_t fapl) /* Verify that written and read data are the same */ for(i = 0; i < NPOINTS; i++) if(rbuf[i] != wbuf[i]){ - printf(" Line %d: Incorrect value, wbuf[%u]=%d, rbuf[%u]=%d\n",__LINE__,(unsigned)i,wbuf[i],(unsigned)i,rbuf[i]); + HDprintf(" Line %d: Incorrect value, wbuf[%u]=%d, rbuf[%u]=%d\n",__LINE__,(unsigned)i,wbuf[i],(unsigned)i,rbuf[i]); TEST_ERROR; } /* end if */ @@ -7508,7 +7507,7 @@ test_deprec(hid_t file) } H5E_END_TRY; if(dataset >= 0) { H5_FAILED(); - puts(" Library allowed overwrite of existing dataset."); + HDputs(" Library allowed overwrite of existing dataset."); goto error; } @@ -7529,7 +7528,7 @@ test_deprec(hid_t file) } H5E_END_TRY; if(dataset >= 0) { H5_FAILED(); - puts(" Opened a non-existent dataset."); + HDputs(" Opened a non-existent dataset."); goto error; } @@ -7578,7 +7577,7 @@ test_deprec(hid_t file) } H5E_END_TRY; if(dataset >= 0) { H5_FAILED(); - puts(" Opened a dataset with incorrect chunking parameters."); + HDputs(" Opened a dataset with incorrect chunking parameters."); goto error; } @@ -7630,7 +7629,7 @@ test_deprec(hid_t file) if(H5Zregister(H5Z_DEPREC) < 0) goto error; if(H5Pset_filter(dcpl, H5Z_FILTER_DEPREC, 0, (size_t)0, NULL) < 0) goto error; - puts(""); + HDputs(""); if(test_filter_internal(file,DSET_DEPREC_NAME_FILTER,dcpl,DISABLE_FLETCHER32,DATA_NOT_CORRUPTED,&deprec_size) < 0) goto error; if(H5Pclose(dcpl) < 0) goto error; @@ -8130,15 +8129,15 @@ test_big_chunks_bypass_cache(hid_t fapl) /* Verify data for the first 1-D dataset */ for(i = 0; i < BYPASS_CHUNK_DIM / 2; i++) if(rdata1[i] != i) { - printf(" Read different values than written in the 1st chunk.\n"); - printf(" At line %d and index %d, rdata1 = %d. It should be %d.\n", __LINE__, i, rdata1[i], i); + HDprintf(" Read different values than written in the 1st chunk.\n"); + HDprintf(" At line %d and index %d, rdata1 = %d. It should be %d.\n", __LINE__, i, rdata1[i], i); TEST_ERROR } /* end if */ for(j = BYPASS_CHUNK_DIM / 2; j < BYPASS_DIM; j++) if(rdata1[j] != fvalue) { - printf(" Read different values than written in the 2nd chunk.\n"); - printf(" At line %d and index %d, rdata1 = %d. It should be %d.\n", __LINE__, i, rdata1[i], fvalue); + HDprintf(" Read different values than written in the 2nd chunk.\n"); + HDprintf(" At line %d and index %d, rdata1 = %d. It should be %d.\n", __LINE__, i, rdata1[i], fvalue); TEST_ERROR } /* end if */ @@ -8146,8 +8145,8 @@ test_big_chunks_bypass_cache(hid_t fapl) for(i = 0; i < BYPASS_CHUNK_DIM / 2; i++) for(j = 0; j < BYPASS_CHUNK_DIM / 2; j++) if(t_rdata1[i][j] != j) { - printf(" Read different values than written in the 1st chunk.\n"); - printf(" At line %d and index (%d, %d), t_rdata1 = %d. It should be %d.\n", + HDprintf(" Read different values than written in the 1st chunk.\n"); + HDprintf(" At line %d and index (%d, %d), t_rdata1 = %d. It should be %d.\n", __LINE__, i, j, t_rdata1[i][j], j); TEST_ERROR } /* end if */ @@ -8155,8 +8154,8 @@ test_big_chunks_bypass_cache(hid_t fapl) for(i = BYPASS_CHUNK_DIM / 2; i < BYPASS_DIM; i++) for(j = BYPASS_CHUNK_DIM / 2; j < BYPASS_DIM; j++) if(t_rdata1[i][j] != fvalue) { - printf(" Read different values than written in the 2nd chunk.\n"); - printf(" At line %d and index (%d, %d), t_rdata1 = %d. It should be %d.\n", + HDprintf(" Read different values than written in the 2nd chunk.\n"); + HDprintf(" At line %d and index (%d, %d), t_rdata1 = %d. It should be %d.\n", __LINE__, i, j, t_rdata1[i][j], fvalue); TEST_ERROR } /* end if */ @@ -8202,8 +8201,8 @@ test_big_chunks_bypass_cache(hid_t fapl) /* Verify data for the second 1-D dataset */ for(i = 0; i < BYPASS_CHUNK_DIM / 2; i++) if(rdata2[i] != i) { - printf(" Read different values than written in the chunk.\n"); - printf(" At line %d and index %d, rdata2 = %d. It should be %d.\n", __LINE__, i, rdata2[i], i); + HDprintf(" Read different values than written in the chunk.\n"); + HDprintf(" At line %d and index %d, rdata2 = %d. It should be %d.\n", __LINE__, i, rdata2[i], i); TEST_ERROR } /* end if */ @@ -8211,8 +8210,8 @@ test_big_chunks_bypass_cache(hid_t fapl) for(i = 0; i < BYPASS_CHUNK_DIM / 2; i++) for(j = 0; j < BYPASS_CHUNK_DIM / 2; j++) if(t_rdata2[i][j] != j) { - printf(" Read different values than written in the chunk.\n"); - printf(" At line %d and index (%d, %d), t_rdata2 = %d. It should be %d.\n", + HDprintf(" Read different values than written in the chunk.\n"); + HDprintf(" At line %d and index (%d, %d), t_rdata2 = %d. It should be %d.\n", __LINE__, i, j, t_rdata2[i][j], j); TEST_ERROR } /* end if */ @@ -8941,7 +8940,7 @@ test_chunk_expand(hid_t fapl) if(sizeof(size_t) <= 4 && low != H5F_LIBVER_LATEST) { SKIPPED(); - puts(" Current machine can't test for error w/old file format"); + HDputs(" Current machine can't test for error w/old file format"); } /* end if */ else { /* Register "expansion" filter */ @@ -9604,7 +9603,7 @@ test_fixed_array(hid_t fapl) /* Verify that written and read data are the same */ for(i = 0; i < POINTS; i++) if(rbuf[i] != wbuf[i]){ - printf(" Line %d: Incorrect value, wbuf[%u]=%d, rbuf[%u]=%d\n", + HDprintf(" Line %d: Incorrect value, wbuf[%u]=%d, rbuf[%u]=%d\n", __LINE__,(unsigned)i,wbuf[i],(unsigned)i,rbuf[i]); TEST_ERROR; } /* end if */ @@ -9632,7 +9631,7 @@ test_fixed_array(hid_t fapl) /* Verify that written and read data are the same */ for(i = 0; i < POINTS; i++) if(rbuf[i] != wbuf[i]){ - printf(" Line %d: Incorrect value, wbuf[%u]=%d, rbuf[%u]=%d\n", + HDprintf(" Line %d: Incorrect value, wbuf[%u]=%d, rbuf[%u]=%d\n", __LINE__,(unsigned)i,wbuf[i],(unsigned)i,rbuf[i]); TEST_ERROR; } /* end if */ @@ -9658,7 +9657,7 @@ test_fixed_array(hid_t fapl) /* Verify that written and read data are the same */ for(i = 0; i < POINTS_BIG; i++) if(rbuf_big[i] != wbuf_big[i]) { - printf(" Line %d: Incorrect value, wbuf_bif[%u]=%d, rbuf_big[%u]=%d\n", + HDprintf(" Line %d: Incorrect value, wbuf_bif[%u]=%d, rbuf_big[%u]=%d\n", __LINE__,(unsigned)i,wbuf_big[i],(unsigned)i,rbuf_big[i]); TEST_ERROR; } /* end if */ @@ -9897,7 +9896,7 @@ test_single_chunk(hid_t fapl) /* Verify that written and read data are the same */ for(i = 0; i < (DSET_DIM1 * DSET_DIM2); i++) if(rbuf[i] != wbuf[i]){ - printf(" Line %d: Incorrect value, wbuf[%u]=%d, rbuf[%u]=%d\n", + HDprintf(" Line %d: Incorrect value, wbuf[%u]=%d, rbuf[%u]=%d\n", __LINE__,(unsigned)i,wbuf[i],(unsigned)i,rbuf[i]); TEST_ERROR; } /* end if */ @@ -9916,7 +9915,7 @@ test_single_chunk(hid_t fapl) /* Verify that written and read data are the same */ for(i = 0; i < (DSET_TMP_DIM1* DSET_TMP_DIM2); i++) if(t_rbuf[i] != t_wbuf[i]) { - printf(" Line %d: Incorrect value, t_wbuf[%u]=%d, t_rbuf[%u]=%d\n", + HDprintf(" Line %d: Incorrect value, t_wbuf[%u]=%d, t_rbuf[%u]=%d\n", __LINE__,(unsigned)i,t_wbuf[i],(unsigned)i,t_rbuf[i]); TEST_ERROR; } /* end if */ @@ -11518,7 +11517,7 @@ typedef struct scatter_info_t { for(k=0; k<(int)(sizeof(ARR[0][0])/sizeof(ARR[0][0][0])); k++) \ if(ARR[i][j][k] != EXP[i][j][k]) { \ H5_FAILED(); AT(); \ - printf(" " #ARR "[%d][%d][%d] == %d, " #EXP "[%d][%d][%d] == %d\n", i, j, k, ARR[i][j][k], i, j, k, EXP[i][j][k]); \ + HDprintf(" " #ARR "[%d][%d][%d] == %d, " #EXP "[%d][%d][%d] == %d\n", i, j, k, ARR[i][j][k], i, j, k, EXP[i][j][k]); \ goto error; \ } @@ -13079,10 +13078,12 @@ test_object_header_minimization_dcpl(void) TEST_ERROR file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - if (0 > file_id) TEST_ERROR + if (file_id == H5I_INVALID_HID) + TEST_ERROR dcpl_id = H5Pcreate(H5P_DATASET_CREATE); - if (0 > dcpl_id) TEST_ERROR + if (dcpl_id == H5I_INVALID_HID) + TEST_ERROR /*********/ /* TESTS */ @@ -13249,20 +13250,20 @@ main(void) my_fapl = fapl2; if(paged) { my_fcpl = fcpl2; - puts("\nTesting with new file format and paged aggregation"); + HDputs("\nTesting with new file format and paged aggregation"); } else { my_fcpl = fcpl; - puts("\nTesting with new file format and non-paged aggregation"); + HDputs("\nTesting with new file format and non-paged aggregation"); } } /* end if */ else { my_fapl = fapl; if(paged) { my_fcpl = fcpl2; - puts("Testing with old file format and paged aggregation:"); + HDputs("Testing with old file format and paged aggregation:"); } else { my_fcpl = fcpl; - puts("Testing with old file format and non-paged aggregation:"); + HDputs("Testing with old file format and non-paged aggregation:"); } } /* end else */ @@ -13273,7 +13274,7 @@ main(void) if (TRUE == minimized_ohdr) { if (0 > H5Fset_dset_no_attrs_hint(file, TRUE)) goto error; - puts("(minimized dataset object headers with file setting)"); + HDputs("(minimized dataset object headers with file setting)"); } /* Cause the library to emit initial messages */ @@ -13380,7 +13381,7 @@ main(void) if(nerrors) goto error; - printf("All dataset tests passed.\n"); + HDprintf("All dataset tests passed.\n"); #ifdef H5_HAVE_FILTER_SZIP if (GetTestCleanup()) HDremove(NOENCODER_COPY_FILENAME); @@ -13391,7 +13392,7 @@ main(void) error: nerrors = MAX(1, nerrors); - printf("***** %d DATASET TEST%s FAILED! *****\n", + HDprintf("***** %d DATASET TEST%s FAILED! *****\n", nerrors, 1 == nerrors ? "" : "S"); return EXIT_FAILURE; } /* end main() */ diff --git a/test/error_test.c b/test/error_test.c index 44f6210..1de9065 100644 --- a/test/error_test.c +++ b/test/error_test.c @@ -12,10 +12,10 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Raymond Lu + * Programmer: Raymond Lu * October 14, 2001 * - * Purpose: Tests the error API routines. + * Purpose: Tests the error API routines. */ #include "h5test.h" #include "H5srcdir.h" @@ -23,7 +23,7 @@ #ifdef H5_USE_16_API int main(void) { - HDfprintf(stderr, "Test skipped because backward compatbility with v1.6 is configured in\n"); + HDfprintf(stderr, "Test skipped because backward compatibility with v1.6 is configured in\n"); return 0; } #else /* H5_USE_16_API */ @@ -38,7 +38,7 @@ const char *FILENAME[] = { #define DIM0 100 #define DIM1 200 -int ipoints2[DIM0][DIM1], icheck2[DIM0][DIM1]; +int ipoints2[DIM0][DIM1], icheck2[DIM0][DIM1]; hid_t ERR_CLS; hid_t ERR_CLS2; @@ -80,7 +80,7 @@ hid_t ERR_MIN_GETNUM; static herr_t custom_print_cb(unsigned n, const H5E_error2_t *err_desc, void *client_data); - + /*------------------------------------------------------------------------- * Function: test_error * @@ -94,10 +94,10 @@ static herr_t custom_print_cb(unsigned n, const H5E_error2_t *err_desc, static herr_t test_error(hid_t file) { - hid_t dataset = -1; + hid_t dataset = -1; hid_t space = -1; hid_t estack_id = -1; - hsize_t dims[2]; + hsize_t dims[2]; const char *FUNC_test_error = "test_error"; H5E_auto2_t old_func; void *old_data = NULL; @@ -169,7 +169,7 @@ test_error(hid_t file) return -1; } /* end test_error() */ - + /*------------------------------------------------------------------------- * Function: init_error * @@ -245,7 +245,7 @@ error: return -1; } /* end init_error() */ - + /*------------------------------------------------------------------------- * Function: error_stack * @@ -287,7 +287,7 @@ error: return -1; } /* end error_stack() */ - + /*------------------------------------------------------------------------- * Function: long_desc_cb * @@ -309,7 +309,7 @@ long_desc_cb(unsigned H5_ATTR_UNUSED n, const H5E_error2_t *err_desc, void *clie return -1; } /* end long_desc_cb() */ - + /*------------------------------------------------------------------------- * Function: test_long_desc * @@ -384,7 +384,7 @@ error: } /* end test_long_desc() */ #pragma GCC diagnostic pop - + /*------------------------------------------------------------------------- * Function: dump_error * @@ -414,7 +414,7 @@ error: return -1; } /* end dump_error() */ - + /*------------------------------------------------------------------------- * Function: custom_print_cb * @@ -445,8 +445,8 @@ custom_print_cb(unsigned n, const H5E_error2_t *err_desc, void* client_data) TEST_ERROR; HDfprintf(stream, "%*serror #%03d: %s in %s(): line %u\n", - indent, "", n, err_desc->file_name, - err_desc->func_name, err_desc->line); + indent, "", n, err_desc->file_name, + err_desc->func_name, err_desc->line); HDfprintf(stream, "%*sclass: %s\n", indent * 2, "", cls); HDfprintf(stream, "%*smajor: %s\n", indent * 2, "", maj); HDfprintf(stream, "%*sminor: %s\n", indent * 2, "", min); @@ -457,7 +457,7 @@ error: return -1; } /* end custom_print_cb() */ - + /*------------------------------------------------------------------------- * Function: test_create * @@ -540,11 +540,11 @@ test_copy(void) err_num = H5Eget_num(H5E_DEFAULT); if (err_num != 1) TEST_ERROR - + /* Copy error stack, which clears the original */ if ((estack_id = H5Eget_current_stack()) < 0) TEST_ERROR - + /* Check the number of errors on stack copy */ err_num = H5Eget_num(estack_id); if (err_num != 1) @@ -564,7 +564,7 @@ test_copy(void) if (err_num != 1) TEST_ERROR - /* Try to close error stack copy. Should fail because + /* Try to close error stack copy. Should fail because * the current H5Eset_current_stack closes the stack to be set. */ H5E_BEGIN_TRY { @@ -579,7 +579,7 @@ error: return -1; } /* end test_copy() */ - + /*------------------------------------------------------------------------- * Function: close_error * @@ -615,17 +615,17 @@ error: return -1; } /* end close_error() */ - + /*------------------------------------------------------------------------- * Function: test_filter_error * * Purpose: Make sure the error message prints out the filter name - * when the existent file is opened but the filter isn't - * registered. The existent file was created with - * gen_filters.c. + * when the existent file is opened but the filter isn't + * registered. The existent file was created with + * gen_filters.c. * * Return: Success: 0 - * Failure: -1 + * Failure: -1 * *------------------------------------------------------------------------- */ @@ -663,7 +663,7 @@ error: return -1; } /* end test_filter_error() */ - + /*------------------------------------------------------------------------- * Function: main * @@ -745,7 +745,7 @@ main(void) if (close_error() < 0) TEST_ERROR; - /* Test error message during data reading when filter isn't registered + /* Test error message during data reading when filter isn't registered * Use default FAPL to avoid some VFD drivers by the check-vfd test because * the test file was pre-generated. */ diff --git a/test/flush2.c b/test/flush2.c index 8ebfb75..0f15903 100644 --- a/test/flush2.c +++ b/test/flush2.c @@ -15,10 +15,10 @@ * Programmer: Robb Matzke * Friday, October 23, 1998 * - * Purpose: This is the second half of a two-part test that makes sure - * that a file can be read after an application crashes as long - * as the file was flushed first. This half tries to read the - * file created by the first half. + * Purpose: This is the second half of a two-part test that makes sure + * that a file can be read after an application crashes as long + * as the file was flushed first. This half tries to read the + * file created by the first half. */ #include "h5test.h" diff --git a/test/gheap.c b/test/gheap.c index 5b51c0e..09ba1cf 100644 --- a/test/gheap.c +++ b/test/gheap.c @@ -57,7 +57,7 @@ const char *FILENAME[] = { NULL }; - + /*------------------------------------------------------------------------- * Function: test_1 * @@ -68,7 +68,7 @@ const char *FILENAME[] = { * * Failure: number of errors * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Tuesday, March 31, 1998 * *------------------------------------------------------------------------- @@ -165,7 +165,7 @@ error: return MAX(1, nerrors); } - + /*------------------------------------------------------------------------- * Function: test_2 * @@ -176,7 +176,7 @@ error: * * Failure: number of errors * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Tuesday, March 31, 1998 * *------------------------------------------------------------------------- @@ -264,7 +264,7 @@ test_2 (hid_t fapl) return MAX(1, nerrors); } - + /*------------------------------------------------------------------------- * Function: test_3 * @@ -275,7 +275,7 @@ test_2 (hid_t fapl) * * Failure: number of errors * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Tuesday, March 31, 1998 * *------------------------------------------------------------------------- @@ -353,7 +353,7 @@ test_3 (hid_t fapl) return MAX(1, nerrors); } - + /*------------------------------------------------------------------------- * Function: test_4 * @@ -365,7 +365,7 @@ test_3 (hid_t fapl) * * Failure: number of errors * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Tuesday, March 31, 1998 * *------------------------------------------------------------------------- @@ -448,7 +448,7 @@ test_4 (hid_t fapl) return MAX(1, nerrors); } - + /*------------------------------------------------------------------------- * Function: test_ooo_indices * @@ -461,7 +461,7 @@ test_4 (hid_t fapl) * * Failure: number of errors * - * Programmer: Neil Fortner + * Programmer: Neil Fortner * Monday, October 26, 2009 * *------------------------------------------------------------------------- @@ -566,7 +566,7 @@ test_ooo_indices(hid_t fapl) return MAX(1, nerrors); } /* end test_ooo_indices */ - + /*------------------------------------------------------------------------- * Function: main * @@ -579,8 +579,8 @@ test_ooo_indices(hid_t fapl) int main (void) { - int nerrors = 0; - hid_t fapl_id = H5I_INVALID_HID; + int nerrors = 0; + hid_t fapl_id = H5I_INVALID_HID; hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ h5_reset(); diff --git a/test/h5test.c b/test/h5test.c index d83c6e7..707c436 100644 --- a/test/h5test.c +++ b/test/h5test.c @@ -110,7 +110,6 @@ const char *LIBVER_NAMES[] = { NULL }; - /* Previous error reporting function */ static H5E_auto2_t err_func = NULL; @@ -1983,7 +1982,6 @@ error: return NULL; } /* h5_get_dummy_vfd_class */ - /*------------------------------------------------------------------------- * Function: h5_get_dummy_vol_class() * diff --git a/test/mf.c b/test/mf.c index 8c17df5..fe98000 100644 --- a/test/mf.c +++ b/test/mf.c @@ -6916,7 +6916,6 @@ test_mf_fs_gone(const char *env_h5_drvr, hid_t fapl, hbool_t new_format) H5FD_mem_t fs_type; hbool_t contig_addr_vfd; - if(new_format) TESTING("File's free-space is going away with new library format") else diff --git a/tools/src/h5dump/h5dump.c b/tools/src/h5dump/h5dump.c index a824197..347c189 100644 --- a/tools/src/h5dump/h5dump.c +++ b/tools/src/h5dump/h5dump.c @@ -1898,4 +1898,3 @@ add_prefix(char **prfx, size_t *prfx_len, const char *name) HDstrcat(HDstrcat(*prfx, "/"), name); } /* end add_prefix */ - diff --git a/tools/src/h5ls/h5ls.c b/tools/src/h5ls/h5ls.c index c81da1e..2364f23 100644 --- a/tools/src/h5ls/h5ls.c +++ b/tools/src/h5ls/h5ls.c @@ -247,7 +247,6 @@ usage (void) } - /*------------------------------------------------------------------------- * Function: print_string * diff --git a/tools/src/h5stat/h5stat.c b/tools/src/h5stat/h5stat.c index 59038a0..5f0452c 100644 --- a/tools/src/h5stat/h5stat.c +++ b/tools/src/h5stat/h5stat.c @@ -74,14 +74,14 @@ typedef struct iter_t { ohdr_info_t group_ohdr_info; /* Object header information for groups */ hsize_t max_attrs; /* Maximum attributes from a group */ - unsigned long *num_small_attrs; /* Size of small attributes tracked */ + unsigned long *num_small_attrs; /* Size of small attributes tracked */ unsigned attr_nbins; /* Number of bins for attribute counts */ unsigned long *attr_bins; /* Pointer to array of bins for attribute counts */ unsigned max_dset_rank; /* Maximum rank of dataset */ unsigned long dset_rank_count[H5S_MAX_RANK]; /* Number of datasets of each rank */ hsize_t max_dset_dims; /* Maximum dimension size of dataset */ - unsigned long *small_dset_dims; /* Size of dimensions of small datasets tracked */ + unsigned long *small_dset_dims; /* Size of dimensions of small datasets tracked */ unsigned long dset_layouts[H5D_NLAYOUTS]; /* Type of storage for each dataset */ unsigned long dset_comptype[H5_NFILTERS_IMPL]; /* Number of currently implemented filters */ unsigned long dset_ntypes; /* Number of diff. dataset datatypes found */ @@ -320,9 +320,9 @@ static void usage(const char *prog) HDfprintf(stdout, " -s, --freespace Print free space information\n"); HDfprintf(stdout, " -S, --summary Print summary of file space information\n"); HDfprintf(stdout, " --enable-error-stack Prints messages from the HDF5 error stack as they occur\n"); - HDfprintf(stdout, " --s3-cred= Access file on S3, using provided credential\n"); - HDfprintf(stdout, " :: (region,id,key)\n"); - HDfprintf(stdout, " If == \"(,,)\", no authentication is used.\n"); + HDfprintf(stdout, " --s3-cred= Access file on S3, using provided credential\n"); + HDfprintf(stdout, " :: (region,id,key)\n"); + HDfprintf(stdout, " If == \"(,,)\", no authentication is used.\n"); HDfprintf(stdout, " --hdfs-attrs= Access a file on HDFS with given configuration\n"); HDfprintf(stdout, " attributes.\n"); HDfprintf(stdout, " :: (,,\n"); @@ -544,7 +544,8 @@ dataset_stats(iter_t *iter, const char *name, const H5O_info_t *oi) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "attribute_stats() failed"); /* Get storage info */ - storage = H5Dget_storage_size(did); + if((storage = H5Dget_storage_size(did)) < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_storage_size() failed"); /* Gather layout statistics */ if((dcpl = H5Dget_create_plist(did)) < 0) diff --git a/tools/test/h5dump/CMakeTests.cmake b/tools/test/h5dump/CMakeTests.cmake index 84016f9..6299821 100644 --- a/tools/test/h5dump/CMakeTests.cmake +++ b/tools/test/h5dump/CMakeTests.cmake @@ -1157,3 +1157,13 @@ if (BUILD_SHARED_LIBS) ADD_H5_UD_TEST (h5dump_plugin_test 0 tudfilter --enable-error-stack tudfilter.h5) endif () + +############################################################################## +############################################################################## +### V F D T E S T S ### +############################################################################## +############################################################################## + +if (HDF5_TEST_VFD) + include (CMakeVFDTests.cmake) +endif () diff --git a/tools/test/h5dump/CMakeVFDTests.cmake b/tools/test/h5dump/CMakeVFDTests.cmake new file mode 100644 index 0000000..0a345ef --- /dev/null +++ b/tools/test/h5dump/CMakeVFDTests.cmake @@ -0,0 +1,91 @@ +# +# Copyright by The HDF Group. +# All rights reserved. +# +# This file is part of HDF5. The full HDF5 copyright notice, including +# terms governing use, modification, and redistribution, is contained in +# the COPYING file, which can be found at the root of the source code +# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. +# If you do not have access to either file, you may request a copy from +# help@hdfgroup.org. +# + +############################################################################## +############################################################################## +### T E S T I N G ### +############################################################################## +############################################################################## + +set (VFD_H5DUMP_LIST + sec2 + stdio + core + core_paged + split + multi + family +) + +if (DIRECT_VFD) + set (VFD_H5DUMP_LIST ${VFD_H5DUMP_LIST} direct) +endif () + +# -------------------------------------------------------------------- +# Copy all the HDF5 files from the source directory into the test directory +# -------------------------------------------------------------------- +set (HDF5_VFD_H5DUMP_FILES + packedbits +) + +foreach (vfdtest ${VFD_H5DUMP_LIST}) + file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/${vfdname}") + foreach (h5_tfile ${HDF5_VFD_H5DUMP_FILES}) + HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/${h5_tfile}.h5" "${PROJECT_BINARY_DIR}/${vfdtest}/${h5_tfile}.h5" "HDF5_VFD_H5DUMP_files") + HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/${h5_tfile}.ddl" "${PROJECT_BINARY_DIR}/${vfdtest}/${h5_tfile}.ddl" "HDF5_VFD_H5DUMP_files") + endforeach () +endforeach () + +add_custom_target(HDF5_VFD_H5DUMP_files ALL COMMENT "Copying files needed by HDF5_VFD_H5DUMP tests" DEPENDS ${HDF5_VFD_H5DUMP_files_list}) + +############################################################################## +############################################################################## +### T H E T E S T S M A C R O S ### +############################################################################## +############################################################################## + +if (NOT BUILD_SHARED_LIBS) + set (tgt_ext "") +else () + set (tgt_ext "-shared") +endif () + +macro (ADD_VFD_H5DUMP_TEST vfdname resultfile resultcode) + if (NOT HDF5_ENABLE_USING_MEMCHECKER) + add_test ( + NAME H5DUMP_VFD-${vfdname}-${resultfile}-h5dump + COMMAND "${CMAKE_COMMAND}" + -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}" + -D "TEST_PROGRAM=$" + -D "TEST_ARGS:STRING=${ARGN}" + -D "TEST_VFD:STRING=${vfdname}" + -D "TEST_EXPECT=${resultcode}" + -D "TEST_OUTPUT=${resultfile}.out" + -D "TEST_REFERENCE=${resultfile}.ddl" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/${vfdname}" + -P "${HDF_RESOURCES_DIR}/vfdTest.cmake" + ) + set_tests_properties (H5DUMP_VFD-${vfdname}-${resultfile}-h5dump PROPERTIES TIMEOUT ${CTEST_SHORT_TIMEOUT}) + endif () +endmacro () + +############################################################################## +############################################################################## +### T H E T E S T S ### +############################################################################## +############################################################################## + +# Run test with different Virtual File Driver +foreach (vfd ${VFD_H5DUMP_LIST}) + # test for signed/unsigned datasets + ADD_VFD_H5DUMP_TEST (${vfd} packedbits 0 --enable-error-stack packedbits.h5) +endforeach () diff --git a/tools/test/h5dump/h5dumpgentest.c b/tools/test/h5dump/h5dumpgentest.c index 3a414d1..699a226 100644 --- a/tools/test/h5dump/h5dumpgentest.c +++ b/tools/test/h5dump/h5dumpgentest.c @@ -1941,7 +1941,7 @@ static void gent_str2(void) for(i = 0; (hsize_t)i < sdim; i++) { start[0] = (hsize_t)i; - sprintf(buf, "This is row %d of type H5T_STR_NULLTERM of", i); + sprintf(buf, "This is row %1d of type H5T_STR_NULLTERM of", i); H5Tset_size(memtype, HDstrlen(buf)+1); H5Sselect_hyperslab(hyper_space, H5S_SELECT_SET, start, stride, count, block); H5Dwrite(dataset, memtype, mem_space, hyper_space, H5P_DEFAULT, buf); @@ -1954,7 +1954,7 @@ static void gent_str2(void) for(i = 0; (hsize_t)i < sdim; i++) { start[0] = (hsize_t)i; - sprintf(buf, "This is row %d of type H5T_STR_NULLTERM of string array", i); + sprintf(buf, "This is row %1d of type H5T_STR_NULLTERM of string array", i); H5Tset_size(memtype, HDstrlen(buf)+1); H5Sselect_hyperslab(hyper_space, H5S_SELECT_SET, start, stride, count, block); H5Dwrite(dataset, memtype, mem_space, hyper_space, H5P_DEFAULT, buf); @@ -1974,7 +1974,7 @@ static void gent_str2(void) for(i = 0;(hsize_t) i < sdim; i++) { start[0] = (hsize_t)i; - sprintf(buf, "This is row %d of type H5T_STR_NULLPAD of", i); + sprintf(buf, "This is row %1d of type H5T_STR_NULLPAD of", i); H5Tset_size(memtype, HDstrlen(buf)+1); H5Sselect_hyperslab(hyper_space, H5S_SELECT_SET, start, stride, count, block); H5Dwrite(dataset, memtype, mem_space, hyper_space, H5P_DEFAULT, buf); @@ -1988,7 +1988,7 @@ static void gent_str2(void) for(i = 0; (hsize_t)i < sdim; i++) { start[0] = (hsize_t)i; - sprintf(buf, "This is row %d of type H5T_STR_NULLPAD of string array", i); + sprintf(buf, "This is row %1d of type H5T_STR_NULLPAD of string array", i); H5Tset_size(memtype, HDstrlen(buf)+1); H5Sselect_hyperslab(hyper_space, H5S_SELECT_SET, start, stride, count, block); H5Dwrite(dataset, memtype, mem_space, hyper_space, H5P_DEFAULT, buf); @@ -2007,7 +2007,7 @@ static void gent_str2(void) for(i = 0; (hsize_t)i < sdim; i++) { start[0] = (hsize_t)i; - sprintf(buf, "This is row %d of type H5T_STR_SPACEPAD of", i); + sprintf(buf, "This is row %1d of type H5T_STR_SPACEPAD of", i); H5Tset_size(memtype, HDstrlen(buf) + 1); H5Sselect_hyperslab(hyper_space, H5S_SELECT_SET, start, stride, count, block); H5Dwrite(dataset, memtype, mem_space, hyper_space, H5P_DEFAULT, buf); @@ -2021,7 +2021,7 @@ static void gent_str2(void) for(i = 0; (hsize_t)i < sdim; i++) { start[0] = (hsize_t)i; - sprintf(buf, "This is row %d of type H5T_STR_SPACEPAD of string array", i); + sprintf(buf, "This is row %1d of type H5T_STR_SPACEPAD of string array", i); H5Tset_size(memtype, HDstrlen(buf) + 1); H5Sselect_hyperslab(hyper_space, H5S_SELECT_SET, start, stride, count, block); H5Dwrite(dataset, memtype, mem_space, hyper_space, H5P_DEFAULT, buf); diff --git a/tools/test/misc/CMakeLists.txt b/tools/test/misc/CMakeLists.txt index 3d63681..a250222 100644 --- a/tools/test/misc/CMakeLists.txt +++ b/tools/test/misc/CMakeLists.txt @@ -7,15 +7,25 @@ project (HDF5_TOOLS_TEST_MISC C) if (HDF5_BUILD_GENERATORS AND NOT ONLY_SHARED_LIBS) add_executable (h5repart_gentest ${HDF5_TOOLS_TEST_MISC_SOURCE_DIR}/h5repart_gentest.c) target_include_directories (h5repart_gentest PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") - TARGET_C_PROPERTIES (h5repart_gentest STATIC) - target_link_libraries (h5repart_gentest PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) + if (NOT ONLY_SHARED_LIBS) + TARGET_C_PROPERTIES (h5repart_gentest STATIC) + target_link_libraries (h5repart_gentest PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) + else () + TARGET_C_PROPERTIES (h5repart_gentest SHARED) + target_link_libraries (h5repart_gentest PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_TEST_LIBSH_TARGET}) + endif () set_target_properties (h5repart_gentest PROPERTIES FOLDER generator/tools) #add_test (NAME h5repart_gentest COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) add_executable (h5clear_gentest ${HDF5_TOOLS_TEST_MISC_SOURCE_DIR}/h5clear_gentest.c) target_include_directories (h5clear_gentest PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") - TARGET_C_PROPERTIES (h5clear_gentest STATIC) - target_link_libraries (h5clear_gentest PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) + if (NOT ONLY_SHARED_LIBS) + TARGET_C_PROPERTIES (h5clear_gentest STATIC) + target_link_libraries (h5clear_gentest PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) + else () + TARGET_C_PROPERTIES (h5clear_gentest SHARED) + target_link_libraries (h5clear_gentest PRIVATE ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_TEST_LIBSH_TARGET}) + endif () set_target_properties (h5clear_gentest PROPERTIES FOLDER tools) #add_test (NAME H5CLEAR-h5clear_gentest COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $) -- cgit v0.12 From 9f12d8397515bdc448a1cd605d4d605e07940ca0 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Mon, 5 Aug 2019 16:57:27 -0500 Subject: Cleanup HD prefix --- test/objcopy.c | 26 +- test/ohdr.c | 4 +- test/set_extent.c | 1436 ++++++++++++++++++++--------------------------------- 3 files changed, 557 insertions(+), 909 deletions(-) diff --git a/test/objcopy.c b/test/objcopy.c index 94a2b36..47a1065 100644 --- a/test/objcopy.c +++ b/test/objcopy.c @@ -14113,7 +14113,7 @@ main(void) ExpressMode = GetTestExpress(); if (ExpressMode > 1) - printf("***Express test mode on. Some tests may be skipped\n"); + HDprintf("***Express test mode on. Some tests may be skipped\n"); /* Copy the file access property list */ if((fapl2 = H5Pcopy(fapl)) < 0) TEST_ERROR @@ -14149,52 +14149,52 @@ main(void) /* Test with and without shared messages */ if(configuration & CONFIG_SHARE_SRC) { - puts("\nTesting with shared src messages:"); + HDputs("\nTesting with shared src messages:"); fcpl_src = fcpl_shared; } else { - puts("\nTesting without shared src messages:"); + HDputs("\nTesting without shared src messages:"); fcpl_src = H5P_DEFAULT; } if(configuration & CONFIG_SHARE_DST) { - puts("Testing with shared dst messages:"); + HDputs("Testing with shared dst messages:"); fcpl_dst = fcpl_shared; same_file = FALSE; } else { - puts("Testing without shared dst messages:"); + HDputs("Testing without shared dst messages:"); fcpl_dst = H5P_DEFAULT; } /* Set the FAPL for the source file's type of format */ if(configuration & CONFIG_SRC_NEW_FORMAT) { - puts("Testing with latest format for source file:"); + HDputs("Testing with latest format for source file:"); src_fapl = fapl2; /* Test with and without dense attributes */ if(configuration & CONFIG_DENSE) { - puts("Testing with dense attributes:"); + HDputs("Testing with dense attributes:"); num_attributes_g = max_compact + 1; } else { - puts("Testing without dense attributes:"); + HDputs("Testing without dense attributes:"); num_attributes_g = MAX(min_dense, 2) - 2; } } /* end if */ else { - puts("Testing with oldest file format for source file:"); + HDputs("Testing with oldest file format for source file:"); src_fapl = fapl; num_attributes_g = 4; } /* end else */ /* Set the FAPL for the destination file's type of format */ if(configuration & CONFIG_DST_NEW_FORMAT) { - puts("Testing with latest format for destination file:"); + HDputs("Testing with latest format for destination file:"); dst_fapl = fapl2; same_file = FALSE; } /* end if */ else { - puts("Testing with oldest file format for destination file:"); + HDputs("Testing with oldest file format for destination file:"); dst_fapl = fapl; } /* end else */ @@ -14365,12 +14365,12 @@ main(void) /* Results */ if(nerrors) { - printf("***** %d OBJECT COPY TEST%s FAILED! *****\n", + HDprintf("***** %d OBJECT COPY TEST%s FAILED! *****\n", nerrors, (1 == nerrors ? "" : "S")); exit(EXIT_FAILURE); } /* end if */ - puts ("All object copying tests passed."); + HDputs ("All object copying tests passed."); /* close property list. * NOTE: if this property list is not closed and the test is diff --git a/test/ohdr.c b/test/ohdr.c index c5d5ac4..13bac9e 100644 --- a/test/ohdr.c +++ b/test/ohdr.c @@ -1641,7 +1641,7 @@ main(void) /* Display info about testing */ low_string = h5_get_version_string(low); high_string = h5_get_version_string(high); - sprintf(msg, "Using file format version: (%s, %s)", low_string, + HDsprintf(msg, "Using file format version: (%s, %s)", low_string, high_string); HDputs(msg); @@ -1887,7 +1887,7 @@ main(void) return 0; error: - puts("*** TESTS FAILED ***"); + HDputs("*** TESTS FAILED ***"); H5E_BEGIN_TRY { H5Fclose(file); } H5E_END_TRY; diff --git a/test/set_extent.c b/test/set_extent.c index f6b02cf..20322a3 100644 --- a/test/set_extent.c +++ b/test/set_extent.c @@ -49,13 +49,13 @@ const char *FILENAME[] = { + CONFIG_EARLY_ALLOC + CONFIG_UNFILT_EDGE) #define FILL_VALUE -1 #define DO_RANKS_PRINT_CONFIG(TEST) { \ - printf(" Config:\n"); \ - printf(" Test: %s\n", TEST); \ - printf(" Compression: %s\n", (config & CONFIG_COMPRESS ? "yes" : "no")); \ - printf(" Fill value: %s\n", (do_fillvalue ? "yes" : "no")); \ - printf(" Early allocation: %s\n", (config & CONFIG_EARLY_ALLOC ? "yes" \ + HDprintf(" Config:\n"); \ + HDprintf(" Test: %s\n", TEST); \ + HDprintf(" Compression: %s\n", (config & CONFIG_COMPRESS ? "yes" : "no")); \ + HDprintf(" Fill value: %s\n", (do_fillvalue ? "yes" : "no")); \ + HDprintf(" Early allocation: %s\n", (config & CONFIG_EARLY_ALLOC ? "yes" \ : "no")); \ - printf(" Edge chunk filters: %s\n", (config & CONFIG_UNFILT_EDGE \ + HDprintf(" Edge chunk filters: %s\n", (config & CONFIG_UNFILT_EDGE \ ? "disabled" : "enabled")); \ } /* end DO_RANKS_PRINT_CONFIG */ @@ -136,8 +136,8 @@ int main( void ) hid_t fapl2; /* file access property list w/latest format set */ unsigned new_format; /* Whether to use the latest file format */ unsigned chunk_cache; /* Whether to enable chunk caching */ - int nerrors = 0; - const char *env_h5_drvr; /* File Driver value from environment */ + int nerrors = 0; + const char *env_h5_drvr; /* File Driver value from environment */ hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */ @@ -173,17 +173,17 @@ int main( void ) for(chunk_cache = FALSE; chunk_cache <= TRUE; chunk_cache++) { /* Output message about the type of format */ if(new_format) - printf("Testing with new file format"); + HDprintf("Testing with new file format"); else - printf("Testing with old file format"); + HDprintf("Testing with old file format"); /* Set the FAPL for the chunk cache settings */ if(chunk_cache) { - puts(" and chunk cache enabled:"); + HDputs(" and chunk cache enabled:"); my_fapl = fapl; } /* end if */ else { - puts(" and chunk cache disabled:"); + HDputs(" and chunk cache disabled:"); my_fapl = fapl2; } /* end else */ @@ -201,15 +201,15 @@ int main( void ) H5F_LIBVER_LATEST) < 0) TEST_ERROR /* Tests which use chunked datasets */ - if(!new_format || (new_format && contig_addr_vfd)) - nerrors += do_ranks( my_fapl, new_format ) < 0 ? 1 : 0; + if(!new_format || (new_format && contig_addr_vfd)) + nerrors += do_ranks( my_fapl, new_format ) < 0 ? 1 : 0; } /* end for */ /* Tests which do not use chunked datasets */ - if(!new_format || (new_format && contig_addr_vfd)) { - nerrors += test_external( fapl ) < 0 ? 1 : 0; - nerrors += do_layouts( fapl ) < 0 ? 1 : 0; - } + if(!new_format || (new_format && contig_addr_vfd)) { + nerrors += test_external( fapl ) < 0 ? 1 : 0; + nerrors += do_layouts( fapl ) < 0 ? 1 : 0; + } } /* end for */ /* Close 2nd FAPL */ @@ -225,13 +225,13 @@ int main( void ) if(nerrors) goto error; - puts("All H5Dset_extent tests passed."); + HDputs("All H5Dset_extent tests passed."); return 0; error: nerrors = MAX(1, nerrors); - printf("***** %d H5Dset_extent TEST%s FAILED! *****\n", + HDprintf("***** %d H5Dset_extent TEST%s FAILED! *****\n", nerrors, 1 == nerrors ? "" : "S"); return 1; } @@ -303,25 +303,25 @@ static int do_ranks( hid_t fapl, hbool_t new_format ) if(test_rank1(fapl, dcpl, do_fillvalue, disable_edge_filters, FALSE) < 0) { DO_RANKS_PRINT_CONFIG("Rank 1") - printf(" Fill time: %s\n", (ifset ? "H5D_FILL_TIME_IFSET" + HDprintf(" Fill time: %s\n", (ifset ? "H5D_FILL_TIME_IFSET" : "H5D_FILL_TIME_ALLOC")); goto error; } /* end if */ if(test_rank2(fapl, dcpl, do_fillvalue, disable_edge_filters, FALSE) < 0) { DO_RANKS_PRINT_CONFIG("Rank 2") - printf(" Fill time: %s\n", (ifset ? "H5D_FILL_TIME_IFSET" + HDprintf(" Fill time: %s\n", (ifset ? "H5D_FILL_TIME_IFSET" : "H5D_FILL_TIME_ALLOC")); goto error; } /* end if */ if(test_rank3(fapl, dcpl, do_fillvalue, disable_edge_filters, FALSE) < 0) { DO_RANKS_PRINT_CONFIG("Rank 3") - printf(" Fill time: %s\n", (ifset ? "H5D_FILL_TIME_IFSET" + HDprintf(" Fill time: %s\n", (ifset ? "H5D_FILL_TIME_IFSET" : "H5D_FILL_TIME_ALLOC")); goto error; } /* end if */ if(test_rank2(fapl, dcpl, do_fillvalue, disable_edge_filters, TRUE) < 0) { DO_RANKS_PRINT_CONFIG("Rank 2 with non-default indexed storage B-tree") - printf(" Fill time: %s\n", (ifset ? "H5D_FILL_TIME_IFSET" + HDprintf(" Fill time: %s\n", (ifset ? "H5D_FILL_TIME_IFSET" : "H5D_FILL_TIME_ALLOC")); goto error; } /* end if */ @@ -362,7 +362,7 @@ static int do_ranks( hid_t fapl, hbool_t new_format ) /* Standard test */ if(test_random_rank4(fapl, dcpl, do_fillvalue, disable_edge_filters, FALSE, index_type) < 0) { DO_RANKS_PRINT_CONFIG("Randomized rank 4") - printf(" Index: %s\n", index_type == RANK4_INDEX_BTREE + HDprintf(" Index: %s\n", index_type == RANK4_INDEX_BTREE ? "btree" : (index_type == RANK4_INDEX_FARRAY ? "farray" : "earray")); goto error; @@ -372,7 +372,7 @@ static int do_ranks( hid_t fapl, hbool_t new_format ) if(test_random_rank4_vl(fapl, dcpl, do_fillvalue, disable_edge_filters, FALSE, index_type) < 0) { DO_RANKS_PRINT_CONFIG("Randomized rank 4 variable length") - printf(" Index: %s\n", index_type == RANK4_INDEX_BTREE + HDprintf(" Index: %s\n", index_type == RANK4_INDEX_BTREE ? "btree" : (index_type == RANK4_INDEX_FARRAY ? "farray" : "earray")); goto error; @@ -383,7 +383,7 @@ static int do_ranks( hid_t fapl, hbool_t new_format ) if(test_random_rank4(fapl, dcpl, do_fillvalue, disable_edge_filters, TRUE, index_type) < 0) { DO_RANKS_PRINT_CONFIG("Randomized rank 4 with sparse allocation") - printf(" Index: %s\n", index_type == RANK4_INDEX_BTREE + HDprintf(" Index: %s\n", index_type == RANK4_INDEX_BTREE ? "btree" : (index_type == RANK4_INDEX_FARRAY ? "farray" : "earray")); goto error; @@ -391,7 +391,7 @@ static int do_ranks( hid_t fapl, hbool_t new_format ) if(test_random_rank4_vl(fapl, dcpl, do_fillvalue, disable_edge_filters, TRUE, index_type) < 0) { DO_RANKS_PRINT_CONFIG("Randomized rank 4 variable length with sparse allocation") - printf(" Index: %s\n", index_type == RANK4_INDEX_BTREE + HDprintf(" Index: %s\n", index_type == RANK4_INDEX_BTREE ? "btree" : (index_type == RANK4_INDEX_FARRAY ? "farray" : "earray")); goto error; @@ -558,10 +558,10 @@ static int test_rank1( hid_t fapl, TEST_ERROR #if defined (H5_SET_EXTENT_DEBUG) - printf("\n buf_o: "); + HDprintf("\n buf_o: "); for (i = 0; i < (int)dims_o[0]; i++ ) - printf("%d ", buf_o[i]); - printf("\n"); + HDprintf("%d ", buf_o[i]); + HDprintf("\n"); #endif if(H5Sclose(sid) < 0) @@ -598,18 +598,18 @@ static int test_rank1( hid_t fapl, #if defined (H5_SET_EXTENT_DEBUG) - printf("\n buf_e: "); + HDprintf("\n buf_e: "); for (i = 0; i < (int)dims_r[0]; i++ ) - printf("%d ", buf_e[i]); - printf("\n"); + HDprintf("%d ", buf_e[i]); + HDprintf("\n"); #endif /* compare the read array with the expanded array */ for (i = 0; i < (int)dims_r[0]; i++ ) if(i >= DIM0) { if(buf_e[i] != comp_value) { - printf("buf_e[%d] = %d\n", i, buf_e[i]); - printf("expected = %d\n", comp_value); + HDprintf("buf_e[%d] = %d\n", i, buf_e[i]); + HDprintf("expected = %d\n", comp_value); TEST_ERROR } /* end if */ } /* end if */ @@ -670,17 +670,17 @@ static int test_rank1( hid_t fapl, TEST_ERROR #if defined (H5_SET_EXTENT_DEBUG) - printf("\n dims_r: "); + HDprintf("\n dims_r: "); for (i = 0; i < (int)dims_r[0]; i++ ) - printf("%d ", buf_s[i]); - printf("\n"); + HDprintf("%d ", buf_s[i]); + HDprintf("\n"); #endif /* compare the read array with the shrinked array */ for( i = 0; i < (int)dims_r[0]; i++ ) if(buf_s[i] != buf_o[i]) { - printf("buf_s[%d] = %d\n", i, buf_s[i]); - printf("buf_o[%d] = %d\n", i, buf_o[i]); + HDprintf("buf_s[%d] = %d\n", i, buf_s[i]); + HDprintf("buf_o[%d] = %d\n", i, buf_o[i]); TEST_ERROR } /* end if */ @@ -714,18 +714,18 @@ static int test_rank1( hid_t fapl, TEST_ERROR #if defined (H5_SET_EXTENT_DEBUG) - printf("\n dims_r: "); + HDprintf("\n dims_r: "); for (i = 0; i < (int)dims_r[0]; i++ ) - printf("%d ", buf_r[i]); - printf("\n"); + HDprintf("%d ", buf_r[i]); + HDprintf("\n"); #endif /* compare the read array with the original array */ for(i = 0; i < (int)dims_r[0]; i++ ) if(i >= DIMS0 ) { if(buf_r[i] != comp_value) { - printf("buf_r[%d] = %d\n", i, buf_r[i] ); - printf("expected = %d\n", comp_value); + HDprintf("buf_r[%d] = %d\n", i, buf_r[i] ); + HDprintf("expected = %d\n", comp_value); TEST_ERROR } /* end if */ } /* end if */ @@ -820,61 +820,47 @@ error: *------------------------------------------------------------------------- */ -static int test_rank2( hid_t fapl, - hid_t dcpl, - hbool_t do_fill_value, - hbool_t disable_edge_filters, - hbool_t set_istore_k) -{ - - hid_t fid=-1; - hid_t did=-1; - hid_t sid=-1; - hid_t my_dcpl=-1; - hid_t fcpl; - hsize_t dims_o[RANK2] = {DIM0,DIM1}; /* original dimensions */ - hsize_t dims_s[RANK2] = {DIMS0,DIMS1}; /* shrinking dimensions */ - hsize_t dims_e[RANK2] = {DIME0,DIME1}; /* extended dimensions */ - hsize_t dims_c[RANK2] = {2,2}; /* chunk dimensions */ - hsize_t dims_r[RANK2]; /* read dimensions */ - hsize_t maxdims[RANK2] = {H5S_UNLIMITED,H5S_UNLIMITED}; - int buf_o[DIM0][DIM1]; - int buf_s[DIMS0][DIMS1]; - int buf_e[DIME0][DIME1]; - int buf_r[DIM0][DIM1]; - int i, j; - int comp_value; - char filename[NAME_BUF_SIZE]; - - if ( do_fill_value ) - { +static int test_rank2(hid_t fapl, hid_t dcpl, hbool_t do_fill_value, hbool_t disable_edge_filters, hbool_t set_istore_k) { + + hid_t fid = -1; + hid_t did = -1; + hid_t sid = -1; + hid_t my_dcpl = -1; + hid_t fcpl; + hsize_t dims_o[RANK2] = { DIM0, DIM1 }; /* original dimensions */ + hsize_t dims_s[RANK2] = { DIMS0, DIMS1 }; /* shrinking dimensions */ + hsize_t dims_e[RANK2] = { DIME0, DIME1 }; /* extended dimensions */ + hsize_t dims_c[RANK2] = { 2, 2 }; /* chunk dimensions */ + hsize_t dims_r[RANK2]; /* read dimensions */ + hsize_t maxdims[RANK2] = { H5S_UNLIMITED, H5S_UNLIMITED }; + int buf_o[DIM0][DIM1]; + int buf_s[DIMS0][DIMS1]; + int buf_e[DIME0][DIME1]; + int buf_r[DIM0][DIM1]; + int i, j; + int comp_value; + char filename[NAME_BUF_SIZE]; + + if (do_fill_value) { comp_value = FILL_VALUE; - } - else - { + } else { comp_value = 0; } - - for( i = 0; i < DIM0; i++ ) - { - for( j = 0; j < DIM1; j++ ) - { + for (i = 0; i < DIM0; i++) { + for (j = 0; j < DIM1; j++) { buf_o[i][j] = 2; } } /* create a file creation property list */ - if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) - { + if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) { TEST_ERROR } - if ( set_istore_k ) - { + if (set_istore_k) { /* set non-default indexed storage B-tree internal 'K' value */ - if (H5Pset_istore_k(fcpl,ISTORE_IK) < 0) - { + if (H5Pset_istore_k(fcpl, ISTORE_IK) < 0) { TEST_ERROR } @@ -882,79 +868,65 @@ static int test_rank2( hid_t fapl, /* create a new file */ h5_fixname(FILENAME[1], fapl, filename, sizeof filename); - if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0) - { + if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0) { TEST_ERROR } - - /* create the data space with unlimited dimensions. */ - if ((sid = H5Screate_simple(RANK2, dims_o, maxdims)) < 0) - { + if ((sid = H5Screate_simple(RANK2, dims_o, maxdims)) < 0) { TEST_ERROR } /* modify dataset creation properties, i.e. enable chunking. */ - if ((my_dcpl = H5Pcopy (dcpl)) < 0) - { + if ((my_dcpl = H5Pcopy(dcpl)) < 0) { TEST_ERROR } - if (H5Pset_chunk(my_dcpl, RANK2, dims_c) < 0) - { + if (H5Pset_chunk(my_dcpl, RANK2, dims_c) < 0) { TEST_ERROR } - if(disable_edge_filters) - if(H5Pset_chunk_opts(my_dcpl, H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS) < 0) + if (disable_edge_filters) + if (H5Pset_chunk_opts(my_dcpl, H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS) < 0) TEST_ERROR - /*------------------------------------------------------------------------- - * Procedure 1 - * a. Write an array AxB. These are the dimensions for creating the dataset - * b. Define a greater array CxD where C > A and D > B - * c. Read data back - * d. Verify if new dimensions are C and D - * e. Verify if data from A to C and B to D is what it is to be expected - * - * original data is - * - * 2 2 2 2 - * 2 2 2 2 - * 2 2 2 2 - * 2 2 2 2 - * - *------------------------------------------------------------------------- - */ - - /* create a dataset */ - if ((did = H5Dcreate2(fid , "dset1", H5T_NATIVE_INT, sid, H5P_DEFAULT, my_dcpl, H5P_DEFAULT)) < 0) - { + /*------------------------------------------------------------------------- + * Procedure 1 + * a. Write an array AxB. These are the dimensions for creating the dataset + * b. Define a greater array CxD where C > A and D > B + * c. Read data back + * d. Verify if new dimensions are C and D + * e. Verify if data from A to C and B to D is what it is to be expected + * + * original data is + * + * 2 2 2 2 + * 2 2 2 2 + * 2 2 2 2 + * 2 2 2 2 + * + *------------------------------------------------------------------------- + */ + + /* create a dataset */ + if ((did = H5Dcreate2(fid, "dset1", H5T_NATIVE_INT, sid, H5P_DEFAULT, my_dcpl, H5P_DEFAULT)) < 0) { TEST_ERROR } /* write */ - if (H5Dwrite(did , H5T_NATIVE_INT, sid, H5S_ALL, H5P_DEFAULT, buf_o) < 0) - { + if (H5Dwrite(did, H5T_NATIVE_INT, sid, H5S_ALL, H5P_DEFAULT, buf_o) < 0) { TEST_ERROR } - #if defined (H5_SET_EXTENT_DEBUG2) - printf("\n"); - for (i = 0; i < (int)dims_o[0]; i++ ) - { - for (j = 0; j < (int)dims_o[1]; j++ ) - { - printf("%d ", buf_o[i][j]); + HDprintf("\n"); + for (i = 0; i < (int)dims_o[0]; i++ ) { + for (j = 0; j < (int)dims_o[1]; j++ ) { + HDprintf("%d ", buf_o[i][j]); } - printf("\n"); + HDprintf("\n"); } #endif - - - if (H5Sclose(sid) < 0) - { + if (H5Sclose(sid) < 0) { TEST_ERROR } @@ -974,32 +946,26 @@ static int test_rank2( hid_t fapl, */ /* set new dimensions for the array. */ - if (H5Dset_extent(did , dims_e) < 0) - { + if (H5Dset_extent(did, dims_e) < 0) { TEST_ERROR } /* get the space */ - if ((sid = H5Dget_space(did)) < 0) - { + if ((sid = H5Dget_space(did)) < 0) { TEST_ERROR } /* get dimensions */ - if (H5Sget_simple_extent_dims(sid, dims_r, NULL) < 0) - { + if (H5Sget_simple_extent_dims(sid, dims_r, NULL) < 0) { TEST_ERROR } - if (H5Sclose(sid) < 0) - { + if (H5Sclose(sid) < 0) { TEST_ERROR } - /* check dimensions */ - for( i = 0; i < RANK2; i++ ) - { + for (i = 0; i < RANK2; i++) { if (dims_r[i] != dims_e[i]) TEST_ERROR } @@ -1008,55 +974,39 @@ static int test_rank2( hid_t fapl, if (H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_e) < 0) TEST_ERROR - - #if defined (H5_SET_EXTENT_DEBUG2) - printf("\n"); - for (i = 0; i < (int)dims_r[0]; i++ ) - { - for (j = 0; j < (int)dims_r[1]; j++ ) - { - printf("%d ", buf_e[i][j]); + HDprintf("\n"); + for (i = 0; i < (int)dims_r[0]; i++ ) { + for (j = 0; j < (int)dims_r[1]; j++ ) { + HDprintf("%d ", buf_e[i][j]); } - printf("\n"); + HDprintf("\n"); } #endif - - - - /* compare the read array with the expanded array */ - for (i = 0; i < (int)dims_r[0]; i++ ) - { - for (j = 0; j < (int)dims_r[1]; j++ ) - { - if ( i >= DIM0 || j >= DIM1 ) - { - if(buf_e[i][j] != comp_value) - { - printf("buf_e[%d][%d] = %d\n", i, j, buf_e[i][j]); - printf("value = %d\n", comp_value); + /* compare the read array with the expanded array */ + for (i = 0; i < (int) dims_r[0]; i++) { + for (j = 0; j < (int) dims_r[1]; j++) { + if (i >= DIM0 || j >= DIM1) { + if (buf_e[i][j] != comp_value) { + HDprintf("buf_e[%d][%d] = %d\n", i, j, buf_e[i][j]); + HDprintf("value = %d\n", comp_value); TEST_ERROR } - } - else - { - if(buf_e[i][j] != buf_o[i][j]) + } else { + if (buf_e[i][j] != buf_o[i][j]) TEST_ERROR } } } - - - /*------------------------------------------------------------------------- * * Procedure 2 - * a. Define a smaller array ExF where E < A and F < B - * b. Read data back - * c. Verify if new dimensions are E and F - * d. Verify if data up until E and F is what to be expected + * a. Define a smaller array ExF where E < A and F < B + * b. Read data back + * c. Verify if new dimensions are E and F + * d. Verify if data up until E and F is what to be expected * * data is now * @@ -1067,106 +1017,81 @@ static int test_rank2( hid_t fapl, */ /* set new dimensions for the array. */ - if (H5Dset_extent(did , dims_s) < 0) - { + if (H5Dset_extent(did, dims_s) < 0) { TEST_ERROR } /* get the space */ - if ((sid = H5Dget_space(did)) < 0) - { + if ((sid = H5Dget_space(did)) < 0) { TEST_ERROR } /* get dimensions */ - if (H5Sget_simple_extent_dims(sid, dims_r, NULL) < 0) - { + if (H5Sget_simple_extent_dims(sid, dims_r, NULL) < 0) { TEST_ERROR } - if (H5Sclose(sid) < 0) - { + if (H5Sclose(sid) < 0) { TEST_ERROR } /* check dimensions */ - for( i = 0; i < RANK2; i++ ) - { + for (i = 0; i < RANK2; i++) { if (dims_r[i] != dims_s[i]) TEST_ERROR } - - /* for this case we close and reopen file */ - if ( set_istore_k ) - { + if (set_istore_k) { - if (H5Dclose(did) < 0) - { + if (H5Dclose(did) < 0) { TEST_ERROR } - if (H5Fclose(fid) < 0) - { + if (H5Fclose(fid) < 0) { TEST_ERROR } - if ((fid = H5Fopen( filename, H5F_ACC_RDWR, fapl ))<0) - { + if ((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) { TEST_ERROR } - if ((did = H5Dopen2( fid , "dset1", H5P_DEFAULT ))<0) - { + if ((did = H5Dopen2(fid, "dset1", H5P_DEFAULT)) < 0) { TEST_ERROR } - - } - /*------------------------------------------------------------------------- * read *------------------------------------------------------------------------- */ /* read */ - if (H5Dread( did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_s ) < 0) - { + if (H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_s) < 0) { TEST_ERROR } #if defined (H5_SET_EXTENT_DEBUG2) - printf("\n"); - for (i = 0; i < (int)dims_r[0]; i++ ) - { - for (j = 0; j < (int)dims_r[1]; j++ ) - { - printf("%d ", buf_s[i][j]); + HDprintf("\n"); + for (i = 0; i < (int)dims_r[0]; i++ ) { + for (j = 0; j < (int)dims_r[1]; j++ ) { + HDprintf("%d ", buf_s[i][j]); } - printf("\n"); + HDprintf("\n"); } #endif - - - /* compare the read array with the shrinked array */ - for( i = 0; i < (int)dims_r[0]; i++ ) - { - for( j = 0; j < (int)dims_r[1]; j++ ) - { - if ( buf_s[i][j] != buf_o[i][j] ) - { - printf("buf_s[%d][%d] = %d\n", i, j, buf_s[i][j]); - printf("buf_o[%d][%d] = %d\n", i, j, buf_o[i][j]); + for (i = 0; i < (int) dims_r[0]; i++) { + for (j = 0; j < (int) dims_r[1]; j++) { + if (buf_s[i][j] != buf_o[i][j]) { + HDprintf("buf_s[%d][%d] = %d\n", i, j, buf_s[i][j]); + HDprintf("buf_o[%d][%d] = %d\n", i, j, buf_o[i][j]); TEST_ERROR } } } - /*------------------------------------------------------------------------- * set new dimensions for the array; expand it back to original size * data is now, extended space was initialized with fill value or default value @@ -1180,36 +1105,30 @@ static int test_rank2( hid_t fapl, */ /* set new dimensions for the array */ - if (H5Dset_extent(did, dims_o) < 0) - { + if (H5Dset_extent(did, dims_o) < 0) { TEST_ERROR } /* get the space */ - if ((sid = H5Dget_space(did)) < 0) - { + if ((sid = H5Dget_space(did)) < 0) { TEST_ERROR } /* get dimensions. */ - if (H5Sget_simple_extent_dims(sid, dims_r, NULL) < 0) - { + if (H5Sget_simple_extent_dims(sid, dims_r, NULL) < 0) { TEST_ERROR } - if (H5Sclose(sid) < 0) - { + if (H5Sclose(sid) < 0) { TEST_ERROR } /* check dimensions */ - for( i = 0; i < RANK2; i++ ) - { + for (i = 0; i < RANK2; i++) { if (dims_r[i] != dims_o[i]) TEST_ERROR } - /*------------------------------------------------------------------------- * read *------------------------------------------------------------------------- @@ -1220,36 +1139,26 @@ static int test_rank2( hid_t fapl, TEST_ERROR #if defined (H5_SET_EXTENT_DEBUG2) - printf("\n"); - for (i = 0; i < (int)dims_r[0]; i++ ) - { - for (j = 0; j < (int)dims_r[1]; j++ ) - { - printf("%d ", buf_r[i][j]); + HDprintf("\n"); + for (i = 0; i < (int)dims_r[0]; i++ ) { + for (j = 0; j < (int)dims_r[1]; j++ ) { + HDprintf("%d ", buf_r[i][j]); } - printf("\n"); + HDprintf("\n"); } #endif - - - /* compare the read array with the original array */ - for (i = 0; i < (int)dims_r[0]; i++ ) - { - for (j = 0; j < (int)dims_r[1]; j++ ) - { - if (i >= DIMS0 || j >= DIMS1) - { - if(buf_r[i][j] != comp_value) - { - printf("buf_r[%d][%d] = %d\n", i, j, buf_r[i][j]); - printf("value = %d\n", comp_value); + /* compare the read array with the original array */ + for (i = 0; i < (int) dims_r[0]; i++) { + for (j = 0; j < (int) dims_r[1]; j++) { + if (i >= DIMS0 || j >= DIMS1) { + if (buf_r[i][j] != comp_value) { + HDprintf("buf_r[%d][%d] = %d\n", i, j, buf_r[i][j]); + HDprintf("value = %d\n", comp_value); TEST_ERROR } - } - else - { - if(buf_r[i][j] != buf_o[i][j]) + } else { + if (buf_r[i][j] != buf_o[i][j]) TEST_ERROR } } @@ -1265,36 +1174,30 @@ static int test_rank2( hid_t fapl, dims_s[1] = 0; /* set new dimensions for the array. */ - if (H5Dset_extent(did , dims_s) < 0) - { + if (H5Dset_extent(did, dims_s) < 0) { TEST_ERROR } /* get the space */ - if ((sid = H5Dget_space(did)) < 0) - { + if ((sid = H5Dget_space(did)) < 0) { TEST_ERROR } /* get dimensions */ - if (H5Sget_simple_extent_dims(sid, dims_r, NULL) < 0) - { + if (H5Sget_simple_extent_dims(sid, dims_r, NULL) < 0) { TEST_ERROR } - if (H5Sclose(sid) < 0) - { + if (H5Sclose(sid) < 0) { TEST_ERROR } /* check dimensions */ - for( i = 0; i < RANK2; i++ ) - { + for (i = 0; i < RANK2; i++) { if (dims_r[i] != dims_s[i]) TEST_ERROR } - /*------------------------------------------------------------------------- * expand then shrink to 0 in dimension 1 while expanding again in * dimension 0 @@ -1302,10 +1205,8 @@ static int test_rank2( hid_t fapl, *------------------------------------------------------------------------- */ - /* expand to original dimensions for the array. */ - if (H5Dset_extent(did , dims_o) < 0) - { + if (H5Dset_extent(did, dims_o) < 0) { TEST_ERROR } @@ -1313,266 +1214,208 @@ static int test_rank2( hid_t fapl, dims_s[1] = 0; /* set new dimensions for the array. */ - if (H5Dset_extent(did , dims_s) < 0) - { + if (H5Dset_extent(did, dims_s) < 0) { TEST_ERROR } /* get the space */ - if ((sid = H5Dget_space(did)) < 0) - { + if ((sid = H5Dget_space(did)) < 0) { TEST_ERROR } /* get dimensions */ - if (H5Sget_simple_extent_dims(sid, dims_r, NULL) < 0) - { + if (H5Sget_simple_extent_dims(sid, dims_r, NULL) < 0) { TEST_ERROR } - if (H5Sclose(sid) < 0) - { + if (H5Sclose(sid) < 0) { TEST_ERROR } /* check dimensions */ - for( i = 0; i < RANK2; i++ ) - { + for (i = 0; i < RANK2; i++) { if (dims_r[i] != dims_s[i]) TEST_ERROR } - /*------------------------------------------------------------------------- * close dataset *------------------------------------------------------------------------- */ - if (H5Dclose(did) < 0) - { + if (H5Dclose(did) < 0) { TEST_ERROR } - - /*------------------------------------------------------------------------- + /*------------------------------------------------------------------------- * test a dataset with non initialized chunks *------------------------------------------------------------------------- */ - - if ((sid = H5Screate_simple(RANK2, dims_o, maxdims)) < 0) - { + if ((sid = H5Screate_simple(RANK2, dims_o, maxdims)) < 0) { TEST_ERROR } - if ((did = H5Dcreate2(fid , "dset3", H5T_NATIVE_INT, sid, H5P_DEFAULT, my_dcpl, H5P_DEFAULT)) < 0) - { + if ((did = H5Dcreate2(fid, "dset3", H5T_NATIVE_INT, sid, H5P_DEFAULT, my_dcpl, H5P_DEFAULT)) < 0) { TEST_ERROR } /* set new dimensions for the array */ - dims_o[ 0 ] = 0; - dims_o[ 1 ] = 0; - if (H5Dset_extent( did , dims_o ) < 0) - { + dims_o[0] = 0; + dims_o[1] = 0; + if (H5Dset_extent(did, dims_o) < 0) { TEST_ERROR } - - - if (H5Dclose(did) < 0) - { + if (H5Dclose(did) < 0) { TEST_ERROR } - if (H5Sclose(sid) < 0) - { + if (H5Sclose(sid) < 0) { TEST_ERROR } - - - /*------------------------------------------------------------------------- * close property list *------------------------------------------------------------------------- */ - - if (H5Pclose(my_dcpl) < 0) - { + if (H5Pclose(my_dcpl) < 0) { TEST_ERROR } /* close file creation property list */ - if(H5Pclose(fcpl) < 0) - { + if (H5Pclose(fcpl) < 0) { TEST_ERROR } - if (H5Fclose( fid ) < 0) - { + if (H5Fclose(fid) < 0) { TEST_ERROR } - return 0; - - -error: + error: H5E_BEGIN_TRY - { - H5Dclose( did ); - H5Sclose( sid ); - H5Pclose( my_dcpl ); - H5Pclose( fcpl ); - H5Fclose( fid ); - } H5E_END_TRY; + { + H5Dclose(did); + H5Sclose(sid); + H5Pclose(my_dcpl); + H5Pclose(fcpl); + H5Fclose(fid); + }H5E_END_TRY; return -1; } - - - /*------------------------------------------------------------------------- * test usage with a 3D rank *------------------------------------------------------------------------- */ -static int test_rank3( hid_t fapl, - hid_t dcpl, - hbool_t do_fill_value, - hbool_t disable_edge_filters, - hbool_t set_istore_k) -{ - - hid_t fid=-1; - hid_t did=-1; - hid_t sid=-1; - hid_t my_dcpl=-1; - hid_t fcpl; - hsize_t dims_o[RANK3] = {DIM0,DIM1,DIM2}; /* original dimensions */ - hsize_t dims_s[RANK3] = {DIMS0,DIMS1,DIMS2}; /* shrinking dimensions */ - hsize_t dims_e[RANK3] = {DIME0,DIME1,DIME2}; /* extended dimensions */ - hsize_t dims_c[RANK3] = {2,2,2}; /* chunk dimensions */ - hsize_t dims_r[RANK3]; /* read dimensions */ - hsize_t maxdims[RANK3] = {H5S_UNLIMITED,H5S_UNLIMITED,H5S_UNLIMITED}; - int buf_o[DIM0][DIM1][DIM2]; - int buf_s[DIMS0][DIMS1][DIMS2]; - int buf_e[DIME0][DIME1][DIME2]; - int buf_r[DIM0][DIM1][DIM2]; - int i, j, k; - int comp_value; - char filename[NAME_BUF_SIZE]; - - if ( do_fill_value ) - { +static int test_rank3(hid_t fapl, hid_t dcpl, hbool_t do_fill_value, hbool_t disable_edge_filters, hbool_t set_istore_k) { + + hid_t fid = -1; + hid_t did = -1; + hid_t sid = -1; + hid_t my_dcpl = -1; + hid_t fcpl; + hsize_t dims_o[RANK3] = { DIM0, DIM1, DIM2 }; /* original dimensions */ + hsize_t dims_s[RANK3] = { DIMS0, DIMS1, DIMS2 }; /* shrinking dimensions */ + hsize_t dims_e[RANK3] = { DIME0, DIME1, DIME2 }; /* extended dimensions */ + hsize_t dims_c[RANK3] = { 2, 2, 2 }; /* chunk dimensions */ + hsize_t dims_r[RANK3]; /* read dimensions */ + hsize_t maxdims[RANK3] = { H5S_UNLIMITED, H5S_UNLIMITED, H5S_UNLIMITED }; + int buf_o[DIM0][DIM1][DIM2]; + int buf_s[DIMS0][DIMS1][DIMS2]; + int buf_e[DIME0][DIME1][DIME2]; + int buf_r[DIM0][DIM1][DIM2]; + int i, j, k; + int comp_value; + char filename[NAME_BUF_SIZE]; + + if (do_fill_value) { comp_value = FILL_VALUE; - } - else - { + } else { comp_value = 0; } - - for( i = 0; i < DIM0; i++ ) - { - for( j = 0; j < DIM1; j++ ) - { - for( k = 0; k < DIM2; k++ ) - { + for (i = 0; i < DIM0; i++) { + for (j = 0; j < DIM1; j++) { + for (k = 0; k < DIM2; k++) { buf_o[i][j][k] = 2; } } } /* create a file creation property list */ - if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) - { + if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) { TEST_ERROR } - if ( set_istore_k ) - { + if (set_istore_k) { /* set non-default indexed storage B-tree internal 'K' value */ - if (H5Pset_istore_k(fcpl,ISTORE_IK) < 0) - { + if (H5Pset_istore_k(fcpl, ISTORE_IK) < 0) { TEST_ERROR } } /* create a new file */ h5_fixname(FILENAME[2], fapl, filename, sizeof filename); - if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0) - { + if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0) { TEST_ERROR } /* close property list */ - if(H5Pclose(fcpl) < 0) - { + if (H5Pclose(fcpl) < 0) { TEST_ERROR } /* create the data space with unlimited dimensions. */ - if ((sid = H5Screate_simple(RANK3, dims_o, maxdims)) < 0) - { + if ((sid = H5Screate_simple(RANK3, dims_o, maxdims)) < 0) { TEST_ERROR } /* modify dataset creation properties, i.e. enable chunking. */ - if ((my_dcpl = H5Pcopy (dcpl)) < 0) - { + if ((my_dcpl = H5Pcopy(dcpl)) < 0) { TEST_ERROR } - if (H5Pset_chunk(my_dcpl, RANK3, dims_c) < 0) - { + if (H5Pset_chunk(my_dcpl, RANK3, dims_c) < 0) { TEST_ERROR } - if(disable_edge_filters) - if(H5Pset_chunk_opts(my_dcpl, H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS) < 0) + if (disable_edge_filters) + if (H5Pset_chunk_opts(my_dcpl, H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS) < 0) TEST_ERROR - /*------------------------------------------------------------------------- - * create, write array - *------------------------------------------------------------------------- - */ + /*------------------------------------------------------------------------- + * create, write array + *------------------------------------------------------------------------- + */ - /* create a dataset */ - if ((did = H5Dcreate2(fid , "dset1", H5T_NATIVE_INT, sid, H5P_DEFAULT, my_dcpl, H5P_DEFAULT)) < 0) - { + /* create a dataset */ + if ((did = H5Dcreate2(fid, "dset1", H5T_NATIVE_INT, sid, H5P_DEFAULT, my_dcpl, H5P_DEFAULT)) < 0) { TEST_ERROR } /* write */ - if (H5Dwrite(did , H5T_NATIVE_INT, sid, H5S_ALL, H5P_DEFAULT, buf_o) < 0) - { + if (H5Dwrite(did, H5T_NATIVE_INT, sid, H5S_ALL, H5P_DEFAULT, buf_o) < 0) { TEST_ERROR } - #if defined (H5_SET_EXTENT_DEBUG3) - printf("\n"); - for (i = 0; i < (int)dims_o[0]; i++ ) - { - for (j = 0; j < (int)dims_o[1]; j++ ) - { - for( k = 0; k < (int)dims_o[2]; k++ ) - { - printf("%d ", buf_o[i][j][k]); + HDprintf("\n"); + for (i = 0; i < (int)dims_o[0]; i++ ) { + for (j = 0; j < (int)dims_o[1]; j++ ) { + for( k = 0; k < (int)dims_o[2]; k++ ) { + HDprintf("%d ", buf_o[i][j][k]); } - printf("[%d] ", j); + HDprintf("[%d] ", j); } - printf("\n"); + HDprintf("\n"); } - printf("\n"); + HDprintf("\n"); #endif - - - if (H5Sclose(sid) < 0) - { + if (H5Sclose(sid) < 0) { TEST_ERROR } @@ -1583,32 +1426,26 @@ static int test_rank3( hid_t fapl, */ /* set new dimensions for the array. */ - if (H5Dset_extent(did , dims_e) < 0) - { + if (H5Dset_extent(did, dims_e) < 0) { TEST_ERROR } /* get the space */ - if ((sid = H5Dget_space(did)) < 0) - { + if ((sid = H5Dget_space(did)) < 0) { TEST_ERROR } /* get dimensions */ - if (H5Sget_simple_extent_dims(sid, dims_r, NULL) < 0) - { + if (H5Sget_simple_extent_dims(sid, dims_r, NULL) < 0) { TEST_ERROR } - if (H5Sclose(sid) < 0) - { + if (H5Sclose(sid) < 0) { TEST_ERROR } - /* check dimensions */ - for( i = 0; i < RANK3; i++ ) - { + for (i = 0; i < RANK3; i++) { if (dims_r[i] != dims_e[i]) TEST_ERROR } @@ -1617,203 +1454,153 @@ static int test_rank3( hid_t fapl, if (H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_e) < 0) TEST_ERROR - - #if defined (H5_SET_EXTENT_DEBUG3) - printf("\n"); - for (i = 0; i < (int)dims_r[0]; i++ ) - { - for (j = 0; j < (int)dims_r[1]; j++ ) - { - for( k = 0; k < (int)dims_r[2]; k++ ) - { - printf("%d ", buf_e[i][j][k]); + HDprintf("\n"); + for (i = 0; i < (int)dims_r[0]; i++ ) { + for (j = 0; j < (int)dims_r[1]; j++ ) { + for( k = 0; k < (int)dims_r[2]; k++ ) { + HDprintf("%d ", buf_e[i][j][k]); } - printf("[%d] ", j); + HDprintf("[%d] ", j); } - printf("\n"); + HDprintf("\n"); } - printf("\n"); + HDprintf("\n"); #endif - - - - /* compare the read array with the expanded array */ - for (i = 0; i < (int)dims_r[0]; i++ ) - { - for (j = 0; j < (int)dims_r[1]; j++ ) - { - for( k = 0; k < (int)dims_r[2]; k++ ) - { - if ( i >= DIM0 || j >= DIM1 || k >= DIM2 ) - { - if(buf_e[i][j][k] != comp_value) - { - printf("buf_e[%d][%d][%d] = %d\n", i, j, k, buf_e[i][j][k] ); - printf("value = %d\n", comp_value); + /* compare the read array with the expanded array */ + for (i = 0; i < (int) dims_r[0]; i++) { + for (j = 0; j < (int) dims_r[1]; j++) { + for (k = 0; k < (int) dims_r[2]; k++) { + if (i >= DIM0 || j >= DIM1 || k >= DIM2) { + if (buf_e[i][j][k] != comp_value) { + HDprintf("buf_e[%d][%d][%d] = %d\n", i, j, k, buf_e[i][j][k]); + HDprintf("value = %d\n", comp_value); TEST_ERROR } - } - else - { - if(buf_e[i][j][k] != buf_o[i][j][k] ) + } else { + if (buf_e[i][j][k] != buf_o[i][j][k]) TEST_ERROR } } } } - - - /*------------------------------------------------------------------------- * shrink *------------------------------------------------------------------------- */ /* set new dimensions for the array. */ - if (H5Dset_extent(did , dims_s) < 0) - { + if (H5Dset_extent(did, dims_s) < 0) { TEST_ERROR } /* get the space */ - if ((sid = H5Dget_space(did)) < 0) - { + if ((sid = H5Dget_space(did)) < 0) { TEST_ERROR } /* get dimensions */ - if (H5Sget_simple_extent_dims(sid, dims_r, NULL) < 0) - { + if (H5Sget_simple_extent_dims(sid, dims_r, NULL) < 0) { TEST_ERROR } - if (H5Sclose(sid) < 0) - { + if (H5Sclose(sid) < 0) { TEST_ERROR } /* check dimensions */ - for( i = 0; i < RANK3; i++ ) - { + for (i = 0; i < RANK3; i++) { if (dims_r[i] != dims_s[i]) TEST_ERROR } - - /* for this case we close and reopen file */ - if ( set_istore_k ) - { + if (set_istore_k) { - if (H5Dclose(did) < 0) - { + if (H5Dclose(did) < 0) { TEST_ERROR } - if (H5Fclose(fid) < 0) - { + if (H5Fclose(fid) < 0) { TEST_ERROR } - if ((fid = H5Fopen( filename, H5F_ACC_RDWR, fapl ))<0) - { + if ((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) { TEST_ERROR } - if ((did = H5Dopen2( fid , "dset1", H5P_DEFAULT ))<0) - { + if ((did = H5Dopen2(fid, "dset1", H5P_DEFAULT)) < 0) { TEST_ERROR } - - } - /*------------------------------------------------------------------------- * read *------------------------------------------------------------------------- */ /* read */ - if (H5Dread( did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_s ) < 0) - { + if (H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_s) < 0) { TEST_ERROR } #if defined (H5_SET_EXTENT_DEBUG3) - printf("\n"); - for (i = 0; i < (int)dims_r[0]; i++ ) - { - for (j = 0; j < (int)dims_r[1]; j++ ) - { - for( k = 0; k < (int)dims_r[2]; k++ ) - { - printf("%d ", buf_s[i][j][k]); + HDprintf("\n"); + for (i = 0; i < (int)dims_r[0]; i++ ) { + for (j = 0; j < (int)dims_r[1]; j++ ) { + for( k = 0; k < (int)dims_r[2]; k++ ) { + HDprintf("%d ", buf_s[i][j][k]); } - printf("[%d] ", j); + HDprintf("[%d] ", j); } - printf("\n"); + HDprintf("\n"); } - printf("\n"); + HDprintf("\n"); #endif - - - /* compare the read array with the shrinked array */ - for( i = 0; i < (int)dims_r[0]; i++ ) - { - for( j = 0; j < (int)dims_r[1]; j++ ) - { - for( k = 0; k < (int)dims_r[2]; k++ ) - { - if ( buf_s[i][j][k] != buf_o[i][j][k] ) - { - printf("buf_s[%d][%d][%d] = %d\n", i, j, k, buf_s[i][j][k] ); - printf("buf_o[%d][%d][%d] = %d\n", i, j, k, buf_o[i][j][k] ); + for (i = 0; i < (int) dims_r[0]; i++) { + for (j = 0; j < (int) dims_r[1]; j++) { + for (k = 0; k < (int) dims_r[2]; k++) { + if (buf_s[i][j][k] != buf_o[i][j][k]) { + HDprintf("buf_s[%d][%d][%d] = %d\n", i, j, k, buf_s[i][j][k]); + HDprintf("buf_o[%d][%d][%d] = %d\n", i, j, k, buf_o[i][j][k]); TEST_ERROR } } } } - /*------------------------------------------------------------------------- * set new dimensions for the array; expand it back to original size *------------------------------------------------------------------------- */ /* set new dimensions for the array */ - if (H5Dset_extent(did, dims_o) < 0) - { + if (H5Dset_extent(did, dims_o) < 0) { TEST_ERROR } /* get the space */ - if ((sid = H5Dget_space(did)) < 0) - { + if ((sid = H5Dget_space(did)) < 0) { TEST_ERROR } /* get dimensions. */ - if (H5Sget_simple_extent_dims(sid, dims_r, NULL) < 0) - { + if (H5Sget_simple_extent_dims(sid, dims_r, NULL) < 0) { TEST_ERROR } - if (H5Sclose(sid) < 0) - { + if (H5Sclose(sid) < 0) { TEST_ERROR } /* check dimensions */ - for( i = 0; i < RANK3; i++ ) - { + for (i = 0; i < RANK3; i++) { if (dims_r[i] != dims_o[i]) TEST_ERROR } @@ -1823,52 +1610,39 @@ static int test_rank3( hid_t fapl, TEST_ERROR #if defined (H5_SET_EXTENT_DEBUG3) - printf("\n"); - for (i = 0; i < (int)dims_r[0]; i++ ) - { - for (j = 0; j < (int)dims_r[1]; j++ ) - { - for( k = 0; k < (int)dims_r[2]; k++ ) - { + HDprintf("\n"); + for (i = 0; i < (int)dims_r[0]; i++ ) { + for (j = 0; j < (int)dims_r[1]; j++ ) { + for( k = 0; k < (int)dims_r[2]; k++ ) { - printf("%d ", buf_r[i][j][k]); + HDprintf("%d ", buf_r[i][j][k]); } - printf("[%d] ", j); + HDprintf("[%d] ", j); } - printf("\n"); + HDprintf("\n"); } - printf("\n"); + HDprintf("\n"); #endif - - - /* compare the read array with the original array */ - for (i = 0; i < (int)dims_r[0]; i++ ) - { - for (j = 0; j < (int)dims_r[1]; j++ ) - { - for( k = 0; k < (int)dims_r[2]; k++ ) - { - if (i >= DIMS0 || j >= DIMS1 || k >= DIMS2 ) - { - if( buf_r[i][j][k] != comp_value ) - { - printf("buf_r[%d][%d][%d] = %d\n", i, j, k, buf_r[i][j][k] ); - printf("value = %d\n", comp_value); + /* compare the read array with the original array */ + for (i = 0; i < (int) dims_r[0]; i++) { + for (j = 0; j < (int) dims_r[1]; j++) { + for (k = 0; k < (int) dims_r[2]; k++) { + if (i >= DIMS0 || j >= DIMS1 || k >= DIMS2) { + if (buf_r[i][j][k] != comp_value) { + HDprintf("buf_r[%d][%d][%d] = %d\n", i, j, k, buf_r[i][j][k]); + HDprintf("value = %d\n", comp_value); TEST_ERROR } - } - else - { - if(buf_r[i][j][k] != buf_o[i][j][k]) + } else { + if (buf_r[i][j][k] != buf_o[i][j][k]) TEST_ERROR } } } } - /*------------------------------------------------------------------------- * shrink to 0 * @@ -1880,158 +1654,126 @@ static int test_rank3( hid_t fapl, dims_s[2] = 0; /* set new dimensions for the array. */ - if (H5Dset_extent(did , dims_s) < 0) - { + if (H5Dset_extent(did, dims_s) < 0) { TEST_ERROR } /* get the space */ - if ((sid = H5Dget_space(did)) < 0) - { + if ((sid = H5Dget_space(did)) < 0) { TEST_ERROR } /* get dimensions */ - if (H5Sget_simple_extent_dims(sid, dims_r, NULL) < 0) - { + if (H5Sget_simple_extent_dims(sid, dims_r, NULL) < 0) { TEST_ERROR } - if (H5Sclose(sid) < 0) - { + if (H5Sclose(sid) < 0) { TEST_ERROR } /* check dimensions */ - for( i = 0; i < RANK3; i++ ) - { + for (i = 0; i < RANK3; i++) { if (dims_r[i] != dims_s[i]) TEST_ERROR } - - /*------------------------------------------------------------------------- * close dataset *------------------------------------------------------------------------- */ - if (H5Dclose(did) < 0) - { + if (H5Dclose(did) < 0) { TEST_ERROR } - /*------------------------------------------------------------------------- * test a dataset with non initialized chunks *------------------------------------------------------------------------- */ - - if ((sid = H5Screate_simple(RANK3, dims_o, maxdims)) < 0) - { + if ((sid = H5Screate_simple(RANK3, dims_o, maxdims)) < 0) { TEST_ERROR } - if ((did = H5Dcreate2(fid , "dset3", H5T_NATIVE_INT, sid, H5P_DEFAULT, my_dcpl, H5P_DEFAULT)) < 0) - { + if ((did = H5Dcreate2(fid, "dset3", H5T_NATIVE_INT, sid, H5P_DEFAULT, my_dcpl, H5P_DEFAULT)) < 0) { TEST_ERROR } /* set new dimensions for the array */ - dims_o[ 0 ] = 0; - dims_o[ 1 ] = 0; - dims_o[ 2 ] = 0; - if (H5Dset_extent( did , dims_o ) < 0) - { + dims_o[0] = 0; + dims_o[1] = 0; + dims_o[2] = 0; + if (H5Dset_extent(did, dims_o) < 0) { TEST_ERROR } - - - if (H5Dclose(did) < 0) - { + if (H5Dclose(did) < 0) { TEST_ERROR } - if (H5Sclose(sid) < 0) - { + if (H5Sclose(sid) < 0) { TEST_ERROR } - - - /*------------------------------------------------------------------------- * close property list *------------------------------------------------------------------------- */ - - if (H5Pclose(my_dcpl) < 0) - { + if (H5Pclose(my_dcpl) < 0) { TEST_ERROR } - if (H5Fclose( fid ) < 0) - { + if (H5Fclose(fid) < 0) { TEST_ERROR } - return 0; - - -error: + error: H5E_BEGIN_TRY - { - H5Dclose( did ); - H5Sclose( sid ); - H5Pclose( my_dcpl ); - H5Pclose( fcpl ); - H5Fclose( fid ); - } H5E_END_TRY; + { + H5Dclose(did); + H5Sclose(sid); + H5Pclose(my_dcpl); + H5Pclose(fcpl); + H5Fclose(fid); + }H5E_END_TRY; return -1; } - /*------------------------------------------------------------------------- * test usage with external storage *------------------------------------------------------------------------- */ -static int test_external( hid_t fapl ) -{ - - hid_t fid=-1; - hid_t did=-1; - hid_t sid=-1; - hid_t dcpl=-1; - hsize_t dims_o[RANK2] = {DIM0,DIM1}; /* original dimensions */ - hsize_t dims_s[RANK2] = {DIMS0,DIMS1}; /* shrinking dimensions */ - hsize_t dims_e[RANK2] = {DIME0,DIM1}; /* extended dimensions, dimension 1 is the original */ - hsize_t dims_r[RANK2]; /* read dimensions */ - hsize_t maxdims[RANK2] = {DIME0,DIM1}; /* only the first dimension can be extendible */ - int buf_o[DIM0][DIM1]; /* original buffer, for writing */ - int buf_s[DIMS0][DIMS1]; /* shrinked buffer, for reading */ - int buf_e[DIME0][DIM1]; /* extended buffer, for writing, dimension 1 is the original */ - int buf_ro[DIM0][DIM1]; /* original buffer for reading */ - int i, j; - int comp_value = 0; - char filename[NAME_BUF_SIZE]; - - - hsize_t size; /* number of bytes reserved in the file for the data */ +static int test_external(hid_t fapl) { + + hid_t fid = -1; + hid_t did = -1; + hid_t sid = -1; + hid_t dcpl = -1; + hsize_t dims_o[RANK2] = { DIM0, DIM1 }; /* original dimensions */ + hsize_t dims_s[RANK2] = { DIMS0, DIMS1 }; /* shrinking dimensions */ + hsize_t dims_e[RANK2] = { DIME0, DIM1 }; /* extended dimensions, dimension 1 is the original */ + hsize_t dims_r[RANK2]; /* read dimensions */ + hsize_t maxdims[RANK2] = { DIME0, DIM1 }; /* only the first dimension can be extendible */ + int buf_o[DIM0][DIM1]; /* original buffer, for writing */ + int buf_s[DIMS0][DIMS1]; /* shrinked buffer, for reading */ + int buf_e[DIME0][DIM1]; /* extended buffer, for writing, dimension 1 is the original */ + int buf_ro[DIM0][DIM1]; /* original buffer for reading */ + int i, j; + int comp_value = 0; + char filename[NAME_BUF_SIZE]; + + hsize_t size; /* number of bytes reserved in the file for the data */ hsize_t max_size[2]; max_size[0] = dims_e[0]; max_size[1] = dims_e[1]; size = max_size[0] * max_size[1] * sizeof(int) / 2; - - for( i = 0; i < DIM0; i++ ) - { - for( j = 0; j < DIM1; j++ ) - { + for (i = 0; i < DIM0; i++) { + for (j = 0; j < DIM1; j++) { buf_o[i][j] = 2; } } @@ -2043,30 +1785,27 @@ static int test_external( hid_t fapl ) if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR - /* modify dataset creation properties */ - if ((dcpl = H5Pcreate (H5P_DATASET_CREATE)) < 0) + /* modify dataset creation properties */ + if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) FAIL_STACK_ERROR - if(H5Pset_external(dcpl, EXT_FILE_NAME1, (off_t)0, size) < 0) + if (H5Pset_external(dcpl, EXT_FILE_NAME1, (off_t) 0, size) < 0) FAIL_STACK_ERROR - if(H5Pset_external(dcpl, EXT_FILE_NAME2, (off_t)0, size) < 0) + if (H5Pset_external(dcpl, EXT_FILE_NAME2, (off_t) 0, size) < 0) FAIL_STACK_ERROR { - char name[256]; /*external file name */ - off_t file_offset; /*external file offset */ - hsize_t file_size; /*sizeof external file segment */ + char name[256]; /*external file name */ + off_t file_offset; /*external file offset */ + hsize_t file_size; /*sizeof external file segment */ - if(H5Pget_external(dcpl, 0, sizeof(name), name, &file_offset, - &file_size) < 0) + if (H5Pget_external(dcpl, 0, sizeof(name), name, &file_offset, &file_size) < 0) FAIL_STACK_ERROR } - - /*------------------------------------------------------------------------- * Write an array AxB. These are the dimensions for creating the dataset * @@ -2080,80 +1819,72 @@ static int test_external( hid_t fapl ) *------------------------------------------------------------------------- */ - /* create the data space with unlimited dimensions. */ if ((sid = H5Screate_simple(RANK2, dims_o, maxdims)) < 0) FAIL_STACK_ERROR - if ((did = H5Dcreate2(fid , "dset1", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) + if ((did = H5Dcreate2(fid, "dset1", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - if (H5Dwrite(did , H5T_NATIVE_INT, sid, H5S_ALL, H5P_DEFAULT, buf_o) < 0) + if (H5Dwrite(did, H5T_NATIVE_INT, sid, H5S_ALL, H5P_DEFAULT, buf_o) < 0) FAIL_STACK_ERROR if (H5Sclose(sid) < 0) FAIL_STACK_ERROR + /*------------------------------------------------------------------------- + * read + *------------------------------------------------------------------------- + */ - /*------------------------------------------------------------------------- - * read - *------------------------------------------------------------------------- - */ - - /* read */ + /* read */ if (H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_ro) < 0) FAIL_STACK_ERROR #if defined (H5_SET_EXTENT_DEBUG) - printf("\n"); - for (i = 0; i < (int)dims_o[0]; i++ ) - { - for (j = 0; j < (int)dims_o[1]; j++ ) - { - printf("%d ", buf_ro[i][j]); + HDprintf("\n"); + for (i = 0; i < (int)dims_o[0]; i++ ) { + for (j = 0; j < (int)dims_o[1]; j++ ) { + HDprintf("%d ", buf_ro[i][j]); } - printf("\n"); + HDprintf("\n"); } #endif - - - /*------------------------------------------------------------------------- - * expand - *------------------------------------------------------------------------- - */ - - /*------------------------------------------------------------------------- - * set new dimensions for the array; expand it - * data is now, extended space was initialized with default value - * - * 2 2 2 2 - * 2 2 2 2 - * 2 2 2 2 - * 2 2 2 2 - * 0 0 0 0 - * 0 0 0 0 - * 0 0 0 0 - * - *------------------------------------------------------------------------- - */ - - /* set new dimensions for the array. */ - if (H5Dset_extent(did , dims_e) < 0) + /*------------------------------------------------------------------------- + * expand + *------------------------------------------------------------------------- + */ + + /*------------------------------------------------------------------------- + * set new dimensions for the array; expand it + * data is now, extended space was initialized with default value + * + * 2 2 2 2 + * 2 2 2 2 + * 2 2 2 2 + * 2 2 2 2 + * 0 0 0 0 + * 0 0 0 0 + * 0 0 0 0 + * + *------------------------------------------------------------------------- + */ + + /* set new dimensions for the array. */ + if (H5Dset_extent(did, dims_e) < 0) FAIL_STACK_ERROR - /* get the space */ + /* get the space */ if ((sid = H5Dget_space(did)) < 0) FAIL_STACK_ERROR - /* get dimensions */ + /* get dimensions */ if (H5Sget_simple_extent_dims(sid, dims_r, NULL) < 0) FAIL_STACK_ERROR if (H5Sclose(sid) < 0) FAIL_STACK_ERROR - - /* check dimensions */ - for( i = 0; i < RANK2; i++ ) - { + /* check dimensions */ + for (i = 0; i < RANK2; i++) { if (dims_r[i] != dims_e[i]) TEST_ERROR } @@ -2162,48 +1893,33 @@ static int test_external( hid_t fapl ) if (H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_e) < 0) FAIL_STACK_ERROR - - #if defined (H5_SET_EXTENT_DEBUG) - printf("\n"); - for (i = 0; i < (int)dims_r[0]; i++ ) - { - for (j = 0; j < (int)dims_r[1]; j++ ) - { - printf("%d ", buf_e[i][j]); + HDprintf("\n"); + for (i = 0; i < (int)dims_r[0]; i++ ) { + for (j = 0; j < (int)dims_r[1]; j++ ) { + HDprintf("%d ", buf_e[i][j]); } - printf("\n"); + HDprintf("\n"); } #endif - - - - /* compare the read array with the expanded array */ - for (i = 0; i < (int)dims_r[0]; i++ ) - { - for (j = 0; j < (int)dims_r[1]; j++ ) - { - if ( i >= DIM0 || j >= DIM1 ) - { - if(buf_e[i][j] != comp_value) - { - printf("buf_e[%d][%d] = %d\n", i, j, buf_e[i][j]); - printf("value = %d\n", comp_value); + /* compare the read array with the expanded array */ + for (i = 0; i < (int) dims_r[0]; i++) { + for (j = 0; j < (int) dims_r[1]; j++) { + if (i >= DIM0 || j >= DIM1) { + if (buf_e[i][j] != comp_value) { + HDprintf("buf_e[%d][%d] = %d\n", i, j, buf_e[i][j]); + HDprintf("value = %d\n", comp_value); TEST_ERROR } - } - else - { - if(buf_e[i][j] != buf_o[i][j]) + } else { + if (buf_e[i][j] != buf_o[i][j]) TEST_ERROR } } } - - - /*------------------------------------------------------------------------- + /*------------------------------------------------------------------------- * shrink * * data is now @@ -2215,208 +1931,172 @@ static int test_external( hid_t fapl ) */ /* set new dimensions for the array. */ - if (H5Dset_extent(did , dims_s) < 0) + if (H5Dset_extent(did, dims_s) < 0) FAIL_STACK_ERROR - /* get the space */ + /* get the space */ if ((sid = H5Dget_space(did)) < 0) FAIL_STACK_ERROR - /* get dimensions */ + /* get dimensions */ if (H5Sget_simple_extent_dims(sid, dims_r, NULL) < 0) FAIL_STACK_ERROR if (H5Sclose(sid) < 0) FAIL_STACK_ERROR - /* check dimensions */ - for( i = 0; i < RANK2; i++ ) - { + /* check dimensions */ + for (i = 0; i < RANK2; i++) { if (dims_r[i] != dims_s[i]) TEST_ERROR } - - - /*------------------------------------------------------------------------- * read *------------------------------------------------------------------------- */ /* read */ - if (H5Dread( did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_s ) < 0) + if (H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_s) < 0) FAIL_STACK_ERROR #if defined (H5_SET_EXTENT_DEBUG) - printf("\n"); - for (i = 0; i < (int)dims_r[0]; i++ ) - { - for (j = 0; j < (int)dims_r[1]; j++ ) - { - printf("%d ", buf_s[i][j]); + HDprintf("\n"); + for (i = 0; i < (int)dims_r[0]; i++ ) { + for (j = 0; j < (int)dims_r[1]; j++ ) { + HDprintf("%d ", buf_s[i][j]); } - printf("\n"); + HDprintf("\n"); } #endif - - - - /* compare the read array with the shrinked array */ - for( i = 0; i < (int)dims_r[0]; i++ ) - { - for( j = 0; j < (int)dims_r[1]; j++ ) - { - if ( buf_s[i][j] != buf_o[i][j] ) - { - printf("buf_s[%d][%d] = %d\n", i, j, buf_s[i][j]); - printf("buf_o[%d][%d] = %d\n", i, j, buf_o[i][j]); + /* compare the read array with the shrinked array */ + for (i = 0; i < (int) dims_r[0]; i++) { + for (j = 0; j < (int) dims_r[1]; j++) { + if (buf_s[i][j] != buf_o[i][j]) { + HDprintf("buf_s[%d][%d] = %d\n", i, j, buf_s[i][j]); + HDprintf("buf_o[%d][%d] = %d\n", i, j, buf_o[i][j]); TEST_ERROR } } } - /*------------------------------------------------------------------------- * negative test * try to extend dimension above maximum *------------------------------------------------------------------------- */ - dims_e[1] = DIME1; - H5E_BEGIN_TRY - { - - - /* set new dimensions for the array. */ - if (H5Dset_extent(did , dims_e) == SUCCEED) { - TEST_ERROR - } - - } H5E_END_TRY; + /* set new dimensions for the array. */ + if (H5Dset_extent(did, dims_e) == SUCCEED) { + TEST_ERROR + } + }H5E_END_TRY; /*------------------------------------------------------------------------- * close property list *------------------------------------------------------------------------- */ - if (H5Pclose(dcpl) < 0) FAIL_STACK_ERROR - if (H5Dclose( did ) < 0) + if (H5Dclose(did) < 0) FAIL_STACK_ERROR - if (H5Fclose( fid ) < 0) + if (H5Fclose(fid) < 0) FAIL_STACK_ERROR - PASSED(); + PASSED() + ; return 0; -error: + error: H5E_BEGIN_TRY - { - H5Dclose( did ); - H5Sclose( sid ); - H5Pclose( dcpl ); - H5Fclose( fid ); - } H5E_END_TRY; + { + H5Dclose(did); + H5Sclose(sid); + H5Pclose(dcpl); + H5Fclose(fid); + }H5E_END_TRY; return -1; } - /*------------------------------------------------------------------------- * test usage with layouts compact and contiguous *------------------------------------------------------------------------- */ -static int test_layouts( H5D_layout_t layout, hid_t fapl ) -{ - - hid_t fid=-1; - hid_t did=-1; - hid_t sid=-1; - hid_t dcpl=-1; - herr_t ret; - hsize_t dims_o[RANK2] = {DIM0,DIM1}; /* original dimensions */ - hsize_t dims_s[RANK2] = {DIMS0,DIMS1}; /* shrinking dimensions */ - hsize_t dims_e[RANK2] = {DIME0,DIME1}; /* extended dimensions */ - hsize_t dims_r[RANK2]; /* read dimensions */ - int buf_o[DIM0][DIM1]; - int buf_r[DIM0][DIM1]; - int i, j; - char filename[NAME_BUF_SIZE]; - - for( i = 0; i < DIM0; i++ ) - { - for( j = 0; j < DIM1; j++ ) - { +static int test_layouts(H5D_layout_t layout, hid_t fapl) { + + hid_t fid = -1; + hid_t did = -1; + hid_t sid = -1; + hid_t dcpl = -1; + herr_t ret; + hsize_t dims_o[RANK2] = { DIM0, DIM1 }; /* original dimensions */ + hsize_t dims_s[RANK2] = { DIMS0, DIMS1 }; /* shrinking dimensions */ + hsize_t dims_e[RANK2] = { DIME0, DIME1 }; /* extended dimensions */ + hsize_t dims_r[RANK2]; /* read dimensions */ + int buf_o[DIM0][DIM1]; + int buf_r[DIM0][DIM1]; + int i, j; + char filename[NAME_BUF_SIZE]; + + for (i = 0; i < DIM0; i++) { + for (j = 0; j < DIM1; j++) { buf_o[i][j] = 2; } } - /* create a new file */ h5_fixname(FILENAME[4], fapl, filename, sizeof filename); - if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) - { + if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) { TEST_ERROR } /* create the data space with unlimited dimensions. */ - if ((sid = H5Screate_simple(RANK2, dims_o, NULL)) < 0) - { + if ((sid = H5Screate_simple(RANK2, dims_o, NULL)) < 0) { TEST_ERROR } /* modify dataset creation properties */ - if ((dcpl = H5Pcreate (H5P_DATASET_CREATE)) < 0) - { + if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) { TEST_ERROR } - if (H5Pset_layout (dcpl, layout) < 0) - { + if (H5Pset_layout(dcpl, layout) < 0) { TEST_ERROR } /* create a dataset */ - if ((did = H5Dcreate2(fid , "dset1", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) - { + if ((did = H5Dcreate2(fid, "dset1", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) { TEST_ERROR } /* write */ - if (H5Dwrite(did , H5T_NATIVE_INT, sid, H5S_ALL, H5P_DEFAULT, buf_o) < 0) - { + if (H5Dwrite(did, H5T_NATIVE_INT, sid, H5S_ALL, H5P_DEFAULT, buf_o) < 0) { TEST_ERROR } - #if defined (H5_SET_EXTENT_DEBUG4) - printf("\n"); - for (i = 0; i < (int)dims_o[0]; i++ ) - { - for (j = 0; j < (int)dims_o[1]; j++ ) - { - printf("%d ", buf_o[i][j]); + HDprintf("\n"); + for (i = 0; i < (int)dims_o[0]; i++ ) { + for (j = 0; j < (int)dims_o[1]; j++ ) { + HDprintf("%d ", buf_o[i][j]); } - printf("\n"); + HDprintf("\n"); } #endif - - - if (H5Sclose(sid) < 0) - { + if (H5Sclose(sid) < 0) { TEST_ERROR } @@ -2427,39 +2107,31 @@ static int test_layouts( H5D_layout_t layout, hid_t fapl ) */ H5E_BEGIN_TRY - { + { - ret = H5Dset_extent(did , dims_e); + ret = H5Dset_extent(did, dims_e); - } H5E_END_TRY; + }H5E_END_TRY; - if(ret >= 0) + if (ret >= 0) TEST_ERROR - - - - /* get the space */ - if ((sid = H5Dget_space(did)) < 0) - { + /* get the space */ + if ((sid = H5Dget_space(did)) < 0) { TEST_ERROR } /* get dimensions */ - if (H5Sget_simple_extent_dims(sid, dims_r, NULL) < 0) - { + if (H5Sget_simple_extent_dims(sid, dims_r, NULL) < 0) { TEST_ERROR } - if (H5Sclose(sid) < 0) - { + if (H5Sclose(sid) < 0) { TEST_ERROR } - /* check dimensions */ - for( i = 0; i < RANK2; i++ ) - { + for (i = 0; i < RANK2; i++) { if (dims_r[i] != dims_o[i]) TEST_ERROR } @@ -2468,123 +2140,100 @@ static int test_layouts( H5D_layout_t layout, hid_t fapl ) if (H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_r) < 0) TEST_ERROR - - #if defined (H5_SET_EXTENT_DEBUG4) - printf("\n"); - for (i = 0; i < (int)dims_r[0]; i++ ) - { - for (j = 0; j < (int)dims_r[1]; j++ ) - { - printf("%d ", buf_r[i][j]); + HDprintf("\n"); + for (i = 0; i < (int)dims_r[0]; i++ ) { + for (j = 0; j < (int)dims_r[1]; j++ ) { + HDprintf("%d ", buf_r[i][j]); } - printf("\n"); + HDprintf("\n"); } #endif - - - /*------------------------------------------------------------------------- - * negative test - * try to shrink dimension - *------------------------------------------------------------------------- - */ + /*------------------------------------------------------------------------- + * negative test + * try to shrink dimension + *------------------------------------------------------------------------- + */ H5E_BEGIN_TRY - { + { - ret = H5Dset_extent(did , dims_s); + ret = H5Dset_extent(did, dims_s); - } H5E_END_TRY; + }H5E_END_TRY; - if(ret >= 0) + if (ret >= 0) TEST_ERROR - - /* get the space */ - if ((sid = H5Dget_space(did)) < 0) - { + /* get the space */ + if ((sid = H5Dget_space(did)) < 0) { TEST_ERROR } /* get dimensions */ - if (H5Sget_simple_extent_dims(sid, dims_r, NULL) < 0) - { + if (H5Sget_simple_extent_dims(sid, dims_r, NULL) < 0) { TEST_ERROR } - if (H5Sclose(sid) < 0) - { + if (H5Sclose(sid) < 0) { TEST_ERROR } /* check dimensions */ - for( i = 0; i < RANK2; i++ ) - { + for (i = 0; i < RANK2; i++) { if (dims_r[i] != dims_o[i]) TEST_ERROR } - /*------------------------------------------------------------------------- * read *------------------------------------------------------------------------- */ /* read */ - if (H5Dread( did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_r ) < 0) - { + if (H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_r) < 0) { TEST_ERROR } #if defined (H5_SET_EXTENT_DEBUG4) - printf("\n"); - for (i = 0; i < (int)dims_r[0]; i++ ) - { - for (j = 0; j < (int)dims_r[1]; j++ ) - { - printf("%d ", buf_r[i][j]); + HDprintf("\n"); + for (i = 0; i < (int)dims_r[0]; i++ ) { + for (j = 0; j < (int)dims_r[1]; j++ ) { + HDprintf("%d ", buf_r[i][j]); } - printf("\n"); + HDprintf("\n"); } #endif - - /*------------------------------------------------------------------------- * close *------------------------------------------------------------------------- */ - if (H5Dclose(did) < 0) - { + if (H5Dclose(did) < 0) { TEST_ERROR } - if (H5Pclose(dcpl) < 0) - { + if (H5Pclose(dcpl) < 0) { TEST_ERROR } - if (H5Fclose( fid ) < 0) - { + if (H5Fclose(fid) < 0) { TEST_ERROR } - return 0; - - -error: + error: H5E_BEGIN_TRY - { - H5Dclose( did ); - H5Sclose( sid ); - H5Pclose( dcpl ); - H5Fclose( fid ); - } H5E_END_TRY; + { + H5Dclose(did); + H5Sclose(sid); + H5Pclose(dcpl); + H5Fclose(fid); + }H5E_END_TRY; return -1; } @@ -3077,16 +2726,15 @@ static void test_random_rank4_dump( unsigned ndim_sets, hsize_t dim_log[][4], { unsigned i; - printf(" Chunk dimensions: ( %u, %u, %u, %u )\n", (unsigned)cdims[0], + HDprintf(" Chunk dimensions: ( %u, %u, %u, %u )\n", (unsigned)cdims[0], (unsigned)cdims[1], (unsigned)cdims[2], (unsigned)cdims[3]); - printf(" Log of dataset dimensions (oldest first):\n"); + HDprintf(" Log of dataset dimensions (oldest first):\n"); for(i=0; i=0) - printf(" First incorrect value read: ( %d, %d, %d, %d )\n", j, k, l, - m); + HDprintf(" First incorrect value read: ( %d, %d, %d, %d )\n", j, k, l, m); return; } /* end test_random_rank4_dump */ -- cgit v0.12 From 83b23a5a42c2124c1c5933d0565be1bbefd1c30d Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Tue, 6 Aug 2019 16:23:15 -0500 Subject: Use prefix variable --- config/cmake/hdf5-config.cmake.in | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/config/cmake/hdf5-config.cmake.in b/config/cmake/hdf5-config.cmake.in index 1803117..a0d6c49 100644 --- a/config/cmake/hdf5-config.cmake.in +++ b/config/cmake/hdf5-config.cmake.in @@ -100,9 +100,9 @@ endif () #----------------------------------------------------------------------------- # Version Strings #----------------------------------------------------------------------------- -set (HDF5_VERSION_STRING @HDF5_VERSION_STRING@) -set (HDF5_VERSION_MAJOR @HDF5_VERSION_MAJOR@) -set (HDF5_VERSION_MINOR @HDF5_VERSION_MINOR@) +set (${HDF5_PACKAGE_NAME}_VERSION_STRING @HDF5_VERSION_STRING@) +set (${HDF5_PACKAGE_NAME}_VERSION_MAJOR @HDF5_VERSION_MAJOR@) +set (${HDF5_PACKAGE_NAME}_VERSION_MINOR @HDF5_VERSION_MINOR@) #----------------------------------------------------------------------------- # Don't include targets if this file is being picked up by another @@ -196,7 +196,7 @@ foreach (libtype IN LISTS ${HDF5_PACKAGE_NAME}_LIB_TYPE) elseif (comp STREQUAL "Java") set (${HDF5_PACKAGE_NAME}_${comp}_FOUND 1) string(TOUPPER ${HDF5_PACKAGE_NAME}_${comp}_LIBRARY COMP_LIBRARY) - set (${COMP_LIBRARY} ${${COMP_LIBRARY}} hdf5::${hdf5_comp}) + set (${COMP_LIBRARY} ${${COMP_LIBRARY}} @HDF5_PACKAGE@::${hdf5_comp}) else () set (${HDF5_PACKAGE_NAME}_${libtype}_${comp}_FOUND 1) string(TOUPPER ${HDF5_PACKAGE_NAME}_${comp}_${libtype}_LIBRARY COMP_LIBRARY) -- cgit v0.12