Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

H5FDunregister plus tests #3014

Merged
merged 11 commits into from
Sep 5, 2024
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -953,6 +953,11 @@ if(NETCDF_ENABLE_PARALLEL4 AND NETCDF_ENABLE_HDF5)
file(COPY "${netCDF_BINARY_DIR}/tmp/run_par_test.sh"
DESTINATION ${netCDF_BINARY_DIR}/nc_test4
FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
configure_file("${netCDF_SOURCE_DIR}/nc_test4/run_par_warn_test.sh.in"
"${netCDF_BINARY_DIR}/tmp/run_par_warn_test.sh" @ONLY NEWLINE_STYLE LF)
file(COPY "${netCDF_BINARY_DIR}/tmp/run_par_warn_test.sh"
DESTINATION ${netCDF_BINARY_DIR}/nc_test4
FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
configure_file("${netCDF_SOURCE_DIR}/h5_test/run_par_tests.sh.in"
"${netCDF_BINARY_DIR}/tmp/run_par_tests.sh" @ONLY NEWLINE_STYLE LF)
file(COPY "${netCDF_BINARY_DIR}/tmp/run_par_tests.sh"
Expand Down
1 change: 1 addition & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -2246,6 +2246,7 @@ AC_CONFIG_FILES(dap4_test/findtestserver4.c:ncdap_test/findtestserver.c.in)
AC_CONFIG_FILES(dap4_test/pingurl4.c:ncdap_test/pingurl.c)
AC_CONFIG_FILES([h5_test/run_par_tests.sh], [chmod ugo+x h5_test/run_par_tests.sh])
AC_CONFIG_FILES([nc_test4/run_par_test.sh], [chmod ugo+x nc_test4/run_par_test.sh])
AC_CONFIG_FILES([nc_test4/run_par_warn_test.sh], [chmod ugo+x nc_test4/run_par_warn_test.sh])
AC_CONFIG_FILES([nc_perf/run_par_bm_test.sh], [chmod ugo+x nc_perf/run_par_bm_test.sh])
AC_CONFIG_FILES([nc_perf/run_gfs_test.sh], [chmod ugo+x nc_perf/run_gfs_test.sh])
AC_CONFIG_FILES(nczarr_test/timer_utils.h:unit_test/timer_utils.h)
Expand Down
2 changes: 1 addition & 1 deletion libhdf5/H5FDhttp.c
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ EXTERNL hid_t
H5FD_http_finalize(void)
{
/* Reset VFL ID */
if (H5FD_HTTP_g)
if (H5FD_HTTP_g && (H5Iis_valid(H5FD_HTTP_g) > 0))
H5FDunregister(H5FD_HTTP_g);
H5FD_HTTP_g = 0;

Expand Down
8 changes: 7 additions & 1 deletion libhdf5/hdf5internal.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,13 @@ extern int nc_log_level;
int nc4_hdf5_initialized = 0; /**< True if initialization has happened. */

/**
* @internal Provide a wrapper for H5Eset_auto
* @internal Provide a wrapper for H5Eset_auto.
*
* If preprocessor symbol DEBUGH5 is set (at the top of this file),
* then error messages will be pronted by the h5catch() function. If
* not, a NULL will be passed as the second argument to H5eset_auto2()
* and error messages will not be printed by HDF5.
*
* @param func Pointer to func.
* @param client_data Client data.
*
Expand Down
4 changes: 3 additions & 1 deletion nc_test4/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ IF(USE_HDF5 AND NETCDF_ENABLE_FILTER_TESTING)
ENDIF()

# Copy some test files from current source dir to out-of-tree build dir.
FILE(GLOB COPY_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.nc ${CMAKE_CURRENT_SOURCE_DIR}/ref_bzip2.c ${CMAKE_CURRENT_SOURCE_DIR}/*.sh ${CMAKE_CURRENT_SOURCE_DIR}/*.h5 ${CMAKE_CURRENT_SOURCE_DIR}/*.cdl)
FILE(GLOB COPY_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.nc ${CMAKE_CURRENT_SOURCE_DIR}/ref_bzip2.c ${CMAKE_CURRENT_SOURCE_DIR}/*.sh ${CMAKE_CURRENT_SOURCE_DIR}/*.h5 ${CMAKE_CURRENT_SOURCE_DIR}/*.cdl ${CMAKE_CURRENT_SOURCE_DIR}/ref_tmp_tst_warn_out.txt)
FILE(COPY ${COPY_FILES} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/)
IF(WIN32)
FILE(COPY ${COPY_FILES} DESTINATION ${RUNTIME_OUTPUT_DIRECTORY}/)
Expand All @@ -132,7 +132,9 @@ IF(TEST_PARALLEL4)
build_bin_test(tst_parallel_compress)
build_bin_test(tst_nc4perf)
build_bin_test(tst_mode)
build_bin_test(tst_warn)
build_bin_test(tst_simplerw_coll_r)
build_bin_test(tst_quantize_par)
add_sh_test(nc_test4 run_par_test)
add_sh_test(nc_test4 run_par_warn_test)
ENDIF()
9 changes: 5 additions & 4 deletions nc_test4/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,8 @@ if TEST_PARALLEL4
check_PROGRAMS += tst_mpi_parallel tst_parallel tst_parallel3 \
tst_parallel4 tst_parallel5 tst_nc4perf tst_mode tst_simplerw_coll_r \
tst_mode tst_parallel_zlib tst_parallel_compress tst_quantize_par \
tst_parallel6
TESTS += run_par_test.sh
tst_parallel6 tst_warn
TESTS += run_par_test.sh run_par_warn_test.sh
endif # TEST_PARALLEL4

EXTRA_DIST = run_par_test.sh.in ref_tst_compounds.nc \
Expand All @@ -145,7 +145,8 @@ tst_specific_filters.sh tst_unknown.sh tst_virtual_datasets.c \
noop1.cdl unknown.cdl tst_broken_files.c ref_bloscx.cdl \
tst_bloscfail.sh tst_fixedstring.sh ref_fixedstring.h5 \
ref_fixedstring.cdl tst_filterinstall.sh tst_filter_vlen.sh \
tst_filter_misc.sh run_zstd_test.sh
tst_filter_misc.sh run_zstd_test.sh run_par_warn_test.sh.in \
ref_tmp_tst_warn_out.txt

CLEANFILES = tst_mpi_parallel.bin cdm_sea_soundings.nc bm_chunking.nc \
tst_floats_1D.cdl floats_1D_3.nc floats_1D.cdl tst_*.nc tmp_*.txt \
Expand All @@ -160,7 +161,7 @@ testfilter_order.nc crfilterorder.txt rdfilterorder.txt 1 \
tmp_*.txt tmp_*.nc tmp*.dump tmp*.cdl tmp*.txt tmp*.tmp \
tmp_bzip2.c bzip2.nc noop.nc tmp_*.dmp tmp_*.cdl

DISTCLEANFILES = findplugin.sh run_par_test.sh
DISTCLEANFILES = findplugin.sh run_par_test.sh run_par_warn_test.sh

clean-local:
rm -fr testdir_* testset_*
Expand Down
4 changes: 4 additions & 0 deletions nc_test4/ref_tmp_tst_warn_out.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

*** Testing for HDF5 extra output
*** Testing create of parallel I/O file...ok.
*** Tests successful!
20 changes: 20 additions & 0 deletions nc_test4/run_par_warn_test.sh.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/sh

# This .in file is processed at build time into a shell that runs some
# parallel I/O tests for netCDF/HDF5 parallel I/O. This tests for
# unexpected output from the HDF5 library. See
# https://github.com/Unidata/netcdf-c/issues/3003.

# Ed Hartnett

set -e

if test "x$srcdir" = x ; then srcdir=`pwd`; fi
. ../test_common.sh

echo
echo "Testing MPI parallel I/O with various other mode flags..."
@MPIEXEC@ -n 1 ./tst_warn > tmp_tst_warn_out.txt 2>&1
cat tmp_tst_warn_out.txt
diff -w tmp_tst_warn_out.txt ref_tmp_tst_warn_out.txt

35 changes: 35 additions & 0 deletions nc_test4/tst_warn.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/* Copyright 2024
University Corporation for Atmospheric Research/Unidata. */

/* This program tests for undesired HDF5 output in parallel
programs. See https://github.com/Unidata/netcdf-c/issues/3003.

This is intended to be run on one processor only, but with MPI.

Edward Hartnett, 9/2/24
*/
#include "nc_tests.h"
#include "err_macros.h"
#include "netcdf_par.h"

#define FILE_NAME "tst_warn.nc"

int
main(int argc, char** argv)
{
int ncid,varid,dimid;
int retval;

printf("\n*** Testing for HDF5 extra output\n");

MPI_Init(&argc,&argv);

printf("*** Testing create of parallel I/O file...");
if ((retval = nc_create_par(FILE_NAME, NC_CLOBBER|NC_NETCDF4, MPI_COMM_WORLD, MPI_INFO_NULL, &ncid))) ERR;
if ((retval = nc_close(ncid))) ERR;

MPI_Finalize();

SUMMARIZE_ERR;
FINAL_RESULTS;
}
Loading