diff --git a/.github/workflows/autotools.yml b/.github/workflows/autotools.yml index a430dc6b51c..a202076005a 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 21d201922de..7fe99c2f3cb 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/intel-auto.yml b/.github/workflows/intel-auto.yml index ea983c3a76b..6e0380efb4e 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 a8d5b7d49b8..fb703d480b3 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 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 diff --git a/.github/workflows/main-auto-par.yml b/.github/workflows/main-auto-par.yml index bd1b1c45902..3d5d7563a15 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 9a87dead10d..55d79ecb776 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') }} 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. */ 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/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() */ diff --git a/test/tfile.c b/test/tfile.c index 1c8e6a04b1f..02f996f66a3 100644 --- a/test/tfile.c +++ b/test/tfile.c @@ -8104,45 +8104,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"); */ } /**************************************************************** ** 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");