From e5e481b8ee1b318aed0d5e1462e47694e30d72a5 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Tue, 3 May 2022 22:59:55 -0700 Subject: [PATCH 1/2] 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. --- testpar/t_cache.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/testpar/t_cache.c b/testpar/t_cache.c index 5d1cfdc5f94..5d7cad1ee7a 100644 --- a/testpar/t_cache.c +++ b/testpar/t_cache.c @@ -1124,6 +1124,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])) || @@ -6981,7 +6983,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__); From e92818a1a5a195eeb70cd20cbce9c90b5ada9286 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Tue, 3 May 2022 23:15:53 -0700 Subject: [PATCH 2/2] Updates the t_cache test to fail noisily on setup errors --- testpar/t_cache.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/testpar/t_cache.c b/testpar/t_cache.c index 5d7cad1ee7a..87928924c05 100644 --- a/testpar/t_cache.c +++ b/testpar/t_cache.c @@ -7087,8 +7087,8 @@ main(int argc, char **argv) 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"); @@ -7105,5 +7105,5 @@ main(int argc, char **argv) MPI_Finalize(); /* cannot just return (failures) because exit code is limited to 1byte */ - return (failures != 0); + return (nerrors != 0 || failures != 0); }