summaryrefslogtreecommitdiffstats
path: root/testpar
diff options
context:
space:
mode:
authorjhendersonHDF <jhenderson@hdfgroup.org>2022-05-08 06:04:32 (GMT)
committerGitHub <noreply@github.com>2022-05-08 06:04:32 (GMT)
commitc0f314ad03f5ef0b4366ee625c83a7955a9ea87f (patch)
tree1aff05e5b992bc1f15b3a1a9b14c325c9ae64c98 /testpar
parent555e79d05f3fb778c9345b3abd4e55a1f177df90 (diff)
downloadhdf5-c0f314ad03f5ef0b4366ee625c83a7955a9ea87f.zip
hdf5-c0f314ad03f5ef0b4366ee625c83a7955a9ea87f.tar.gz
hdf5-c0f314ad03f5ef0b4366ee625c83a7955a9ea87f.tar.bz2
[1.10 Merge] Hdf5 1 10 warnings merge (#1754)
* Warnings fixes (#1680) * Clean stack size warnings in sio_engine (#1687) * Fixes stack size warnings in tcoords.c (#1688) * Address some warnings from casting away of const (#1684) * Fixes stack size warnings in dtransform (#1696) * Fixes stack size warnings in set_extent test (#1698) * Be a bit safer with signed arithmetic, thus quieting some signed-overflow warnings from GCC (#1706) * Avoid a signed overflow: check the range of `entry_ptr->age` before increasing it instead of increasing it and then checking the range. This quiets a GCC warning. * Avoid the potential for signed overflow by rewriting expressions `MAX(0, fwidth - n)` as `MAX(n, fwidth) - n` for various `n`. This change quiets some GCC warnings. * Change some local variables that cannot take sensible negative values from signed to unsigned. This quiets GCC warnings about potential signed overflow. * In a handful of instances, check the range of a signed integer before increasing/decreasing it, just in case the increase/decrease overflows. This quiets a handful of GCC signed-overflow warnings. * Committing clang-format changes Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> * Fix object size warnings in cache.c test (#1701) * Fix some const cast and stack/static object size warnings (#1700) * Fix various warnings * Move HDfree_const to H5private.h for wider use * Print output from all ranks in parallel tests on allocation failure * Move const pointer freeing macro to h5test.h for now * Fixes a bug where t_cache fails due to a string size being too small (#1720) * Fixes a bug where t_cache fails due to a string size being too small Recent warning reductions led to an incorrect string size being passed to h5_fileaccess, causing the test to silently fail. In addition to fixing the bug, the test will now fail noisily on setup failures. * Updates the t_cache test to fail noisily on setup errors * Fix a few Clang sanitizer warnings (#1727) * Stop lying about H5S_t const-ness (#1209) Hyperslabs can be reworked inside several H5S callbacks, making H5S_t non-const in some places where it is marked const. This change switches these incorrectly const H5S_t pointer parameters and variables to non-const where appropriate. * Fix a few warnings after recent H5S const-related changes (#1225) * Adjustments for HDF5 1.10 * Hdf5 1 12 Miscellaneous warnings fixes (#1718) * Fixes const issues in the version 2 B-trees (#1172) The operations that were changed are fundamentally not const since the shadow operation can modify the node structure when SWMR is in use. * Quiets const warning in H5RS code (#1181) * Avoid calling H5Ropen_object with a misaligned H5R_ref_t: copy the (#1171) * Avoid calling H5Ropen_object with a misaligned H5R_ref_t: copy the raw H5R_ref_t bytes to a heap buffer that's known to have the right alignment. * Committing clang-format changes * Use an automatic H5R_ref_t instead of malloc'ing one. Go ahead and initialize the H5R_ref_t to all-0s so that arbitrary stack content doesn't foul things up. Bail out with an error if `size` exceeds `sizeof(H5R_ref_t)`. * Committing clang-format changes Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> * Miscellaneous warnings fixes Co-authored-by: Dana Robinson <43805+derobins@users.noreply.github.com> Co-authored-by: David Young <dyoung@hdfgroup.org> Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> * Fix several warnings (#747) Co-authored-by: Dana Robinson <43805+derobins@users.noreply.github.com> Co-authored-by: David Young <dyoung@hdfgroup.org> Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Diffstat (limited to 'testpar')
-rw-r--r--testpar/t_cache.c45
-rw-r--r--testpar/t_filters_parallel.c6
-rw-r--r--testpar/t_mdset.c6
-rw-r--r--testpar/t_mpi.c34
-rw-r--r--testpar/t_pflush1.c16
-rw-r--r--testpar/t_pflush2.c18
-rw-r--r--testpar/t_shapesame.c17
-rw-r--r--testpar/t_span_tree.c5
-rw-r--r--testpar/testphdf5.c17
9 files changed, 128 insertions, 36 deletions
diff --git a/testpar/t_cache.c b/testpar/t_cache.c
index 71fbe1a..ca3d467 100644
--- a/testpar/t_cache.c
+++ b/testpar/t_cache.c
@@ -41,7 +41,7 @@ const char *FILENAME[NFILENAME] = {"CacheTestDummy", NULL};
#ifndef PATH_MAX
#define PATH_MAX 512
#endif /* !PATH_MAX */
-char filenames[NFILENAME][PATH_MAX];
+char * filenames[NFILENAME];
hid_t fapl; /* file access property list */
haddr_t max_addr = 0; /* used to store the end of
* the address space used by
@@ -192,7 +192,7 @@ struct datum {
#define NUM_DATA_ENTRIES 100000
-struct datum data[NUM_DATA_ENTRIES];
+struct datum *data = NULL;
/* Many tests use the size of data array as the size of test loops.
* On some machines, this results in unacceptably long test runs.
@@ -231,7 +231,7 @@ int virt_num_data_entries = NUM_DATA_ENTRIES;
*
*****************************************************************************/
-int data_index[NUM_DATA_ENTRIES];
+int *data_index = NULL;
/*****************************************************************************
* The following two #defines are used to control code that is in turn used
@@ -1116,6 +1116,8 @@ setup_derived_types(void)
MPI_Aint displs[9];
struct mssg_t sample; /* used to compute displacements */
+ HDmemset(&sample, 0, sizeof(struct mssg_t));
+
/* setup the displacements array */
if ((MPI_SUCCESS != MPI_Get_address(&sample.req, &displs[0])) ||
(MPI_SUCCESS != MPI_Get_address(&sample.src, &displs[1])) ||
@@ -2251,13 +2253,13 @@ datum_deserialize(const void *image_ptr, H5_ATTR_UNUSED size_t len, void *udata_
static herr_t
datum_image_len(const void *thing, size_t *image_len)
{
- int idx;
- struct datum *entry_ptr;
+ int idx;
+ const struct datum *entry_ptr;
HDassert(thing);
HDassert(image_len);
- entry_ptr = (struct datum *)thing;
+ entry_ptr = (const struct datum *)thing;
idx = addr_to_datum_index(entry_ptr->base_addr);
@@ -6932,6 +6934,23 @@ main(int argc, char **argv)
goto finish;
}
+ if (NULL == (data = HDmalloc(NUM_DATA_ENTRIES * sizeof(*data)))) {
+ HDprintf(" Couldn't allocate data array. Exiting.\n");
+ MPI_Abort(MPI_COMM_WORLD, -1);
+ }
+ if (NULL == (data_index = HDmalloc(NUM_DATA_ENTRIES * sizeof(*data_index)))) {
+ HDprintf(" Couldn't allocate data index array. Exiting.\n");
+ MPI_Abort(MPI_COMM_WORLD, -1);
+ }
+
+ HDmemset(filenames, 0, sizeof(filenames));
+ for (int i = 0; i < NFILENAME; i++) {
+ if (NULL == (filenames[i] = HDmalloc(PATH_MAX))) {
+ HDprintf("couldn't allocate filename array\n");
+ MPI_Abort(MPI_COMM_WORLD, -1);
+ }
+ }
+
set_up_file_communicator();
setup_derived_types();
@@ -6958,8 +6977,7 @@ main(int argc, char **argv)
/* fix the file names */
for (u = 0; u < sizeof(FILENAME) / sizeof(FILENAME[0]) - 1; ++u) {
- if (h5_fixname(FILENAME[u], fapl, filenames[u], sizeof(filenames[u])) == NULL) {
-
+ if (h5_fixname(FILENAME[u], fapl, filenames[u], PATH_MAX) == NULL) {
nerrors++;
if (verbose)
HDfprintf(stdout, "%d:%s: h5_fixname() failed.\n", world_mpi_rank, FUNC);
@@ -7047,14 +7065,19 @@ main(int argc, char **argv)
#endif
finish:
+ if (data_index)
+ HDfree(data_index);
+ if (data)
+ HDfree(data);
+
/* make sure all processes are finished before final report, cleanup
* and exit.
*/
MPI_Barrier(MPI_COMM_WORLD);
if (MAINPROCESS) { /* only process 0 reports */
HDprintf("===================================\n");
- if (failures) {
- HDprintf("***metadata cache tests detected %d failures***\n", failures);
+ if (nerrors || failures) {
+ HDprintf("***metadata cache tests detected %d failures***\n", nerrors + failures);
}
else {
HDprintf("metadata cache tests finished with no failures\n");
@@ -7071,5 +7094,5 @@ finish:
MPI_Finalize();
/* cannot just return (failures) because exit code is limited to 1byte */
- return (failures != 0);
+ return (nerrors != 0 || failures != 0);
}
diff --git a/testpar/t_filters_parallel.c b/testpar/t_filters_parallel.c
index bfb5897..409c4ed 100644
--- a/testpar/t_filters_parallel.c
+++ b/testpar/t_filters_parallel.c
@@ -7857,8 +7857,10 @@ test_edge_chunks_overlap(const char *parent_group, H5Z_filter_t filter_id, hid_t
* edge chunk and writes to just a portion of the edge chunk.
*/
static void
-test_edge_chunks_partial_write(const char *parent_group, H5Z_filter_t filter_id, hid_t fapl_id, hid_t dcpl_id,
- hid_t dxpl_id)
+test_edge_chunks_partial_write(const char H5_ATTR_PARALLEL_UNUSED * parent_group,
+ H5Z_filter_t H5_ATTR_PARALLEL_UNUSED filter_id,
+ hid_t H5_ATTR_PARALLEL_UNUSED fapl_id, hid_t H5_ATTR_PARALLEL_UNUSED dcpl_id,
+ hid_t H5_ATTR_PARALLEL_UNUSED dxpl_id)
{
/* TODO */
}
diff --git a/testpar/t_mdset.c b/testpar/t_mdset.c
index 6dfa6f8..aecd76b 100644
--- a/testpar/t_mdset.c
+++ b/testpar/t_mdset.c
@@ -1966,6 +1966,7 @@ rr_obj_hdr_flush_confusion_writer(MPI_Comm comm)
/* Tell the reader to check the file up to steps. */
steps++;
Reader_check(mrc, steps, steps_done);
+ VRFY((MPI_SUCCESS == mrc), "Reader_check failed");
/*
* Step 2: write attributes to each dataset
@@ -2020,6 +2021,7 @@ rr_obj_hdr_flush_confusion_writer(MPI_Comm comm)
/* Tell the reader to check the file up to steps. */
steps++;
Reader_check(mrc, steps, steps_done);
+ VRFY((MPI_SUCCESS == mrc), "Reader_check failed");
/*
* Step 3: write large attributes to each dataset
@@ -2067,6 +2069,7 @@ rr_obj_hdr_flush_confusion_writer(MPI_Comm comm)
/* Tell the reader to check the file up to steps. */
steps++;
Reader_check(mrc, steps, steps_done);
+ VRFY((MPI_SUCCESS == mrc), "Reader_check failed");
/*
* Step 4: write different large attributes to each dataset
@@ -2100,6 +2103,7 @@ rr_obj_hdr_flush_confusion_writer(MPI_Comm comm)
/* Tell the reader to check the file up to steps. */
steps++;
Reader_check(mrc, steps, steps_done);
+ VRFY((MPI_SUCCESS == mrc), "Reader_check failed");
/* Step 5: Close all objects and the file */
@@ -2154,10 +2158,12 @@ rr_obj_hdr_flush_confusion_writer(MPI_Comm comm)
/* Tell the reader to check the file up to steps. */
steps++;
Reader_check(mrc, steps, steps_done);
+ VRFY((MPI_SUCCESS == mrc), "Reader_check failed");
/* All done. Inform reader to end. */
steps = 0;
Reader_check(mrc, steps, steps_done);
+ VRFY((MPI_SUCCESS == mrc), "Reader_check failed");
if (verbose)
HDfprintf(stdout, "%0d:%s: Done.\n", mpi_rank, fcn_name);
diff --git a/testpar/t_mpi.c b/testpar/t_mpi.c
index a883f55..3fd83dc 100644
--- a/testpar/t_mpi.c
+++ b/testpar/t_mpi.c
@@ -41,18 +41,18 @@ static int errors_sum(int nerrs);
static int
test_mpio_overlap_writes(char *filename)
{
- int mpi_size, mpi_rank;
- MPI_Comm comm;
- MPI_Info info = MPI_INFO_NULL;
- int color, mrc;
- MPI_File fh;
- int i;
- int vrfyerrs, nerrs;
- unsigned char buf[4093]; /* use some prime number for size */
- int bufsize = sizeof(buf);
- MPI_Offset stride;
- MPI_Offset mpi_off;
- MPI_Status mpi_stat;
+ int mpi_size, mpi_rank;
+ MPI_Comm comm;
+ MPI_Info info = MPI_INFO_NULL;
+ int color, mrc;
+ MPI_File fh;
+ int i;
+ int vrfyerrs, nerrs;
+ unsigned char *buf = NULL;
+ int bufsize;
+ MPI_Offset stride;
+ MPI_Offset mpi_off;
+ MPI_Status mpi_stat;
if (VERBOSE_MED)
HDprintf("MPIO independent overlapping writes test on file %s\n", filename);
@@ -70,6 +70,13 @@ test_mpio_overlap_writes(char *filename)
return 0;
}
+ bufsize = 4093; /* use some prime number for size */
+ if (NULL == (buf = HDmalloc((size_t)bufsize))) {
+ if (MAINPROCESS)
+ HDprintf("couldn't allocate buffer\n");
+ return 1;
+ }
+
/* splits processes 0 to n-2 into one comm. and the last one into another */
color = ((mpi_rank < (mpi_size - 1)) ? 0 : 1);
mrc = MPI_Comm_split(MPI_COMM_WORLD, color, mpi_rank, &comm);
@@ -159,6 +166,9 @@ test_mpio_overlap_writes(char *filename)
*/
mrc = MPI_Barrier(MPI_COMM_WORLD);
VRFY((mrc == MPI_SUCCESS), "Sync before leaving test");
+
+ HDfree(buf);
+
return (nerrs);
}
diff --git a/testpar/t_pflush1.c b/testpar/t_pflush1.c
index 2a80f4a..c847895 100644
--- a/testpar/t_pflush1.c
+++ b/testpar/t_pflush1.c
@@ -25,7 +25,7 @@
const char *FILENAME[] = {"flush", "noflush", NULL};
-static int data_g[100][100];
+static int *data_g = NULL;
#define N_GROUPS 100
@@ -77,7 +77,7 @@ create_test_file(char *name, hid_t fapl_id)
/* Write some data */
for (i = 0; i < dims[0]; i++)
for (j = 0; j < dims[1]; j++)
- data_g[i][j] = (int)(i + (i * j) + j);
+ data_g[(i * 100) + j] = (int)(i + (i * j) + j);
if (H5Dwrite(did, H5T_NATIVE_INT, sid, sid, dxpl_id, data_g) < 0)
goto error;
@@ -146,6 +146,9 @@ main(int argc, char *argv[])
HDexit(EXIT_FAILURE);
}
+ if (NULL == (data_g = HDmalloc(100 * 100 * sizeof(*data_g))))
+ goto error;
+
if ((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0)
goto error;
if (H5Pset_fapl_mpio(fapl_id, comm, info) < 0)
@@ -192,6 +195,11 @@ main(int argc, char *argv[])
HDfflush(stdout);
HDfflush(stderr);
+ if (data_g) {
+ HDfree(data_g);
+ data_g = NULL;
+ }
+
/* Always exit with a failure code!
*
* In accordance with the standard, not having all processes
@@ -207,5 +215,9 @@ error:
HDfflush(stderr);
HDprintf("*** ERROR ***\n");
HDprintf("THERE WAS A REAL ERROR IN t_pflush1.\n");
+
+ if (data_g)
+ HDfree(data_g);
+
HD_exit(EXIT_FAILURE);
} /* end main() */
diff --git a/testpar/t_pflush2.c b/testpar/t_pflush2.c
index c96233a..a3df64c 100644
--- a/testpar/t_pflush2.c
+++ b/testpar/t_pflush2.c
@@ -26,7 +26,7 @@
const char *FILENAME[] = {"flush", "noflush", NULL};
-static int data_g[100][100];
+static int *data_g = NULL;
#define N_GROUPS 100
@@ -77,9 +77,10 @@ check_test_file(char *name, hid_t fapl_id)
for (i = 0; i < dims[0]; i++) {
for (j = 0; j < dims[1]; j++) {
val = (int)(i + (i * j) + j);
- if (data_g[i][j] != val) {
+ if (data_g[(i * 100) + j] != val) {
H5_FAILED();
- HDprintf(" data_g[%lu][%lu] = %d\n", (unsigned long)i, (unsigned long)j, data_g[i][j]);
+ HDprintf(" data_g[%lu][%lu] = %d\n", (unsigned long)i, (unsigned long)j,
+ data_g[(i * 100) + j]);
HDprintf(" should be %d\n", val);
}
}
@@ -170,6 +171,9 @@ main(int argc, char *argv[])
HDexit(EXIT_FAILURE);
}
+ if (NULL == (data_g = HDmalloc(100 * 100 * sizeof(*data_g))))
+ goto error;
+
if ((fapl_id1 = H5Pcreate(H5P_FILE_ACCESS)) < 0)
goto error;
if (H5Pset_fapl_mpio(fapl_id1, comm, info) < 0)
@@ -213,10 +217,18 @@ main(int argc, char *argv[])
h5_clean_files(&FILENAME[0], fapl_id1);
h5_clean_files(&FILENAME[1], fapl_id2);
+ if (data_g) {
+ HDfree(data_g);
+ data_g = NULL;
+ }
+
MPI_Finalize();
HDexit(EXIT_SUCCESS);
error:
+ if (data_g)
+ HDfree(data_g);
+
HDexit(EXIT_FAILURE);
} /* end main() */
diff --git a/testpar/t_shapesame.c b/testpar/t_shapesame.c
index ab9ce26..9d450f5 100644
--- a/testpar/t_shapesame.c
+++ b/testpar/t_shapesame.c
@@ -3975,7 +3975,7 @@ void * old_client_data; /* previous error handler arg.*/
#define NFILENAME 2
#define PARATESTFILE filenames[0]
const char *FILENAME[NFILENAME] = {"ShapeSameTest", NULL};
-char filenames[NFILENAME][PATH_MAX];
+char * filenames[NFILENAME];
hid_t fapl; /* file access property list */
#ifdef USE_PAUSE
@@ -4163,7 +4163,7 @@ parse_options(int argc, char **argv)
n = sizeof(FILENAME) / sizeof(FILENAME[0]) - 1; /* exclude the NULL */
for (i = 0; i < n; i++)
- if (h5_fixname(FILENAME[i], fapl, filenames[i], sizeof(filenames[i])) == NULL) {
+ if (h5_fixname(FILENAME[i], fapl, filenames[i], PATH_MAX) == NULL) {
HDprintf("h5_fixname failed\n");
nerrors++;
return (1);
@@ -4321,6 +4321,14 @@ main(int argc, char **argv)
H5open();
h5_show_hostname();
+ HDmemset(filenames, 0, sizeof(filenames));
+ for (int i = 0; i < NFILENAME; i++) {
+ if (NULL == (filenames[i] = HDmalloc(PATH_MAX))) {
+ HDprintf("couldn't allocate filename array\n");
+ MPI_Abort(MPI_COMM_WORLD, -1);
+ }
+ }
+
/* Initialize testing framework */
TestInit(argv[0], usage, parse_options);
@@ -4385,6 +4393,11 @@ main(int argc, char **argv)
HDprintf("===================================\n");
}
+ for (int i = 0; i < NFILENAME; i++) {
+ HDfree(filenames[i]);
+ filenames[i] = NULL;
+ }
+
/* close HDF5 library */
H5close();
diff --git a/testpar/t_span_tree.c b/testpar/t_span_tree.c
index 32d0265..e6fc9aa 100644
--- a/testpar/t_span_tree.c
+++ b/testpar/t_span_tree.c
@@ -42,6 +42,8 @@
#include "H5Spkg.h" /* Dataspaces */
#include "testphdf5.h"
+#define LOWER_DIM_SIZE_COMP_TEST__RUN_TEST__DEBUG 0
+
static void coll_write_test(int chunk_factor);
static void coll_read_test(int chunk_factor);
@@ -1430,8 +1432,7 @@ lower_dim_size_comp_test__verify_data(uint32_t *buf_ptr,
*-------------------------------------------------------------------------
*/
-#define LDSCT_DS_RANK 5
-#define LOWER_DIM_SIZE_COMP_TEST__RUN_TEST__DEBUG 0
+#define LDSCT_DS_RANK 5
static void
lower_dim_size_comp_test__run_test(const int chunk_edge_size, const hbool_t use_collective_io,
diff --git a/testpar/testphdf5.c b/testpar/testphdf5.c
index 7405554..ba763da 100644
--- a/testpar/testphdf5.c
+++ b/testpar/testphdf5.c
@@ -43,7 +43,7 @@ int dxfer_coll_type = DXFER_COLLECTIVE_IO;
#define NFILENAME 2
#define PARATESTFILE filenames[0]
const char *FILENAME[NFILENAME] = {"ParaTest", NULL};
-char filenames[NFILENAME][PATH_MAX];
+char * filenames[NFILENAME];
hid_t fapl; /* file access property list */
#ifdef USE_PAUSE
@@ -231,7 +231,7 @@ parse_options(int argc, char **argv)
n = sizeof(FILENAME) / sizeof(FILENAME[0]) - 1; /* exclude the NULL */
for (i = 0; i < n; i++)
- if (h5_fixname(FILENAME[i], fapl, filenames[i], sizeof(filenames[i])) == NULL) {
+ if (h5_fixname(FILENAME[i], fapl, filenames[i], PATH_MAX) == NULL) {
HDprintf("h5_fixname failed\n");
nerrors++;
return (1);
@@ -336,6 +336,14 @@ main(int argc, char **argv)
H5open();
h5_show_hostname();
+ HDmemset(filenames, 0, sizeof(filenames));
+ for (int i = 0; i < NFILENAME; i++) {
+ if (NULL == (filenames[i] = HDmalloc(PATH_MAX))) {
+ HDprintf("couldn't allocate filename array\n");
+ MPI_Abort(MPI_COMM_WORLD, -1);
+ }
+ }
+
/* Initialize testing framework */
TestInit(argv[0], usage, parse_options);
@@ -540,6 +548,11 @@ main(int argc, char **argv)
HDprintf("===================================\n");
}
+ for (int i = 0; i < NFILENAME; i++) {
+ HDfree(filenames[i]);
+ filenames[i] = NULL;
+ }
+
/* close HDF5 library */
H5close();