From 1e02ff0cdfeb6ead6bc37950aabdaa6973442753 Mon Sep 17 00:00:00 2001 From: "H. Joe Lee" Date: Wed, 21 Aug 2024 21:33:13 -0500 Subject: [PATCH 01/22] Use gfortran 14 for cmake-ctest.yml on mac (#4739) * Use gfortran 14 for cmake-test on mac * Remove notarization step * Address @byrnHDF review --- .github/workflows/cmake-bintest.yml | 2 +- .github/workflows/cmake-ctest.yml | 2 +- .github/workflows/main-cmake.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/cmake-bintest.yml b/.github/workflows/cmake-bintest.yml index 1e4b6cd1078..11ae036b3bd 100644 --- a/.github/workflows/cmake-bintest.yml +++ b/.github/workflows/cmake-bintest.yml @@ -192,7 +192,7 @@ jobs: id: setup-fortran with: compiler: gcc - version: 12 + version: 14 - name: Run ctest (MacOS_latest) id: run-ctest diff --git a/.github/workflows/cmake-ctest.yml b/.github/workflows/cmake-ctest.yml index f7a4a93d70b..2b77eaa8780 100644 --- a/.github/workflows/cmake-ctest.yml +++ b/.github/workflows/cmake-ctest.yml @@ -363,7 +363,7 @@ jobs: id: setup-fortran with: compiler: gcc - version: 12 + version: 14 - name: Run ctest (MacOS_latest) id: run-ctest diff --git a/.github/workflows/main-cmake.yml b/.github/workflows/main-cmake.yml index 7c89f089a25..4d9b42bbf8d 100644 --- a/.github/workflows/main-cmake.yml +++ b/.github/workflows/main-cmake.yml @@ -141,7 +141,7 @@ jobs: id: setup-fortran with: compiler: gcc - version: 12 + version: 14 if: ${{ matrix.os == 'macos-latest' }} - name: Install Dependencies From 28649f96a6ca6fc5d3bc2ab980280e8beebfdcf2 Mon Sep 17 00:00:00 2001 From: "H. Joe Lee" Date: Wed, 21 Aug 2024 22:40:53 -0500 Subject: [PATCH 02/22] Fix enum type mismatch warning (#4741) --- src/H5VLpassthru.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/H5VLpassthru.c b/src/H5VLpassthru.c index 09ac6617e09..df13afc2513 100644 --- a/src/H5VLpassthru.c +++ b/src/H5VLpassthru.c @@ -2686,7 +2686,7 @@ H5VL_pass_through_request_wait(void *obj, uint64_t timeout, H5VL_request_status_ ret_value = H5VLrequest_wait(o->under_object, o->under_vol_id, timeout, status); - if (ret_value >= 0 && *status != H5ES_STATUS_IN_PROGRESS) + if (ret_value >= 0 && *status != H5VL_REQUEST_STATUS_IN_PROGRESS) H5VL_pass_through_free_obj(o); return ret_value; From 9f89469ec78f65984f691a994ff2eea84b6e2578 Mon Sep 17 00:00:00 2001 From: "H. Joe Lee" Date: Thu, 22 Aug 2024 11:12:59 -0500 Subject: [PATCH 03/22] Fix macro redefined warnings (#4744) Removes a duplicated HDopen macro from the performance testing programs --- tools/src/h5perf/pio_engine.c | 6 ------ tools/src/h5perf/sio_engine.c | 6 ------ 2 files changed, 12 deletions(-) diff --git a/tools/src/h5perf/pio_engine.c b/tools/src/h5perf/pio_engine.c index 8b11f51fc68..7930d9645a0 100644 --- a/tools/src/h5perf/pio_engine.c +++ b/tools/src/h5perf/pio_engine.c @@ -72,12 +72,6 @@ } while (0) /* POSIX I/O macros */ -#ifdef H5_HAVE_WIN32_API -/* Can't link against the library, so this test will use the older, non-Unicode - * _open() call on Windows. - */ -#define HDopen(S, F, ...) _open(S, F | _O_BINARY, __VA_ARGS__) -#endif /* H5_HAVE_WIN32_API */ #define POSIXCREATE(fn) HDopen(fn, O_CREAT | O_TRUNC | O_RDWR, 0600) #define POSIXOPEN(fn, F) HDopen(fn, F, 0600) #define POSIXCLOSE(F) HDclose(F) diff --git a/tools/src/h5perf/sio_engine.c b/tools/src/h5perf/sio_engine.c index 12305f54a76..0d2240fa69f 100644 --- a/tools/src/h5perf/sio_engine.c +++ b/tools/src/h5perf/sio_engine.c @@ -53,12 +53,6 @@ } while (0) /* POSIX I/O macros */ -#ifdef H5_HAVE_WIN32_API -/* Can't link against the library, so this test will use the older, non-Unicode - * _open() call on Windows. - */ -#define HDopen(S, F, ...) _open(S, F | _O_BINARY, __VA_ARGS__) -#endif /* H5_HAVE_WIN32_API */ #define POSIXCREATE(fn) HDopen(fn, O_CREAT | O_TRUNC | O_RDWR, 0600) #define POSIXOPEN(fn, F) HDopen(fn, F, 0600) #define POSIXCLOSE(F) HDclose(F) From c070b23e16f2b9962ec30786a28d2e20d3d0b51c Mon Sep 17 00:00:00 2001 From: "H. Joe Lee" Date: Thu, 22 Aug 2024 11:17:11 -0500 Subject: [PATCH 04/22] Update nvhpc CI version to 24.7 (#4740) --- .github/workflows/nvhpc-auto.yml | 20 ++++++++++---------- .github/workflows/nvhpc-cmake.yml | 16 ++++++++-------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/.github/workflows/nvhpc-auto.yml b/.github/workflows/nvhpc-auto.yml index a1064b6a51b..2a1a361813f 100644 --- a/.github/workflows/nvhpc-auto.yml +++ b/.github/workflows/nvhpc-auto.yml @@ -35,21 +35,21 @@ jobs: curl https://developer.download.nvidia.com/hpc-sdk/ubuntu/DEB-GPG-KEY-NVIDIA-HPC-SDK | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-hpcsdk-archive-keyring.gpg echo 'deb [signed-by=/usr/share/keyrings/nvidia-hpcsdk-archive-keyring.gpg] https://developer.download.nvidia.com/hpc-sdk/ubuntu/amd64 /' | sudo tee /etc/apt/sources.list.d/nvhpc.list sudo apt-get update -y - sudo apt-get install -y nvhpc-24-5 + sudo apt-get install -y nvhpc-24-7 echo "NVHPCSDK=/opt/nvidia/hpc_sdk" >> $GITHUB_ENV - echo "OMPI_CXX=/opt/nvidia/hpc_sdk/Linux_x86_64/24.5/compilers/bin/nvc++" >> $GITHUB_ENV - echo "OMPI_CC=/opt/nvidia/hpc_sdk/Linux_x86_64/24.5/compilers/bin/nvc" >> $GITHUB_ENV - echo "OMPI_FC=/opt/nvidia/hpc_sdk/Linux_x86_64/24.5/compilers/bin/nvfortran" >> $GITHUB_ENV - echo "CC=/opt/nvidia/hpc_sdk/Linux_x86_64/24.5/comm_libs/openmpi4/bin/mpicc" >> $GITHUB_ENV - echo "FC=/opt/nvidia/hpc_sdk/Linux_x86_64/24.5/comm_libs/openmpi4/bin/mpifort" >> $GITHUB_ENV - echo "LD_LIBRARY_PATH=/opt/nvidia/hpc_sdk/Linux_x86_64/24.5/compilers/lib" >> $GITHUB_ENV + echo "OMPI_CXX=/opt/nvidia/hpc_sdk/Linux_x86_64/24.7/compilers/bin/nvc++" >> $GITHUB_ENV + echo "OMPI_CC=/opt/nvidia/hpc_sdk/Linux_x86_64/24.7/compilers/bin/nvc" >> $GITHUB_ENV + echo "OMPI_FC=/opt/nvidia/hpc_sdk/Linux_x86_64/24.7/compilers/bin/nvfortran" >> $GITHUB_ENV + echo "CC=/opt/nvidia/hpc_sdk/Linux_x86_64/24.7/comm_libs/openmpi4/bin/mpicc" >> $GITHUB_ENV + echo "FC=/opt/nvidia/hpc_sdk/Linux_x86_64/24.7/comm_libs/openmpi4/bin/mpifort" >> $GITHUB_ENV + echo "LD_LIBRARY_PATH=/opt/nvidia/hpc_sdk/Linux_x86_64/24.7/compilers/lib" >> $GITHUB_ENV echo "DESTDIR=/tmp" >> $GITHUB_ENV - name: Autotools Configure shell: bash run: | export RUNPARALLEL="mpiexec -np 2" - export PATH=/opt/nvidia/hpc_sdk/Linux_x86_64/24.5/comm_libs/openmpi4/bin:/opt/nvidia/hpc_sdk/Linux_x86_64/24.5/compilers/bin:$PATH + export PATH=/opt/nvidia/hpc_sdk/Linux_x86_64/24.7/comm_libs/openmpi4/bin:/opt/nvidia/hpc_sdk/Linux_x86_64/24.7/compilers/bin:$PATH sh ./autogen.sh mkdir "${{ runner.workspace }}/build" cd "${{ runner.workspace }}/build" @@ -63,13 +63,13 @@ jobs: - name: Autotools Build shell: bash run: | - export PATH=/opt/nvidia/hpc_sdk/Linux_x86_64/24.5/comm_libs/openmpi4/bin:/opt/nvidia/hpc_sdk/Linux_x86_64/24.5/compilers/bin:$PATH + export PATH=/opt/nvidia/hpc_sdk/Linux_x86_64/24.7/comm_libs/openmpi4/bin:/opt/nvidia/hpc_sdk/Linux_x86_64/24.7/compilers/bin:$PATH make -j3 working-directory: ${{ runner.workspace }}/build - name: Autotools Install shell: bash run: | - export PATH=/opt/nvidia/hpc_sdk/Linux_x86_64/24.5/comm_libs/openmpi4/bin:/opt/nvidia/hpc_sdk/Linux_x86_64/24.5/compilers/bin:$PATH + export PATH=/opt/nvidia/hpc_sdk/Linux_x86_64/24.7/comm_libs/openmpi4/bin:/opt/nvidia/hpc_sdk/Linux_x86_64/24.7/compilers/bin:$PATH make install working-directory: ${{ runner.workspace }}/build diff --git a/.github/workflows/nvhpc-cmake.yml b/.github/workflows/nvhpc-cmake.yml index 48891b9fdff..9e73a1c856f 100644 --- a/.github/workflows/nvhpc-cmake.yml +++ b/.github/workflows/nvhpc-cmake.yml @@ -34,20 +34,20 @@ jobs: curl https://developer.download.nvidia.com/hpc-sdk/ubuntu/DEB-GPG-KEY-NVIDIA-HPC-SDK | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-hpcsdk-archive-keyring.gpg echo 'deb [signed-by=/usr/share/keyrings/nvidia-hpcsdk-archive-keyring.gpg] https://developer.download.nvidia.com/hpc-sdk/ubuntu/amd64 /' | sudo tee /etc/apt/sources.list.d/nvhpc.list sudo apt-get update -y - sudo apt-get install -y nvhpc-24-5 + sudo apt-get install -y nvhpc-24-7 echo "NVHPCSDK=/opt/nvidia/hpc_sdk" >> $GITHUB_ENV - echo "OMPI_CXX=/opt/nvidia/hpc_sdk/Linux_x86_64/24.5/compilers/bin/nvc++" >> $GITHUB_ENV - echo "OMPI_CC=/opt/nvidia/hpc_sdk/Linux_x86_64/24.5/compilers/bin/nvc" >> $GITHUB_ENV - echo "OMPI_FC=/opt/nvidia/hpc_sdk/Linux_x86_64/24.5/compilers/bin/nvfortran" >> $GITHUB_ENV - echo "CC=/opt/nvidia/hpc_sdk/Linux_x86_64/24.5/comm_libs/openmpi4/bin/mpicc" >> $GITHUB_ENV - echo "FC=/opt/nvidia/hpc_sdk/Linux_x86_64/24.5/comm_libs/openmpi4/bin/mpifort" >> $GITHUB_ENV - echo "LD_LIBRARY_PATH=/opt/nvidia/hpc_sdk/Linux_x86_64/24.5/cuda/12.3/lib64:/opt/nvidia/hpc_sdk/Linux_x86_64/24.5/compilers/lib" >> $GITHUB_ENV + echo "OMPI_CXX=/opt/nvidia/hpc_sdk/Linux_x86_64/24.7/compilers/bin/nvc++" >> $GITHUB_ENV + echo "OMPI_CC=/opt/nvidia/hpc_sdk/Linux_x86_64/24.7/compilers/bin/nvc" >> $GITHUB_ENV + echo "OMPI_FC=/opt/nvidia/hpc_sdk/Linux_x86_64/24.7/compilers/bin/nvfortran" >> $GITHUB_ENV + echo "CC=/opt/nvidia/hpc_sdk/Linux_x86_64/24.7/comm_libs/openmpi4/bin/mpicc" >> $GITHUB_ENV + echo "FC=/opt/nvidia/hpc_sdk/Linux_x86_64/24.7/comm_libs/openmpi4/bin/mpifort" >> $GITHUB_ENV + echo "LD_LIBRARY_PATH=/opt/nvidia/hpc_sdk/Linux_x86_64/24.7/cuda/12.3/lib64:/opt/nvidia/hpc_sdk/Linux_x86_64/24.7/compilers/lib" >> $GITHUB_ENV echo "DESTDIR=/tmp" >> $GITHUB_ENV - name: CMake Configure shell: bash run: | - export PATH=/opt/nvidia/hpc_sdk/Linux_x86_64/24.5/comm_libs/openmpi4/bin:/opt/nvidia/hpc_sdk/Linux_x86_64/24.5/compilers/bin:$PATH + export PATH=/opt/nvidia/hpc_sdk/Linux_x86_64/24.7/comm_libs/openmpi4/bin:/opt/nvidia/hpc_sdk/Linux_x86_64/24.7/compilers/bin:$PATH mkdir "${{ runner.workspace }}/build" cd "${{ runner.workspace }}/build" cmake -C $GITHUB_WORKSPACE/config/cmake/cacheinit.cmake -G Ninja \ From 77444b8e5766112c4649ad0b079b5c004a70d50b Mon Sep 17 00:00:00 2001 From: Aleksandar Jelenak Date: Thu, 22 Aug 2024 12:18:54 -0400 Subject: [PATCH 05/22] Return basic HTTP range GET logging to ROS3 (#4738) * Add minimal amount of S3 request logging to ROS3 * Fix ROS3 logging ifdef conditions --- src/H5FDs3comms.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/H5FDs3comms.c b/src/H5FDs3comms.c index 1d5ee2608e1..0d1cd0f868a 100644 --- a/src/H5FDs3comms.c +++ b/src/H5FDs3comms.c @@ -50,7 +50,7 @@ /* manipulate verbosity of CURL output * * 0 -> no explicit curl output - * 1 -> on error, print failure info to stderr + * 1 -> print: (1) failure info to stderr on error, (2) basic HTTP range GET info * 2 -> in addition to above, print information for all performs; sets all * curl handles with CURLOPT_VERBOSE */ @@ -810,6 +810,11 @@ H5FD_s3comms_s3r_getsize(s3r_t *handle) handle->filesize = (size_t)content_length; +#if S3COMMS_CURL_VERBOSITY > 0 + fprintf(stdout, " -- size: %ju\n", content_length); + fflush(stdout); +#endif + /********************** * UNDO HEAD SETTINGS * **********************/ @@ -1119,6 +1124,12 @@ H5FD_s3comms_s3r_read(s3r_t *handle, haddr_t offset, size_t len, void *dest) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to format HTTP Range value"); } +#if S3COMMS_CURL_VERBOSITY > 0 + fprintf(stdout, "%s: Bytes %" PRIuHADDR " - %" PRIuHADDR ", Request Size: %zu\n", handle->httpverb, + offset, offset + len - 1, len); + fflush(stdout); +#endif + /******************* * COMPILE REQUEST * *******************/ From 2c89149eb715e631a6a9d11bb0f8e4021d4af886 Mon Sep 17 00:00:00 2001 From: bmribler <39579120+bmribler@users.noreply.github.com> Date: Thu, 22 Aug 2024 14:32:48 -0400 Subject: [PATCH 06/22] Replace non-VOL calls with VOL calls - part 1 (#4745) This PR is part of the incremental switching H5I_object() and H5I_object_verify() to their VOL counterpart, H5VL_object() and H5VL_vol_object_verify(), a newly addedinternal function. Fixes GH-4730 partially. --- src/H5A.c | 14 +++++++------- src/H5D.c | 46 +++++++++++++++++++++++----------------------- src/H5Ddeprec.c | 2 +- src/H5VLint.c | 35 +++++++++++++++++++++++++++++++++++ src/H5VLprivate.h | 1 + 5 files changed, 67 insertions(+), 31 deletions(-) diff --git a/src/H5A.c b/src/H5A.c index 651ed13c256..9bad7053a48 100644 --- a/src/H5A.c +++ b/src/H5A.c @@ -983,7 +983,7 @@ H5A__read_api_common(hid_t attr_id, hid_t dtype_id, void *buf, void **token_ptr, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "buf parameter can't be NULL"); /* Get attribute object pointer */ - if (NULL == (*vol_obj_ptr = (H5VL_object_t *)H5I_object_verify(attr_id, H5I_ATTR))) + if (NULL == (*vol_obj_ptr = H5VL_vol_object_verify(attr_id, H5I_ATTR))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an attribute"); /* Read the attribute data */ @@ -1090,7 +1090,7 @@ H5Aget_space(hid_t attr_id) FUNC_ENTER_API(H5I_INVALID_HID) /* Check arguments */ - if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(attr_id, H5I_ATTR))) + if (NULL == (vol_obj = H5VL_vol_object_verify(attr_id, H5I_ATTR))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not an attribute"); /* Set up VOL callback arguments */ @@ -1134,7 +1134,7 @@ H5Aget_type(hid_t attr_id) FUNC_ENTER_API(H5I_INVALID_HID) /* Check arguments */ - if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(attr_id, H5I_ATTR))) + if (NULL == (vol_obj = H5VL_vol_object_verify(attr_id, H5I_ATTR))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not an attribute"); /* Set up VOL callback arguments */ @@ -1183,7 +1183,7 @@ H5Aget_create_plist(hid_t attr_id) assert(H5P_LST_ATTRIBUTE_CREATE_ID_g != -1); /* Check arguments */ - if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(attr_id, H5I_ATTR))) + if (NULL == (vol_obj = H5VL_vol_object_verify(attr_id, H5I_ATTR))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not an attribute"); /* Set up VOL callback arguments */ @@ -1234,7 +1234,7 @@ H5Aget_name(hid_t attr_id, size_t buf_size, char *buf /*out*/) FUNC_ENTER_API((-1)) /* check arguments */ - if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(attr_id, H5I_ATTR))) + if (NULL == (vol_obj = H5VL_vol_object_verify(attr_id, H5I_ATTR))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "not an attribute"); if (!buf && buf_size) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "buf cannot be NULL if buf_size is non-zero"); @@ -1352,7 +1352,7 @@ H5Aget_storage_size(hid_t attr_id) FUNC_ENTER_API(0) /* Check arguments */ - if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(attr_id, H5I_ATTR))) + if (NULL == (vol_obj = H5VL_vol_object_verify(attr_id, H5I_ATTR))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "not an attribute"); /* Set up VOL callback arguments */ @@ -1390,7 +1390,7 @@ H5Aget_info(hid_t attr_id, H5A_info_t *ainfo /*out*/) FUNC_ENTER_API(FAIL) /* Check args */ - if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(attr_id, H5I_ATTR))) + if (NULL == (vol_obj = H5VL_vol_object_verify(attr_id, H5I_ATTR))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an attribute"); if (!ainfo) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "attribute_info parameter cannot be NULL"); diff --git a/src/H5D.c b/src/H5D.c index 7416405e7f9..a50a2aceda6 100644 --- a/src/H5D.c +++ b/src/H5D.c @@ -295,7 +295,7 @@ H5Dcreate_anon(hid_t loc_id, hid_t type_id, hid_t space_id, hid_t dcpl_id, hid_t HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info"); /* get the location object */ - if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) + if (NULL == (vol_obj = H5VL_vol_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier"); /* Set location parameters */ @@ -559,7 +559,7 @@ H5D__get_space_api_common(hid_t dset_id, void **token_ptr, H5VL_object_t **_vol_ FUNC_ENTER_PACKAGE /* Check args */ - if (NULL == (*vol_obj_ptr = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET))) + if (NULL == (*vol_obj_ptr = H5VL_vol_object_verify(dset_id, H5I_DATASET))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid dataset identifier"); /* Set up VOL callback arguments */ @@ -671,7 +671,7 @@ H5Dget_space_status(hid_t dset_id, H5D_space_status_t *allocation /*out*/) FUNC_ENTER_API(FAIL) /* Check args */ - if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET))) + if (NULL == (vol_obj = H5VL_vol_object_verify(dset_id, H5I_DATASET))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset identifier"); /* Set up VOL callback arguments */ @@ -709,7 +709,7 @@ H5Dget_type(hid_t dset_id) FUNC_ENTER_API(H5I_INVALID_HID) /* Check args */ - if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET))) + if (NULL == (vol_obj = H5VL_vol_object_verify(dset_id, H5I_DATASET))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid dataset identifier"); /* Set up VOL callback arguments */ @@ -750,7 +750,7 @@ H5Dget_create_plist(hid_t dset_id) FUNC_ENTER_API(H5I_INVALID_HID) /* Check args */ - if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET))) + if (NULL == (vol_obj = H5VL_vol_object_verify(dset_id, H5I_DATASET))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid dataset identifier"); /* Set up VOL callback arguments */ @@ -808,7 +808,7 @@ H5Dget_access_plist(hid_t dset_id) FUNC_ENTER_API(H5I_INVALID_HID) /* Check args */ - if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET))) + if (NULL == (vol_obj = H5VL_vol_object_verify(dset_id, H5I_DATASET))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid dataset identifier"); /* Set up VOL callback arguments */ @@ -852,7 +852,7 @@ H5Dget_storage_size(hid_t dset_id) FUNC_ENTER_API(0) /* Check args */ - if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET))) + if (NULL == (vol_obj = H5VL_vol_object_verify(dset_id, H5I_DATASET))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "invalid dataset identifier"); /* Set up VOL callback arguments */ @@ -893,7 +893,7 @@ H5Dget_offset(hid_t dset_id) FUNC_ENTER_API(HADDR_UNDEF) /* Check args */ - if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET))) + if (NULL == (vol_obj = H5VL_vol_object_verify(dset_id, H5I_DATASET))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, HADDR_UNDEF, "invalid dataset identifier"); /* Set up VOL callback arguments */ @@ -957,7 +957,7 @@ H5D__read_api_common(size_t count, hid_t dset_id[], hid_t mem_type_id[], hid_t m HGOTO_ERROR(H5E_VOL, H5E_CANTALLOC, FAIL, "can't allocate space for object array"); /* Get vol_obj_ptr (return just the first dataset to caller if requested) */ - if (NULL == (*vol_obj_ptr = (H5VL_object_t *)H5I_object_verify(dset_id[0], H5I_DATASET))) + if (NULL == (*vol_obj_ptr = H5VL_vol_object_verify(dset_id[0], H5I_DATASET))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dset_id is not a dataset ID"); /* Save the connector of the first dataset. Unpack the connector and call @@ -969,7 +969,7 @@ H5D__read_api_common(size_t count, hid_t dset_id[], hid_t mem_type_id[], hid_t m obj[0] = (*vol_obj_ptr)->data; for (i = 1; i < count; i++) { /* Get the object */ - if (NULL == (tmp_vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id[i], H5I_DATASET))) + if (NULL == (tmp_vol_obj = H5VL_vol_object_verify(dset_id[i], H5I_DATASET))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dset_id is not a dataset ID"); obj[i] = tmp_vol_obj->data; @@ -1181,7 +1181,7 @@ H5Dread_chunk(hid_t dset_id, hid_t dxpl_id, const hsize_t *offset, uint32_t *fil FUNC_ENTER_API(FAIL) /* Check arguments */ - if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET))) + if (NULL == (vol_obj = H5VL_vol_object_verify(dset_id, H5I_DATASET))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dset_id is not a dataset ID"); if (!buf) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "buf cannot be NULL"); @@ -1487,7 +1487,7 @@ H5Dwrite_chunk(hid_t dset_id, hid_t dxpl_id, uint32_t filters, const hsize_t *of FUNC_ENTER_API(FAIL) /* Check arguments */ - if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET))) + if (NULL == (vol_obj = H5VL_vol_object_verify(dset_id, H5I_DATASET))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset ID"); if (!buf) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "buf cannot be NULL"); @@ -1874,7 +1874,7 @@ H5Dvlen_get_buf_size(hid_t dataset_id, hid_t type_id, hid_t space_id, hsize_t *s FUNC_ENTER_API(FAIL) /* Check args */ - if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dataset_id, H5I_DATASET))) + if (NULL == (vol_obj = H5VL_vol_object_verify(dataset_id, H5I_DATASET))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset identifier"); if (H5I_DATATYPE != H5I_get_type(type_id)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid datatype identifier"); @@ -1935,7 +1935,7 @@ H5D__set_extent_api_common(hid_t dset_id, const hsize_t size[], void **token_ptr FUNC_ENTER_PACKAGE /* Check args */ - if (NULL == (*vol_obj_ptr = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET))) + if (NULL == (*vol_obj_ptr = H5VL_vol_object_verify(dset_id, H5I_DATASET))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset identifier"); if (!size) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "size array cannot be NULL"); @@ -2040,7 +2040,7 @@ H5Dflush(hid_t dset_id) FUNC_ENTER_API(FAIL) /* Check args */ - if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET))) + if (NULL == (vol_obj = H5VL_vol_object_verify(dset_id, H5I_DATASET))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dset_id parameter is not a valid dataset identifier"); /* Set up collective metadata if appropriate */ @@ -2081,7 +2081,7 @@ H5Drefresh(hid_t dset_id) FUNC_ENTER_API(FAIL) /* Check args */ - if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET))) + if (NULL == (vol_obj = H5VL_vol_object_verify(dset_id, H5I_DATASET))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dset_id parameter is not a valid dataset identifier"); /* Set up collective metadata if appropriate */ @@ -2124,7 +2124,7 @@ H5Dformat_convert(hid_t dset_id) FUNC_ENTER_API(FAIL) /* Check args */ - if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET))) + if (NULL == (vol_obj = H5VL_vol_object_verify(dset_id, H5I_DATASET))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dset_id parameter is not a valid dataset identifier"); /* Set up collective metadata if appropriate */ @@ -2163,7 +2163,7 @@ H5Dget_chunk_index_type(hid_t dset_id, H5D_chunk_index_t *idx_type /*out*/) FUNC_ENTER_API(FAIL) /* Check args */ - if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET))) + if (NULL == (vol_obj = H5VL_vol_object_verify(dset_id, H5I_DATASET))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dset_id parameter is not a valid dataset identifier"); if (NULL == idx_type) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "idx_type parameter cannot be NULL"); @@ -2204,7 +2204,7 @@ H5Dget_chunk_storage_size(hid_t dset_id, const hsize_t *offset, hsize_t *chunk_n FUNC_ENTER_API(FAIL) /* Check arguments */ - if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET))) + if (NULL == (vol_obj = H5VL_vol_object_verify(dset_id, H5I_DATASET))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dset_id parameter is not a valid dataset identifier"); if (NULL == offset) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "offset parameter cannot be NULL"); @@ -2254,7 +2254,7 @@ H5Dget_num_chunks(hid_t dset_id, hid_t fspace_id, hsize_t *nchunks /*out*/) FUNC_ENTER_API(FAIL) /* Check arguments */ - if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET))) + if (NULL == (vol_obj = H5VL_vol_object_verify(dset_id, H5I_DATASET))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset identifier"); if (NULL == nchunks) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid argument (null)"); @@ -2308,7 +2308,7 @@ H5Dget_chunk_info(hid_t dset_id, hid_t fspace_id, hsize_t chk_index, hsize_t *of if (NULL == offset && NULL == filter_mask && NULL == addr && NULL == size) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid arguments, must have at least one non-null output argument"); - if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET))) + if (NULL == (vol_obj = H5VL_vol_object_verify(dset_id, H5I_DATASET))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset identifier"); /* Set up VOL callback arguments */ @@ -2373,7 +2373,7 @@ H5Dget_chunk_info_by_coord(hid_t dset_id, const hsize_t *offset, unsigned *filte FUNC_ENTER_API(FAIL) /* Check arguments */ - if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET))) + if (NULL == (vol_obj = H5VL_vol_object_verify(dset_id, H5I_DATASET))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset identifier"); if (NULL == filter_mask && NULL == addr && NULL == size) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, @@ -2423,7 +2423,7 @@ H5Dchunk_iter(hid_t dset_id, hid_t dxpl_id, H5D_chunk_iter_op_t op, void *op_dat FUNC_ENTER_API(FAIL) /* Check arguments */ - if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET))) + if (NULL == (vol_obj = H5VL_vol_object_verify(dset_id, H5I_DATASET))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset identifier"); if (NULL == op) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid callback to chunk iteration"); diff --git a/src/H5Ddeprec.c b/src/H5Ddeprec.c index 5b0f4e33ede..51d6e4323c0 100644 --- a/src/H5Ddeprec.c +++ b/src/H5Ddeprec.c @@ -232,7 +232,7 @@ H5Dextend(hid_t dset_id, const hsize_t size[]) FUNC_ENTER_API(FAIL) /* Check args */ - if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET))) + if (NULL == (vol_obj = H5VL_vol_object_verify(dset_id, H5I_DATASET))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset identifier"); if (!size) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no size specified"); diff --git a/src/H5VLint.c b/src/H5VLint.c index a40d64e3ac4..19a11e9b6b8 100644 --- a/src/H5VLint.c +++ b/src/H5VLint.c @@ -1761,6 +1761,41 @@ H5VL_vol_object(hid_t id) FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_vol_object() */ +/*------------------------------------------------------------------------- + * Function: H5VL_vol_object_verify + * + * Purpose: Utility function to return the object pointer associated with + * an ID of the specified type. This routine is the same as + * H5VL_vol_object except it takes the additional argument + * obj_type to verify the ID's type against. + * + * Return: Success: object pointer + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +H5VL_object_t * +H5VL_vol_object_verify(hid_t id, H5I_type_t obj_type) +{ + void *obj = NULL; + H5VL_object_t *ret_value = NULL; + + FUNC_ENTER_NOAPI(NULL) + + if (NULL == (obj = H5I_object_verify(id, obj_type))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "identifier is not of specified type"); + + /* If this is a datatype, get the VOL object attached to the H5T_t struct */ + if (H5I_DATATYPE == obj_type) + if (NULL == (obj = H5T_get_named_type((H5T_t *)obj))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a named datatype"); + + ret_value = (H5VL_object_t *)obj; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} + /*------------------------------------------------------------------------- * Function: H5VL_object_data * diff --git a/src/H5VLprivate.h b/src/H5VLprivate.h index 79ed93c03ba..2904a5b1c15 100644 --- a/src/H5VLprivate.h +++ b/src/H5VLprivate.h @@ -96,6 +96,7 @@ H5_DLL void *H5VL_object_data(const H5VL_object_t *vol_obj); H5_DLL void *H5VL_object_unwrap(const H5VL_object_t *vol_obj); H5_DLL void *H5VL_object_verify(hid_t id, H5I_type_t obj_type); H5_DLL H5VL_object_t *H5VL_vol_object(hid_t id); +H5_DLL H5VL_object_t *H5VL_vol_object_verify(hid_t id, H5I_type_t obj_type); H5_DLL H5VL_object_t *H5VL_create_object(void *object, H5VL_t *vol_connector); H5_DLL H5VL_object_t *H5VL_create_object_using_vol_id(H5I_type_t type, void *obj, hid_t connector_id); H5_DLL hsize_t H5VL_object_inc_rc(H5VL_object_t *obj); From c3444df42668f2d39c1f09a480ea5fb92b745dcf Mon Sep 17 00:00:00 2001 From: bmribler <39579120+bmribler@users.noreply.github.com> Date: Fri, 23 Aug 2024 12:17:35 -0400 Subject: [PATCH 07/22] Fix inconsistent documentation of get_name functions (#4715) - Verified that the listed functions do not include null terminator in the returned length - Improved some of the tests - Corrected documentation Fixes GH-4704 * Casted a positive int to size_t --- src/H5A.c | 42 +++++++++++++++++++++++++++--------------- src/H5Apublic.h | 15 +++------------ src/H5Epublic.h | 8 +++++--- src/H5Gdeprec.c | 7 +++---- src/H5Gpublic.h | 7 +------ src/H5Lpublic.h | 11 ++++------- test/error_test.c | 6 ++++-- test/links.c | 14 ++++++++++++-- test/tfile.c | 3 ++- test/th5o.c | 5 +++++ test/tmisc.c | 1 + test/trefer.c | 1 + 12 files changed, 68 insertions(+), 52 deletions(-) diff --git a/src/H5A.c b/src/H5A.c index 9bad7053a48..10475919fbe 100644 --- a/src/H5A.c +++ b/src/H5A.c @@ -1218,7 +1218,7 @@ H5Aget_create_plist(hid_t attr_id) DESCRIPTION This function retrieves the name of an attribute for an attribute ID. - Up to 'buf_size' characters are stored in 'buf' followed by a '\0' string + Up to 'buf_size'-1 characters are stored in 'buf' followed by a '\0' string terminator. If the name of the attribute is longer than 'buf_size'-1, the string terminator is stored in the last position of the buffer to properly terminate the string. @@ -1258,20 +1258,32 @@ H5Aget_name(hid_t attr_id, size_t buf_size, char *buf /*out*/) FUNC_LEAVE_API(ret_value) } /* H5Aget_name() */ -/*------------------------------------------------------------------------- - * Function: H5Aget_name_by_idx - * - * Purpose: Retrieve the name of an attribute, according to the - * order within an index. - * - * Same pattern of behavior as H5Iget_name. - * - * Return: Success: Non-negative length of name, with information - * in NAME buffer - * Failure: Negative - * - *------------------------------------------------------------------------- - */ +/*-------------------------------------------------------------------------- + NAME + H5Aget_name_by_idx + PURPOSE + Retrieve the name of an attribute, according to the order within an index. + USAGE + ssize_t H5Aget_name_by_idx(loc_id, obj_name, idx_type, order, n, name, size, lapl_id) + hid_t loc_id; IN: Object that attribute is attached to + const char *obj_name; IN: Name of the object relative to location + H5_index_t idx_type; IN: Type of index to use + H5_iter_order_t order; IN: Order to iterate over index + hsize_t n; IN: Index (0-based) of attribute to retrieve + char *name; IN: Buffer to store the name in + size_t size; IN: The size of the buffer to store the name in. + hid_t lapl_id; IN: Link access property list + RETURNS + This function returns the length of the attribute's name (which may be + longer than 'buf_size') on success or negative for failure. + + DESCRIPTION + This function retrieves the name of an attribute given its index. Up + to 'buf_size'-1 characters are stored in 'buf' followed by a '\0' string + terminator. If the name of the attribute is longer than 'buf_size'-1, + the string terminator is stored in the last position of the buffer to + properly terminate the string. +--------------------------------------------------------------------------*/ ssize_t H5Aget_name_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, char *name /*out*/, size_t size, hid_t lapl_id) diff --git a/src/H5Apublic.h b/src/H5Apublic.h index 256d19cf355..7c28c0a24a2 100644 --- a/src/H5Apublic.h +++ b/src/H5Apublic.h @@ -501,15 +501,9 @@ H5_DLL herr_t H5Aget_info_by_name(hid_t loc_id, const char *obj_name, const char * value. * * \details H5Aget_name() retrieves the name of an attribute specified by - * the identifier, \p attr_id. Up to \p buf_size characters are - * stored in \p buf followed by a \0 string terminator. If the - * name of the attribute is longer than (\p buf_size -1), the - * string terminator is stored in the last position of the buffer - * to properly terminate the string. + * the identifier, \p attr_id. * - * If the user only wants to retrieve the name length, the - * values 0 and NULL should be passed for the parameters - * \p bufsize and \p buf. + * \details_namelen{attribute,H5Aget_name} * * \since 1.0.0 * @@ -544,10 +538,7 @@ H5_DLL ssize_t H5Aget_name(hid_t attr_id, size_t buf_size, char *buf); * traversal order, and a position in the index, \p idx_type, * \p order and \p n, respectively. * - * If the attribute name's size is unknown, the values 0 and NULL - * can be passed in for the parameters \p size and \p name. The - * function's return value will provide the correct value for - * \p size. + * \details_namelen{attribute,H5Aget_name_by_idx} * * The link access property list, \p lapl_id, may provide * information regarding the properties of links required to access diff --git a/src/H5Epublic.h b/src/H5Epublic.h index 49628efb9be..9263c3c96bf 100644 --- a/src/H5Epublic.h +++ b/src/H5Epublic.h @@ -420,9 +420,11 @@ H5_DLL herr_t H5Eclose_stack(hid_t stack_id); * by the class identifier. If a non-NULL pointer is passed in for \p * name and \p size is greater than zero, the class name of \p size * long is returned. The length of the error class name is also - * returned. If NULL is passed in as \p name, only the length of class - * name is returned. If zero is returned, it means no name. The user is - * responsible for allocating sufficient buffer space for the name. + * returned. + * + * \details_namelen{error class,H5Eget_class_name} + * + * If zero is returned, it means the error class has no name. * * \since 1.8.0 */ diff --git a/src/H5Gdeprec.c b/src/H5Gdeprec.c index 433748e4389..e86bc82c738 100644 --- a/src/H5Gdeprec.c +++ b/src/H5Gdeprec.c @@ -719,11 +719,10 @@ H5Gset_comment(hid_t loc_id, const char *name, const char *comment) * * Note: Deprecated in favor of H5Oget_comment/H5Oget_comment_by_name * - * Return: Success: Number of characters in the comment counting - * the null terminator. The value returned may - * be larger than the BUFSIZE argument. + * Return: Success: Number of characters in the comment. The value + * returned may be larger than the BUFSIZE argument. * - * Failure: Negative + * Failure: Negative * *------------------------------------------------------------------------- */ diff --git a/src/H5Gpublic.h b/src/H5Gpublic.h index 03c7dfbed6f..38880e787b7 100644 --- a/src/H5Gpublic.h +++ b/src/H5Gpublic.h @@ -960,12 +960,7 @@ H5_DLL herr_t H5Gset_comment(hid_t loc_id, const char *name, const char *comment * root group * \li A dot (\c .), if \p loc_id fully specifies the object * - * At most bufsize characters, including a null-terminator, are - * returned in \p buf. The returned value is not null-terminated if the - * comment is longer than the supplied buffer. If the size of the - * comment is unknown, a preliminary \p H5Gget_comment() call will - * return the size of the comment, including space for the - * null-terminator. + * \details_namelen{comment,H5Gget_comment} * * If an object does not have a comment, the empty string is returned * in comment. diff --git a/src/H5Lpublic.h b/src/H5Lpublic.h index 89998b838e7..ec325b8ad77 100644 --- a/src/H5Lpublic.h +++ b/src/H5Lpublic.h @@ -764,7 +764,7 @@ H5_DLL herr_t H5Lget_info2(hid_t loc_id, const char *name, H5L_info2_t *linfo, h * * \return \herr_t * - * \details H5get_info_by_idx2() returns the metadata for a link in a group + * \details H5Lget_info_by_idx2() returns the metadata for a link in a group * according to a specified field or index and a specified order. The * link for which information is to be returned is specified by \p * idx_type, \p order, and \p n as follows: @@ -819,7 +819,7 @@ H5_DLL herr_t H5Lget_info_by_idx2(hid_t loc_id, const char *group_name, H5_index * \return Returns the size of the link name if successful; otherwise returns a * negative value. * - * \details H5get_name_by_idx() retrieves the name of the \Emph{n}-th link in a + * \details H5Lget_name_by_idx() retrieves the name of the \Emph{n}-th link in a * group, according to the specified order, \p order, within a specified * field or index, \p idx_type. * @@ -835,10 +835,7 @@ H5_DLL herr_t H5Lget_info_by_idx2(hid_t loc_id, const char *group_name, H5_index * If \p loc_id specifies the group in which the link resides, * \p group_name can be a dot (\c .). * - * The size in bytes of name is specified in \p size. If \p size is - * unknown, it can be determined via an initial H5Lget_name_by_idx() - * call with name set to NULL; the function's return value will be the - * size of the name. + * \details_namelen{link,H5Lget_name_by_idx} * * \note Please note that in order for the specified index to correspond to the * creation order index, \p order must be set to #H5_ITER_INC or @@ -1578,7 +1575,7 @@ H5_DLL herr_t H5Lget_info1(hid_t loc_id, const char *name, H5L_info1_t *linfo /* * the function H5Lget_info_by_idx2() and the macro * H5Lget_info_by_idx(). * - * \details H5get_info_by_idx1() returns the metadata for a link in a group + * \details H5Lget_info_by_idx1() returns the metadata for a link in a group * according to a specified field or index and a specified order. * * The link for which information is to be returned is specified by \p diff --git a/test/error_test.c b/test/error_test.c index fe27300f431..204055097b8 100644 --- a/test/error_test.c +++ b/test/error_test.c @@ -175,12 +175,13 @@ test_error(hid_t file) static herr_t init_error(void) { - ssize_t cls_size = (ssize_t)strlen(ERR_CLS_NAME) + 1; + ssize_t cls_size = (ssize_t)strlen(ERR_CLS_NAME); ssize_t msg_size = (ssize_t)strlen(ERR_MIN_SUBROUTINE_MSG) + 1; char *cls_name = NULL; char *msg = NULL; H5E_type_t msg_type; + /* Account for null terminator */ if (NULL == (cls_name = (char *)malloc(strlen(ERR_CLS_NAME) + 1))) TEST_ERROR; if (NULL == (msg = (char *)malloc(strlen(ERR_MIN_SUBROUTINE_MSG) + 1))) @@ -189,7 +190,8 @@ init_error(void) if ((ERR_CLS = H5Eregister_class(ERR_CLS_NAME, PROG_NAME, PROG_VERS)) < 0) TEST_ERROR; - if (cls_size != H5Eget_class_name(ERR_CLS, cls_name, (size_t)cls_size) + 1) + /* Account for null terminator */ + if (cls_size != H5Eget_class_name(ERR_CLS, cls_name, (size_t)cls_size + 1)) TEST_ERROR; if (strcmp(ERR_CLS_NAME, cls_name) != 0) TEST_ERROR; diff --git a/test/links.c b/test/links.c index 222b3b66039..6612f56e363 100644 --- a/test/links.c +++ b/test/links.c @@ -1949,6 +1949,7 @@ test_deprec(hid_t fapl, bool new_format) hsize_t num_objs; /* Number of objects in a group */ char filename[1024]; char tmpstr[1024]; + int len = 0; /* Length of comment */ if (new_format) TESTING("backwards compatibility (w/new group format)"); @@ -1968,12 +1969,21 @@ test_deprec(hid_t fapl, bool new_format) FAIL_STACK_ERROR; /* Test H5Gset and get comment */ + if (H5Gset_comment(file_id, "group1", "comment") < 0) FAIL_STACK_ERROR; - if (H5Gget_comment(file_id, "group1", sizeof(tmpstr), tmpstr) < 0) + if ((len = H5Gget_comment(file_id, "group1", 0, NULL)) < 0) + FAIL_STACK_ERROR; + + /* Returned length should be the same as strlen of the comment */ + if ((size_t)len != strlen("comment")) + FAIL_STACK_ERROR; + + /* Get and verify the comment */ + if (H5Gget_comment(file_id, "group1", (size_t)len + 1, tmpstr) < 0) FAIL_STACK_ERROR; if (strcmp(tmpstr, "comment") != 0) - TEST_ERROR; + FAIL_STACK_ERROR; /* Create links using H5Glink and H5Glink2 */ if (H5Glink(file_id, H5G_LINK_HARD, "group2", "group1/link_to_group2") < 0) diff --git a/test/tfile.c b/test/tfile.c index c7cdb30483c..7bf63d30e96 100644 --- a/test/tfile.c +++ b/test/tfile.c @@ -2420,10 +2420,11 @@ test_file_getname(void) file_id = H5Fcreate(FILE1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); CHECK(file_id, FAIL, "H5Fcreate"); - /* Get and verify file name */ + /* Get and verify file name and its length */ name_len = H5Fget_name(file_id, name, (size_t)TESTA_NAME_BUF_SIZE); CHECK(name_len, FAIL, "H5Fget_name"); VERIFY_STR(name, FILE1, "H5Fget_name"); + VERIFY(name_len, strlen(FILE1), "H5Fget_name"); /* Create a group in the root group */ group_id = H5Gcreate2(file_id, TESTA_GROUPNAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); diff --git a/test/th5o.c b/test/th5o.c index 39d804a347e..0ea8d927e83 100644 --- a/test/th5o.c +++ b/test/th5o.c @@ -1220,6 +1220,7 @@ test_h5o_comment(void) /* Getting the comment on the file and verify it */ comment_len = H5Oget_comment(fid, NULL, (size_t)0); CHECK(comment_len, FAIL, "H5Oget_comment"); + VERIFY(comment_len, strlen(file_comment), "H5Oget_comment"); len = H5Oget_comment(fid, check_comment, (size_t)comment_len + 1); CHECK(len, FAIL, "H5Oget_comment"); @@ -1237,6 +1238,7 @@ test_h5o_comment(void) len = H5Oget_comment(grp, check_comment, (size_t)comment_len + 1); CHECK(len, FAIL, "H5Oget_comment"); + VERIFY(len, strlen(grp_comment), "H5Oget_comment"); ret_value = strcmp(grp_comment, check_comment); VERIFY(ret_value, 0, "H5Oget_comment"); @@ -1248,6 +1250,7 @@ test_h5o_comment(void) /* Getting the comment on the datatype and verify it */ comment_len = H5Oget_comment(dtype, NULL, (size_t)0); CHECK(comment_len, FAIL, "H5Oget_comment"); + VERIFY(comment_len, strlen(dtype_comment), "H5Oget_comment"); len = H5Oget_comment(dtype, check_comment, (size_t)comment_len + 1); CHECK(len, FAIL, "H5Oget_comment"); @@ -1265,6 +1268,7 @@ test_h5o_comment(void) len = H5Oget_comment(dset, check_comment, (size_t)comment_len + 1); CHECK(ret, len, "H5Oget_comment"); + VERIFY(len, strlen(dset_comment), "H5Oget_comment"); ret_value = strcmp(dset_comment, check_comment); VERIFY(ret_value, 0, "H5Oget_comment"); @@ -1406,6 +1410,7 @@ test_h5o_comment_by_name(void) len = H5Oget_comment_by_name(fid, ".", check_comment, (size_t)comment_len + 1, H5P_DEFAULT); CHECK(len, FAIL, "H5Oget_comment_by_name"); + VERIFY(len, strlen(file_comment), "H5Oget_comment"); ret_value = strcmp(file_comment, check_comment); VERIFY(ret_value, 0, "H5Oget_comment_by_name"); diff --git a/test/tmisc.c b/test/tmisc.c index a9d94a5ec97..63bf5d8edcb 100644 --- a/test/tmisc.c +++ b/test/tmisc.c @@ -4296,6 +4296,7 @@ test_misc23(void) namelen = H5Iget_name(tmp_id, objname, (size_t)MISC23_NAME_BUF_SIZE); CHECK(namelen, FAIL, "H5Iget_name"); VERIFY_STR(objname, "/A/B01/grp", "H5Iget_name"); + VERIFY(namelen, strlen("/A/B01/grp"), "H5Iget_name"); status = H5Gclose(tmp_id); CHECK(status, FAIL, "H5Gclose"); diff --git a/test/trefer.c b/test/trefer.c index 6e5bd65e48b..b1e4a3854b4 100644 --- a/test/trefer.c +++ b/test/trefer.c @@ -2417,6 +2417,7 @@ test_reference_group(void) H5P_DEFAULT); CHECK(size, (-1), "H5Lget_name_by_idx"); VERIFY_STR(objname, DSETNAME2, "H5Lget_name_by_idx"); + VERIFY(size, strlen(DSETNAME2), "H5Lget_name_by_idx"); ret = H5Oget_info_by_idx3(gid, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)0, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT); From 4eba47a0194551cfd09515792d6b37a9c13c0f04 Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Fri, 23 Aug 2024 09:41:33 -0700 Subject: [PATCH 08/22] Remove HDF-EOS5 CI action (#4750) The code can't be downloaded due to changes that put it behind an EarthData login. We'll disable this while we figure out a work-around. --- .github/workflows/hdfeos5.yml | 51 ----------------------------------- 1 file changed, 51 deletions(-) delete mode 100644 .github/workflows/hdfeos5.yml diff --git a/.github/workflows/hdfeos5.yml b/.github/workflows/hdfeos5.yml deleted file mode 100644 index 4f4fb1adea1..00000000000 --- a/.github/workflows/hdfeos5.yml +++ /dev/null @@ -1,51 +0,0 @@ -name: hdfeos5 1.14 - -# Triggers the workflow on push or pull request or on demand -on: - workflow_dispatch: - push: - pull_request: - branches: [ hdf5_1_14 ] - paths-ignore: - - '.github/CODEOWNERS' - - '.github/FUNDING.yml' - - 'doc/**' - - 'release_docs/**' - - 'ACKNOWLEDGEMENTS' - - 'COPYING**' - - '**.md' - -# Using concurrency to cancel any in-progress job or run -concurrency: - group: ${{ github.workflow }}-${{ github.head_ref && github.ref || github.run_id }} - cancel-in-progress: true - -permissions: - contents: read - -jobs: - build: - name: Build hdfeos5 - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4.1.7 - - - name: Install Autotools Dependencies (Linux) - run: | - sudo apt update - sudo apt install automake autoconf libtool libtool-bin - - name: Install HDF5 - run: | - ./autogen.sh - ./configure --prefix=/usr/local --disable-tests --with-default-api-version=v16 - make - sudo make install - - name: Install HDF-EOS5 - run: | - wget -O HDF-EOS5.2.0.tar.gz "https://git.earthdata.nasa.gov/projects/DAS/repos/hdfeos5/raw/hdf-eos5-2.0-src.tar.gz?at=refs%2Fheads%2FHDFEOS5_2.0" - tar zxvf HDF-EOS5.2.0.tar.gz - cd hdf-eos5-2.0 - ./configure CC=/usr/local/bin/h5cc --prefix=/usr/local/ --enable-install-include - make - make check - sudo make install From f604a25f1bcba6f85b596b373aa73e3d1f5a864a Mon Sep 17 00:00:00 2001 From: bmribler <39579120+bmribler@users.noreply.github.com> Date: Fri, 23 Aug 2024 12:44:48 -0400 Subject: [PATCH 09/22] Replace non-VOL calls with VOL calls - part 2 (#4748) This PR switches H5I_object_verify() to H5VL_vol_object_verify() in the H5F API and fixes documentation of H5Fmount and H5Funmount. * More on H5F API --- src/H5F.c | 74 ++++++++++++++++++++++++------------------------- src/H5Fdeprec.c | 2 +- src/H5Fpublic.h | 10 +++---- test/mount.c | 25 +++++++++++++++++ test/tfile.c | 8 ++++++ 5 files changed, 76 insertions(+), 43 deletions(-) diff --git a/src/H5F.c b/src/H5F.c index 390f667648b..5dd7bda3903 100644 --- a/src/H5F.c +++ b/src/H5F.c @@ -118,7 +118,7 @@ H5Fget_create_plist(hid_t file_id) FUNC_ENTER_API(H5I_INVALID_HID) /* check args */ - if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) + if (NULL == (vol_obj = H5VL_vol_object_verify(file_id, H5I_FILE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid file identifier"); /* Set up VOL callback arguments */ @@ -164,7 +164,7 @@ H5Fget_access_plist(hid_t file_id) FUNC_ENTER_API(H5I_INVALID_HID) /* Check args */ - if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) + if (NULL == (vol_obj = H5VL_vol_object_verify(file_id, H5I_FILE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid file identifier"); /* Set up VOL callback arguments */ @@ -239,7 +239,7 @@ H5Fget_obj_count(hid_t file_id, unsigned types) H5VL_file_get_args_t vol_cb_args; /* Arguments to VOL callback */ /* Get the file object */ - if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) + if (NULL == (vol_obj = H5VL_vol_object_verify(file_id, H5I_FILE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "not a file id"); /* Set up VOL callback arguments */ @@ -358,7 +358,7 @@ H5Fget_obj_ids(hid_t file_id, unsigned types, size_t max_objs, hid_t *oid_list / H5VL_file_get_args_t vol_cb_args; /* Arguments to VOL callback */ /* get the file object */ - if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) + if (NULL == (vol_obj = H5VL_vol_object_verify(file_id, H5I_FILE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid file identifier"); /* Set up VOL callback arguments */ @@ -439,7 +439,7 @@ H5Fget_vfd_handle(hid_t file_id, hid_t fapl_id, void **file_handle /*out*/) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file handle pointer"); /* Get the file object */ - if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) + if (NULL == (vol_obj = H5VL_vol_object_verify(file_id, H5I_FILE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier"); /* Set up VOL callback arguments */ @@ -1226,7 +1226,7 @@ H5Fmount(hid_t loc_id, const char *name, hid_t child_id, hid_t plist_id) H5VL_loc_params_t loc_params; /* Location parameters for object access */ /* Get the location object */ - if (NULL == (vol_obj = (H5VL_object_t *)H5VL_vol_object(loc_id))) + if (NULL == (vol_obj = H5VL_vol_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier"); /* Set location parameters */ @@ -1244,12 +1244,12 @@ H5Fmount(hid_t loc_id, const char *name, hid_t child_id, hid_t plist_id) } /* end if */ else { assert(H5I_GROUP == loc_type); - if (NULL == (loc_vol_obj = (H5VL_object_t *)H5I_object(loc_id))) + if (NULL == (loc_vol_obj = H5VL_vol_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "could not get location object"); } /* end else */ /* Get the child object */ - if (NULL == (child_vol_obj = (H5VL_object_t *)H5I_object(child_id))) + if (NULL == (child_vol_obj = H5VL_vol_object(child_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "could not get child object"); /* Check if both objects are associated with the same VOL connector */ @@ -1336,7 +1336,7 @@ H5Funmount(hid_t loc_id, const char *name) H5VL_loc_params_t loc_params; /* Location parameters for object access */ /* Get the location object */ - if (NULL == (vol_obj = (H5VL_object_t *)H5VL_vol_object(loc_id))) + if (NULL == (vol_obj = H5VL_vol_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier"); /* Set location parameters */ @@ -1354,7 +1354,7 @@ H5Funmount(hid_t loc_id, const char *name) } /* end if */ else { assert(H5I_GROUP == loc_type); - if (NULL == (loc_vol_obj = (H5VL_object_t *)H5I_object(loc_id))) + if (NULL == (loc_vol_obj = H5VL_vol_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "could not get location object"); } /* end else */ @@ -1404,7 +1404,7 @@ H5F__reopen_api_common(hid_t file_id, void **token_ptr) FUNC_ENTER_PACKAGE /* Get the file object */ - if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) + if (NULL == (vol_obj = H5VL_vol_object_verify(file_id, H5I_FILE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid file identifier"); /* Set up VOL callback arguments */ @@ -1555,7 +1555,7 @@ H5Fget_intent(hid_t file_id, unsigned *intent_flags /*out*/) H5VL_file_get_args_t vol_cb_args; /* Arguments to VOL callback */ /* Get the internal file structure */ - if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) + if (NULL == (vol_obj = H5VL_vol_object_verify(file_id, H5I_FILE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier"); /* Set up VOL callback arguments */ @@ -1594,7 +1594,7 @@ H5Fget_fileno(hid_t file_id, unsigned long *fnumber /*out*/) H5VL_file_get_args_t vol_cb_args; /* Arguments to VOL callback */ /* Get the internal file structure */ - if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) + if (NULL == (vol_obj = H5VL_vol_object_verify(file_id, H5I_FILE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier"); /* Set up VOL callback arguments */ @@ -1631,7 +1631,7 @@ H5Fget_freespace(hid_t file_id) FUNC_ENTER_API((-1)) /* Get the file object */ - if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) + if (NULL == (vol_obj = H5VL_vol_object_verify(file_id, H5I_FILE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid file identifier"); /* Set up VOL callback arguments */ @@ -1674,7 +1674,7 @@ H5Fget_filesize(hid_t file_id, hsize_t *size /*out*/) /* Check args */ if (!size) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "size parameter cannot be NULL"); - if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) + if (NULL == (vol_obj = H5VL_vol_object_verify(file_id, H5I_FILE))) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID"); /* Set up VOL callback arguments */ @@ -1739,7 +1739,7 @@ H5Fget_file_image(hid_t file_id, void *buf /*out*/, size_t buf_len) FUNC_ENTER_API((-1)) /* Check args */ - if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) + if (NULL == (vol_obj = H5VL_vol_object_verify(file_id, H5I_FILE))) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "not a file ID"); /* Set up VOL callback arguments */ @@ -1789,7 +1789,7 @@ H5Fget_mdc_config(hid_t file_id, H5AC_cache_config_t *config /*out*/) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Bad config ptr"); /* Get the file object */ - if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) + if (NULL == (vol_obj = H5VL_vol_object_verify(file_id, H5I_FILE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier"); /* Set up VOL callback arguments */ @@ -1827,7 +1827,7 @@ H5Fset_mdc_config(hid_t file_id, const H5AC_cache_config_t *config_ptr) FUNC_ENTER_API(FAIL) /* Get the file object */ - if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) + if (NULL == (vol_obj = H5VL_vol_object_verify(file_id, H5I_FILE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier"); /* Set up VOL callback arguments */ @@ -1868,7 +1868,7 @@ H5Fget_mdc_hit_rate(hid_t file_id, double *hit_rate /*out*/) /* Check args */ if (NULL == hit_rate) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL hit rate pointer"); - if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) + if (NULL == (vol_obj = H5VL_vol_object_verify(file_id, H5I_FILE))) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID"); /* Set up VOL callback arguments */ @@ -1910,7 +1910,7 @@ H5Fget_mdc_size(hid_t file_id, size_t *max_size /*out*/, size_t *min_clean_size FUNC_ENTER_API(FAIL) /* Check args */ - if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) + if (NULL == (vol_obj = H5VL_vol_object_verify(file_id, H5I_FILE))) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID"); /* Set up VOL callback arguments */ @@ -1959,7 +1959,7 @@ H5Freset_mdc_hit_rate_stats(hid_t file_id) FUNC_ENTER_API(FAIL) /* Get the file object */ - if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) + if (NULL == (vol_obj = H5VL_vol_object_verify(file_id, H5I_FILE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier"); /* Set up VOL callback arguments */ @@ -2109,7 +2109,7 @@ H5Fget_metadata_read_retry_info(hid_t file_id, H5F_retry_info_t *info /*out*/) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct"); /* Get the file pointer */ - if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) + if (NULL == (vol_obj = H5VL_vol_object_verify(file_id, H5I_FILE))) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID"); /* Set up VOL callback arguments */ @@ -2149,7 +2149,7 @@ H5Fget_free_sections(hid_t file_id, H5F_mem_t type, size_t nsects, H5F_sect_info FUNC_ENTER_API((-1)) /* Check args */ - if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) + if (NULL == (vol_obj = H5VL_vol_object_verify(file_id, H5I_FILE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid file identifier"); if (sect_info && nsects == 0) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "nsects must be > 0"); @@ -2194,7 +2194,7 @@ H5Fclear_elink_file_cache(hid_t file_id) FUNC_ENTER_API(FAIL) /* Check args */ - if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) + if (NULL == (vol_obj = H5VL_vol_object_verify(file_id, H5I_FILE))) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID"); /* Set up VOL callback arguments */ @@ -2253,7 +2253,7 @@ H5Fstart_swmr_write(hid_t file_id) FUNC_ENTER_API(FAIL) /* Check args */ - if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) + if (NULL == (vol_obj = H5VL_vol_object_verify(file_id, H5I_FILE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hid_t identifier is not a file ID"); /* Set up collective metadata if appropriate */ @@ -2292,7 +2292,7 @@ H5Fstart_mdc_logging(hid_t file_id) FUNC_ENTER_API(FAIL) /* Sanity check */ - if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) + if (NULL == (vol_obj = H5VL_vol_object_verify(file_id, H5I_FILE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hid_t identifier is not a file ID"); /* Set up VOL callback arguments */ @@ -2328,7 +2328,7 @@ H5Fstop_mdc_logging(hid_t file_id) FUNC_ENTER_API(FAIL) /* Sanity check */ - if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) + if (NULL == (vol_obj = H5VL_vol_object_verify(file_id, H5I_FILE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hid_t identifier is not a file ID"); /* Set up VOL callback arguments */ @@ -2365,7 +2365,7 @@ H5Fget_mdc_logging_status(hid_t file_id, hbool_t *is_enabled /*out*/, hbool_t *i FUNC_ENTER_API(FAIL) /* Sanity check */ - if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) + if (NULL == (vol_obj = H5VL_vol_object_verify(file_id, H5I_FILE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hid_t identifier is not a file ID"); /* Set up VOL callback arguments */ @@ -2405,7 +2405,7 @@ H5Fset_libver_bounds(hid_t file_id, H5F_libver_t low, H5F_libver_t high) FUNC_ENTER_API(FAIL) /* Check args */ - if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) + if (NULL == (vol_obj = H5VL_vol_object_verify(file_id, H5I_FILE))) HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "not a file ID"); /* Set up collective metadata if appropriate */ @@ -2447,7 +2447,7 @@ H5Fformat_convert(hid_t file_id) FUNC_ENTER_API(FAIL) /* Check args */ - if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) + if (NULL == (vol_obj = H5VL_vol_object_verify(file_id, H5I_FILE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "file_id parameter is not a valid file identifier"); /* Set up collective metadata if appropriate */ @@ -2485,7 +2485,7 @@ H5Freset_page_buffering_stats(hid_t file_id) FUNC_ENTER_API(FAIL) /* Check args */ - if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) + if (NULL == (vol_obj = H5VL_vol_object_verify(file_id, H5I_FILE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier"); /* Set up VOL callback arguments */ @@ -2522,7 +2522,7 @@ H5Fget_page_buffering_stats(hid_t file_id, unsigned accesses[2] /*out*/, unsigne FUNC_ENTER_API(FAIL) /* Check args */ - if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) + if (NULL == (vol_obj = H5VL_vol_object_verify(file_id, H5I_FILE))) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID"); if (NULL == accesses || NULL == hits || NULL == misses || NULL == evictions || NULL == bypasses) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL input parameters for stats"); @@ -2568,7 +2568,7 @@ H5Fget_mdc_image_info(hid_t file_id, haddr_t *image_addr /*out*/, hsize_t *image FUNC_ENTER_API(FAIL) /* Check args */ - if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) + if (NULL == (vol_obj = H5VL_vol_object_verify(file_id, H5I_FILE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hid_t identifier is not a file ID"); /* Set up VOL callback arguments */ @@ -2605,7 +2605,7 @@ H5Fget_eoa(hid_t file_id, haddr_t *eoa /*out*/) FUNC_ENTER_API(FAIL) /* Check args */ - if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) + if (NULL == (vol_obj = H5VL_vol_object_verify(file_id, H5I_FILE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hid_t identifier is not a file ID"); /* Only do work if valid pointer to fill in */ @@ -2647,7 +2647,7 @@ H5Fincrement_filesize(hid_t file_id, hsize_t increment) FUNC_ENTER_API(FAIL) /* Check args */ - if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) + if (NULL == (vol_obj = H5VL_vol_object_verify(file_id, H5I_FILE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hid_t identifier is not a file ID"); /* Set up VOL callback arguments */ @@ -2686,7 +2686,7 @@ H5Fget_dset_no_attrs_hint(hid_t file_id, hbool_t *minimize /*out*/) /* Check args */ if (NULL == minimize) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "out pointer 'minimize' cannot be NULL"); - if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) + if (NULL == (vol_obj = H5VL_vol_object_verify(file_id, H5I_FILE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier"); /* Set up VOL callback arguments */ @@ -2723,7 +2723,7 @@ H5Fset_dset_no_attrs_hint(hid_t file_id, hbool_t minimize) FUNC_ENTER_API(FAIL) /* Check args */ - if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) + if (NULL == (vol_obj = H5VL_vol_object_verify(file_id, H5I_FILE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier"); /* Set up VOL callback arguments */ diff --git a/src/H5Fdeprec.c b/src/H5Fdeprec.c index 06141de767b..c7552840bc1 100644 --- a/src/H5Fdeprec.c +++ b/src/H5Fdeprec.c @@ -214,7 +214,7 @@ H5Fset_latest_format(hid_t file_id, hbool_t latest_format) FUNC_ENTER_API(FAIL) /* Check args */ - if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) + if (NULL == (vol_obj = H5VL_vol_object_verify(file_id, H5I_FILE))) HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "not a file ID"); /* Set up collective metadata if appropriate */ diff --git a/src/H5Fpublic.h b/src/H5Fpublic.h index 91b307bae40..a54e4274302 100644 --- a/src/H5Fpublic.h +++ b/src/H5Fpublic.h @@ -873,7 +873,7 @@ H5_DLL herr_t H5Fget_vfd_handle(hid_t file_id, hid_t fapl, void **file_handle); * * \brief Mounts an HDF5 file * - * \loc_id{loc} + * \fg_loc_id{loc_id} * \param[in] name Name of the group onto which the file specified by \p child * is to be mounted * \file_id{child} @@ -897,13 +897,13 @@ H5_DLL herr_t H5Fget_vfd_handle(hid_t file_id, hid_t fapl, void **file_handle); * \since 1.0.0 * */ -H5_DLL herr_t H5Fmount(hid_t loc, const char *name, hid_t child, hid_t plist); +H5_DLL herr_t H5Fmount(hid_t loc_id, const char *name, hid_t child, hid_t plist); /** * \ingroup H5F * - * \brief Unounts an HDF5 file + * \brief Un-mounts an HDF5 file * - * \loc_id{loc} + * \fg_loc_id{loc_id} * \param[in] name Name of the mount point * * \return \herr_t @@ -921,7 +921,7 @@ H5_DLL herr_t H5Fmount(hid_t loc, const char *name, hid_t child, hid_t plist); * \since 1.0.0 * */ -H5_DLL herr_t H5Funmount(hid_t loc, const char *name); +H5_DLL herr_t H5Funmount(hid_t loc_id, const char *name); /** * \ingroup H5F * diff --git a/test/mount.c b/test/mount.c index 92a0c13d84c..2d833fbf102 100644 --- a/test/mount.c +++ b/test/mount.c @@ -164,6 +164,7 @@ test_illegal(hid_t fapl) { hid_t file1 = H5I_INVALID_HID, file1b = H5I_INVALID_HID, file2 = H5I_INVALID_HID, file3 = H5I_INVALID_HID, file3b = H5I_INVALID_HID, mnt = H5I_INVALID_HID; + hid_t dtype = H5I_INVALID_HID; /* To test invalid ID */ char filename1[1024], filename2[1024], filename3[1024]; herr_t status; @@ -259,6 +260,30 @@ test_illegal(hid_t fapl) if (H5Funmount(file1, "/mnt1") < 0) FAIL_STACK_ERROR; + /* Try passing in IDs that are not a file or group ID */ + if ((dtype = H5Tcopy(H5T_C_S1)) < 0) + FAIL_STACK_ERROR; + H5E_BEGIN_TRY + { + status = H5Fmount(dtype, "/mnt1", file1b, H5P_DEFAULT); + } + H5E_END_TRY + if (status >= 0) { + H5_FAILED(); + puts(" Passing in an ID other than file or group ID should have failed."); + TEST_ERROR; + } /* end if */ + H5E_BEGIN_TRY + { + status = H5Funmount(dtype, "/mnt1"); + } + H5E_END_TRY + if (status >= 0) { + H5_FAILED(); + puts(" Passing in an ID other than file or group ID should have failed."); + TEST_ERROR; + } /* end if */ + /* Close everything and return */ if (H5Fclose(file1) < 0) FAIL_STACK_ERROR; diff --git a/test/tfile.c b/test/tfile.c index 7bf63d30e96..f93051e6aff 100644 --- a/test/tfile.c +++ b/test/tfile.c @@ -8197,6 +8197,14 @@ test_deprec(const char *driver_name) fcpl = H5Fget_create_plist(file); CHECK(fcpl, FAIL, "H5Fget_create_plist"); + /* Test passing in an ID that is not a file ID, should fail */ + H5E_BEGIN_TRY + { + ret = H5Fset_latest_format(fcpl, true); + } + H5E_END_TRY + VERIFY(ret, FAIL, "H5Fset_latest_format"); + /* Get the file's version information */ ret = H5Pget_version(fcpl, &super, &freelist, &stab, &shhdr); CHECK(ret, FAIL, "H5Pget_version"); From 874e727bb6070c004f02e2203c17f664e814dec1 Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Fri, 23 Aug 2024 15:22:40 -0700 Subject: [PATCH 10/22] Restore rand_r in a few parallel tests (#4749) The t_pmulti_dset and t_select_io_dset tests rely on the behavior of the previous private rand_r-like implementation to get the correct sequence of random numbers to pass. This has been restored using a fully private rand_r-like implementation that doesn't rely on rand_r and will work on Windows and other platforms where rand_r doesn't exist. --- test/h5test.c | 21 +++++++++++++++++ test/h5test.h | 8 +++++++ testpar/t_pmulti_dset.c | 46 ++++++++++++++++++++------------------ testpar/t_select_io_dset.c | 14 ++++++------ 4 files changed, 60 insertions(+), 29 deletions(-) diff --git a/test/h5test.c b/test/h5test.c index c524d4b8d3d..f4a371ff42f 100644 --- a/test/h5test.c +++ b/test/h5test.c @@ -2555,3 +2555,24 @@ h5_driver_uses_multiple_files(const char *drv_name, unsigned flags) return ret_val; } + +/* Deterministic random number functions that don't modify the underlying + * C/POSIX library rand/random state, as this can cause spurious test failures. + * + * Adapted from the example code in the POSIX.1-2001 standard. + */ + +static unsigned int next_g = 1; + +int +h5_local_rand(void) +{ + next_g = next_g * 1103515245 + 12345; + return next_g & RAND_MAX; +} + +void +h5_local_srand(unsigned int seed) +{ + next_g = seed; +} diff --git a/test/h5test.h b/test/h5test.h index 238bd38acd6..1ec537c62e3 100644 --- a/test/h5test.h +++ b/test/h5test.h @@ -319,6 +319,14 @@ H5TEST_DLL herr_t h5_using_parallel_driver(hid_t fapl_id, bool *driver_i H5TEST_DLL herr_t h5_driver_is_default_vfd_compatible(hid_t fapl_id, bool *default_vfd_compatible); H5TEST_DLL bool h5_driver_uses_multiple_files(const char *drv_name, unsigned flags); +/* Random number functions that don't modify the underlying rand/random state. + * These use rand_r with a state pointer under the hood. The state is always + * initialized to the same value so that each process in the parallel tests + * always gets the same sequence. + */ +H5TEST_DLL int h5_local_rand(void); +H5TEST_DLL void h5_local_srand(unsigned int seed); + /* Functions that will replace components of a FAPL */ H5TEST_DLL herr_t h5_get_vfd_fapl(hid_t fapl_id); H5TEST_DLL herr_t h5_get_libver_fapl(hid_t fapl_id); diff --git a/testpar/t_pmulti_dset.c b/testpar/t_pmulti_dset.c index f0d49291ad4..e9819840cb3 100644 --- a/testpar/t_pmulti_dset.c +++ b/testpar/t_pmulti_dset.c @@ -267,7 +267,7 @@ test_pmdset(size_t niter, unsigned flags) for (i = 0; i < niter; i++) { /* Determine number of datasets */ ndsets = (flags & MDSET_FLAG_MLAYOUT) ? 3 - : (flags & MDSET_FLAG_MDSET) ? (size_t)((size_t)HDrandom() % max_dsets) + 1 + : (flags & MDSET_FLAG_MDSET) ? (size_t)((size_t)h5_local_rand() % max_dsets) + 1 : 1; /* Create file */ @@ -280,16 +280,16 @@ test_pmdset(size_t niter, unsigned flags) (flags & MDSET_FLAG_CHUNK) || ((flags & MDSET_FLAG_MLAYOUT) && (j == 1 || j == 2)); /* Generate file dataspace */ - dset_dims[j][0] = (hsize_t)((HDrandom() % MAX_DSET_X) + 1); - dset_dims[j][1] = (hsize_t)((HDrandom() % MAX_DSET_Y) + 1); + dset_dims[j][0] = (hsize_t)((h5_local_rand() % MAX_DSET_X) + 1); + dset_dims[j][1] = (hsize_t)((h5_local_rand() % MAX_DSET_Y) + 1); if ((file_space_ids[j] = H5Screate_simple(2, dset_dims[j], use_chunk ? max_dims : NULL)) < 0) T_PMD_ERROR; /* Generate chunk if called for by configuration (multi layout uses chunked for datasets * 1 and 2) */ if (use_chunk) { - chunk_dims[0] = (hsize_t)((HDrandom() % MAX_CHUNK_X) + 1); - chunk_dims[1] = (hsize_t)((HDrandom() % MAX_CHUNK_Y) + 1); + chunk_dims[0] = (hsize_t)((h5_local_rand() % MAX_CHUNK_X) + 1); + chunk_dims[1] = (hsize_t)((h5_local_rand() % MAX_CHUNK_Y) + 1); if (H5Pset_chunk(dcpl_id[j], 2, chunk_dims) < 0) T_PMD_ERROR; } /* end if */ @@ -298,8 +298,8 @@ test_pmdset(size_t niter, unsigned flags) /* If MDSET_FLAG_TCONV is set, use a different datatype with 50% probability, so * some datasets require type conversion and others do not */ if ((dset_ids[j] = H5Dcreate2(file_id, dset_name[j], - (flags & MDSET_FLAG_TCONV && HDrandom() % 2) ? H5T_NATIVE_LONG - : H5T_NATIVE_UINT, + (flags & MDSET_FLAG_TCONV && h5_local_rand() % 2) ? H5T_NATIVE_LONG + : H5T_NATIVE_UINT, file_space_ids[j], H5P_DEFAULT, dcpl_id[j], H5P_DEFAULT)) < 0) T_PMD_ERROR; } /* end for */ @@ -325,7 +325,7 @@ test_pmdset(size_t niter, unsigned flags) /* Perform read/write operations */ for (j = 0; j < OPS_PER_FILE; j++) { /* Decide whether to read or write */ - do_read = (bool)(HDrandom() % 2); + do_read = (bool)(h5_local_rand() % 2); /* Barrier to ensure processes have finished the previous operation */ @@ -387,9 +387,9 @@ test_pmdset(size_t niter, unsigned flags) (int)((unsigned)max_dsets * MAX_DSET_X * MAX_DSET_Y) * ((int)l - (int)mpi_rank); /* Decide whether to do a hyperslab or point selection */ - if (HDrandom() % 2) { + if (h5_local_rand() % 2) { /* Hyperslab */ - size_t nhs = (size_t)((HDrandom() % MAX_HS) + 1); /* Number of hyperslabs */ + size_t nhs = (size_t)((h5_local_rand() % MAX_HS) + 1); /* Number of hyperslabs */ size_t max_hs_x = (MAX_HS_X <= dset_dims[k][0]) ? MAX_HS_X : dset_dims[k][0]; /* Determine maximum hyperslab size in X */ @@ -401,14 +401,16 @@ test_pmdset(size_t niter, unsigned flags) overlap = true; for (n = 0; overlap && (n < MAX_SEL_RETRIES); n++) { /* Generate hyperslab */ - count[m][0] = (hsize_t)(((hsize_t)HDrandom() % max_hs_x) + 1); - count[m][1] = (hsize_t)(((hsize_t)HDrandom() % max_hs_y) + 1); - start[m][0] = (count[m][0] == dset_dims[k][0]) - ? 0 - : (hsize_t)HDrandom() % (dset_dims[k][0] - count[m][0] + 1); - start[m][1] = (count[m][1] == dset_dims[k][1]) - ? 0 - : (hsize_t)HDrandom() % (dset_dims[k][1] - count[m][1] + 1); + count[m][0] = (hsize_t)(((hsize_t)h5_local_rand() % max_hs_x) + 1); + count[m][1] = (hsize_t)(((hsize_t)h5_local_rand() % max_hs_y) + 1); + start[m][0] = + (count[m][0] == dset_dims[k][0]) + ? 0 + : (hsize_t)h5_local_rand() % (dset_dims[k][0] - count[m][0] + 1); + start[m][1] = + (count[m][1] == dset_dims[k][1]) + ? 0 + : (hsize_t)h5_local_rand() % (dset_dims[k][1] - count[m][1] + 1); /* If writing, check for overlap with other processes */ overlap = false; @@ -461,7 +463,7 @@ test_pmdset(size_t niter, unsigned flags) else { /* Point selection */ size_t npoints = - (size_t)(((size_t)HDrandom() % MAX_POINTS) + 1); /* Number of points */ + (size_t)(((size_t)h5_local_rand() % MAX_POINTS) + 1); /* Number of points */ /* Reset dataset usage array if reading, since in this case we don't care * about overlapping selections between processes */ @@ -473,8 +475,8 @@ test_pmdset(size_t niter, unsigned flags) overlap = true; for (n = 0; overlap && (n < MAX_SEL_RETRIES); n++) { /* Generate point */ - points[2 * m] = (unsigned)((hsize_t)HDrandom() % dset_dims[k][0]); - points[(2 * m) + 1] = (unsigned)((hsize_t)HDrandom() % dset_dims[k][1]); + points[2 * m] = (unsigned)((hsize_t)h5_local_rand() % dset_dims[k][0]); + points[(2 * m) + 1] = (unsigned)((hsize_t)h5_local_rand() % dset_dims[k][1]); /* Check for overlap with other processes (write) or this process * (always) */ @@ -665,7 +667,7 @@ main(int argc, char *argv[]) /* Seed random number generator with shared seed (so all ranks generate the * same sequence) */ - HDsrandom(seed); + h5_local_srand(seed); /* Fill dset_name array */ for (i = 0; i < MAX_DSETS; i++) { diff --git a/testpar/t_select_io_dset.c b/testpar/t_select_io_dset.c index 2afe65e7b9d..a6e62c6f8e5 100644 --- a/testpar/t_select_io_dset.c +++ b/testpar/t_select_io_dset.c @@ -1588,7 +1588,7 @@ test_multi_dsets_no_bkg(hid_t fid, unsigned chunked, unsigned dtrans, unsigned s mwbuf ? "mwbuf" : "nomwbuf"); /* Flip a coin to see if we're doing type conversion */ - tconv = HDrandom() % 2; + tconv = h5_local_rand() % 2; if (tconv) any_tconv = true; @@ -2079,7 +2079,7 @@ test_multi_dsets_cmpd_with_bkg(hid_t fid, unsigned chunked, unsigned select, uns } /* Case c */ - mm = HDrandom() % (int)ndsets; + mm = h5_local_rand() % (int)ndsets; if (!mm) mm++; @@ -2719,9 +2719,9 @@ test_multi_dsets_conv_sel_empty(hid_t fid, unsigned chunked, unsigned dtrans, un P_TEST_ERROR; } else { - if ((dset_dids[i] = - H5Dcreate2(fid, dset_names[i], ((HDrandom() % 2) ? H5T_NATIVE_LLONG : H5T_NATIVE_SHORT), - file_sids[i], H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) + if ((dset_dids[i] = H5Dcreate2(fid, dset_names[i], + ((h5_local_rand() % 2) ? H5T_NATIVE_LLONG : H5T_NATIVE_SHORT), + file_sids[i], H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) P_TEST_ERROR; } } @@ -2790,7 +2790,7 @@ test_multi_dsets_conv_sel_empty(hid_t fid, unsigned chunked, unsigned dtrans, un * process 0: get 0 row; other processes: hyperslab */ - mm = HDrandom() % (int)ndsets; + mm = h5_local_rand() % (int)ndsets; if (mm == 0) mm++; @@ -3169,7 +3169,7 @@ test_multi_dsets_all(int niter, hid_t fid, unsigned chunked, unsigned select, un if ((mem_sids[i] = H5Screate_simple(1, block, NULL)) < 0) P_TEST_ERROR; - mm = HDrandom() % (int)ndsets; + mm = h5_local_rand() % (int)ndsets; if (mm == 0) { dset_types[i] = DSET_WITH_NO_CONV; snprintf(dset_names[i], sizeof(dset_names[i]), "multi_all_nconv_dset%d_%s_%s_%s", i, From 77da1056837d6860d163a77580bbd1b5c768a7a4 Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Fri, 23 Aug 2024 19:37:28 -0700 Subject: [PATCH 11/22] Don't run AOCC parallel tests with -j2 (#4752) Don't run parallel tests in both Autotools and CMake with multiple processes. ph5diff still runs with -j2 w/ Autotools since the test script is in the tools/test/h5diff directory. * Split off AOCC CMake parallel tests * Remove unnecessary NPROCS env vars * Put NPROCS back in serial tests We run ph5diff tests there --- .github/workflows/aocc-auto.yml | 16 ++++++++++++---- .github/workflows/aocc-cmake.yml | 8 +++++++- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/.github/workflows/aocc-auto.yml b/.github/workflows/aocc-auto.yml index 7ca5b50ccfd..8e87fb74604 100644 --- a/.github/workflows/aocc-auto.yml +++ b/.github/workflows/aocc-auto.yml @@ -79,24 +79,32 @@ jobs: - name: Autotools Build shell: bash - env: - NPROCS: 2 run: | export PATH=/home/runner/work/hdf5/hdf5/openmpi-4.1.6-install/bin:/usr/local/bin:$PATH make -j3 working-directory: ${{ runner.workspace }}/build + # ph5diff tests are in the tools/tests directory so they will get run + # here, so leave NPROCS set here as well - name: Autotools Run Tests env: NPROCS: 2 run: | export PATH=/home/runner/work/hdf5/hdf5/openmpi-4.1.6-install/bin:/usr/local/bin:$PATH - make check -j + cd test && make check -j2 && cd .. + cd tools && make check -j2 && cd .. + cd hl && make check -j2 && cd .. working-directory: ${{ runner.workspace }}/build - - name: Autotools Install + - name: Autotools Run Parallel Tests env: NPROCS: 2 + run: | + export PATH=/home/runner/work/hdf5/hdf5/openmpi-4.1.6-install/bin:/usr/local/bin:$PATH + cd testpar && make check && cd .. + working-directory: ${{ runner.workspace }}/build + + - name: Autotools Install run: | export PATH=/home/runner/work/hdf5/hdf5/openmpi-4.1.6-install/bin:/usr/local/bin:$PATH make install diff --git a/.github/workflows/aocc-cmake.yml b/.github/workflows/aocc-cmake.yml index 947a38e3696..1e49511dfcc 100644 --- a/.github/workflows/aocc-cmake.yml +++ b/.github/workflows/aocc-cmake.yml @@ -89,5 +89,11 @@ jobs: - name: CMake Run Tests shell: bash run: | - ctest . --parallel 2 -C ${{ inputs.build_mode }} -V + ctest . -E MPI_TEST --parallel 2 -C ${{ inputs.build_mode }} -V + working-directory: ${{ runner.workspace }}/build + + - name: CMake Run Parallel Tests + shell: bash + run: | + ctest . -R MPI_TEST -C ${{ inputs.build_mode }} -V working-directory: ${{ runner.workspace }}/build From 3fa8ec0d85bc2600d2bf1d95c8c42d872fbed163 Mon Sep 17 00:00:00 2001 From: bmribler <39579120+bmribler@users.noreply.github.com> Date: Mon, 26 Aug 2024 12:04:18 -0400 Subject: [PATCH 12/22] Replace non-VOL calls with VOL calls - part 3 (#4756) This PR switches H5I_object_verify() to H5VL_vol_object_verify() in the H5G API and removes unnecessary casts. --- src/H5G.c | 8 ++++---- src/H5L.c | 4 ++-- src/H5Ldeprec.c | 12 ++++++------ test/th5o.c | 9 +++++++++ 4 files changed, 21 insertions(+), 12 deletions(-) diff --git a/src/H5G.c b/src/H5G.c index ede81551b9c..88d617afc3d 100644 --- a/src/H5G.c +++ b/src/H5G.c @@ -340,7 +340,7 @@ H5Gcreate_anon(hid_t loc_id, hid_t gcpl_id, hid_t gapl_id) loc_params.obj_type = H5I_get_type(loc_id); /* Get the location object */ - if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) + if (NULL == (vol_obj = H5VL_vol_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier"); /* Create the group */ @@ -507,7 +507,7 @@ H5Gget_create_plist(hid_t group_id) FUNC_ENTER_API(H5I_INVALID_HID) /* Check args */ - if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(group_id, H5I_GROUP))) + if (NULL == (vol_obj = H5VL_vol_object_verify(group_id, H5I_GROUP))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a group ID"); /* Set up VOL callback arguments */ @@ -960,7 +960,7 @@ H5Gflush(hid_t group_id) FUNC_ENTER_API(FAIL) /* Check args */ - if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(group_id, H5I_GROUP))) + if (NULL == (vol_obj = H5VL_vol_object_verify(group_id, H5I_GROUP))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group ID"); /* Set up collective metadata if appropriate */ @@ -998,7 +998,7 @@ H5Grefresh(hid_t group_id) FUNC_ENTER_API(FAIL) /* Check args */ - if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(group_id, H5I_GROUP))) + if (NULL == (vol_obj = H5VL_vol_object_verify(group_id, H5I_GROUP))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group ID"); /* Set up collective metadata if appropriate */ diff --git a/src/H5L.c b/src/H5L.c index eb731f1832e..cbc584f6b44 100644 --- a/src/H5L.c +++ b/src/H5L.c @@ -468,11 +468,11 @@ H5L__create_hard_api_common(hid_t cur_loc_id, const char *cur_name, hid_t link_l if (H5L_SAME_LOC != cur_loc_id) /* Get the current location object */ - if (NULL == (curr_vol_obj = (H5VL_object_t *)H5VL_vol_object(cur_loc_id))) + if (NULL == (curr_vol_obj = H5VL_vol_object(cur_loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier"); if (H5L_SAME_LOC != link_loc_id) /* Get the new location object */ - if (NULL == (link_vol_obj = (H5VL_object_t *)H5VL_vol_object(link_loc_id))) + if (NULL == (link_vol_obj = H5VL_vol_object(link_loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier"); /* Make sure that the VOL connectors are the same */ diff --git a/src/H5Ldeprec.c b/src/H5Ldeprec.c index c5f8470c912..819aea87f10 100644 --- a/src/H5Ldeprec.c +++ b/src/H5Ldeprec.c @@ -162,7 +162,7 @@ H5Literate1(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, hsize_t HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no operator specified"); /* Get the location object */ - if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(group_id))) + if (NULL == (vol_obj = H5VL_vol_object(group_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier"); /* Check if the VOL object is a native VOL connector object */ @@ -248,7 +248,7 @@ H5Literate_by_name1(hid_t loc_id, const char *group_name, H5_index_t idx_type, H HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info"); /* Get the location object */ - if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) + if (NULL == (vol_obj = H5VL_vol_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier"); /* Check if the VOL object is a native VOL connector object */ @@ -325,7 +325,7 @@ H5Lget_info1(hid_t loc_id, const char *name, H5L_info1_t *linfo /*out*/, hid_t l loc_params.loc_data.loc_by_name.lapl_id = lapl_id; /* Get the location object */ - if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) + if (NULL == (vol_obj = H5VL_vol_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier"); /* Check if the VOL object is a native VOL connector object */ @@ -416,7 +416,7 @@ H5Lget_info_by_idx1(hid_t loc_id, const char *group_name, H5_index_t idx_type, H loc_params.obj_type = H5I_get_type(loc_id); /* Get the location object */ - if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) + if (NULL == (vol_obj = H5VL_vol_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier"); /* Check if the VOL object is a native VOL connector object */ @@ -515,7 +515,7 @@ H5Lvisit1(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, H5L_iterat loc_params.obj_type = H5I_get_type(group_id); /* Get the location object */ - if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(group_id))) + if (NULL == (vol_obj = H5VL_vol_object(group_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier"); /* Check if the VOL object is a native VOL connector object */ @@ -604,7 +604,7 @@ H5Lvisit_by_name1(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_ HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info"); /* get the location object */ - if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) + if (NULL == (vol_obj = H5VL_vol_object(loc_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier"); /* Check if the VOL object is a native VOL connector object */ diff --git a/test/th5o.c b/test/th5o.c index 0ea8d927e83..815b5648e4d 100644 --- a/test/th5o.c +++ b/test/th5o.c @@ -752,6 +752,7 @@ test_h5o_plist(void) hid_t grp, dset, dtype, dspace; /* Object identifiers */ hid_t fapl; /* File access property list */ hid_t gcpl, dcpl, tcpl; /* Object creation properties */ + hid_t bad_pl = H5I_INVALID_HID; /* Invalid property list dues to invalid arg */ char filename[1024]; unsigned def_max_compact, def_min_dense; /* Default phase change parameters */ unsigned max_compact, min_dense; /* Actual phase change parameters */ @@ -854,6 +855,14 @@ test_h5o_plist(void) dcpl = H5Dget_create_plist(dset); CHECK(dcpl, FAIL, "H5Dget_create_plist"); + /* Test passing in a non-group identifier to the H5G API */ + H5E_BEGIN_TRY + { + bad_pl = H5Gget_create_plist(dtype); + } + H5E_END_TRY + VERIFY(bad_pl, H5I_INVALID_HID, "H5Gget_create_plist"); + /* Retrieve attribute phase change values on each creation property list and verify */ ret = H5Pget_attr_phase_change(gcpl, &max_compact, &min_dense); CHECK(ret, FAIL, "H5Pget_attr_phase_change"); From 2c7edff0668e12255ba17d91474871326b319c26 Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Mon, 26 Aug 2024 09:32:44 -0700 Subject: [PATCH 13/22] Turn on parallel CI tests in Autotools & CMake (#4573) --- .github/workflows/main-auto-par.yml | 26 ++++++++++++++++++++++++-- .github/workflows/main-cmake-par.yml | 13 +++++++++++++ 2 files changed, 37 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main-auto-par.yml b/.github/workflows/main-auto-par.yml index d5f18189249..39ce70767ef 100644 --- a/.github/workflows/main-auto-par.yml +++ b/.github/workflows/main-auto-par.yml @@ -50,8 +50,9 @@ jobs: - name: Get Sources uses: actions/checkout@v4.1.7 - # AUTOTOOLS CONFIGURE - name: Autotools Configure + env: + NPROCS: 2 run: | sh ./autogen.sh mkdir "${{ runner.workspace }}/build" @@ -71,7 +72,28 @@ jobs: --with-szlib=yes shell: bash - # BUILD - name: Autotools Build run: make -j3 working-directory: ${{ runner.workspace }}/build + + # ph5diff tests are in the tools/tests directory so they will get run + # here, so leave NPROCS set here as well + - name: Autotools Run Tests + env: + NPROCS: 2 + run: | + cd test && make check -j2 && cd .. + cd tools && make check -j2 && cd .. + cd hl && make check -j2 && cd .. + cd fortran/test && make check -j2 && cd ../.. + working-directory: ${{ runner.workspace }}/build + if: ${{ inputs.thread_safety == 'disable' }} + + - name: Autotools Run Parallel Tests + env: + NPROCS: 2 + run: | + cd testpar && make check && cd .. + cd fortran/testpar && make check -j2 && cd ../.. + working-directory: ${{ runner.workspace }}/build + if: ${{ inputs.thread_safety == 'disable' }} diff --git a/.github/workflows/main-cmake-par.yml b/.github/workflows/main-cmake-par.yml index b7e22655313..2e724bf031e 100644 --- a/.github/workflows/main-cmake-par.yml +++ b/.github/workflows/main-cmake-par.yml @@ -62,3 +62,16 @@ jobs: - name: CMake Build run: cmake --build . --parallel 3 --config ${{ inputs.build_mode }} working-directory: ${{ runner.workspace }}/build + + # + # RUN TESTS + # + - name: CMake Run Tests + run: ctest . -E MPI_TEST --parallel 2 -C ${{ inputs.build_mode }} -V + working-directory: ${{ runner.workspace }}/build + if: ${{ matrix.run_tests && (inputs.thread_safety != 'TS') }} + + - name: CMake Run Parallel Tests + run: ctest . -R MPI_TEST -C ${{ inputs.build_mode }} -V + working-directory: ${{ runner.workspace }}/build + if: ${{ matrix.run_tests && (inputs.thread_safety != 'TS') }} From c4567627206198fc663da2d4c1a651df85254c90 Mon Sep 17 00:00:00 2001 From: "H. Joe Lee" Date: Mon, 26 Aug 2024 12:25:27 -0500 Subject: [PATCH 14/22] Fix typo in H5Centry.c (#4762) --- src/H5Centry.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/H5Centry.c b/src/H5Centry.c index 6883e897186..1ca7479cf7e 100644 --- a/src/H5Centry.c +++ b/src/H5Centry.c @@ -3131,7 +3131,7 @@ H5C_protect(H5F_t *f, const H5C_class_t *type, haddr_t addr, void *udata, unsign else empty_space = cache_ptr->max_cache_size - cache_ptr->index_size; - /* try to free up if necceary and if evictions are permitted. Note + /* try to free up if necessary and if evictions are permitted. Note * that if evictions are enabled, we will call H5C__make_space_in_cache() * regardless if the min_free_space requirement is not met. */ From 94168016e4208eefda0f0d04d8ebd3603491904e Mon Sep 17 00:00:00 2001 From: jhendersonHDF Date: Mon, 26 Aug 2024 12:38:31 -0500 Subject: [PATCH 15/22] Set/Unset VOL wrapping context in H5VL_attr_close (#4759) --- src/H5VLcallback.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/H5VLcallback.c b/src/H5VLcallback.c index 1662776ef9c..58e839c9985 100644 --- a/src/H5VLcallback.c +++ b/src/H5VLcallback.c @@ -1744,18 +1744,28 @@ H5VL__attr_close(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req) herr_t H5VL_attr_close(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req) { - herr_t ret_value = SUCCEED; /* Return value */ + bool vol_wrapper_set = false; /* Whether the VOL object wrapping context was set up */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ assert(vol_obj); + /* Set wrapper info in API context */ + if (H5VL_set_vol_wrapper(vol_obj) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info"); + vol_wrapper_set = true; + /* Call the corresponding internal VOL routine */ if (H5VL__attr_close(vol_obj->data, vol_obj->connector->cls, dxpl_id, req) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "attribute close failed"); done: + /* Reset object wrapping info in API context */ + if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info"); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_attr_close() */ From e9663b546cdc34012c56f3b1fdfcee719785da8d Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Mon, 26 Aug 2024 10:47:54 -0700 Subject: [PATCH 16/22] Add missing C++ and Fortran to Intel oneAPI CI (#4761) * Add Fortran and C++ to Autotools * Add Fortran and C++ to Linux CMake * Add C++ to Windows CMake * Fix bad GitHub workspace variable --- .github/workflows/intel-auto.yml | 3 ++- .github/workflows/intel-cmake.yml | 10 +++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/workflows/intel-auto.yml b/.github/workflows/intel-auto.yml index e5515d0e775..4b90bfc571e 100644 --- a/.github/workflows/intel-auto.yml +++ b/.github/workflows/intel-auto.yml @@ -46,7 +46,8 @@ jobs: $GITHUB_WORKSPACE/configure \ --enable-build-mode=${{ inputs.build_mode }} \ --enable-shared \ - --disable-fortran + --enable-cxx \ + --enable-fortran - name: Autotools Build shell: bash diff --git a/.github/workflows/intel-cmake.yml b/.github/workflows/intel-cmake.yml index 7a27243d446..f71ae1414b8 100644 --- a/.github/workflows/intel-cmake.yml +++ b/.github/workflows/intel-cmake.yml @@ -43,13 +43,13 @@ jobs: run: | mkdir "${{ runner.workspace }}/build" cd "${{ runner.workspace }}/build" - cmake -C $GITHUB_WORKSPACE/config/cmake/cacheinit.cmake \ - -G Ninja \ - --log-level=VERBOSE \ + cmake -C $GITHUB_WORKSPACE/config/cmake/cacheinit.cmake -G Ninja --log-level=VERBOSE \ -DCMAKE_BUILD_TYPE=${{ inputs.build_mode }} \ + -DHDF5_BUILD_FORTRAN:BOOL=ON \ + -DHDF5_BUILD_CPP_LIB:BOOL=ON \ -DLIBAEC_USE_LOCALCONTENT=OFF \ -DZLIB_USE_LOCALCONTENT=OFF \ - $GITHUB_WORKSPACE + ${{ github.workspace }} - name: CMake Build (Linux) shell: bash @@ -97,7 +97,7 @@ jobs: run: | mkdir "${{ runner.workspace }}/build" Set-Location -Path "${{ runner.workspace }}\\build" - cmake -C ${{ github.workspace }}/config/cmake/cacheinit.cmake -G Ninja -DCMAKE_BUILD_TYPE=${{ inputs.build_mode }} -DHDF5_BUILD_FORTRAN=ON -DLIBAEC_USE_LOCALCONTENT=OFF -DZLIB_USE_LOCALCONTENT=OFF ${{ github.workspace }} + cmake -C ${{ github.workspace }}/config/cmake/cacheinit.cmake -G Ninja -DCMAKE_BUILD_TYPE=${{ inputs.build_mode }} -DHDF5_BUILD_FORTRAN=ON -DHDF5_BUILD_CPP_LIB=ON -DLIBAEC_USE_LOCALCONTENT=OFF -DZLIB_USE_LOCALCONTENT=OFF ${{ github.workspace }} - name: CMake Build (Windows) shell: pwsh From 021d36afd9279be34ed41cbadb44632e6bd5b83f Mon Sep 17 00:00:00 2001 From: mattjala <124107509+mattjala@users.noreply.github.com> Date: Mon, 26 Aug 2024 13:29:13 -0500 Subject: [PATCH 17/22] Remove early test exit (#4757) * Don't skip file tests * Remove test with invalid flag for H5Fopen * Verify that create/open of unseekable file fails * Remove failure verification --- test/tfile.c | 35 ++++++++++++++--------------------- 1 file changed, 14 insertions(+), 21 deletions(-) diff --git a/test/tfile.c b/test/tfile.c index f93051e6aff..721b8d2b656 100644 --- a/test/tfile.c +++ b/test/tfile.c @@ -8103,45 +8103,38 @@ test_min_dset_ohdr(void) /**************************************************************** ** ** test_unseekable_file(): -** Test that attempting to open an unseekable file fails gracefully +** Test that attempting to create/open an unseekable file fails gracefully ** without a segfault (see hdf5#1498) ****************************************************************/ static void test_unseekable_file(void) { - hid_t file_id = H5I_INVALID_HID; /* File ID */ - /* Output message about test being performed */ MESSAGE(5, ("Testing creating/opening an unseekable file\n")); - /* Creation */ -#ifdef H5_HAVE_WIN32_API - file_id = H5Fcreate("NUL", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); -#else - file_id = H5Fcreate("/dev/null", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); -#endif - - H5Fclose(file_id); + /* Flush message in case this test segfaults */ + fflush(stdout); - /* Open, truncate */ + /* Creation */ #ifdef H5_HAVE_WIN32_API - file_id = H5Fopen("NUL", H5F_ACC_TRUNC, H5P_DEFAULT); + H5Fcreate("NUL", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); #else - file_id = H5Fopen("/dev/null", H5F_ACC_TRUNC, H5P_DEFAULT); + H5Fcreate("/dev/null", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); #endif - H5Fclose(file_id); + /* Should fail without segfault */ + /* TODO - Does not properly fail on all systems */ + /* VERIFY(file_id, H5I_INVALID_HID, "H5Fcreate"); */ - /* Open, RDWR */ + /* Opening */ #ifdef H5_HAVE_WIN32_API - file_id = H5Fopen("NUL", H5F_ACC_RDWR, H5P_DEFAULT); + H5Fopen("NUL", H5F_ACC_RDWR, H5P_DEFAULT); #else - file_id = H5Fopen("/dev/null", H5F_ACC_RDWR, H5P_DEFAULT); + H5Fopen("/dev/null", H5F_ACC_RDWR, H5P_DEFAULT); #endif - H5Fclose(file_id); - - exit(EXIT_SUCCESS); + /* TODO - Does not properly fail on all systems */ + /* VERIFY(file_id, H5I_INVALID_HID, "H5Fopen"); */ } /**************************************************************** ** From c5723dba04f13146aedd2c7443999af19433b043 Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Mon, 26 Aug 2024 12:23:11 -0700 Subject: [PATCH 18/22] Restore Julia CI (#4763) Fixes #4539 --- .github/workflows/autotools.yml | 6 +++ .github/workflows/cmake.yml | 6 ++- .github/workflows/julia-auto.yml | 79 +++++++++++++++++++++++++++++ .github/workflows/julia-cmake.yml | 82 +++++++++++++++++++++++++++++++ 4 files changed, 172 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/julia-auto.yml create mode 100644 .github/workflows/julia-cmake.yml diff --git a/.github/workflows/autotools.yml b/.github/workflows/autotools.yml index d777f448575..63c015ea93c 100644 --- a/.github/workflows/autotools.yml +++ b/.github/workflows/autotools.yml @@ -100,6 +100,12 @@ jobs: name: "Autotools TestExpress Workflows" uses: ./.github/workflows/testxpr-auto.yml + call-release-auto-julia: + name: "Autotools Julia Workflows" + uses: ./.github/workflows/julia-auto.yml + with: + build_mode: "production" + # workflow-msys2-autotools: # name: "CMake msys2 Workflows" # uses: ./.github/workflows/msys2-auto.yml diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 1db073e2929..ae1cd5430d8 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -103,4 +103,8 @@ jobs: name: "CMake TestExpress Workflows" uses: ./.github/workflows/testxpr-cmake.yml - + call-release-cmake-julia: + name: "CMake Julia Workflows" + uses: ./.github/workflows/julia-cmake.yml + with: + build_mode: "Release" diff --git a/.github/workflows/julia-auto.yml b/.github/workflows/julia-auto.yml new file mode 100644 index 00000000000..a7dd2ab15b9 --- /dev/null +++ b/.github/workflows/julia-auto.yml @@ -0,0 +1,79 @@ +name: hdf5 dev autotools julia + +on: + workflow_call: + inputs: + build_mode: + description: "release vs. debug build" + required: true + type: string + +permissions: + contents: read + +jobs: + julia_build_and_test: + name: "julia ${{ inputs.build_mode }}" + runs-on: ubuntu-latest + steps: + - name: Get Sources + uses: actions/checkout@v4.1.1 + + - name: Install Dependencies + shell: bash + run: | + sudo apt-get update + sudo apt-get install autoconf automake libtool libtool-bin libaec-dev + sudo apt-get install doxygen graphviz + sudo apt install -y zlib1g-dev libcurl4-openssl-dev libjpeg-dev wget curl bzip2 + sudo apt install -y m4 flex bison cmake libzip-dev openssl build-essential + + - name: Autotools Configure + shell: bash + run: | + sh ./autogen.sh + mkdir "${{ runner.workspace }}/build" + cd "${{ runner.workspace }}/build" + $GITHUB_WORKSPACE/configure \ + --enable-build-mode=${{ inputs.build_mode }} \ + --disable-fortran \ + --enable-shared \ + --disable-parallel \ + --prefix=/tmp + + - name: Autotools Build + shell: bash + run: | + make -j3 + working-directory: ${{ runner.workspace }}/build + + - name: Install HDF5 + shell: bash + run: | + make install + working-directory: ${{ runner.workspace }}/build + + - name: Install julia + uses: julia-actions/setup-julia@latest + with: + version: '1.6' + arch: 'x64' + + - name: Get julia hdf5 source + uses: actions/checkout@v4.1.1 + with: + repository: JuliaIO/HDF5.jl + path: . + + - name: Generate LocalPreferences + run: | + echo '[HDF5]' >> LocalPreferences.toml + echo 'libhdf5 = "/tmp/lib/libhdf5.so"' >> LocalPreferences.toml + echo 'libhdf5_hl = "/tmp/lib/libhdf5_hl.so"' >> LocalPreferences.toml + + - uses: julia-actions/julia-buildpkg@latest + + - name: Julia Run Tests + uses: julia-actions/julia-runtest@latest + env: + JULIA_DEBUG: Main diff --git a/.github/workflows/julia-cmake.yml b/.github/workflows/julia-cmake.yml new file mode 100644 index 00000000000..c1306d6a381 --- /dev/null +++ b/.github/workflows/julia-cmake.yml @@ -0,0 +1,82 @@ +name: hdf5 dev CMake julia + +on: + workflow_call: + inputs: + build_mode: + description: "release vs. debug build" + required: true + type: string + +permissions: + contents: read + +jobs: + julia_build_and_test: + name: "julia ${{ inputs.build_mode }}" + runs-on: ubuntu-latest + steps: + - name: Get Sources + uses: actions/checkout@v4.1.1 + + - name: Install Dependencies + shell: bash + run: | + sudo apt-get update + sudo apt-get install ninja-build doxygen graphviz + sudo apt install libssl3 libssl-dev libcurl4 libcurl4-openssl-dev + sudo apt install -y libaec-dev zlib1g-dev wget curl bzip2 flex bison cmake libzip-dev openssl build-essential + + - name: CMake Configure + shell: bash + run: | + mkdir "${{ runner.workspace }}/build" + cd "${{ runner.workspace }}/build" + cmake -C $GITHUB_WORKSPACE/config/cmake/cacheinit.cmake -G Ninja \ + -DCMAKE_BUILD_TYPE=${{ inputs.build_mode }} \ + -DHDF5_ENABLE_SZIP_SUPPORT:BOOL=OFF \ + -DHDF5_ENABLE_PARALLEL:BOOL=OFF \ + -DHDF5_BUILD_CPP_LIB:BOOL=OFF \ + -DLIBAEC_USE_LOCALCONTENT=OFF \ + -DZLIB_USE_LOCALCONTENT=OFF \ + -DHDF5_BUILD_FORTRAN:BOOL=OFF \ + -DHDF5_BUILD_JAVA:BOOL=OFF \ + -DCMAKE_INSTALL_PREFIX=/tmp \ + $GITHUB_WORKSPACE + + - name: CMake Build + shell: bash + run: | + cmake --build . --parallel 3 --config ${{ inputs.build_mode }} + working-directory: ${{ runner.workspace }}/build + + - name: Install HDF5 + shell: bash + run: | + cmake --install . + working-directory: ${{ runner.workspace }}/build + + - name: Install julia + uses: julia-actions/setup-julia@latest + with: + version: '1.6' + arch: 'x64' + + - name: Get julia hdf5 source + uses: actions/checkout@v4.1.1 + with: + repository: JuliaIO/HDF5.jl + path: . + + - name: Generate LocalPreferences + run: | + echo '[HDF5]' >> LocalPreferences.toml + echo 'libhdf5 = "/tmp/lib/libhdf5.so"' >> LocalPreferences.toml + echo 'libhdf5_hl = "/tmp/lib/libhdf5_hl.so"' >> LocalPreferences.toml + + - uses: julia-actions/julia-buildpkg@latest + + - name: Julia Run Tests + uses: julia-actions/julia-runtest@latest + env: + JULIA_DEBUG: Main From e5504ede3a37689b73eb329aaf77583f42ce367b Mon Sep 17 00:00:00 2001 From: "H. Joe Lee" Date: Mon, 26 Aug 2024 16:37:47 -0500 Subject: [PATCH 19/22] Capitalize f in (#4766) --- src/H5public.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/H5public.h b/src/H5public.h index e202f88d1f5..300287bc1f4 100644 --- a/src/H5public.h +++ b/src/H5public.h @@ -427,7 +427,7 @@ extern "C" { * \details H5open() initializes the HDF5 library. * * \details When the HDF5 library is used in a C application, the library is - * automatically initialized when the first HDf5 function call is + * automatically initialized when the first HDF5 function call is * issued. If one finds that an HDF5 library function is failing * inexplicably, H5open() can be called first. It is safe to call * H5open() before an application issues any other function calls to From f8619f10b3c9fdced5d8e63aae47bc2ab08eb56f Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Tue, 27 Aug 2024 00:18:01 -0700 Subject: [PATCH 20/22] Add testing to NVHPC CI actions (CMake & Autotools) (#4760) Turns on testing, both serial and parallel, but skips: * dt_arith and dtransform in CMake * All main library tests in the Autotools Due to dt_arith and dtransform segfaults when handling long doubles. --- .github/workflows/nvhpc-auto.yml | 20 ++++++++++++++++++++ .github/workflows/nvhpc-cmake.yml | 13 +++++++++++++ 2 files changed, 33 insertions(+) diff --git a/.github/workflows/nvhpc-auto.yml b/.github/workflows/nvhpc-auto.yml index 2a1a361813f..abb4987e536 100644 --- a/.github/workflows/nvhpc-auto.yml +++ b/.github/workflows/nvhpc-auto.yml @@ -67,6 +67,26 @@ jobs: make -j3 working-directory: ${{ runner.workspace }}/build + # ph5diff tests are in the tools/tests directory so they will get run + # here, so leave NPROCS set here as well + - name: Autotools Run Tests + env: + NPROCS: 2 + run: | + export PATH=/opt/nvidia/hpc_sdk/Linux_x86_64/24.7/comm_libs/openmpi4/bin:/opt/nvidia/hpc_sdk/Linux_x86_64/24.7/compilers/bin:$PATH + cd tools && make check -j2 && cd .. + cd hl && make check -j2 && cd .. + cd fortran && make check -j2 && cd .. + working-directory: ${{ runner.workspace }}/build + + - name: Autotools Run Parallel Tests + env: + NPROCS: 2 + run: | + export PATH=/opt/nvidia/hpc_sdk/Linux_x86_64/24.7/comm_libs/openmpi4/bin:/opt/nvidia/hpc_sdk/Linux_x86_64/24.7/compilers/bin:$PATH + cd testpar && make check && cd .. + working-directory: ${{ runner.workspace }}/build + - name: Autotools Install shell: bash run: | diff --git a/.github/workflows/nvhpc-cmake.yml b/.github/workflows/nvhpc-cmake.yml index 9e73a1c856f..56828c0c118 100644 --- a/.github/workflows/nvhpc-cmake.yml +++ b/.github/workflows/nvhpc-cmake.yml @@ -68,3 +68,16 @@ jobs: run: | cmake --build . --parallel 3 --config ${{ inputs.build_mode }} working-directory: ${{ runner.workspace }}/build + + # Skipping dt_arith and dtransform while we investigate long double failures + - name: CMake Run Tests + shell: bash + run: | + ctest . -E "MPI_TEST|H5TEST-dt_arith|H5TEST-dtransform" --parallel 2 -C ${{ inputs.build_mode }} -V + working-directory: ${{ runner.workspace }}/build + + - name: CMake Run Parallel Tests + shell: bash + run: | + ctest . -R MPI_TEST -C ${{ inputs.build_mode }} -V + working-directory: ${{ runner.workspace }}/build From 51364044e69cbf859b5ffa66e5789133894a706a Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Tue, 27 Aug 2024 06:05:47 -0700 Subject: [PATCH 21/22] Fix typo in H5T_order_t enum (#4773) 'bit endian' --> 'big endian' --- src/H5Tpublic.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/H5Tpublic.h b/src/H5Tpublic.h index 97ee27c7f46..57a5b6047c3 100644 --- a/src/H5Tpublic.h +++ b/src/H5Tpublic.h @@ -52,7 +52,7 @@ typedef enum H5T_class_t { typedef enum H5T_order_t { H5T_ORDER_ERROR = -1, /**< error */ H5T_ORDER_LE = 0, /**< little endian */ - H5T_ORDER_BE = 1, /**< bit endian */ + H5T_ORDER_BE = 1, /**< big endian */ H5T_ORDER_VAX = 2, /**< VAX mixed endian */ H5T_ORDER_MIXED = 3, /**< Compound type with mixed member orders */ H5T_ORDER_NONE = 4 /**< no particular order (strings, bits,..) */ From b0e01f00f6d99f3ca458266a8270a7e32fa25e7b Mon Sep 17 00:00:00 2001 From: Larry Knox Date: Tue, 27 Aug 2024 10:41:29 -0500 Subject: [PATCH 22/22] Correct julia workflows name for hdf5_1_14 branch. --- .github/workflows/julia-auto.yml | 2 +- .github/workflows/julia-cmake.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/julia-auto.yml b/.github/workflows/julia-auto.yml index a7dd2ab15b9..9c13990edf6 100644 --- a/.github/workflows/julia-auto.yml +++ b/.github/workflows/julia-auto.yml @@ -1,4 +1,4 @@ -name: hdf5 dev autotools julia +name: hdf5 1.14 autotools julia on: workflow_call: diff --git a/.github/workflows/julia-cmake.yml b/.github/workflows/julia-cmake.yml index c1306d6a381..1972deefd8f 100644 --- a/.github/workflows/julia-cmake.yml +++ b/.github/workflows/julia-cmake.yml @@ -1,4 +1,4 @@ -name: hdf5 dev CMake julia +name: hdf5 1.14 CMake julia on: workflow_call: