summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorjhendersonHDF <jhenderson@hdfgroup.org>2023-10-18 04:57:55 (GMT)
committerGitHub <noreply@github.com>2023-10-18 04:57:55 (GMT)
commit4a028905e48a40ac50442e1185e5ddff5a704ce3 (patch)
tree47b6058d3d2f8b811138af9250bf583cba70a42c /test
parentda9d4e78e17b7e2943c926fdd2d70031d264c8ee (diff)
downloadhdf5-4a028905e48a40ac50442e1185e5ddff5a704ce3.zip
hdf5-4a028905e48a40ac50442e1185e5ddff5a704ce3.tar.gz
hdf5-4a028905e48a40ac50442e1185e5ddff5a704ce3.tar.bz2
Sync 1.14 branch with develop (#3705)
* Address nagfor exceptions stoppage. (#3658) * added cmake ieee flag for nagfor * generalized determining the nag compiler * fixing some misc. NAG warnings * Simplify. (#3659) * Address @jhendersonHDF review * Add expedited testing support to t_filters_parallel (#3665) * Remove clang warnings (#3656) * Fixes test failure for gfortran -O2 and -O3, -fdefault-real-16 (#3662) * added cmake ieee flag for nagfor * fixes gfortran -O2 and -O3, -fdefault-real-16 * fixed sync * updated release notes * Fix link error on clang17/gfortran13/macOS-13 (#3666) (#3671) * Correct fortran CMake generator expressions (#3670) * Add AOCC GitHub Action (#3504) (#3657) * Fix uninitialized subfiling test variable (#3675) Picked up by gcc 10 on skybridge. Probably spurious, but no harm in initializing it to a "bad" value. * Add support for AOCC & Flang w/ the Autotools (#3674) * Adds a config/clang-fflags options file to support Flang * Corrects missing "-Wl," from linker options in the libtool wrappers when using Flang, the MPI Fortran compiler wrappers, and building the shared library. This would often result in unrecognized options like -soname. * Enable -nomp w/ Flang to avoid linking to the OpenMPI library. CMake can build the parallel, shared library w/ Fortran using AOCC and Flang, so no changes were needed for that build system. Fixes GitHub issues #3439, #1588, #366, #280 * Fix a strncpy call to use dest size not src (#3677) A strncpy call in a path construction call used the size of the src buffer instead of the dest buffer as the limit n. This was switched to use the dest size and properly terminate the string if truncation occurs. * Remove CANBE_UNUSED() from subfiling VFD (#3678) This macro was an attempt to quiet warnings about release mode unused variables that only appear in asserts. It resolves to a void cast, which doesn't quiet warnings when an assignment has already taken place. * Suppress MPI_Waitall warnings w/ MPICH (#3680) MPICH defines MPI_STATUSES_IGNORE (a pointer) to 1, which raises warnings w/ gcc. This is a known issue that the MPICH devs are not going to fix. See here: https://github.com/pmodels/mpich/issues/5687 This fix suppresses those issues w/ gcc * Fix a possible NULL pointer dereference in tests (#3676) The dtypes test could dereference a NULL pointer if a strdup call failed. * Fix printf warnings in t_mpi (#3679) * Fix printf warnings in t_mpi The type of MPI_Offset varies with implementation. In MPICH, it's long, which raises warnings when we attempt to use long long format specifiers. Casting to long long fixes the warnings. * Fix invalid memory access in S3 comms (#3681) In the ros3 VFD, passing an empty string parameter to an internal API call could result in accessing the -1th element of a string. This would cause failures on big-endian systems like s390x. This parameter is now checked before writing to the string. Fixes GitHub #1168 * Add Doxygen for H5Pset_fapl_sec2() (#3685) * * switch to using time function instead of date function (#3690) * Initialize API context MPI types to MPI_BYTE (#3688) * Add test info output to t_filters_parallel (#3696) * Suppress format string warnings in subfiling test (#3699) * Fix unused variable in tselect.c (#3701) * Fix unused variable warning in H5F_sfile_assert_num (#3700) * Restore floating-point suffixes in tests (#3698) A prior commit removed too many F suffixes. This restores the suffixes for float variables. * Sync with changes from develop --------- Co-authored-by: Scot Breitenfeld <brtnfld@hdfgroup.org> Co-authored-by: H. Joe Lee <hyoklee@hdfgroup.org> Co-authored-by: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Co-authored-by: Dana Robinson <43805+derobins@users.noreply.github.com>
Diffstat (limited to 'test')
-rw-r--r--test/dt_arith.c12
-rw-r--r--test/dtypes.c218
-rw-r--r--test/tselect.c8
3 files changed, 103 insertions, 135 deletions
diff --git a/test/dt_arith.c b/test/dt_arith.c
index ab89b68..d3147cb 100644
--- a/test/dt_arith.c
+++ b/test/dt_arith.c
@@ -696,7 +696,7 @@ test_particular_fp_integer(void)
/* Print errors */
if (dst_i != fill_value) {
- float x = 0.0;
+ float x = 0.0F;
int y;
if (0 == fails_this_test++)
@@ -2637,7 +2637,7 @@ my_isnan(dtype_t type, void *val)
char s[256];
if (FLT_FLOAT == type) {
- float x = 0.0;
+ float x = 0.0F;
memcpy(&x, val, sizeof(float));
retval = isnan(x);
}
@@ -2663,7 +2663,7 @@ my_isnan(dtype_t type, void *val)
*/
if (!retval) {
if (FLT_FLOAT == type) {
- float x = 0.0;
+ float x = 0.0F;
memcpy(&x, val, sizeof(float));
snprintf(s, sizeof(s), "%g", (double)x);
@@ -3115,7 +3115,7 @@ test_conv_flt_1(const char *name, int run_test, hid_t src, hid_t dst)
int check_expo[2];
if (FLT_FLOAT == dst_type) {
- float x = 0.0;
+ float x = 0.0F;
memcpy(&x, &buf[j * dst_size], sizeof(float));
if (underflow && fabsf(x) <= FLT_MIN && fabsf(hw_f) <= FLT_MIN)
continue; /* all underflowed, no error */
@@ -3185,7 +3185,7 @@ test_conv_flt_1(const char *name, int run_test, hid_t src, hid_t dst)
printf(" %02x", saved[j * src_size + ENDIAN(src_size, k, sendian)]);
printf("%*s", (int)(3 * MAX(0, (ssize_t)dst_size - (ssize_t)src_size)), "");
if (FLT_FLOAT == src_type) {
- float x = 0.0;
+ float x = 0.0F;
memcpy(&x, &saved[j * src_size], sizeof(float));
printf(" %29.20e\n", (double)x);
}
@@ -3207,7 +3207,7 @@ test_conv_flt_1(const char *name, int run_test, hid_t src, hid_t dst)
printf(" %02x", buf[j * dst_size + ENDIAN(dst_size, k, dendian)]);
printf("%*s", (int)(3 * MAX(0, (ssize_t)src_size - (ssize_t)dst_size)), "");
if (FLT_FLOAT == dst_type) {
- float x = 0.0;
+ float x = 0.0F;
memcpy(&x, &buf[j * dst_size], sizeof(float));
printf(" %29.20e\n", (double)x);
}
diff --git a/test/dtypes.c b/test/dtypes.c
index 74b6f61..a8def07 100644
--- a/test/dtypes.c
+++ b/test/dtypes.c
@@ -1983,26 +1983,36 @@ test_compound_10(void)
cmpd_struct wdata[ARRAY_DIM];
cmpd_struct rdata[ARRAY_DIM];
- hid_t file;
- hid_t arr_tid, cmpd_tid, cstr_id, vlstr_id;
- hid_t space_id;
- hid_t dset_id;
+ hid_t file = H5I_INVALID_HID;
+ hid_t arr_tid = H5I_INVALID_HID;
+ hid_t cmpd_tid = H5I_INVALID_HID;
+ hid_t cstr_id = H5I_INVALID_HID;
+ hid_t vlstr_id = H5I_INVALID_HID;
+ hid_t space_id = H5I_INVALID_HID;
+ hid_t dset_id = H5I_INVALID_HID;
hsize_t arr_dim[1] = {ARRAY_DIM}; /* Array dimensions */
hsize_t dim1[1];
- void *t1, *t2;
+ void *t1 = NULL;
+ void *t2 = NULL;
char filename[1024];
size_t len;
int i;
TESTING("array datatype of compound type with VL string");
+ memset(wdata, 0, sizeof(wdata));
+ memset(rdata, 0, sizeof(rdata));
+
+ /* Initialize */
for (i = 0; i < ARRAY_DIM; i++) {
- wdata[i].i1 = i * 10 + i;
- wdata[i].str = strdup("C string A");
+ wdata[i].i1 = i * 10 + i;
+ if (NULL == (wdata[i].str = strdup("C string A")))
+ FAIL_PUTS_ERROR("Unable to duplicate string");
wdata[i].str[9] = (char)(wdata[i].str[9] + i);
wdata[i].i2 = i * 1000 + i * 10;
- wdata[i].text.p = (void *)strdup("variable-length text A\0");
+ if (NULL == (wdata[i].text.p = (void *)strdup("variable-length text A\0")))
+ FAIL_PUTS_ERROR("Unable to duplicate string");
len = wdata[i].text.len = strlen((char *)wdata[i].text.p) + 1;
((char *)(wdata[i].text.p))[len - 2] = (char)(((char *)(wdata[i].text.p))[len - 2] + i);
((char *)(wdata[i].text.p))[len - 1] = '\0';
@@ -2010,160 +2020,116 @@ test_compound_10(void)
/* Create File */
h5_fixname(FILENAME[4], H5P_DEFAULT, filename, sizeof filename);
- if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) {
- H5_FAILED();
- AT();
- printf("Can't create file!\n");
- goto error;
- } /* end if */
+ if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
/* Create first compound datatype */
- if ((cmpd_tid = H5Tcreate(H5T_COMPOUND, sizeof(struct cmpd_struct))) < 0) {
- H5_FAILED();
- AT();
- printf("Can't create datatype!\n");
- goto error;
- } /* end if */
+ if ((cmpd_tid = H5Tcreate(H5T_COMPOUND, sizeof(struct cmpd_struct))) < 0)
+ TEST_ERROR;
- if (H5Tinsert(cmpd_tid, "i1", HOFFSET(struct cmpd_struct, i1), H5T_NATIVE_INT) < 0) {
- H5_FAILED();
- AT();
- printf("Can't insert field 'i1'\n");
- goto error;
- } /* end if */
+ if (H5Tinsert(cmpd_tid, "i1", HOFFSET(struct cmpd_struct, i1), H5T_NATIVE_INT) < 0)
+ TEST_ERROR;
- cstr_id = H5Tcopy(H5T_C_S1);
- if (H5Tset_size(cstr_id, H5T_VARIABLE) < 0) {
- H5_FAILED();
- AT();
- printf("Can't set size for C string\n");
- goto error;
- } /* end if */
+ if ((cstr_id = H5Tcopy(H5T_C_S1)) < 0)
+ TEST_ERROR;
+ if (H5Tset_size(cstr_id, H5T_VARIABLE) < 0)
+ TEST_ERROR;
- if (H5Tinsert(cmpd_tid, "c_string", HOFFSET(cmpd_struct, str), cstr_id) < 0) {
- H5_FAILED();
- AT();
- printf("Can't insert field 'str'\n");
- goto error;
- } /* end if */
+ if (H5Tinsert(cmpd_tid, "c_string", HOFFSET(cmpd_struct, str), cstr_id) < 0)
+ TEST_ERROR;
/* Create vl-string datatype */
- if ((vlstr_id = H5Tvlen_create(H5T_NATIVE_CHAR)) < 0) {
- H5_FAILED();
- AT();
- printf("Can't create VL string\n");
- goto error;
- } /* end if */
+ if ((vlstr_id = H5Tvlen_create(H5T_NATIVE_CHAR)) < 0)
+ TEST_ERROR;
- if (H5Tinsert(cmpd_tid, "vl_string", HOFFSET(cmpd_struct, text), vlstr_id) < 0) {
- H5_FAILED();
- AT();
- printf("Can't insert field 'text'\n");
- goto error;
- } /* end if */
+ if (H5Tinsert(cmpd_tid, "vl_string", HOFFSET(cmpd_struct, text), vlstr_id) < 0)
+ TEST_ERROR;
- if (H5Tinsert(cmpd_tid, "i2", HOFFSET(struct cmpd_struct, i2), H5T_NATIVE_INT) < 0) {
- H5_FAILED();
- AT();
- printf("Can't insert field 'i2'\n");
- goto error;
- } /* end if */
+ if (H5Tinsert(cmpd_tid, "i2", HOFFSET(struct cmpd_struct, i2), H5T_NATIVE_INT) < 0)
+ TEST_ERROR;
/* Create the array datatype for c_string data */
- if ((arr_tid = H5Tarray_create2(cmpd_tid, 1, arr_dim)) < 0) {
- H5_FAILED();
- AT();
- printf("Can't create array type\n");
- goto error;
- } /* end if */
+ if ((arr_tid = H5Tarray_create2(cmpd_tid, 1, arr_dim)) < 0)
+ TEST_ERROR;
dim1[0] = 1;
- if ((space_id = H5Screate_simple(1, dim1, NULL)) < 0) {
- H5_FAILED();
- AT();
- printf("Can't create space\n");
- goto error;
- } /* end if */
+ if ((space_id = H5Screate_simple(1, dim1, NULL)) < 0)
+ TEST_ERROR;
- if ((dset_id = H5Dcreate2(file, "Dataset", arr_tid, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) <
- 0) {
- H5_FAILED();
- AT();
- printf("Can't create dataset\n");
- goto error;
- } /* end if */
+ if ((dset_id = H5Dcreate2(file, "Dataset", arr_tid, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
- if (H5Dwrite(dset_id, arr_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, &wdata) < 0) {
- H5_FAILED();
- AT();
- printf("Can't write data\n");
- goto error;
- } /* end if */
+ if (H5Dwrite(dset_id, arr_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, &wdata) < 0)
+ TEST_ERROR;
- if (H5Dread(dset_id, arr_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata) < 0) {
- H5_FAILED();
- AT();
- printf("Can't read data\n");
- goto error;
- } /* end if */
+ if (H5Dread(dset_id, arr_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata) < 0)
+ TEST_ERROR;
for (i = 0; i < ARRAY_DIM; i++) {
if (rdata[i].i1 != wdata[i].i1 || rdata[i].i2 != wdata[i].i2 ||
- strcmp(rdata[i].str, wdata[i].str) != 0) {
- H5_FAILED();
- AT();
- printf("incorrect read data\n");
- goto error;
- } /* end if */
+ strcmp(rdata[i].str, wdata[i].str) != 0)
+ FAIL_PUTS_ERROR("incorrect read data\n");
- if (rdata[i].text.len != wdata[i].text.len) {
- H5_FAILED();
- AT();
- printf("incorrect VL length\n");
- goto error;
- } /* end if */
+ if (rdata[i].text.len != wdata[i].text.len)
+ FAIL_PUTS_ERROR("incorrect VL length\n");
t1 = rdata[i].text.p;
t2 = wdata[i].text.p;
- if (strcmp((char *)t1, (char *)t2) != 0) {
- H5_FAILED();
- AT();
- printf("incorrect VL read data\n");
- goto error;
- }
- } /* end for */
- if (H5Treclaim(arr_tid, space_id, H5P_DEFAULT, &rdata) < 0) {
- H5_FAILED();
- AT();
- printf("Can't reclaim read data\n");
- goto error;
- } /* end if */
- if (H5Treclaim(arr_tid, space_id, H5P_DEFAULT, &wdata) < 0) {
- H5_FAILED();
- AT();
- printf("Can't reclaim read data\n");
- goto error;
- } /* end if */
+ if (strcmp((char *)t1, (char *)t2) != 0)
+ FAIL_PUTS_ERROR("incorrect VL read data\n");
+ }
+
+ if (H5Treclaim(arr_tid, space_id, H5P_DEFAULT, &rdata) < 0)
+ TEST_ERROR;
+ if (H5Treclaim(arr_tid, space_id, H5P_DEFAULT, &wdata) < 0)
+ TEST_ERROR;
if (H5Dclose(dset_id) < 0)
- goto error;
+ TEST_ERROR;
if (H5Tclose(arr_tid) < 0)
- goto error;
+ TEST_ERROR;
+ arr_tid = H5I_INVALID_HID;
if (H5Tclose(cmpd_tid) < 0)
- goto error;
+ TEST_ERROR;
if (H5Tclose(cstr_id) < 0)
- goto error;
+ TEST_ERROR;
if (H5Tclose(vlstr_id) < 0)
- goto error;
+ TEST_ERROR;
if (H5Sclose(space_id) < 0)
- goto error;
+ TEST_ERROR;
+ space_id = H5I_INVALID_HID;
if (H5Fclose(file) < 0)
- goto error;
+ TEST_ERROR;
PASSED();
return 0;
error:
+
+ H5E_BEGIN_TRY
+ {
+ if (arr_tid != H5I_INVALID_HID && space_id != H5I_INVALID_HID) {
+ H5Treclaim(arr_tid, space_id, H5P_DEFAULT, &rdata);
+ H5Treclaim(arr_tid, space_id, H5P_DEFAULT, &wdata);
+ }
+ else {
+ /* Clean up memory if we failed out early */
+ for (i = 0; i < ARRAY_DIM; i++) {
+ free(wdata[i].str);
+ free(wdata[i].text.p);
+ }
+ }
+
+ H5Dclose(dset_id);
+ H5Tclose(arr_tid);
+ H5Tclose(cmpd_tid);
+ H5Tclose(cstr_id);
+ H5Tclose(vlstr_id);
+ H5Sclose(space_id);
+ H5Fclose(file);
+ }
+ H5E_END_TRY
+
return 1;
}
diff --git a/test/tselect.c b/test/tselect.c
index 55599b3..55430f2 100644
--- a/test/tselect.c
+++ b/test/tselect.c
@@ -1875,8 +1875,8 @@ test_select_hyper_contig3(hid_t dset_type, hid_t xfer_plist)
**
****************************************************************/
static void
-verify_select_hyper_contig_dr__run_test(const uint16_t *cube_buf, size_t H5_ATTR_NDEBUG_UNUSED cube_size,
- unsigned edge_size, unsigned cube_rank)
+verify_select_hyper_contig_dr__run_test(const uint16_t *cube_buf, size_t cube_size, unsigned edge_size,
+ unsigned cube_rank)
{
const uint16_t *cube_ptr; /* Pointer into the cube buffer */
uint16_t expected_value; /* Expected value in dataset */
@@ -1902,7 +1902,9 @@ verify_select_hyper_contig_dr__run_test(const uint16_t *cube_buf, size_t H5_ATTR
m = 0;
do {
/* Sanity check */
- assert(s < cube_size);
+ if (s >= cube_size)
+ TestErrPrintf("s should not be >= cube_size! s = %zu, cube_size = %zu\n", s,
+ cube_size);
/* Check for correct value */
if (*cube_ptr != expected_value)