summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAllen Byrne <50328838+byrnHDF@users.noreply.github.com>2021-08-25 20:11:06 (GMT)
committerGitHub <noreply@github.com>2021-08-25 20:11:06 (GMT)
commit6b1adb2ec97a529854613e091270f5b3cb37bc22 (patch)
tree2779f78bcfad97dcaeff4ef8560ee0c27ef850a1
parent9424fa2d5e9cab7e187f9e1efe0bc7ba50f691ca (diff)
downloadhdf5-6b1adb2ec97a529854613e091270f5b3cb37bc22.zip
hdf5-6b1adb2ec97a529854613e091270f5b3cb37bc22.tar.gz
hdf5-6b1adb2ec97a529854613e091270f5b3cb37bc22.tar.bz2
Merge test changes from develop (#959)
-rw-r--r--release_docs/RELEASE.txt2
-rw-r--r--test/big.c4
-rw-r--r--test/cmpd_dset.c8
-rw-r--r--test/cmpd_dtransform.c114
-rw-r--r--test/cross_read.c2
-rw-r--r--test/direct_chunk.c98
-rw-r--r--test/dsets.c53
-rw-r--r--test/dt_arith.c8
-rw-r--r--test/dtransform.c70
-rw-r--r--test/dtypes.c66
-rw-r--r--test/enc_dec_plist.c4
-rw-r--r--test/file_image.c14
-rw-r--r--test/fillval.c6
-rw-r--r--test/gheap.c2
-rw-r--r--test/hyperslab.c6
-rw-r--r--test/links.c17
-rw-r--r--test/objcopy.c12
-rw-r--r--test/pool.c2
-rw-r--r--test/set_extent.c6
-rw-r--r--test/tattr.c7
-rw-r--r--test/tconfig.c5
-rw-r--r--test/testhdf5.h2
-rw-r--r--test/tfile.c12
-rw-r--r--test/tid.c2
-rw-r--r--test/timer.c18
-rw-r--r--test/titerate.c5
-rw-r--r--test/tmeta.c4
-rw-r--r--test/tmisc.c2
-rw-r--r--test/trefer_deprec.c6
-rw-r--r--test/trefstr.c2
-rw-r--r--test/tsohm.c2
-rw-r--r--test/tunicode.c2
-rw-r--r--test/tvltypes.c8
-rw-r--r--test/use_common.c21
-rw-r--r--test/vds.c12
-rw-r--r--test/vfd.c2
-rw-r--r--test/vol.c4
-rw-r--r--testpar/t_filters_parallel.c8
-rw-r--r--testpar/t_shapesame.c22
39 files changed, 404 insertions, 236 deletions
diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt
index df429d7..e291edb 100644
--- a/release_docs/RELEASE.txt
+++ b/release_docs/RELEASE.txt
@@ -263,7 +263,7 @@ Bug Fixes since HDF5-1.12.1 release
Testing
-------
- -
+ -
Supported Platforms
diff --git a/test/big.c b/test/big.c
index 36fb27d..2bbae67 100644
--- a/test/big.c
+++ b/test/big.c
@@ -56,8 +56,8 @@
#define DNAME "big.data"
#define WRT_N 50
-#define WRT_SIZE 4 * 1024
-#define FAMILY_SIZE 1024 * 1024 * 1024
+#define WRT_SIZE (4 * 1024)
+#define FAMILY_SIZE (1024 * 1024 * 1024)
#define GB (HDoff_t)0x40000000L
diff --git a/test/cmpd_dset.c b/test/cmpd_dset.c
index e74b438..8777096 100644
--- a/test/cmpd_dset.c
+++ b/test/cmpd_dset.c
@@ -110,8 +110,8 @@ typedef struct {
long long r, s, t;
} stype4;
-#define NX 100u
-#define NY 2000u
+#define NX 100U
+#define NY 2000U
#define PACK_NMEMBS 100
/*-------------------------------------------------------------------------
@@ -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/cmpd_dtransform.c b/test/cmpd_dtransform.c
index ef5ad75..76ff287 100644
--- a/test/cmpd_dtransform.c
+++ b/test/cmpd_dtransform.c
@@ -31,59 +31,75 @@ typedef struct {
int
main(void)
{
- hsize_t dima[] = {1};
- hsize_t dims[] = {LENGTH};
- hid_t str_dtyp_id, att_dtyp_id, file_id, fspace_id, dset_id, att_dspc_id, att_attr_id, dxpl_id;
+ hsize_t dima[] = {1};
+ hsize_t dims[] = {LENGTH};
+ hid_t str_dtyp_id = H5I_INVALID_HID, att_dtyp_id = H5I_INVALID_HID;
+ hid_t file_id = H5I_INVALID_HID;
+ hid_t fspace_id = H5I_INVALID_HID;
+ hid_t dset_id = H5I_INVALID_HID;
+ hid_t att_dspc_id = H5I_INVALID_HID;
+ hid_t att_attr_id = H5I_INVALID_HID;
+ hid_t dxpl_id = H5I_INVALID_HID;
+ const char *expr = "2*x";
+ int * data = NULL;
+ int * data_res = NULL;
+ att_t * atts = NULL;
+ att_t * atts_res = NULL;
/* Compound datatype */
- att_t *atts = HDmalloc(sizeof(att_t));
+ if (NULL == (atts = HDmalloc(sizeof(att_t))))
+ TEST_ERROR;
HDstrcpy(atts[0].name, "Name");
HDstrcpy(atts[0].unit, "Unit");
/* String type */
if ((str_dtyp_id = H5Tcopy(H5T_C_S1)) < 0)
- TEST_ERROR;
- H5Tset_size(str_dtyp_id, 64);
+ FAIL_STACK_ERROR
+ if (H5Tset_size(str_dtyp_id, 64) < 0)
+ FAIL_STACK_ERROR
/* Attribute type */
if ((att_dtyp_id = H5Tcreate(H5T_COMPOUND, sizeof(att_t))) < 0)
- TEST_ERROR;
- H5Tinsert(att_dtyp_id, "NAME", HOFFSET(att_t, name), str_dtyp_id);
- H5Tinsert(att_dtyp_id, "UNIT", HOFFSET(att_t, unit), str_dtyp_id);
+ FAIL_STACK_ERROR
+ if (H5Tinsert(att_dtyp_id, "NAME", HOFFSET(att_t, name), str_dtyp_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Tinsert(att_dtyp_id, "UNIT", HOFFSET(att_t, unit), str_dtyp_id) < 0)
+ FAIL_STACK_ERROR
/* Create file. */
if ((file_id = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
- TEST_ERROR;
+ FAIL_STACK_ERROR
/* Create file dataspace. */
if ((fspace_id = H5Screate_simple(1, dims, NULL)) < 0)
- TEST_ERROR;
+ FAIL_STACK_ERROR
/* Create dataset. */
if ((dset_id = H5Dcreate2(file_id, "test_dset", H5T_NATIVE_INT, fspace_id, H5P_DEFAULT, H5P_DEFAULT,
H5P_DEFAULT)) < 0)
- TEST_ERROR;
+ FAIL_STACK_ERROR
/* Write the attribute (compound) to the dataset */
if ((att_dspc_id = H5Screate_simple(1, dima, NULL)) < 0)
- TEST_ERROR;
+ FAIL_STACK_ERROR
if ((att_attr_id =
H5Acreate2(dset_id, "ATTRIBUTES", att_dtyp_id, att_dspc_id, H5P_DEFAULT, H5P_DEFAULT)) < 0)
- TEST_ERROR;
+ FAIL_STACK_ERROR
if (H5Awrite(att_attr_id, att_dtyp_id, atts) < 0)
- TEST_ERROR;
+ FAIL_STACK_ERROR
/* Create dataset transfer property list */
- const char *expr = "2*x";
if ((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0)
- TEST_ERROR;
+ FAIL_STACK_ERROR
if (H5Pset_data_transform(dxpl_id, expr) < 0) {
HDprintf("**** ERROR: H5Pset_data_transform (expression: %s) ****\n", expr);
- TEST_ERROR;
+ FAIL_STACK_ERROR
}
- int *data = HDmalloc(LENGTH * sizeof(int));
- int *data_res = HDmalloc(LENGTH * sizeof(int));
+ if (NULL == (data = HDmalloc(LENGTH * sizeof(int))))
+ TEST_ERROR;
+ if (NULL == (data_res = HDmalloc(LENGTH * sizeof(int))))
+ TEST_ERROR;
for (unsigned i = 0; i < LENGTH; i++) {
data[i] = 10;
data_res[i] = 2 * data[i];
@@ -91,12 +107,13 @@ main(void)
/* Write the data */
if (H5Dwrite(dset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl_id, data) < 0)
- TEST_ERROR;
+ FAIL_STACK_ERROR
/* Read attribute */
- att_t *atts_res = HDmalloc(sizeof(att_t));
- if (H5Aread(att_attr_id, att_dtyp_id, atts_res) < 0)
+ if (NULL == (atts_res = HDmalloc(sizeof(att_t))))
TEST_ERROR;
+ if (H5Aread(att_attr_id, att_dtyp_id, atts_res) < 0)
+ FAIL_STACK_ERROR
/* Verify attribute */
if (HDstrcmp(atts_res[0].name, atts[0].name) != 0)
@@ -106,13 +123,12 @@ main(void)
/* Read the data */
if (H5Dread(dset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0)
- TEST_ERROR;
+ FAIL_STACK_ERROR
/* Verify data */
- for (unsigned idx = 0; idx < LENGTH; idx++) {
+ for (unsigned idx = 0; idx < LENGTH; idx++)
if (data[idx] != data_res[idx])
TEST_ERROR;
- }
HDfree(atts);
HDfree(atts_res);
@@ -120,17 +136,47 @@ main(void)
HDfree(data_res);
/* Close all identifiers. */
- H5Pclose(dxpl_id);
- H5Aclose(att_attr_id);
- H5Sclose(att_dspc_id);
- H5Dclose(dset_id);
- H5Sclose(fspace_id);
- H5Fclose(file_id);
- H5Tclose(att_dtyp_id);
- H5Tclose(str_dtyp_id);
+ if (H5Pclose(dxpl_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Aclose(att_attr_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Sclose(att_dspc_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Dclose(dset_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Sclose(fspace_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Fclose(file_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Tclose(att_dtyp_id) < 0)
+ FAIL_STACK_ERROR
+ if (H5Tclose(str_dtyp_id) < 0)
+ FAIL_STACK_ERROR
return 0;
error:
+ H5E_BEGIN_TRY
+ {
+ H5Pclose(dxpl_id);
+ H5Aclose(att_attr_id);
+ H5Sclose(att_dspc_id);
+ H5Dclose(dset_id);
+ H5Sclose(fspace_id);
+ H5Fclose(file_id);
+ H5Tclose(att_dtyp_id);
+ H5Tclose(str_dtyp_id);
+ }
+ H5E_END_TRY
+
+ if (atts)
+ HDfree(atts);
+ if (atts_res)
+ HDfree(atts_res);
+ if (data)
+ HDfree(data);
+ if (data_res)
+ HDfree(data_res);
+
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..b2b7cba 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;
+ TEST_ERROR
if (direct_chunk_nbytes != 0)
- goto error;
+ 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 3b38242..941dd11 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"
@@ -1390,10 +1394,10 @@ test_conv_buffer(hid_t fid)
cf->a[j][k][l] = 10 * (j + 1) + l + k;
for (j = 0; j < DIM2; j++)
- cf->b[j] = 100.0f * (float)(j + 1) + 0.01f * (float)j;
+ cf->b[j] = 100.0F * (float)(j + 1) + 0.01F * (float)j;
for (j = 0; j < DIM3; j++)
- cf->c[j] = 100.0f * (float)(j + 1) + 0.02f * (float)j;
+ cf->c[j] = 100.0F * (float)(j + 1) + 0.02F * (float)j;
/* Create data space */
if ((space = H5Screate(H5S_SCALAR)) < 0)
@@ -1502,6 +1506,9 @@ test_conv_buffer(hid_t fid)
return SUCCEED;
error:
+ HDfree(cfrR);
+ HDfree(cf);
+
H5E_BEGIN_TRY
{
H5Pclose(xfer_list);
@@ -3315,8 +3322,8 @@ test_nbit_float(hid_t file)
/* orig_data[] are initialized to be within the range that can be represented by
* dataset datatype (no precision loss during datatype conversion)
*/
- float orig_data[2][5] = {{188384.0f, 19.103516f, -1.0831790e9f, -84.242188f, 5.2045898f},
- {-49140.0f, 2350.25f, -3.2110596e-1f, 6.4998865e-5f, -0.0f}};
+ float orig_data[2][5] = {{188384.0F, 19.103516F, -1.0831790e9F, -84.242188F, 5.2045898F},
+ {-49140.0F, 2350.25F, -3.2110596e-1F, 6.4998865e-5F, -0.0F}};
float new_data[2][5];
size_t precision, offset;
size_t i, j;
@@ -7160,6 +7167,7 @@ error:
H5E_END_TRY;
return FAIL;
#else
+ (void)file; /* Silence compiler */
SKIPPED();
return SUCCEED;
#endif
@@ -11632,7 +11640,7 @@ test_unfiltered_edge_chunks(hid_t fapl)
TEST_ERROR
/* Add "count" filter */
- if (H5Pset_filter(dcpl, H5Z_FILTER_COUNT, 0u, (size_t)0, NULL) < 0)
+ if (H5Pset_filter(dcpl, H5Z_FILTER_COUNT, 0U, (size_t)0, NULL) < 0)
TEST_ERROR
/* Disable filters on partial chunks */
@@ -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/dt_arith.c b/test/dt_arith.c
index 7b79102..91e31d5 100644
--- a/test/dt_arith.c
+++ b/test/dt_arith.c
@@ -53,7 +53,7 @@ const char *FILENAME[] = {"dt_arith1", "dt_arith2", NULL};
* endian. If local variable `endian' is H5T_ORDER_BE then the result will
* be I, otherwise the result will be Z-(I+1).
*/
-#define ENDIAN(Z, I, E) (H5T_ORDER_BE == E ? (I) : (Z) - ((I) + 1))
+#define ENDIAN(Z, I, E) (H5T_ORDER_BE == (E) ? (I) : (Z) - ((I) + 1))
typedef enum dtype_t {
INT_SCHAR,
@@ -3058,10 +3058,10 @@ test_conv_flt_1(const char *name, int run_test, hid_t src, hid_t dst)
/* Check the software results against the hardware */
for (j = 0; j < nelmts; j++) {
underflow = 0;
- hw_f = 911.0f;
- hw_d = 911.0f;
+ hw_f = 911.0F;
+ hw_d = 911.0F;
#if H5_SIZEOF_LONG_DOUBLE != H5_SIZEOF_DOUBLE
- hw_ld = 911.0f;
+ hw_ld = 911.0L;
#endif
/* The hardware conversion */
diff --git a/test/dtransform.c b/test/dtransform.c
index 9445d83..8d3a8c0 100644
--- a/test/dtransform.c
+++ b/test/dtransform.c
@@ -32,30 +32,30 @@ hid_t dset_id_int_chunk = -1;
hid_t dset_id_float_chunk = -1;
const float windchillFfloat[ROWS][COLS] = {
- {36.0f, 31.0f, 25.0f, 19.0f, 13.0f, 7.0f, 1.0f, -5.0f, -11.0f, -16.0f, -22.0f, -28.0f, -34.0f, -40.0f,
- -46.0f, -52.0f, -57.0f, -63.0f},
- {34.0f, 27.0f, 21.0f, 15.0f, 9.0f, 3.0f, -4.0f, -10.0f, -16.0f, -22.0f, -28.0f, -35.0f, -41.0f, -47.0f,
- -53.0f, -59.0f, -66.0f, -72.0f},
- {32.0f, 25.0f, 19.0f, 13.0f, 6.0f, 0.0f, -7.0f, -13.0f, -19.0f, -26.0f, -32.0f, -39.0f, -45.0f, -51.0f,
- -58.0f, -64.0f, -71.0f, -77.0f},
- {30.0f, 24.0f, 17.0f, 11.0f, 4.0f, -2.0f, -9.0f, -15.0f, -22.0f, -29.0f, -35.0f, -42.0f, -48.0f, -55.0f,
- -61.0f, -68.0f, -74.0f, -81.0f},
- {29.0f, 23.0f, 16.0f, 9.0f, 3.0f, -4.0f, -11.0f, -17.0f, -24.0f, -31.0f, -37.0f, -44.0f, -51.0f, -58.0f,
- -64.0f, -71.0f, -78.0f, -84.0f},
- {28.0f, 22.0f, 15.0f, 8.0f, 1.0f, -5.0f, -12.0f, -19.0f, -26.0f, -33.0f, -39.0f, -46.0f, -53.0f, -60.0f,
- -67.0f, -73.0f, -80.0f, -87.0f},
- {28.0f, 21.0f, 14.0f, 7.0f, 0.0f, -7.0f, -14.0f, -21.0f, -27.0f, -34.0f, -41.0f, -48.0f, -55.0f, -62.0f,
- -69.0f, -76.0f, -82.0f, -89.0f},
- {27.0f, 20.0f, 13.0f, 6.0f, -1.0f, -8.0f, -15.0f, -22.0f, -29.0f, -36.0f, -43.0f, -50.0f, -57.0f, -64.0f,
- -71.0f, -78.0f, -84.0f, -91.0f},
- {26.0f, 19.0f, 12.0f, 5.0f, -2.0f, -9.0f, -16.0f, -23.0f, -30.0f, -37.0f, -44.0f, -51.0f, -58.0f, -65.0f,
- -72.0f, -79.0f, -86.0f, -93.0f},
- {26.0f, 19.0f, 12.0f, 4.0f, -3.0f, -10.0f, -17.0f, -24.0f, -31.0f, -38.0f, -45.0f, -52.0f, -60.0f, -67.0f,
- -74.0f, -81.0f, -88.0f, -95.0f},
- {25.0f, 18.0f, 11.0f, 4.0f, -3.0f, -11.0f, -18.0f, -25.0f, -32.0f, -39.0f, -46.0f, -54.0f, -61.0f, -68.0f,
- -75.0f, -82.0f, -89.0f, -97.0f},
- {25.0f, 17.0f, 10.0f, 3.0f, -4.0f, -11.0f, -19.0f, -26.0f, -33.0f, -40.0f, -48.0f, -55.0f, -62.0f, -69.0f,
- -76.0f, -84.0f, -91.0f, -98.0f}};
+ {36.0F, 31.0F, 25.0F, 19.0F, 13.0F, 7.0F, 1.0F, -5.0F, -11.0F, -16.0F, -22.0F, -28.0F, -34.0F, -40.0F,
+ -46.0F, -52.0F, -57.0F, -63.0F},
+ {34.0F, 27.0F, 21.0F, 15.0F, 9.0F, 3.0F, -4.0F, -10.0F, -16.0F, -22.0F, -28.0F, -35.0F, -41.0F, -47.0F,
+ -53.0F, -59.0F, -66.0F, -72.0F},
+ {32.0F, 25.0F, 19.0F, 13.0F, 6.0F, 0.0F, -7.0F, -13.0F, -19.0F, -26.0F, -32.0F, -39.0F, -45.0F, -51.0F,
+ -58.0F, -64.0F, -71.0F, -77.0F},
+ {30.0F, 24.0F, 17.0F, 11.0F, 4.0F, -2.0F, -9.0F, -15.0F, -22.0F, -29.0F, -35.0F, -42.0F, -48.0F, -55.0F,
+ -61.0F, -68.0F, -74.0F, -81.0F},
+ {29.0F, 23.0F, 16.0F, 9.0F, 3.0F, -4.0F, -11.0F, -17.0F, -24.0F, -31.0F, -37.0F, -44.0F, -51.0F, -58.0F,
+ -64.0F, -71.0F, -78.0F, -84.0F},
+ {28.0F, 22.0F, 15.0F, 8.0F, 1.0F, -5.0F, -12.0F, -19.0F, -26.0F, -33.0F, -39.0F, -46.0F, -53.0F, -60.0F,
+ -67.0F, -73.0F, -80.0F, -87.0F},
+ {28.0F, 21.0F, 14.0F, 7.0F, 0.0F, -7.0F, -14.0F, -21.0F, -27.0F, -34.0F, -41.0F, -48.0F, -55.0F, -62.0F,
+ -69.0F, -76.0F, -82.0F, -89.0F},
+ {27.0F, 20.0F, 13.0F, 6.0F, -1.0F, -8.0F, -15.0F, -22.0F, -29.0F, -36.0F, -43.0F, -50.0F, -57.0F, -64.0F,
+ -71.0F, -78.0F, -84.0F, -91.0F},
+ {26.0F, 19.0F, 12.0F, 5.0F, -2.0F, -9.0F, -16.0F, -23.0F, -30.0F, -37.0F, -44.0F, -51.0F, -58.0F, -65.0F,
+ -72.0F, -79.0F, -86.0F, -93.0F},
+ {26.0F, 19.0F, 12.0F, 4.0F, -3.0F, -10.0F, -17.0F, -24.0F, -31.0F, -38.0F, -45.0F, -52.0F, -60.0F, -67.0F,
+ -74.0F, -81.0F, -88.0F, -95.0F},
+ {25.0F, 18.0F, 11.0F, 4.0F, -3.0F, -11.0F, -18.0F, -25.0F, -32.0F, -39.0F, -46.0F, -54.0F, -61.0F, -68.0F,
+ -75.0F, -82.0F, -89.0F, -97.0F},
+ {25.0F, 17.0F, 10.0F, 3.0F, -4.0F, -11.0F, -19.0F, -26.0F, -33.0F, -40.0F, -48.0F, -55.0F, -62.0F, -69.0F,
+ -76.0F, -84.0F, -91.0F, -98.0F}};
const int transformData[ROWS][COLS] = {{36, 31, 25, 19, 13, 7, 1, 5, 11, 16, 22, 28, 34, 40, 46, 52, 57, 63},
{34, 27, 21, 15, 9, 3, 4, 10, 16, 22, 28, 35, 41, 47, 53, 59, 66, 1},
@@ -77,9 +77,9 @@ const int transformData[ROWS][COLS] = {{36, 31, 25, 19, 13, 7, 1, 5, 11, 16, 22,
for (i = 0; i < ROWS; i++) \
for (j = 0; j < COLS; j++) { \
if (!((((VAR1)[i][j] >= (TYPE)((VAR2)[i][j])) && \
- (((VAR1)[i][j] - TOL) < (TYPE)((VAR2)[i][j]))) || \
+ (((VAR1)[i][j] - (TOL)) < (TYPE)((VAR2)[i][j]))) || \
(((VAR1)[i][j] <= (TYPE)((VAR2)[i][j])) && \
- (((VAR1)[i][j] + TOL) > (TYPE)((VAR2)[i][j]))))) { \
+ (((VAR1)[i][j] + (TOL)) > (TYPE)((VAR2)[i][j]))))) { \
H5_FAILED(); \
HDfprintf(stderr, " ERROR: Conversion failed to match computed data\n"); \
goto error; \
@@ -94,8 +94,8 @@ const int transformData[ROWS][COLS] = {{36, 31, 25, 19, 13, 7, 1, 5, 11, 16, 22,
\
for (i = 0; i < ROWS; i++) \
for (j = 0; j < COLS; j++) { \
- if (!(((VAR1)[i][j] <= ((TYPE)(VAR2)[i][j] + TOL)) && \
- ((VAR1)[i][j] >= ((TYPE)(VAR2)[i][j] - TOL)))) { \
+ if (!(((VAR1)[i][j] <= ((TYPE)(VAR2)[i][j] + (TOL))) && \
+ ((VAR1)[i][j] >= ((TYPE)(VAR2)[i][j] - (TOL))))) { \
H5_FAILED(); \
HDfprintf(stderr, " ERROR: Conversion failed to match computed data\n"); \
goto error; \
@@ -540,19 +540,19 @@ test_poly(const hid_t dxpl_id_polynomial)
for (row = 0; row < ROWS; row++)
for (col = 0; col < COLS; col++) {
- windchillC = (int)((5.0f / 9.0f) * (windchillFfloat[row][col] - 32));
- polyflres[row][col] = ((2.0f + (float)windchillC) * (((float)windchillC - 8.0f) / 2.0f));
+ windchillC = (int)((5.0F / 9.0F) * (windchillFfloat[row][col] - 32));
+ polyflres[row][col] = ((2.0F + (float)windchillC) * (((float)windchillC - 8.0F) / 2.0F));
}
TESTING("data transform, polynomial transform (int->float)")
if (H5Dread(dset_id_int, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, dxpl_id_polynomial, polyflread) < 0)
TEST_ERROR
- COMPARE(float, polyflread, polyflres, 2.0f)
+ COMPARE(float, polyflread, polyflres, 2.0F)
for (row = 0; row < ROWS; row++)
for (col = 0; col < COLS; col++) {
- windchillC = (int)((5.0f / 9.0f) * (windchillFfloat[row][col] - 32));
+ windchillC = (int)((5.0F / 9.0F) * (windchillFfloat[row][col] - 32));
polyflres[row][col] = (float)((2 + windchillC) * ((windchillC - 8) / 2));
}
@@ -752,7 +752,7 @@ test_copy(const hid_t dxpl_id_c_to_f_copy, const hid_t dxpl_id_polynomial_copy)
for (row = 0; row < ROWS; row++)
for (col = 0; col < COLS; col++) {
- windchillC = (int)((5.0f / 9.0f) * (windchillFfloat[row][col] - 32));
+ windchillC = (int)((5.0F / 9.0F) * (windchillFfloat[row][col] - 32));
polyflres[row][col] = (float)((2 + windchillC) * ((windchillC - 8) / 2));
}
@@ -786,7 +786,7 @@ test_trivial(const hid_t dxpl_id_simple)
TEST_ERROR
for (row = 0; row < ROWS; row++)
for (col = 0; col < COLS; col++) {
- if ((windchillFfloatread[row][col] - 4.8f) > FLOAT_TOL)
+ if ((windchillFfloatread[row][col] - 4.8F) > FLOAT_TOL)
FAIL_PUTS_ERROR(" ERROR: Conversion failed to match computed data\n");
}
@@ -843,7 +843,7 @@ test_getset(const hid_t dxpl_id_c_to_f)
for (row = 0; row < ROWS; row++)
for (col = 0; col < COLS; col++) {
- if ((windchillFfloatread[row][col] - 4.8f) > FLOAT_TOL)
+ if ((windchillFfloatread[row][col] - 4.8F) > FLOAT_TOL)
FAIL_PUTS_ERROR(" ERROR: Conversion failed to match computed data\n")
}
diff --git a/test/dtypes.c b/test/dtypes.c
index 29bb38b..b9979f9 100644
--- a/test/dtypes.c
+++ b/test/dtypes.c
@@ -70,7 +70,7 @@
FAIL_STACK_ERROR \
if ((NMEMBS) != H5I_nmembers(H5I_DATATYPE)) { \
H5_FAILED(); \
- HDprintf(" #dtype ids expected: %lld; found: %lld\n", (long long)NMEMBS, \
+ HDprintf(" #dtype ids expected: %lld; found: %lld\n", (long long)(NMEMBS), \
(long long)H5I_nmembers(H5I_DATATYPE)); \
goto error; \
}
@@ -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 */
@@ -6651,13 +6683,13 @@ static int
test_int_float_except(void)
{
#if H5_SIZEOF_INT == 4 && H5_SIZEOF_FLOAT == 4
- float buf[CONVERT_SIZE] = {(float)INT_MIN - 172.0f, (float)INT_MAX - 32.0f, (float)INT_MAX - 68.0f,
- (float)4.5f};
+ float buf[CONVERT_SIZE] = {(float)INT_MIN - 172.0F, (float)INT_MAX - 32.0F, (float)INT_MAX - 68.0F,
+ (float)4.5F};
int buf_int[CONVERT_SIZE] = {INT_MIN, INT_MAX, INT_MAX - 127, 4};
- float buf_float[CONVERT_SIZE] = {(float)INT_MIN, (float)INT_MAX + 1.0f, (float)INT_MAX - 127.0f, 4};
+ float buf_float[CONVERT_SIZE] = {(float)INT_MIN, (float)INT_MAX + 1.0F, (float)INT_MAX - 127.0F, 4};
int * intp; /* Pointer to buffer, as integers */
int buf2[CONVERT_SIZE] = {INT_MIN, INT_MAX, INT_MAX - 72, 0};
- float buf2_float[CONVERT_SIZE] = {(float)INT_MIN, (float)INT_MAX, (float)INT_MAX - 127.0f, (float)0.0f};
+ float buf2_float[CONVERT_SIZE] = {(float)INT_MIN, (float)INT_MAX, (float)INT_MAX - 127.0F, (float)0.0F};
int buf2_int[CONVERT_SIZE] = {INT_MIN, INT_MAX, INT_MAX - 127, 0};
float *floatp; /* Pointer to buffer #2, as floats */
hid_t dxpl; /* Dataset transfer property list */
diff --git a/test/enc_dec_plist.c b/test/enc_dec_plist.c
index 9b4879e..60b229a 100644
--- a/test/enc_dec_plist.c
+++ b/test/enc_dec_plist.c
@@ -350,7 +350,7 @@ main(void)
TESTING("DXPL Encoding/Decoding");
- if ((H5Pset_btree_ratios(dxpl, 0.2f, 0.6f, 0.2f)) < 0)
+ if ((H5Pset_btree_ratios(dxpl, 0.2, 0.6, 0.2)) < 0)
FAIL_STACK_ERROR
if ((H5Pset_hyper_vector_size(dxpl, 5)) < 0)
FAIL_STACK_ERROR
@@ -544,7 +544,7 @@ main(void)
FAIL_STACK_ERROR
if ((H5Pset_alignment(fapl, 2, 1024)) < 0)
FAIL_STACK_ERROR
- if ((H5Pset_cache(fapl, 1024, 128, 10485760, 0.3f)) < 0)
+ if ((H5Pset_cache(fapl, 1024, 128, 10485760, 0.3)) < 0)
FAIL_STACK_ERROR
if ((H5Pset_elink_file_cache_size(fapl, 10485760)) < 0)
FAIL_STACK_ERROR
diff --git a/test/file_image.c b/test/file_image.c
index f6075d5..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() */
diff --git a/test/fillval.c b/test/fillval.c
index 4215c89..8de6ef1 100644
--- a/test/fillval.c
+++ b/test/fillval.c
@@ -1050,7 +1050,7 @@ test_rdwr_cases(hid_t file, hid_t dcpl, const char *dname, void *_fillval, H5D_f
for (u = 0; u < nelmts; u++) {
buf_c[u].a = 1111.11F;
buf_c[u].x = 2222;
- buf_c[u].y = 3333.3333F;
+ buf_c[u].y = 3333.3333;
buf_c[u].z = 'd';
}
if (H5Dwrite(dset2, ctype_id, mspace, fspace, H5P_DEFAULT, buf_c) < 0)
@@ -1304,7 +1304,7 @@ test_rdwr(hid_t fapl, const char *base_name, H5D_layout_t layout)
if (H5Pset_fill_time(dcpl, H5D_FILL_TIME_ALLOC) < 0)
goto error;
HDmemset(&fill_ctype, 0, sizeof(fill_ctype));
- fill_ctype.y = 4444.4444F;
+ fill_ctype.y = 4444.4444;
if (H5Pset_fill_value(dcpl, ctype_id, &fill_ctype) < 0)
goto error;
nerrors += test_rdwr_cases(file, dcpl, "dset11", &fill_ctype, H5D_FILL_TIME_ALLOC, layout,
@@ -1370,7 +1370,7 @@ test_rdwr(hid_t fapl, const char *base_name, H5D_layout_t layout)
if (H5Pset_fill_time(dcpl, H5D_FILL_TIME_ALLOC) < 0)
goto error;
HDmemset(&fill_ctype, 0, sizeof(fill_ctype));
- fill_ctype.y = 4444.4444F;
+ fill_ctype.y = 4444.4444;
if (H5Pset_fill_value(dcpl, ctype_id, &fill_ctype) < 0)
goto error;
nerrors += test_rdwr_cases(file, dcpl, "dset12", &fill_ctype, H5D_FILL_TIME_ALLOC, layout, H5T_COMPOUND,
diff --git a/test/gheap.c b/test/gheap.c
index 158c9da..fa761b4 100644
--- a/test/gheap.c
+++ b/test/gheap.c
@@ -503,7 +503,7 @@ test_ooo_indices(hid_t fapl)
GHEAP_REPEATED_ERR(" Unable to insert object into global heap")
/* Check that the index is as expected */
- if (obj[j].idx != ((1000 * i) + j - (1000 * ((~i & 1)))) % ((1u << 16) - 1) + 1)
+ if (obj[j].idx != ((1000 * i) + j - (1000 * ((~i & 1)))) % ((1U << 16) - 1) + 1)
GHEAP_REPEATED_ERR(" Unexpected global heap index");
}
diff --git a/test/hyperslab.c b/test/hyperslab.c
index 1f57e3b..1c55259 100644
--- a/test/hyperslab.c
+++ b/test/hyperslab.c
@@ -585,10 +585,10 @@ test_multifill(size_t nx)
for (i = 0; i < nx; i++) {
src[i].left = 1111111;
- src[i].mid = 12345.6789F;
+ src[i].mid = 12345.6789;
src[i].right = 2222222;
dst[i].left = 3333333;
- dst[i].mid = 98765.4321F;
+ dst[i].mid = 98765.4321;
dst[i].right = 4444444;
} /* end for */
@@ -597,7 +597,7 @@ test_multifill(size_t nx)
* over and over again.
*/
fill.left = 55555555;
- fill.mid = 3.1415927F;
+ fill.mid = 3.1415927;
fill.right = 66666666;
src_stride = 0;
diff --git a/test/links.c b/test/links.c
index 4600ebf..2de1fca 100644
--- a/test/links.c
+++ b/test/links.c
@@ -631,6 +631,8 @@ cklinks(hid_t fapl, hbool_t new_format)
if ((file = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
FAIL_STACK_ERROR
+ //! [H5Otoken_cmp_snip]
+
/* Hard link */
if (H5Oget_info_by_name3(file, "d1", &oinfo1, H5O_INFO_BASIC, H5P_DEFAULT) < 0)
FAIL_STACK_ERROR
@@ -641,6 +643,9 @@ cklinks(hid_t fapl, hbool_t new_format)
HDprintf(" %d: Unexpected object type should have been a dataset\n", __LINE__);
TEST_ERROR
} /* end if */
+
+ //! [H5Otoken_cmp_snip]
+
if (H5Otoken_cmp(file, &oinfo1.token, &oinfo2.token, &token_cmp) < 0)
FAIL_STACK_ERROR
if (token_cmp) {
@@ -15938,12 +15943,16 @@ obj_visit(hid_t fapl, hbool_t new_format)
if ((fid = build_visit_file(fapl)) < 0)
TEST_ERROR
+ //! [H5Ovisit3_snip]
+
/* Visit all the objects reachable from the root group (with file ID) */
udata.idx = 0;
udata.info = new_format ? ovisit0_new : ovisit0_old;
if (H5Ovisit3(fid, H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC) < 0)
FAIL_STACK_ERROR
+ //! [H5Ovisit3_snip]
+
/* Visit all the objects reachable from the root group (with group ID) */
if ((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
@@ -16015,6 +16024,8 @@ obj_visit_by_name(hid_t fapl, hbool_t new_format)
if ((fid = build_visit_file(fapl)) < 0)
TEST_ERROR
+ //! [H5Ovisit_by_name3_snip]
+
/* Visit all the objects reachable from the root group (with file ID) */
udata.idx = 0;
udata.info = new_format ? ovisit0_new : ovisit0_old;
@@ -16022,6 +16033,8 @@ obj_visit_by_name(hid_t fapl, hbool_t new_format)
H5P_DEFAULT) < 0)
FAIL_STACK_ERROR
+ //! [H5Ovisit_by_name3_snip]
+
/* Visit all the objects reachable from the root group (with group ID) */
if ((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
@@ -16670,7 +16683,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);
@@ -16689,7 +16702,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/pool.c b/test/pool.c
index 9ce1846..c508025 100644
--- a/test/pool.c
+++ b/test/pool.c
@@ -34,7 +34,7 @@
#define MPOOL_LARGE_BLOCK (MPOOL_PAGE_SIZE * 3)
#define MPOOL_NUM_SMALL_BLOCKS 64
#define MPOOL_SMALL_BLOCK 1
-#define MPOOL_NUM_RANDOM 10 * 1024
+#define MPOOL_NUM_RANDOM (10 * 1024)
#define MPOOL_RANDOM_MAX_SIZE (MPOOL_PAGE_SIZE * 2)
/*-------------------------------------------------------------------------
diff --git a/test/set_extent.c b/test/set_extent.c
index 5a07362..3078c2d 100644
--- a/test/set_extent.c
+++ b/test/set_extent.c
@@ -39,7 +39,7 @@ const char *FILENAME[] = {"set_extent1", "set_extent2", "set_extent3", "set_exte
#define CONFIG_EARLY_ALLOC 0x04u
#define CONFIG_UNFILT_EDGE 0x08u
#define CONFIG_ALL (CONFIG_COMPRESS + CONFIG_FILL + CONFIG_EARLY_ALLOC + CONFIG_UNFILT_EDGE)
-#define FILL_VALUE -1
+#define FILL_VALUE (-1)
#define DO_RANKS_PRINT_CONFIG(TEST) \
{ \
HDprintf(" Config:\n"); \
@@ -134,11 +134,11 @@ main(void)
TEST_ERROR
/* Set chunk cache so only part of the chunks can be cached on fapl */
- if (H5Pset_cache(fapl, 0, (size_t)8, 256 * sizeof(int), 0.75F) < 0)
+ if (H5Pset_cache(fapl, 0, (size_t)8, 256 * sizeof(int), 0.75) < 0)
TEST_ERROR
/* Disable chunk caching on fapl2 */
- if (H5Pset_cache(fapl2, 0, (size_t)0, (size_t)0, 0.0F) < 0)
+ if (H5Pset_cache(fapl2, 0, (size_t)0, (size_t)0, 0.0) < 0)
TEST_ERROR
/* Set the "use the latest version of the format" bounds for creating objects in the file */
diff --git a/test/tattr.c b/test/tattr.c
index b602222..756e139 100644
--- a/test/tattr.c
+++ b/test/tattr.c
@@ -95,8 +95,7 @@ int attr_data2[ATTR2_DIM1][ATTR2_DIM2] = {{7614, -416}, {197814, -3}}; /* Test d
#define ATTR3_DIM2 2
#define ATTR3_DIM3 2
double attr_data3[ATTR3_DIM1][ATTR3_DIM2][ATTR3_DIM3] = {
- {{2.3F, -26.1F}, {0.123F, -10.0F}},
- {{973.23F, -0.91827F}, {2.0F, 23.0F}}}; /* Test data for 3rd attribute */
+ {{2.3, -26.1}, {0.123, -10.0}}, {{973.23, -0.91827}, {2.0, 23.0}}}; /* Test data for 3rd attribute */
#define ATTR4_NAME "Attr4"
#define ATTR4_RANK 2
@@ -113,8 +112,8 @@ struct attr4_struct {
double d;
char c;
} attr_data4[ATTR4_DIM1][ATTR4_DIM2] = {
- {{3, -26.1F, 'd'}, {-100000, 0.123F, '3'}},
- {{-23, 981724.2F, 'Q'}, {0, 2.0F, '\n'}}}; /* Test data for 4th attribute */
+ {{3, -26.1, 'd'}, {-100000, 0.123, '3'}},
+ {{-23, 981724.2, 'Q'}, {0, 2.0, '\n'}}}; /* Test data for 4th attribute */
#define ATTR5_NAME "Attr5"
#define ATTR5_RANK 0
diff --git a/test/tconfig.c b/test/tconfig.c
index e3c6a2c..101de9a 100644
--- a/test/tconfig.c
+++ b/test/tconfig.c
@@ -37,8 +37,9 @@
/* verify if the sizeof(type) matches size defined in macro. */
/* Needs this extra step so that we can print the macro name. */
#define vrfy_macrosize(type, macro, macroname) \
- if (sizeof(type) != macro) \
- TestErrPrintf("Error: sizeof(%s) is %zu but %s is %d\n", #type, sizeof(type), macroname, (int)macro);
+ if (sizeof(type) != (macro)) \
+ TestErrPrintf("Error: sizeof(%s) is %zu but %s is %d\n", #type, sizeof(type), macroname, \
+ (int)(macro));
/* local routine prototypes */
void test_config_ctypes(void);
diff --git a/test/testhdf5.h b/test/testhdf5.h
index 5fb01a8..ba5fa71 100644
--- a/test/testhdf5.h
+++ b/test/testhdf5.h
@@ -136,7 +136,7 @@
"%s \n", \
(where), (int)__LINE__, __FILE__, x); \
} \
- if (HDstrcmp(x, val)) { \
+ if (HDstrcmp(x, val) != 0) { \
TestErrPrintf("*** UNEXPECTED VALUE from %s should be %s, but is %s at line %4d " \
"in %s\n", \
where, val, x, (int)__LINE__, __FILE__); \
diff --git a/test/tfile.c b/test/tfile.c
index 796a99b..8c3f9b0 100644
--- a/test/tfile.c
+++ b/test/tfile.c
@@ -125,7 +125,7 @@
#define TEST_THRESHOLD10 10 /* Free space section threshold */
#define FSP_SIZE_DEF 4096 /* File space page size default */
#define FSP_SIZE512 512 /* File space page size */
-#define FSP_SIZE1G 1024 * 1024 * 1024 /* File space page size */
+#define FSP_SIZE1G (1024 * 1024 * 1024) /* File space page size */
/* Declaration for test_libver_macros2() */
#define FILE6 "tfile6.h5" /* Test file */
@@ -5307,7 +5307,12 @@ test_libver_bounds_real(H5F_libver_t libver_create, unsigned oh_vers_create, H5F
group = H5Gcreate2(file, "/G1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(group, FAIL, "H5Gcreate");
+ //! [H5Oget_native_info_snip]
+
ret = H5Oget_native_info(group, &ninfo, H5O_NATIVE_INFO_HDR);
+
+ //! [H5Oget_native_info_snip]
+
CHECK(ret, FAIL, "H5Oget_native)info");
VERIFY(ninfo.hdr.version, oh_vers_mod, "H5Oget_native_info");
@@ -5328,10 +5333,15 @@ test_libver_bounds_real(H5F_libver_t libver_create, unsigned oh_vers_create, H5F
ret = H5Gclose(group);
CHECK(ret, FAIL, "H5Gclose");
+ //! [H5Oget_native_info_by_name_snip]
+
/*
* Make sure the root group still has the correct object header version
*/
ret = H5Oget_native_info_by_name(file, "/", &ninfo, H5O_NATIVE_INFO_HDR, H5P_DEFAULT);
+
+ //! [H5Oget_native_info_by_name_snip]
+
CHECK(ret, FAIL, "H5Oget_native_info_by_name");
VERIFY(ninfo.hdr.version, oh_vers_create, "H5Oget_native_info_by_name");
diff --git a/test/tid.c b/test/tid.c
index 2f5188e..c7e40a0 100644
--- a/test/tid.c
+++ b/test/tid.c
@@ -855,7 +855,7 @@ test_remove_clear_type(void)
return 0;
error:
- /* Cleanup. For simplicity, just destroy the types and ignore errors. */
+ /* Cleanup. For simplicity, just destroy the types and ignore errors. */
H5E_BEGIN_TRY
{
H5Idestroy_type(obj_type);
diff --git a/test/timer.c b/test/timer.c
index bb474ca..11b7427 100644
--- a/test/timer.c
+++ b/test/timer.c
@@ -43,55 +43,55 @@ test_time_formatting(void)
TESTING("Time string formats");
/* < 0, N/A */
- s = H5_timer_get_time_string(-1.0F);
+ s = H5_timer_get_time_string(-1.0);
if (NULL == s || HDstrcmp(s, "N/A") != 0)
TEST_ERROR;
HDfree(s);
/* 0 0 */
- s = H5_timer_get_time_string(0.0F);
+ s = H5_timer_get_time_string(0.0);
if (NULL == s || HDstrcmp(s, "0.0 s") != 0)
TEST_ERROR;
HDfree(s);
/* < 1 us nanoseconds */
- s = H5_timer_get_time_string(123.0E-9F);
+ s = H5_timer_get_time_string(123.0E-9);
if (NULL == s || HDstrcmp(s, "123 ns") != 0)
TEST_ERROR;
HDfree(s);
/* < 1 ms microseconds */
- s = H5_timer_get_time_string(23.456E-6F);
+ s = H5_timer_get_time_string(23.456E-6);
if (NULL == s || HDstrcmp(s, "23.5 us") != 0)
TEST_ERROR;
HDfree(s);
/* < 1 s milliseconds */
- s = H5_timer_get_time_string(4.56789E-3F);
+ s = H5_timer_get_time_string(4.56789E-3);
if (NULL == s || HDstrcmp(s, "4.6 ms") != 0)
TEST_ERROR;
HDfree(s);
/* < 1 min seconds */
- s = H5_timer_get_time_string(3.14F);
+ s = H5_timer_get_time_string(3.14);
if (NULL == s || HDstrcmp(s, "3.14 s") != 0)
TEST_ERROR;
HDfree(s);
/* < 1 hr mins, secs */
- s = H5_timer_get_time_string(2521.0F);
+ s = H5_timer_get_time_string(2521.0);
if (NULL == s || HDstrcmp(s, "42 m 1 s") != 0)
TEST_ERROR;
HDfree(s);
/* < 1 d hrs, mins, secs */
- s = H5_timer_get_time_string(9756.0F);
+ s = H5_timer_get_time_string(9756.0);
if (NULL == s || HDstrcmp(s, "2 h 42 m 36 s") != 0)
TEST_ERROR;
HDfree(s);
/* > 1 d days, hrs, mins, secs */
- s = H5_timer_get_time_string(280802.0F);
+ s = H5_timer_get_time_string(280802.0);
if (NULL == s || HDstrcmp(s, "3 d 6 h 0 m 2 s") != 0)
TEST_ERROR;
HDfree(s);
diff --git a/test/titerate.c b/test/titerate.c
index 3ec01ae..b6cdd9e3 100644
--- a/test/titerate.c
+++ b/test/titerate.c
@@ -218,9 +218,14 @@ test_iter_group(hid_t fapl, hbool_t new_format)
dataset_name, (size_t)NAMELEN, H5P_DEFAULT);
CHECK(ret, FAIL, "H5Lget_name_by_idx");
+ //! [H5Oget_info_by_idx3_snip]
+
ret = H5Oget_info_by_idx3(root_group, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i, &oinfo,
H5O_INFO_BASIC, H5P_DEFAULT);
CHECK(ret, FAIL, "H5Oget_info_by_idx");
+
+ //! [H5Oget_info_by_idx3_snip]
+
} /* end for */
H5E_BEGIN_TRY
diff --git a/test/tmeta.c b/test/tmeta.c
index 2609703..e70db16 100644
--- a/test/tmeta.c
+++ b/test/tmeta.c
@@ -22,9 +22,9 @@
#include "testhdf5.h"
#include "H5Fprivate.h"
-#define TEST_INT16_VALUE -7641
+#define TEST_INT16_VALUE (-7641)
#define TEST_UINT16_VALUE 45002
-#define TEST_INT32_VALUE -981236
+#define TEST_INT32_VALUE (-981236)
#define TEST_UINT32_VALUE 3476589
uint8_t compar_buffer[] = {
diff --git a/test/tmisc.c b/test/tmisc.c
index 8c7a6c5..3199ae1 100644
--- a/test/tmisc.c
+++ b/test/tmisc.c
@@ -5276,7 +5276,7 @@ test_misc28(void)
* bytes). */
fapl = H5Pcreate(H5P_FILE_ACCESS);
CHECK(fapl, FAIL, "H5Pcreate");
- ret = H5Pset_cache(fapl, MISC28_NSLOTS, MISC28_NSLOTS, MISC28_SIZE, 0.75F);
+ ret = H5Pset_cache(fapl, MISC28_NSLOTS, MISC28_NSLOTS, MISC28_SIZE, 0.75);
CHECK(ret, FAIL, "H5Pset_cache");
/* Create the dcpl and set the chunk size */
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 0dcf621..ea30f24 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/tsohm.c b/test/tsohm.c
index fcbb06a..b4ece0b 100644
--- a/test/tsohm.c
+++ b/test/tsohm.c
@@ -622,7 +622,7 @@ size1_helper(hid_t file, const char *filename, hid_t fapl_id, hbool_t test_file_
HDprintf("Can't read data\n"); \
goto error; \
} \
- if ((rdata.i1 != wdata.i1) || (rdata.i2 != wdata.i2) || HDstrcmp(rdata.str, wdata.str)) { \
+ if ((rdata.i1 != wdata.i1) || (rdata.i2 != wdata.i2) || HDstrcmp(rdata.str, wdata.str) != 0) { \
H5_FAILED(); \
AT(); \
HDprintf("incorrect read data\n"); \
diff --git a/test/tunicode.c b/test/tunicode.c
index 52341bb..1b696ac 100644
--- a/test/tunicode.c
+++ b/test/tunicode.c
@@ -33,7 +33,7 @@
#define RANK 1
#define COMP_INT_VAL 7
-#define COMP_FLOAT_VAL -42.0F
+#define COMP_FLOAT_VAL (-42.0F)
#define COMP_DOUBLE_VAL 42.0F
/* Test function prototypes */
diff --git a/test/tvltypes.c b/test/tvltypes.c
index 50b2d7a..03a8ad3 100644
--- a/test/tvltypes.c
+++ b/test/tvltypes.c
@@ -2526,10 +2526,10 @@ test_vltypes_fill_value(void)
hsize_t small_dims[] = {SPACE4_DIM_SMALL};
hsize_t large_dims[] = {SPACE4_DIM_LARGE};
size_t dset_elmts = 0; /* Number of elements in a particular dataset */
- const dtype1_struct fill1 = {1, 2, "foobar", "", NULL, "\0", "dead",
- 3, 4.0F, 100.0F, 1.0F, "liquid", "meter"};
- const dtype1_struct wdata = {3, 4, "", NULL, "\0", "foo", "two", 6, 8.0F, 200.0F, 2.0F, "solid", "yard"};
- dtype1_struct * rbuf = NULL; /* Buffer for reading data */
+ const dtype1_struct fill1 = {1, 2, "foobar", "", NULL, "\0", "dead",
+ 3, 4.0, 100.0, 1.0, "liquid", "meter"};
+ const dtype1_struct wdata = {3, 4, "", NULL, "\0", "foo", "two", 6, 8.0, 200.0, 2.0, "solid", "yard"};
+ dtype1_struct * rbuf = NULL; /* Buffer for reading data */
size_t mem_used = 0; /* Memory used during allocation */
H5D_layout_t layout; /* Dataset storage layout */
char dset_name1[64], dset_name2[64]; /* Dataset names */
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;
}
diff --git a/test/vds.c b/test/vds.c
index 88ac4eb..ac9bb5d 100644
--- a/test/vds.c
+++ b/test/vds.c
@@ -78,12 +78,12 @@ char vds_test_str_g[128] = "";
#endif /* VDS_TEST_VERBOSE */
/* I/O test config flags */
-#define TEST_IO_CLOSE_SRC 0x01u
-#define TEST_IO_DIFFERENT_FILE 0x02u
-#define TEST_IO_REOPEN_VIRT 0x04u
-#define TEST_IO_FCLOSE_SEMI 0x08u
-#define TEST_IO_FCLOSE_STRONG 0x10u
-#define TEST_IO_NTESTS 0x20u
+#define TEST_IO_CLOSE_SRC 0x01U
+#define TEST_IO_DIFFERENT_FILE 0x02U
+#define TEST_IO_REOPEN_VIRT 0x04U
+#define TEST_IO_FCLOSE_SEMI 0x08U
+#define TEST_IO_FCLOSE_STRONG 0x10U
+#define TEST_IO_NTESTS 0x20U
#define LIST_DOUBLE_SIZE (H5D_VIRTUAL_DEF_LIST_SIZE + 1)
diff --git a/test/vfd.c b/test/vfd.c
index 237086a..e90a589 100644
--- a/test/vfd.c
+++ b/test/vfd.c
@@ -340,7 +340,7 @@ test_core(void)
if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0)
TEST_ERROR;
- /* Retrieve the access property list... */
+ /* Retrieve the access property list */
if ((fapl_id_out = H5Fget_access_plist(fid)) < 0)
TEST_ERROR;
diff --git a/test/vol.c b/test/vol.c
index 6b17765..a2fcffb 100644
--- a/test/vol.c
+++ b/test/vol.c
@@ -958,10 +958,14 @@ test_basic_object_operation(void)
if (H5Oget_info3(fid, &object_info, H5O_INFO_ALL) < 0)
TEST_ERROR;
+ //! [H5Oget_info_by_name3_snip]
+
/* H5Oget_info_by_name */
if (H5Oget_info_by_name3(fid, NATIVE_VOL_TEST_GROUP_NAME, &object_info, H5O_INFO_ALL, H5P_DEFAULT) < 0)
TEST_ERROR;
+ //! [H5Oget_info_by_name3_snip]
+
/* H5Oexists_by_name */
if (H5Oexists_by_name(fid, NATIVE_VOL_TEST_GROUP_NAME, H5P_DEFAULT) != TRUE)
TEST_ERROR;
diff --git a/testpar/t_filters_parallel.c b/testpar/t_filters_parallel.c
index 5153bce..50cd306 100644
--- a/testpar/t_filters_parallel.c
+++ b/testpar/t_filters_parallel.c
@@ -1762,8 +1762,8 @@ test_write_3d_filtered_dataset_overlap(void)
WRITE_SHARED_FILTERED_CHUNKS_3D_NCOLS)) /
(hsize_t)(WRITE_SHARED_FILTERED_CHUNKS_3D_DEPTH * WRITE_SHARED_FILTERED_CHUNKS_3D_NCOLS))
- /* Add the amount that gets added when a rank moves down to its next section vertically in the
- dataset */
+ /* Add the amount that gets added when a rank moves down to its next
+ section vertically in the dataset */
+ ((hsize_t)(WRITE_SHARED_FILTERED_CHUNKS_3D_DEPTH * WRITE_SHARED_FILTERED_CHUNKS_3D_NCOLS) *
(i / (hsize_t)(mpi_size * WRITE_SHARED_FILTERED_CHUNKS_3D_DEPTH *
WRITE_SHARED_FILTERED_CHUNKS_3D_NCOLS))));
@@ -4497,8 +4497,8 @@ test_read_3d_filtered_dataset_overlap(void)
READ_SHARED_FILTERED_CHUNKS_3D_NCOLS)) /
(hsize_t)(READ_SHARED_FILTERED_CHUNKS_3D_DEPTH * READ_SHARED_FILTERED_CHUNKS_3D_NCOLS))
- /* Add the amount that gets added when a rank moves down to its next section vertically in the
- dataset */
+ /* Add the amount that gets added when a rank moves down to its next
+ section vertically in the dataset */
+ ((hsize_t)(READ_SHARED_FILTERED_CHUNKS_3D_DEPTH * READ_SHARED_FILTERED_CHUNKS_3D_NCOLS) *
(i / (hsize_t)(mpi_size * READ_SHARED_FILTERED_CHUNKS_3D_DEPTH *
READ_SHARED_FILTERED_CHUNKS_3D_NCOLS))));
diff --git a/testpar/t_shapesame.c b/testpar/t_shapesame.c
index 027c8c9..2dd867a 100644
--- a/testpar/t_shapesame.c
+++ b/testpar/t_shapesame.c
@@ -441,11 +441,8 @@ hs_dr_pio_test__setup(const int test_num, const int edge_size, const int checker
VRFY((ret >= 0), "H5Dwrite() small_dataset initial write succeeded");
/* sync with the other processes before checking data */
- if (!use_collective_io) {
-
- mrc = MPI_Barrier(MPI_COMM_WORLD);
- VRFY((mrc == MPI_SUCCESS), "Sync after small dataset writes");
- }
+ mrc = MPI_Barrier(MPI_COMM_WORLD);
+ VRFY((mrc == MPI_SUCCESS), "Sync after small dataset writes");
/* read the small data set back to verify that it contains the
* expected data. Note that each process reads in the entire
@@ -515,11 +512,8 @@ hs_dr_pio_test__setup(const int test_num, const int edge_size, const int checker
VRFY((ret >= 0), "H5Dwrite() large_dataset initial write succeeded");
/* sync with the other processes before checking data */
- if (!use_collective_io) {
-
- mrc = MPI_Barrier(MPI_COMM_WORLD);
- VRFY((mrc == MPI_SUCCESS), "Sync after large dataset writes");
- }
+ mrc = MPI_Barrier(MPI_COMM_WORLD);
+ VRFY((mrc == MPI_SUCCESS), "Sync after large dataset writes");
/* read the large data set back to verify that it contains the
* expected data. Note that each process reads in the entire
@@ -547,12 +541,8 @@ hs_dr_pio_test__setup(const int test_num, const int edge_size, const int checker
VRFY((mis_match == FALSE), "large ds init data good.");
/* sync with the other processes before changing data */
-
- if (!use_collective_io) {
-
- mrc = MPI_Barrier(MPI_COMM_WORLD);
- VRFY((mrc == MPI_SUCCESS), "Sync initial values check");
- }
+ mrc = MPI_Barrier(MPI_COMM_WORLD);
+ VRFY((mrc == MPI_SUCCESS), "Sync initial values check");
return;