diff options
author | Dana Robinson <43805+derobins@users.noreply.github.com> | 2021-07-12 20:30:20 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-12 20:30:20 (GMT) |
commit | eebaee65290de59a4fbf1a426df09e32872d9efc (patch) | |
tree | ad1ed5e22cf84e5ab9981e5f798d96ee2dc2a389 /test | |
parent | b9dbabc1523c13627ada0bcb04d780e7ad93b658 (diff) | |
download | hdf5-eebaee65290de59a4fbf1a426df09e32872d9efc.zip hdf5-eebaee65290de59a4fbf1a426df09e32872d9efc.tar.gz hdf5-eebaee65290de59a4fbf1a426df09e32872d9efc.tar.bz2 |
VFD SWMR: sync with develop (#830)
* Normalization with develop
* Removes checks and work-arounds for strtoll and strtoull (#769)
* Removes checks for (v)snprintf, which are C99 (#772)
* Update missing release note info. (#776)
* Replaces the H5_OVERRIDE macro with override (#773)
The macro is no longer necessary now that we require C++11.
* Cleans up some POSIX header bits in H5private.h (#783)
* Removes outdated checks for ways inline might be defined (#781)
These are obsolete now that we require C99.
* Removes checks for system(), which is C89/90 (#782)
* Removes C++ dependency on H5private.h (#774)
* Removes C++ dependency on H5private.h
Most C API calls have been removed, aside from a few uses of free,
where we just dropped the 'HD'. A couple of H5_ATTR_UNUSED macros
were also replaced with (void) statements.
* Committing clang-format changes
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
* Further simplifies Autotools type size checks (#789)
Also fixes an issue where clock_gettime and difftime are not detected
due to earlier simplifications of this code.
* Release Note (#784)
* Normalization of CMake H5pubconf.h with Autotools (#791)
Mostly just moving things around and changing the comments to keep the
delta small. The only symbol change is that for curl/curl.h which I
changed to H5_HAVE_CURL_CURL_H to match the Autotools. This symbol
is not used in the library and is just an artifact of the checks.
* Fix tools test (#794)
* Removes ancient Autotools cruft (#790)
* Reorganization of C and POSIX headers in H5public.h & H5private.h (#793)
* Reorganization of C and POSIX headers in H5public.h & H5private.h
Consolidated and removed duplicates
* It turns out Windows has sys/types.h
Co-authored-by: Larry Knox <lrknox@hdfgroup.org>
* Removes checks for signal and set/longjmp, which are C89 (#798)
Also removes checks for setjmp.h and stddef.h
* Assume frexpl/f and fabsl/f, which are C99 (#799)
* Assume the library has C99 types in C++ type code (#806)
* Assume the library has C99 types in C++ type code
* Committing clang-format changes
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
* Removes obsolete equivalents of C99's __func__ (#800)
* Cleans up POSIX/C bits in H5private.h (#804)
* Cleans up POSIX/C bits in H5private.h
* Assume difftime exists (C89)
* Reorg AC_CHECK_HEADERS so headers are in alphabetical order
* Split off networking-related AC_CHECK_HEADERS
* Remove unused UNAME_CYGWIN from configure.ac
* Remove checks for unused sys/timeb.h
* Tidying pass over H5private.h HD prefix macros
* Tidy H5win32defs.h
* Add HD prefix to various scanf calls
* Committing clang-format changes
* Fixes to the alarm(2) code used in the tests to make Windows happy
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
* Brings the tools getopt(3) replacement into the main library (#803)
* Moves get_option from the tools library to the C library
* Adds H5 prefix to get_option call and variables
* Renames the H5_get_option long options struct and enum
* Removes type guesses when C99 types are missing (#807)
* Assume C99 types exist in H5detect.c (#808)
* Fixes parallel issues from recent C99 changes
* Adds MPE FUNC --> __func__ changes missed in earlier PRs
* Fix typo
* Fixes parallel issues from recent C99 changes (#809)
* Fixes parallel issues from recent C99 changes
* Adds MPE FUNC --> __func__ changes missed in earlier PRs
* Even more missed FUNC --> __func__ macros
* Removes remaining H5_TIME_WITH_SYS_TIME cruft (#810)
Mostly from CMake
* Merges with develop
* Committing clang-format changes
* Normalization with develop
* direct_chunk test and H5Dget_chunk_storage_size changes
* Removes unused H5O call
* Brings some dataspace changes from the combo branch merge
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Larry Knox <lrknox@hdfgroup.org>
Diffstat (limited to 'test')
-rw-r--r-- | test/cmpd_dset.c | 4 | ||||
-rw-r--r-- | test/cross_read.c | 2 | ||||
-rw-r--r-- | test/direct_chunk.c | 100 | ||||
-rw-r--r-- | test/dsets.c | 43 | ||||
-rw-r--r-- | test/dtypes.c | 56 | ||||
-rw-r--r-- | test/earray.c | 4 | ||||
-rw-r--r-- | test/farray.c | 4 | ||||
-rw-r--r-- | test/file_image.c | 16 | ||||
-rw-r--r-- | test/h5test.c | 33 | ||||
-rw-r--r-- | test/h5test.h | 14 | ||||
-rw-r--r-- | test/hyperslab.c | 7 | ||||
-rw-r--r-- | test/istore.c | 6 | ||||
-rw-r--r-- | test/links.c | 8 | ||||
-rw-r--r-- | test/objcopy.c | 12 | ||||
-rw-r--r-- | test/page_buffer.c | 12 | ||||
-rw-r--r-- | test/testfiles/err_compat_1 | 4 | ||||
-rw-r--r-- | test/testfiles/links_env.out | 4 | ||||
-rw-r--r-- | test/tfile.c | 1 | ||||
-rw-r--r-- | test/trefer_deprec.c | 6 | ||||
-rw-r--r-- | test/trefstr.c | 2 | ||||
-rw-r--r-- | test/unlink.c | 2 | ||||
-rw-r--r-- | test/use_common.c | 21 |
22 files changed, 227 insertions, 134 deletions
diff --git a/test/cmpd_dset.c b/test/cmpd_dset.c index e74b438..4c3233d 100644 --- a/test/cmpd_dset.c +++ b/test/cmpd_dset.c @@ -1466,6 +1466,10 @@ test_hdf5_src_subset(char *filename, hid_t fapl) return 0; error: + HDfree(orig); + HDfree(rbuf); + HDfree(rew_buf); + HDputs("*** DATASET TESTS FAILED ***"); return 1; } diff --git a/test/cross_read.c b/test/cross_read.c index eef814f..cb71996 100644 --- a/test/cross_read.c +++ b/test/cross_read.c @@ -41,8 +41,10 @@ const char *FILENAME[] = {"vms_data", "le_data", "be_data", NULL}; #define DATASETNAME14 "Fletcher_float_data_le" #define DATASETNAME15 "Fletcher_float_data_be" +#ifdef H5_HAVE_FILTER_DEFLATE #define DATASETNAME16 "Deflate_float_data_le" #define DATASETNAME17 "Deflate_float_data_be" +#endif #ifdef H5_HAVE_FILTER_SZIP #define DATASETNAME18 "Szip_float_data_le" #define DATASETNAME19 "Szip_float_data_be" diff --git a/test/direct_chunk.c b/test/direct_chunk.c index 61e3df9..8960784 100644 --- a/test/direct_chunk.c +++ b/test/direct_chunk.c @@ -23,7 +23,9 @@ #define FILE_NAME "direct_chunk.h5" /* Datasets for Direct Write tests */ +#ifdef H5_HAVE_FILTER_DEFLATE #define DATASETNAME1 "direct_write" +#endif #define DATASETNAME2 "skip_one_filter" #define DATASETNAME3 "skip_two_filters" #define DATASETNAME4 "data_conv" @@ -31,9 +33,11 @@ #define DATASETNAME6 "invalid_argue" #define DATASETNAME7 "overwrite_chunk" /* Datasets for Direct Read tests */ +#ifdef H5_HAVE_FILTER_DEFLATE #define DATASETNAME8 "disabled_chunk_cache" #define DATASETNAME9 "flush_chunk_cache" #define DATASETNAME10 "read_w_valid_cache" +#endif #define DATASETNAME11 "unallocated_chunk" #define DATASETNAME12 "unfiltered_data" @@ -43,7 +47,9 @@ #define CHUNK_NX 4 #define CHUNK_NY 4 +#ifdef H5_HAVE_FILTER_DEFLATE #define DEFLATE_SIZE_ADJUST(s) (HDceil(((double)(s)) * 1.001) + 12.0) +#endif /* Temporary filter IDs used for testing */ #define H5Z_FILTER_BOGUS1 305 @@ -1990,23 +1996,23 @@ test_read_unallocated_chunk(hid_t file) /* Create the data space with unlimited dimensions. */ if ((dataspace = H5Screate_simple(RANK, dims, maxdims)) < 0) - goto error; + FAIL_STACK_ERROR; if ((mem_space = H5Screate_simple(RANK, chunk_dims, NULL)) < 0) - goto error; + FAIL_STACK_ERROR; /* Modify dataset creation properties, i.e. enable chunking, no compression */ if ((cparms = H5Pcreate(H5P_DATASET_CREATE)) < 0) - goto error; + FAIL_STACK_ERROR; if ((status = H5Pset_chunk(cparms, RANK, chunk_dims)) < 0) - goto error; + FAIL_STACK_ERROR; /* Create a new dataset within the file using cparms creation properties. */ if ((dataset = H5Dcreate2(file, DATASETNAME11, H5T_NATIVE_INT, dataspace, H5P_DEFAULT, cparms, H5P_DEFAULT)) < 0) - goto error; + FAIL_STACK_ERROR; if ((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0) - goto error; + FAIL_STACK_ERROR; /* Write a single chunk to intialize the chunk storage */ HDmemset(direct_buf, 0, CHUNK_NX * CHUNK_NY * sizeof(int)); @@ -2014,7 +2020,7 @@ test_read_unallocated_chunk(hid_t file) offset[1] = 0; if (H5Dwrite_chunk(dataset, dxpl, filter_mask, offset, chunk_nbytes, direct_buf) < 0) - goto error; + FAIL_STACK_ERROR; /* Attempt to read each chunk in the dataset. Chunks are not allocated, * therefore we expect the result of H5Dread_chunk to fail. Chunk idx starts @@ -2034,7 +2040,7 @@ test_read_unallocated_chunk(hid_t file) /* Check that the chunk read call does not succeed. */ if (status != -1) - goto error; + TEST_ERROR /* Query the size of the non-existant chunk */ direct_chunk_nbytes = ULONG_MAX; @@ -2046,18 +2052,23 @@ test_read_unallocated_chunk(hid_t file) /* Check that the chunk storage size call does not succeed. */ if (status != -1) - goto error; - if (direct_chunk_nbytes != 0) - goto error; + TEST_ERROR + if (direct_chunk_nbytes != ULONG_MAX) + TEST_ERROR } } /* Close/release resources. */ - H5Dclose(dataset); - H5Sclose(mem_space); - H5Sclose(dataspace); - H5Pclose(cparms); - H5Pclose(dxpl); + if (H5Dclose(dataset) < 0) + FAIL_STACK_ERROR; + if (H5Sclose(mem_space) < 0) + FAIL_STACK_ERROR; + if (H5Sclose(dataspace) < 0) + FAIL_STACK_ERROR; + if (H5Pclose(cparms) < 0) + FAIL_STACK_ERROR; + if (H5Pclose(dxpl) < 0) + FAIL_STACK_ERROR; PASSED(); return 0; @@ -2121,103 +2132,100 @@ test_single_chunk(unsigned config) TESTING("Single chunk I/O"); /* Initialize data */ - for (i = 0; i < DIM0; i++) { + for (i = 0; i < DIM0; i++) for (j = 0; j < DIM1; j++) wdata[i][j] = j / CHUNK0; - } /* Create a new file with the latest format */ if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) - goto error; + FAIL_STACK_ERROR; if (config & CONFIG_LATEST) if (H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) - goto error; + FAIL_STACK_ERROR; if ((fid = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) - goto error; + FAIL_STACK_ERROR; /* Create dataspace */ if ((sid = H5Screate_simple(2, dims, NULL)) < 0) - goto error; + FAIL_STACK_ERROR; /* Create the dataset creation property list and set the chunk size */ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) - goto error; + FAIL_STACK_ERROR; if (H5Pset_chunk(dcpl, 2, chunk) < 0) - goto error; + FAIL_STACK_ERROR; /* Create the dataset */ if ((did = H5Dcreate2(fid, DATASET, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) - goto error; + FAIL_STACK_ERROR; if (config & CONFIG_DIRECT_WRITE) { /* Write the data directly to the dataset */ if (H5Dwrite_chunk(did, H5P_DEFAULT, 0, offset, CHUNK0 * CHUNK1 * 4, (void *)wdata) < 0) - goto error; + FAIL_STACK_ERROR; } /* end if */ else /* Write the data to the dataset */ if (H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, (void *)wdata) < 0) - goto error; + FAIL_STACK_ERROR; /* * Close and release resources. */ if (H5Pclose(dcpl) < 0) - goto error; + FAIL_STACK_ERROR; if (config & CONFIG_REOPEN_DSET) if (H5Dclose(did) < 0) - goto error; + FAIL_STACK_ERROR; if (H5Sclose(sid) < 0) - goto error; + FAIL_STACK_ERROR; if (H5Pclose(fapl) < 0) - goto error; + FAIL_STACK_ERROR; if (config & CONFIG_REOPEN_FILE) if (H5Fclose(fid) < 0) - goto error; + FAIL_STACK_ERROR; /* Open the file and dataset with default properties */ if (config & CONFIG_REOPEN_FILE) if ((fid = H5Fopen(FILE, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) - goto error; + FAIL_STACK_ERROR; if (config & CONFIG_REOPEN_DSET) if ((did = H5Dopen2(fid, DATASET, H5P_DEFAULT)) < 0) - goto error; + FAIL_STACK_ERROR; /* Retrieve dataset creation property list */ if ((dcpl = H5Dget_create_plist(did)) < 0) - goto error; + FAIL_STACK_ERROR; if (config & CONFIG_DIRECT_READ) { /* Read the data directly */ if (H5Dread_chunk(did, H5P_DEFAULT, offset, &filters, rdata) < 0) - goto error; + FAIL_STACK_ERROR; /* Verify returned filter mask */ if (filters != 0) - goto error; + TEST_ERROR } /* end if */ else /* Read the data */ if (H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata) < 0) - goto error; + FAIL_STACK_ERROR; /* Verify that the data read was correct. */ - for (i = 0; i < DIM0; i++) { - for (j = 0; j < DIM1; j++) { + for (i = 0; i < DIM0; i++) + for (j = 0; j < DIM1; j++) if (rdata[i][j] != wdata[i][j]) - goto error; - } - } + TEST_ERROR /* * Close and release resources */ if (H5Pclose(dcpl) < 0) - goto error; + FAIL_STACK_ERROR; if (H5Dclose(did) < 0) - goto error; + FAIL_STACK_ERROR; if (H5Fclose(fid) < 0) - goto error; + FAIL_STACK_ERROR; PASSED(); return 0; diff --git a/test/dsets.c b/test/dsets.c index 96f8b81..3a17575 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -93,25 +93,29 @@ const char *FILENAME[] = {"dataset", /* 0 */ #define FILE_DEFLATE_NAME "deflate.h5" /* Dataset names for testing filters */ -#define DSET_DEFAULT_NAME "default" -#define DSET_CHUNKED_NAME "chunked" -#define DSET_COMPACT_NAME "compact" -#define DSET_SIMPLE_IO_NAME "simple_io" -#define DSET_USERBLOCK_IO_NAME "userblock_io" -#define DSET_COMPACT_IO_NAME "compact_io" -#define DSET_COMPACT_MAX_NAME "max_compact" -#define DSET_COMPACT_MAX2_NAME "max_compact_2" -#define DSET_CONV_BUF_NAME "conv_buf" -#define DSET_TCONV_NAME "tconv" -#define DSET_DEFLATE_NAME "deflate" -#define DSET_SHUFFLE_NAME "shuffle" -#define DSET_FLETCHER32_NAME "fletcher32" -#define DSET_FLETCHER32_NAME_2 "fletcher32_2" -#define DSET_FLETCHER32_NAME_3 "fletcher32_3" +#define DSET_DEFAULT_NAME "default" +#define DSET_CHUNKED_NAME "chunked" +#define DSET_COMPACT_NAME "compact" +#define DSET_SIMPLE_IO_NAME "simple_io" +#define DSET_USERBLOCK_IO_NAME "userblock_io" +#define DSET_COMPACT_IO_NAME "compact_io" +#define DSET_COMPACT_MAX_NAME "max_compact" +#define DSET_COMPACT_MAX2_NAME "max_compact_2" +#define DSET_CONV_BUF_NAME "conv_buf" +#define DSET_TCONV_NAME "tconv" +#ifdef H5_HAVE_FILTER_DEFLATE +#define DSET_DEFLATE_NAME "deflate" +#endif +#define DSET_SHUFFLE_NAME "shuffle" +#define DSET_FLETCHER32_NAME "fletcher32" +#define DSET_FLETCHER32_NAME_2 "fletcher32_2" +#define DSET_FLETCHER32_NAME_3 "fletcher32_3" +#ifdef H5_HAVE_FILTER_DEFLATE #define DSET_SHUF_DEF_FLET_NAME "shuffle+deflate+fletcher32" #define DSET_SHUF_DEF_FLET_NAME_2 "shuffle+deflate+fletcher32_2" -#define DSET_OPTIONAL_SCALAR "dataset_with_scalar_space" -#define DSET_OPTIONAL_VLEN "dataset_with_vlen_type" +#endif +#define DSET_OPTIONAL_SCALAR "dataset_with_scalar_space" +#define DSET_OPTIONAL_VLEN "dataset_with_vlen_type" #ifdef H5_HAVE_FILTER_SZIP #define DSET_SZIP_NAME "szip" #define DSET_SHUF_SZIP_FLET_NAME "shuffle+szip+fletcher32" @@ -1502,6 +1506,9 @@ test_conv_buffer(hid_t fid) return SUCCEED; error: + HDfree(cfrR); + HDfree(cf); + H5E_BEGIN_TRY { H5Pclose(xfer_list); @@ -7160,6 +7167,7 @@ error: H5E_END_TRY; return FAIL; #else + (void)file; /* Silence compiler */ SKIPPED(); return SUCCEED; #endif @@ -15407,6 +15415,7 @@ main(void) /* Tests version bounds using its own file */ nerrors += (test_versionbounds() < 0 ? 1 : 0); + /* Tests that use their own file */ nerrors += (test_object_header_minimization_dcpl() < 0 ? 1 : 0); /* Run misc tests */ diff --git a/test/dtypes.c b/test/dtypes.c index 52eb0ea..2a18302 100644 --- a/test/dtypes.c +++ b/test/dtypes.c @@ -783,9 +783,12 @@ test_compound_2(void) FAIL_STACK_ERROR /* Sizes should be the same, but be careful just in case */ - buf = (unsigned char *)HDmalloc(nelmts * MAX(sizeof(struct st), sizeof(struct dt))); - bkg = (unsigned char *)HDmalloc(nelmts * sizeof(struct dt)); - orig = (unsigned char *)HDmalloc(nelmts * sizeof(struct st)); + if (NULL == (buf = (unsigned char *)HDmalloc(nelmts * MAX(sizeof(struct st), sizeof(struct dt))))) + goto error; + if (NULL == (bkg = (unsigned char *)HDmalloc(nelmts * sizeof(struct dt)))) + goto error; + if (NULL == (orig = (unsigned char *)HDmalloc(nelmts * sizeof(struct st)))) + goto error; for (i = 0; i < (int)nelmts; i++) { s_ptr = ((struct st *)((void *)orig)) + i; s_ptr->a = i * 8 + 0; @@ -857,6 +860,10 @@ test_compound_2(void) return 0; error: + HDfree(buf); + HDfree(bkg); + HDfree(orig); + /* Restore the default error handler (set in h5_reset()) */ h5_restore_err(); @@ -903,9 +910,12 @@ test_compound_3(void) FAIL_STACK_ERROR /* Initialize */ - buf = (unsigned char *)HDmalloc(nelmts * MAX(sizeof(struct st), sizeof(struct dt))); - bkg = (unsigned char *)HDmalloc(nelmts * sizeof(struct dt)); - orig = (unsigned char *)HDmalloc(nelmts * sizeof(struct st)); + if (NULL == (buf = (unsigned char *)HDmalloc(nelmts * MAX(sizeof(struct st), sizeof(struct dt))))) + goto error; + if (NULL == (bkg = (unsigned char *)HDmalloc(nelmts * sizeof(struct dt)))) + goto error; + if (NULL == (orig = (unsigned char *)HDmalloc(nelmts * sizeof(struct st)))) + goto error; for (i = 0; i < (int)nelmts; i++) { s_ptr = ((struct st *)((void *)orig)) + i; s_ptr->a = i * 8 + 0; @@ -973,6 +983,10 @@ test_compound_3(void) return 0; error: + HDfree(buf); + HDfree(bkg); + HDfree(orig); + /* Restore the default error handler (set in h5_reset()) */ h5_restore_err(); @@ -1023,9 +1037,12 @@ test_compound_4(void) FAIL_STACK_ERROR /* Sizes should be the same, but be careful just in case */ - buf = (unsigned char *)HDmalloc(nelmts * MAX(sizeof(struct st), sizeof(struct dt))); - bkg = (unsigned char *)HDmalloc(nelmts * sizeof(struct dt)); - orig = (unsigned char *)HDmalloc(nelmts * sizeof(struct st)); + if (NULL == (buf = (unsigned char *)HDmalloc(nelmts * MAX(sizeof(struct st), sizeof(struct dt))))) + goto error; + if (NULL == (bkg = (unsigned char *)HDmalloc(nelmts * sizeof(struct dt)))) + goto error; + if (NULL == (orig = (unsigned char *)HDmalloc(nelmts * sizeof(struct st)))) + goto error; for (i = 0; i < (int)nelmts; i++) { s_ptr = ((struct st *)((void *)orig)) + i; s_ptr->a = i * 8 + 0; @@ -1096,6 +1113,10 @@ test_compound_4(void) return 0; error: + HDfree(buf); + HDfree(bkg); + HDfree(orig); + /* Restore the default error handler (set in h5_reset()) */ h5_restore_err(); @@ -1146,6 +1167,12 @@ test_compound_5(void) TESTING("optimized struct converter"); + if (!buf || !bkg) { + HDfree(buf); + HDfree(bkg); + return 1; + } + /* Build datatypes */ short_array = H5Tcreate(H5T_COMPOUND, 4 * sizeof(short)); array_dt = H5Tarray_create2(H5T_NATIVE_SHORT, 1, dims); @@ -1238,9 +1265,12 @@ test_compound_6(void) FAIL_STACK_ERROR /* Sizes should be the same, but be careful just in case */ - buf = (unsigned char *)HDmalloc(nelmts * MAX(sizeof(struct st), sizeof(struct dt))); - bkg = (unsigned char *)HDmalloc(nelmts * sizeof(struct dt)); - orig = (unsigned char *)HDmalloc(nelmts * sizeof(struct st)); + if (NULL == (buf = (unsigned char *)HDmalloc(nelmts * MAX(sizeof(struct st), sizeof(struct dt))))) + goto error; + if (NULL == (bkg = (unsigned char *)HDmalloc(nelmts * sizeof(struct dt)))) + goto error; + if (NULL == (orig = (unsigned char *)HDmalloc(nelmts * sizeof(struct st)))) + goto error; for (i = 0; i < (int)nelmts; i++) { s_ptr = ((struct st *)((void *)orig)) + i; s_ptr->b = (int16_t)((i * 8 + 1) & 0x7fff); @@ -2290,6 +2320,8 @@ test_compound_11(void) ((big_t *)buf)[u].i1 = (int)(u * 3); ((big_t *)buf)[u].i2 = (int)(u * 5); ((big_t *)buf)[u].s1 = (char *)HDmalloc((size_t)32); + if (!((big_t *)buf)[u].s1) + TEST_ERROR HDsprintf(((big_t *)buf)[u].s1, "%u", (unsigned)u); } /* end for */ diff --git a/test/earray.c b/test/earray.c index bf7dcf3..337e818 100644 --- a/test/earray.c +++ b/test/earray.c @@ -2087,7 +2087,7 @@ test_set_elmts(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t *tparam, h /* * Display testing message */ - TESTING("%s", test_str); + TESTING(test_str); /* Create file & retrieve pointer to internal file object */ if (create_file(H5F_ACC_TRUNC, fapl, &file, &f) < 0) @@ -2261,7 +2261,7 @@ test_skip_elmts(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t *tparam, /* * Display testing message */ - TESTING("%s", test_str); + TESTING(test_str); /* Create file & retrieve pointer to internal file object */ if (create_file(H5F_ACC_TRUNC, fapl, &file, &f) < 0) diff --git a/test/farray.c b/test/farray.c index bb5e3fc..950c7a7 100644 --- a/test/farray.c +++ b/test/farray.c @@ -1361,7 +1361,7 @@ test_set_elmts(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tparam, h /* * Display testing message */ - TESTING("%s", test_str); + TESTING(test_str); /* Create file & retrieve pointer to internal file object */ if (create_file(fapl, &file, &f) < 0) @@ -1516,7 +1516,7 @@ test_skip_elmts(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tparam, /* * Display testing message */ - TESTING("%s", test_str); + TESTING(test_str); /* Create file & retrieve pointer to internal file object */ if (create_file(fapl, &file, &f) < 0) diff --git a/test/file_image.c b/test/file_image.c index 4fb1ef3..0373468 100644 --- a/test/file_image.c +++ b/test/file_image.c @@ -102,8 +102,9 @@ test_properties(void) * property list functions. In the file driver tests further down, this will * not be the case. */ - size = (size_t)count * sizeof(char); - buffer = (char *)HDmalloc(size); + size = (size_t)count * sizeof(char); + if (NULL == (buffer = (char *)HDmalloc(size))) + TEST_ERROR for (i = 0; i < count - 1; i++) buffer[i] = (char)(65 + i); buffer[count - 1] = '\0'; @@ -338,8 +339,8 @@ test_callbacks(void) H5FD_file_image_callbacks_t callbacks; hid_t fapl_1; hid_t fapl_2; - udata_t * udata; - char * file_image; + udata_t * udata = NULL; + char * file_image = NULL; char * temp_file_image; int count = 10; int i; @@ -350,6 +351,7 @@ test_callbacks(void) /* Allocate and initialize udata */ udata = (udata_t *)HDmalloc(sizeof(udata_t)); + VERIFY(udata != NULL, "udata malloc failed"); reset_udata(udata); /* copy the address of the user data into read_callbacks */ @@ -358,6 +360,7 @@ test_callbacks(void) /* Allocate and initialize file image buffer */ size = (size_t)count * sizeof(char); file_image = (char *)HDmalloc(size); + VERIFY(file_image != NULL, "file_image malloc failed"); for (i = 0; i < count - 1; i++) file_image[i] = (char)(65 + i); file_image[count - 1] = '\0'; @@ -529,6 +532,9 @@ test_callbacks(void) return 0; error: + HDfree(file_image); + HDfree(udata); + return 1; } /* test_callbacks() */ @@ -735,7 +741,7 @@ test_get_file_image(const char *test_banner, const int file_name_num, hid_t fapl hid_t fcpl = -1; herr_t ret; - TESTING("%s", test_banner); + TESTING(test_banner); /* set flag if we are dealing with a family file */ driver = H5Pget_driver(fapl); diff --git a/test/h5test.c b/test/h5test.c index 8f74e45..9ec29ed 100644 --- a/test/h5test.c +++ b/test/h5test.c @@ -148,29 +148,6 @@ h5_errors(hid_t estack, void H5_ATTR_UNUSED *client_data) } /*------------------------------------------------------------------------- - * Function: h5_testing - * - * Purpose: Prints "Testing" + formatted options to stdout - * Used in the TESTING macro - * - * Return: void - *------------------------------------------------------------------------- - */ -void -h5_testing(const char *fmt, ...) -{ - va_list ap; - char buf[62 + 1]; /* room for 62-char field + NUL */ - - HDva_start(ap, fmt); - HDvsnprintf(buf, sizeof(buf), fmt, ap); - HDva_end(ap); - - HDprintf("Testing %s", buf); - HDfflush(stdout); -} - -/*------------------------------------------------------------------------- * Function: h5_clean_files * * Purpose: Cleanup temporary test files (always). @@ -1218,9 +1195,10 @@ h5_set_info_object(void) valp++; /* copy key/value pair into temporary buffer */ - len = strcspn(valp, ";"); - next = &valp[len]; - key_val = (char *)HDcalloc(1, len + 1); + len = HDstrcspn(valp, ";"); + next = &valp[len]; + if (NULL == (key_val = (char *)HDcalloc(1, len + 1))) + return -1; /* increment the next pointer past the terminating semicolon */ if (*next == ';') @@ -1616,6 +1594,9 @@ h5_make_local_copy(const char *origfilename, const char *local_copy_name) void * buf = NULL; /* Buffer for copying data */ const char *filename = H5_get_srcdir_filename(origfilename); /* Get the test file name to copy */ + if (!filename) + goto error; + /* Allocate copy buffer */ if (NULL == (buf = HDcalloc((size_t)1, (size_t)READ_BUF_SIZE))) goto error; diff --git a/test/h5test.h b/test/h5test.h index 3736537..2855fb5 100644 --- a/test/h5test.h +++ b/test/h5test.h @@ -100,7 +100,11 @@ H5TEST_DLLVAR MPI_Info h5_io_info_g; /* MPI INFO object for IO */ * spaces. If the h5_errors() is used for automatic error handling then * the H5_FAILED() macro is invoked automatically when an API function fails. */ -#define TESTING(...) h5_testing(__VA_ARGS__); +#define TESTING(WHAT) \ + { \ + HDprintf("Testing %-62s", WHAT); \ + HDfflush(stdout); \ + } #define TESTING_2(WHAT) \ { \ HDprintf(" Testing %-60s", WHAT); \ @@ -157,13 +161,6 @@ H5TEST_DLLVAR MPI_Info h5_io_info_g; /* MPI INFO object for IO */ HDputs(s); \ goto error; \ } -#define FAIL_PRINTF_ERROR(fmt, ...) \ - { \ - H5_FAILED(); \ - AT(); \ - HDprintf(fmt, __VA_ARGS__); \ - goto error; \ - } /* Number of seconds to wait before killing a test (requires alarm(2)) */ #define H5_ALARM_SEC 1200 /* default is 20 minutes */ @@ -235,7 +232,6 @@ extern "C" { #endif /* Generally useful testing routines */ -H5TEST_DLL void h5_testing(const char *, ...) H5_ATTR_FORMAT(printf, 1, 2); H5TEST_DLL void h5_clean_files(const char *base_name[], hid_t fapl); H5TEST_DLL int h5_cleanup(const char *base_name[], hid_t fapl); H5TEST_DLL char * h5_fixname(const char *base_name, hid_t fapl, char *fullname, size_t size); diff --git a/test/hyperslab.c b/test/hyperslab.c index 41528ad..1f57e3b 100644 --- a/test/hyperslab.c +++ b/test/hyperslab.c @@ -1014,7 +1014,8 @@ test_array_fill(size_t lo, size_t hi) size_t u, v, w; /* Local index variables */ char s[256]; - TESTING("array filling %4zu-%-4zu elements", lo, hi); + HDsprintf(s, "array filling %4lu-%-4lu elements", (unsigned long)lo, (unsigned long)hi); + TESTING(s); /* Initialize */ if (NULL == (dst = (int *)HDcalloc(sizeof(int), ARRAY_FILL_SIZE * hi))) @@ -1077,7 +1078,9 @@ test_array_offset_n_calc(size_t n, size_t x, size_t y, size_t z) hsize_t new_coords[ARRAY_OFFSET_NDIMS]; /* X, Y & X coordinates of offset */ char s[256]; - TESTING("array offset %4zux%4zux%4zu elements", z, y, x); + HDsprintf(s, "array offset %4lux%4lux%4lu elements", (unsigned long)z, (unsigned long)y, + (unsigned long)x); + TESTING(s); /* Initialize */ if (NULL == (a = (hsize_t *)HDmalloc(sizeof(hsize_t) * x * y * z))) diff --git a/test/istore.c b/test/istore.c index 192e184..c75b8bf 100644 --- a/test/istore.c +++ b/test/istore.c @@ -284,7 +284,8 @@ test_extend(hid_t f, const char *prefix, size_t nx, size_t ny, size_t nz) HDsprintf(dims, "%lux%lux%lu", (unsigned long)nx, (unsigned long)ny, (unsigned long)nz); } - TESTING("istore extend: %s", dims); + HDsprintf(s, "istore extend: %s", dims); + TESTING(s); buf = (uint8_t *)HDmalloc(nx * ny * nz); check = (uint8_t *)HDmalloc(nx * ny * nz); whole = (uint8_t *)HDcalloc((size_t)1, nx * ny * nz); @@ -499,7 +500,8 @@ test_sparse(hid_t f, const char *prefix, size_t nblocks, size_t nx, size_t ny, s HDsprintf(dims, "%lux%lux%lu", (unsigned long)nx, (unsigned long)ny, (unsigned long)nz); } - TESTING("istore sparse: %s", dims); + HDsprintf(s, "istore sparse: %s", dims); + TESTING(s); if (skip_test) { SKIPPED() return SUCCEED; diff --git a/test/links.c b/test/links.c index b2d0d9a..f022783 100644 --- a/test/links.c +++ b/test/links.c @@ -3507,6 +3507,7 @@ done: case H5I_ERROR_MSG: case H5I_ERROR_STACK: case H5I_SPACE_SEL_ITER: + case H5I_EVENTSET: case H5I_NTYPES: default: return FAIL; @@ -3597,6 +3598,7 @@ done: case H5I_ERROR_MSG: case H5I_ERROR_STACK: case H5I_SPACE_SEL_ITER: + case H5I_EVENTSET: case H5I_NTYPES: default: return FAIL; @@ -13785,6 +13787,7 @@ done: case H5I_ERROR_MSG: case H5I_ERROR_STACK: case H5I_SPACE_SEL_ITER: + case H5I_EVENTSET: case H5I_NTYPES: default: return FAIL; @@ -13876,6 +13879,7 @@ done: case H5I_ERROR_MSG: case H5I_ERROR_STACK: case H5I_SPACE_SEL_ITER: + case H5I_EVENTSET: case H5I_NTYPES: default: return FAIL; @@ -16683,7 +16687,7 @@ obj_exists(hid_t fapl, hbool_t new_format) FAIL_STACK_ERROR /* Hard links */ - /* Verify that H5Oexists_by_name() fails for non-existent link in root group */ + /* Verify that H5Oexists_by_name() returns false for non-existent link in root group */ H5E_BEGIN_TRY { status = H5Oexists_by_name(fid, "foo", H5P_DEFAULT); @@ -16702,7 +16706,7 @@ obj_exists(hid_t fapl, hbool_t new_format) if (TRUE != H5Oexists_by_name(fid, "group", H5P_DEFAULT)) TEST_ERROR - /* Verify that H5Oexists_by_name() fails for non-existent link in non-root group */ + /* Verify that H5Oexists_by_name() returns false for non-existent object in non-root group */ H5E_BEGIN_TRY { status = H5Oexists_by_name(fid, "group/foo", H5P_DEFAULT); diff --git a/test/objcopy.c b/test/objcopy.c index 43a5756..e01083d 100644 --- a/test/objcopy.c +++ b/test/objcopy.c @@ -4498,6 +4498,10 @@ test_copy_dataset_compressed(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid TESTING("H5Ocopy(): compressed dataset"); #ifndef H5_HAVE_FILTER_DEFLATE + (void)fcpl_src; + (void)fcpl_dst; + (void)src_fapl; + (void)dst_fapl; /* Silence compiler */ SKIPPED(); HDputs(" Deflation filter not available"); #else /* H5_HAVE_FILTER_DEFLATE */ @@ -4923,6 +4927,10 @@ test_copy_dataset_no_edge_filt(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, h } #ifndef H5_HAVE_FILTER_DEFLATE + (void)fcpl_src; + (void)fcpl_dst; + (void)src_fapl; + (void)dst_fapl; /* Silence compiler */ SKIPPED(); HDputs(" Deflation filter not available"); #else /* H5_HAVE_FILTER_DEFLATE */ @@ -7277,6 +7285,10 @@ test_copy_dataset_compressed_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, TESTING("H5Ocopy(): compressed dataset with VLEN datatype"); #ifndef H5_HAVE_FILTER_DEFLATE + (void)fcpl_src; + (void)fcpl_dst; + (void)src_fapl; + (void)dst_fapl; /* Silence compiler */ SKIPPED(); HDputs(" Deflation filter not available"); #else /* H5_HAVE_FILTER_DEFLATE */ diff --git a/test/page_buffer.c b/test/page_buffer.c index b04d1a2..61e9696 100644 --- a/test/page_buffer.c +++ b/test/page_buffer.c @@ -1167,8 +1167,10 @@ test_raw_data_handling(hid_t orig_fapl, const char *env_h5_drvr, bool vfd_swmr_m int * data = NULL; H5F_t * f = NULL; const uint32_t max_lag = 5; + char s[256]; - TESTING("%sRaw Data Handling", vfd_swmr_mode ? "VFD SWMR " : ""); + HDsprintf(s, "%sRaw Data Handling", vfd_swmr_mode ? "VFD SWMR " : ""); + TESTING(s); h5_fixname(namebase, orig_fapl, filename, sizeof(filename)); @@ -2909,8 +2911,10 @@ md_entry_splitting_smoke_check(hid_t orig_fapl, const char *env_h5_drvr, bool vf haddr_t p2_addr; H5F_t * f = NULL; const uint32_t max_lag = 5; + char s[256]; - TESTING("%sMetadata Entry Splitting Smoke Check", vfd_swmr_mode ? "VFD SWMR " : ""); + HDsprintf(s, "%sMetadata Entry Splitting Smoke Check", vfd_swmr_mode ? "VFD SWMR " : ""); + TESTING(s); h5_fixname(namebase, orig_fapl, filename, sizeof(filename)); @@ -3202,8 +3206,10 @@ md_entry_splitting_boundary_test(hid_t orig_fapl, const char *env_h5_drvr, bool haddr_t first_page_addr = HADDR_UNDEF; haddr_t start_addr = HADDR_UNDEF; size_t test_len; + char s[256]; - TESTING("%sMetadata Entry Splitting Boundary Test", vfd_swmr_mode ? "VFD SWMR " : ""); + HDsprintf(s, "%sMetadata Entry Splitting Boundary Test", vfd_swmr_mode ? "VFD SWMR " : ""); + TESTING(s); h5_fixname(namebase, orig_fapl, filename, sizeof(filename)); diff --git a/test/testfiles/err_compat_1 b/test/testfiles/err_compat_1 index e588a8b..e0c4654 100644 --- a/test/testfiles/err_compat_1 +++ b/test/testfiles/err_compat_1 @@ -1,5 +1,5 @@ -Testing error API H5Eset/get_auto -Testing error API based on data I/O +Testing error API H5Eset/get_auto +Testing error API based on data I/O All error API tests passed. This program tests the Error API compatible with HDF5 version (number). There are supposed to be some error messages ********* Print error stack in HDF5 default way ********* diff --git a/test/testfiles/links_env.out b/test/testfiles/links_env.out index b9a9893..3f10fc6 100644 --- a/test/testfiles/links_env.out +++ b/test/testfiles/links_env.out @@ -1,3 +1,3 @@ -Testing external links via environment variable PASSED -Testing external links via environment variable (w/new group format) PASSED +Testing external links via environment variable PASSED +Testing external links via environment variable (w/new group format) PASSED All external Link (HDF5_EXT_PREFIX) tests passed. diff --git a/test/tfile.c b/test/tfile.c index 19263e8..d85d188 100644 --- a/test/tfile.c +++ b/test/tfile.c @@ -1452,6 +1452,7 @@ test_obj_count_and_id(hid_t fid1, hid_t fid2, hid_t did, hid_t gid1, hid_t gid2, case H5I_ERROR_MSG: case H5I_ERROR_STACK: case H5I_SPACE_SEL_ITER: + case H5I_EVENTSET: case H5I_NTYPES: default: ERROR("H5Fget_obj_ids"); diff --git a/test/trefer_deprec.c b/test/trefer_deprec.c index 24371ef..755df68 100644 --- a/test/trefer_deprec.c +++ b/test/trefer_deprec.c @@ -87,8 +87,11 @@ test_reference_params(void) /* Allocate write & read buffers */ wbuf = (hobj_ref_t *)HDmalloc(MAX(sizeof(unsigned), sizeof(hobj_ref_t)) * SPACE1_DIM1); + CHECK_PTR(wbuf, "HDmalloc"); rbuf = (hobj_ref_t *)HDmalloc(MAX(sizeof(unsigned), sizeof(hobj_ref_t)) * SPACE1_DIM1); + CHECK_PTR(rbuf, "HDmalloc"); tbuf = (hobj_ref_t *)HDmalloc(MAX(sizeof(unsigned), sizeof(hobj_ref_t)) * SPACE1_DIM1); + CHECK_PTR(tbuf, "HDmalloc"); /* Create file */ fid1 = H5Fcreate(FILE1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); @@ -269,8 +272,11 @@ test_reference_obj(void) /* Allocate write & read buffers */ wbuf = (hobj_ref_t *)HDmalloc(MAX(sizeof(unsigned), sizeof(hobj_ref_t)) * SPACE1_DIM1); + CHECK_PTR(wbuf, "HDmalloc"); rbuf = (hobj_ref_t *)HDmalloc(MAX(sizeof(unsigned), sizeof(hobj_ref_t)) * SPACE1_DIM1); + CHECK_PTR(rbuf, "HDmalloc"); tbuf = (hobj_ref_t *)HDmalloc(MAX(sizeof(unsigned), sizeof(hobj_ref_t)) * SPACE1_DIM1); + CHECK_PTR(tbuf, "HDmalloc"); /* Create file */ fid1 = H5Fcreate(FILE1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); diff --git a/test/trefstr.c b/test/trefstr.c index a3f568a..d0575ab 100644 --- a/test/trefstr.c +++ b/test/trefstr.c @@ -186,7 +186,7 @@ test_refstr_cmp(void) H5RS_str_t *rs1; /* Ref-counted string created */ H5RS_str_t *rs2; /* Ref-counted string created */ int cmp; /* Comparison value */ - ssize_t len; /* Length of string */ + size_t len; /* Length of string */ herr_t ret; /* Generic return value */ /* Output message about test being performed */ diff --git a/test/unlink.c b/test/unlink.c index 73e3b25..94bd035 100644 --- a/test/unlink.c +++ b/test/unlink.c @@ -1493,7 +1493,7 @@ test_create_unlink(const char *msg, hid_t fapl) char groupname[1024]; char filename[1024]; - TESTING("%s", msg); + TESTING(msg); /* Create file */ h5_fixname(FILENAME[3], fapl, filename, sizeof filename); diff --git a/test/use_common.c b/test/use_common.c index 0ea2c83..8f78f3b 100644 --- a/test/use_common.c +++ b/test/use_common.c @@ -322,10 +322,12 @@ write_uc_file(hbool_t tosend, hid_t file_id, options_t *opts) rank = H5Sget_simple_extent_ndims(f_sid); if (rank != UC_RANK) { HDfprintf(stderr, "rank(%d) of dataset does not match\n", rank); + HDfree(buffer); return -1; } if (H5Sget_simple_extent_dims(f_sid, dims, NULL) < 0) { HDfprintf(stderr, "H5Sget_simple_extent_dims got error\n"); + HDfree(buffer); return -1; } HDprintf("dataset rank %d, dimensions %llu x %llu x %llu\n", rank, (unsigned long long)(dims[0]), @@ -334,12 +336,14 @@ write_uc_file(hbool_t tosend, hid_t file_id, options_t *opts) if (dims[0] != 0 || dims[1] != memdims[1] || dims[2] != memdims[2]) { HDfprintf(stderr, "dataset is not empty. Got dims=(%llu,%llu,%llu)\n", (unsigned long long)dims[0], (unsigned long long)dims[1], (unsigned long long)dims[2]); + HDfree(buffer); return -1; } /* setup mem-space for buffer */ if ((m_sid = H5Screate_simple(rank, memdims, NULL)) < 0) { HDfprintf(stderr, "H5Screate_simple for memory failed\n"); + HDfree(buffer); return -1; } @@ -360,6 +364,7 @@ write_uc_file(hbool_t tosend, hid_t file_id, options_t *opts) if (opts->use_swmr) { if (H5Odisable_mdc_flushes(dsid) < 0) { HDfprintf(stderr, "H5Odisable_mdc_flushes failed\n"); + HDfree(buffer); return -1; } } @@ -368,12 +373,14 @@ write_uc_file(hbool_t tosend, hid_t file_id, options_t *opts) dims[0] = i + 1; if (H5Dset_extent(dsid, dims) < 0) { HDfprintf(stderr, "H5Dset_extent failed\n"); + HDfree(buffer); return -1; } /* Get the dataset's dataspace */ if ((f_sid = H5Dget_space(dsid)) < 0) { HDfprintf(stderr, "H5Dset_extent failed\n"); + HDfree(buffer); return -1; } @@ -381,12 +388,14 @@ write_uc_file(hbool_t tosend, hid_t file_id, options_t *opts) /* Choose the next plane to write */ if (H5Sselect_hyperslab(f_sid, H5S_SELECT_SET, start, NULL, count, NULL) < 0) { HDfprintf(stderr, "Failed H5Sselect_hyperslab\n"); + HDfree(buffer); return -1; } /* Write plane to the dataset */ if (H5Dwrite(dsid, UC_DATATYPE, m_sid, f_sid, H5P_DEFAULT, buffer) < 0) { HDfprintf(stderr, "Failed H5Dwrite\n"); + HDfree(buffer); return -1; } @@ -394,6 +403,7 @@ write_uc_file(hbool_t tosend, hid_t file_id, options_t *opts) if (opts->use_swmr) { if (H5Oenable_mdc_flushes(dsid) < 0) { HDfprintf(stderr, "H5Oenable_mdc_flushes failed\n"); + HDfree(buffer); return -1; } } @@ -401,6 +411,7 @@ write_uc_file(hbool_t tosend, hid_t file_id, options_t *opts) /* flush file to make the just written plane available. */ if (H5Dflush(dsid) < 0) { HDfprintf(stderr, "Failed to H5Fflush file\n"); + HDfree(buffer); return -1; } } /* end for each plane to write */ @@ -488,10 +499,12 @@ read_uc_file(hbool_t towait, options_t *opts) rank = H5Sget_simple_extent_ndims(f_sid); if (rank != UC_RANK) { HDfprintf(stderr, "rank(%d) of dataset does not match\n", rank); + HDfree(buffer); return -1; } if (H5Sget_simple_extent_dims(f_sid, dims, NULL) < 0) { HDfprintf(stderr, "H5Sget_simple_extent_dims got error\n"); + HDfree(buffer); return -1; } HDprintf("dataset rank %d, dimensions %llu x %llu x %llu\n", rank, (unsigned long long)(dims[0]), @@ -502,12 +515,14 @@ read_uc_file(hbool_t towait, options_t *opts) (unsigned long long)dims[0], (unsigned long long)dims[1], (unsigned long long)dims[2]); HDfprintf(stderr, "But memdims=(%llu,%llu,%llu)\n", (unsigned long long)memdims[0], (unsigned long long)memdims[1], (unsigned long long)memdims[2]); + HDfree(buffer); return -1; } /* Setup mem-space for buffer */ if ((m_sid = H5Screate_simple(rank, memdims, NULL)) < 0) { HDfprintf(stderr, "H5Screate_simple for memory failed\n"); + HDfree(buffer); return -1; } @@ -533,6 +548,7 @@ read_uc_file(hbool_t towait, options_t *opts) HDprintf("."); if (loops_waiting_for_plane >= 30) { HDfprintf(stderr, "waited too long for new plane, quit.\n"); + HDfree(buffer); return -1; } } @@ -550,6 +566,7 @@ read_uc_file(hbool_t towait, options_t *opts) /* Get the dataset's dataspace */ if ((f_sid = H5Dget_space(dsid)) < 0) { HDfprintf(stderr, "H5Dget_space failed\n"); + HDfree(buffer); return -1; } @@ -557,12 +574,14 @@ read_uc_file(hbool_t towait, options_t *opts) /* Choose the next plane to read */ if (H5Sselect_hyperslab(f_sid, H5S_SELECT_SET, start, NULL, count, NULL) < 0) { HDfprintf(stderr, "H5Sselect_hyperslab failed\n"); + HDfree(buffer); return -1; } /* Read the plane from the dataset */ if (H5Dread(dsid, UC_DATATYPE, m_sid, f_sid, H5P_DEFAULT, buffer) < 0) { HDfprintf(stderr, "H5Dread failed\n"); + HDfree(buffer); return -1; } @@ -594,12 +613,14 @@ read_uc_file(hbool_t towait, options_t *opts) f_sid = H5Dget_space(dsid); /* Get filespace handle first. */ if (H5Sget_simple_extent_dims(f_sid, dims, NULL) < 0) { HDfprintf(stderr, "H5Sget_simple_extent_dims got error\n"); + HDfree(buffer); return -1; } } /* end while (expecting more planes to read) */ if (H5Fclose(fid) < 0) { HDfprintf(stderr, "H5Fclose failed\n"); + HDfree(buffer); return -1; } |