From 24bdf6c0679064d8959d95ab2f28ca8947e8377c Mon Sep 17 00:00:00 2001 From: Ward Fisher Date: Tue, 28 Jun 2022 14:56:38 -0600 Subject: [PATCH 1/9] Generate nc_test/run_pnetcdf_tests.sh when using cmake, in support of https://github.com/Unidata/netcdf-c/issues/2435 --- CMakeLists.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 944e302d86..95ec804617 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1479,6 +1479,12 @@ IF(ENABLE_PNETCDF) ELSE() MESSAGE(WARNING "ENABLE_PNETCDF requires version 1.6.1 or later; found version ${pnetcdf_version}. PnetCDF is disabled") ENDIF() + + ### + # Generate pnetcdf test. + ### + CONFIGURE_FILE("${netCDF_SOURCE_DIR}/nc_test/run_pnetcdf_tests.sh.in" + "${netCDF_BINARY_DIR}/nc_test/run_pnetcdf_tests.sh") ENDIF(NOT PNETCDF) ENDIF() From bfca0300375fb25aa2f40d7707f23646817ecdc1 Mon Sep 17 00:00:00 2001 From: Ward Fisher Date: Tue, 28 Jun 2022 15:04:58 -0600 Subject: [PATCH 2/9] Fixing cmake-based run_pnetcdf_tests.sh --- .github/workflows/run_tests_ubuntu.yml | 80 ++++++++++++++++++++++++++ nc_test/CMakeLists.txt | 2 +- 2 files changed, 81 insertions(+), 1 deletion(-) diff --git a/.github/workflows/run_tests_ubuntu.yml b/.github/workflows/run_tests_ubuntu.yml index 5ad0edf62a..39d2e10a3a 100644 --- a/.github/workflows/run_tests_ubuntu.yml +++ b/.github/workflows/run_tests_ubuntu.yml @@ -351,6 +351,86 @@ jobs: LD_LIBRARY_PATH=${LD_LIBRARY_PATH} ctest -j 12 --rerun-failed --output-on-failure -VV if: ${{ failure() }} + ## + # Parallel + ## + nc-cmake-tests-oneoff-parallel: + + needs: build-deps-parallel + runs-on: ubuntu-latest + + strategy: + matrix: + hdf5: [ 1.12.1 ] + + steps: + + - uses: actions/checkout@v2 + + - name: Install System dependencies + shell: bash -l {0} + run: sudo apt update && sudo apt install -y libaec-dev zlib1g-dev automake autoconf libcurl4-openssl-dev libjpeg-dev wget curl bzip2 m4 flex bison cmake libzip-dev doxygen mpich libmpich-dev + + ### + # Set Environmental Variables + ### + + - run: echo "CMAKE_PREFIX_PATH=${HOME}/environments/${{ matrix.hdf5 }}/" >> $GITHUB_ENV + - run: echo "LD_LIBRARY_PATH=${HOME}/environments/${{ matrix.hdf5 }}/lib" >> $GITHUB_ENV + + ### + # Fetch Cache + ### + + - name: Fetch HDF Cache + id: cache-hdf5 + uses: actions/cache@v2 + with: + path: ~/environments/${{ matrix.hdf5 }} + key: hdf5-${{ runner.os }}-${{ matrix.hdf5 }} + + - name: Check Cache + shell: bash -l {0} + run: ls ${HOME}/environments && ls ${HOME}/environments/${{ matrix.hdf5 }} && ls ${HOME}/environments/${{ matrix.hdf5}}/lib + + ### + # Configure and build + ### + + - name: Perform out-of-directory build + shell: bash -l {0} + run: | + mkdir build + cd build + LD_LIBRARY_PATH=${LD_LIBRARY_PATH} cmake .. -DCMAKE_C_COMPILER=mpicc -DENABLE_HDF4=TRUE -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} -DENABLE_DAP=TRUE -DENABLE_HDF5=TRUE -DENABLE_NCZARR=TRUE -D ENABLE_DAP_LONG_TESTS=TRUE -DENABLE_PNETCDF=TRUE + + - name: Print Summary + shell: bash -l {0} + run: | + cd build + cat libnetcdf.settings + + - name: Build All + shell: bash -l {0} + run: | + cd build + LD_LIBRARY_PATH=${LD_LIBRARY_PATH} make -j 12 + if: ${{ success() }} + + - name: Run Tests + shell: bash -l {0} + run: | + cd build + LD_LIBRARY_PATH=${LD_LIBRARY_PATH} ctest --output-on-failure -j 12 . + if: ${{ success() }} + + - name: Verbose Output if CTest Failure + shell: bash -l {0} + run: | + cd build + LD_LIBRARY_PATH=${LD_LIBRARY_PATH} ctest -j 12 --rerun-failed --output-on-failure -VV + if: ${{ failure() }} + nc-autotools: needs: [ nc-cmake-tests-oneoff-serial, nc-ac-tests-oneoff-serial ] diff --git a/nc_test/CMakeLists.txt b/nc_test/CMakeLists.txt index 2149579a18..311f055ca0 100644 --- a/nc_test/CMakeLists.txt +++ b/nc_test/CMakeLists.txt @@ -50,7 +50,7 @@ IF(USE_PNETCDF) build_bin_test_no_prefix(tst_pnetcdf) build_bin_test_no_prefix(tst_parallel2) build_bin_test_no_prefix(tst_addvar) - add_sh_test(nc_test run_pnetcdf_test) + add_sh_test(nc_test run_pnetcdf_tests) add_bin_test(nc_test tst_formatx_pnetcdf) add_bin_test(nc_test tst_default_format_pnetcdf) ENDIF() From baaa2b6f00fee532ac73f6dc94dfd0fef2de83ca Mon Sep 17 00:00:00 2001 From: Ward Fisher Date: Tue, 28 Jun 2022 15:28:40 -0600 Subject: [PATCH 3/9] Building test programs invoked by run_pnetcdf_tests.sh --- nc_test/CMakeLists.txt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/nc_test/CMakeLists.txt b/nc_test/CMakeLists.txt index 311f055ca0..61942001e0 100644 --- a/nc_test/CMakeLists.txt +++ b/nc_test/CMakeLists.txt @@ -50,6 +50,13 @@ IF(USE_PNETCDF) build_bin_test_no_prefix(tst_pnetcdf) build_bin_test_no_prefix(tst_parallel2) build_bin_test_no_prefix(tst_addvar) + build_bin_test_no_prefix(t_nc) + build_bin_test_no_prefix(tst_atts3) + build_bin_test_no_prefix(tst_default_format_pnetcdf) + build_bin_test_no_prefix(tst_small) + build_bin_test_no_prefix(tst_formatx_pnetcdf) + build_bin_test_no_prefix(tst_cdf5format) + build_bin_test_no_prefix(tst_nofill) add_sh_test(nc_test run_pnetcdf_tests) add_bin_test(nc_test tst_formatx_pnetcdf) add_bin_test(nc_test tst_default_format_pnetcdf) From ff34b6618238ddca7ef6cf5113fc92eee0afb1c7 Mon Sep 17 00:00:00 2001 From: Ward Fisher Date: Tue, 28 Jun 2022 16:27:23 -0600 Subject: [PATCH 4/9] Fix cache check. --- .github/workflows/run_tests_ubuntu.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/run_tests_ubuntu.yml b/.github/workflows/run_tests_ubuntu.yml index 39d2e10a3a..592ad3c71c 100644 --- a/.github/workflows/run_tests_ubuntu.yml +++ b/.github/workflows/run_tests_ubuntu.yml @@ -387,7 +387,7 @@ jobs: uses: actions/cache@v2 with: path: ~/environments/${{ matrix.hdf5 }} - key: hdf5-${{ runner.os }}-${{ matrix.hdf5 }} + key: hdf5-parallel-${{ runner.os }}-${{ matrix.hdf5 }} - name: Check Cache shell: bash -l {0} From e34f8d5dc0a15eb9280b905ab89dfaf830636cf1 Mon Sep 17 00:00:00 2001 From: Ward Fisher Date: Tue, 28 Jun 2022 16:29:35 -0600 Subject: [PATCH 5/9] Run one-off tests first. --- .github/workflows/run_tests_ubuntu.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/run_tests_ubuntu.yml b/.github/workflows/run_tests_ubuntu.yml index 592ad3c71c..5aea8e11c4 100644 --- a/.github/workflows/run_tests_ubuntu.yml +++ b/.github/workflows/run_tests_ubuntu.yml @@ -433,7 +433,7 @@ jobs: nc-autotools: - needs: [ nc-cmake-tests-oneoff-serial, nc-ac-tests-oneoff-serial ] + needs: [ nc-cmake-tests-oneoff-serial, nc-ac-tests-oneoff-serial, nc-cmake-tests-oneoff-parallel, nc-cmake-tests-oneoff-serial ] runs-on: ubuntu-latest strategy: @@ -540,7 +540,7 @@ jobs: nc-cmake: - needs: [ nc-cmake-tests-oneoff-serial, nc-ac-tests-oneoff-serial ] + needs: [ nc-cmake-tests-oneoff-serial, nc-ac-tests-oneoff-serial, nc-cmake-tests-oneoff-parallel, nc-cmake-tests-oneoff-serial ] runs-on: ubuntu-latest strategy: From 73a0d92f9d97c15749137dc979ed9cca84581e1b Mon Sep 17 00:00:00 2001 From: Ward Fisher Date: Tue, 28 Jun 2022 16:30:26 -0600 Subject: [PATCH 6/9] Fix a typo. --- .github/workflows/run_tests_ubuntu.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/run_tests_ubuntu.yml b/.github/workflows/run_tests_ubuntu.yml index 5aea8e11c4..2ea5ec9ba4 100644 --- a/.github/workflows/run_tests_ubuntu.yml +++ b/.github/workflows/run_tests_ubuntu.yml @@ -433,7 +433,7 @@ jobs: nc-autotools: - needs: [ nc-cmake-tests-oneoff-serial, nc-ac-tests-oneoff-serial, nc-cmake-tests-oneoff-parallel, nc-cmake-tests-oneoff-serial ] + needs: [ nc-cmake-tests-oneoff-serial, nc-ac-tests-oneoff-serial, nc-cmake-tests-oneoff-parallel, nc-ac-tests-oneoff-serial ] runs-on: ubuntu-latest strategy: @@ -540,7 +540,7 @@ jobs: nc-cmake: - needs: [ nc-cmake-tests-oneoff-serial, nc-ac-tests-oneoff-serial, nc-cmake-tests-oneoff-parallel, nc-cmake-tests-oneoff-serial ] + needs: [ nc-cmake-tests-oneoff-serial, nc-ac-tests-oneoff-serial, nc-cmake-tests-oneoff-parallel, nc-ac-tests-oneoff-serial ] runs-on: ubuntu-latest strategy: From 7d6d4b9b408bae328272eb5b0a5b4d58925433cc Mon Sep 17 00:00:00 2001 From: Ward Fisher Date: Tue, 28 Jun 2022 16:31:15 -0600 Subject: [PATCH 7/9] Fix a typo. --- .github/workflows/run_tests_ubuntu.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/run_tests_ubuntu.yml b/.github/workflows/run_tests_ubuntu.yml index 2ea5ec9ba4..5f18aa1e0d 100644 --- a/.github/workflows/run_tests_ubuntu.yml +++ b/.github/workflows/run_tests_ubuntu.yml @@ -433,7 +433,7 @@ jobs: nc-autotools: - needs: [ nc-cmake-tests-oneoff-serial, nc-ac-tests-oneoff-serial, nc-cmake-tests-oneoff-parallel, nc-ac-tests-oneoff-serial ] + needs: [ nc-cmake-tests-oneoff-serial, nc-ac-tests-oneoff-serial, nc-cmake-tests-oneoff-parallel, nc-ac-tests-oneoff-parallel ] runs-on: ubuntu-latest strategy: @@ -540,7 +540,7 @@ jobs: nc-cmake: - needs: [ nc-cmake-tests-oneoff-serial, nc-ac-tests-oneoff-serial, nc-cmake-tests-oneoff-parallel, nc-ac-tests-oneoff-serial ] + needs: [ nc-cmake-tests-oneoff-serial, nc-ac-tests-oneoff-serial, nc-cmake-tests-oneoff-parallel, nc-ac-tests-oneoff-parallel ] runs-on: ubuntu-latest strategy: From dfc47497e352b010402e1249eb2c7da36c09a636 Mon Sep 17 00:00:00 2001 From: Ward Fisher Date: Tue, 28 Jun 2022 16:53:38 -0600 Subject: [PATCH 8/9] Make pnetcdf tests run in serial fashion when using cmake --- nc_test/CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nc_test/CMakeLists.txt b/nc_test/CMakeLists.txt index 61942001e0..2460aab45f 100644 --- a/nc_test/CMakeLists.txt +++ b/nc_test/CMakeLists.txt @@ -57,9 +57,10 @@ IF(USE_PNETCDF) build_bin_test_no_prefix(tst_formatx_pnetcdf) build_bin_test_no_prefix(tst_cdf5format) build_bin_test_no_prefix(tst_nofill) - add_sh_test(nc_test run_pnetcdf_tests) add_bin_test(nc_test tst_formatx_pnetcdf) add_bin_test(nc_test tst_default_format_pnetcdf) + add_sh_test(nc_test run_pnetcdf_tests) + SET_TESTS_PROPERTIES(nc_test_run_pnetcdf_tests PROPERTIES RUN_SERIAL TRUE) ENDIF() IF(LARGE_FILE_TESTS) From 9d44421024fda7554d8c0ae8ec37085917416e18 Mon Sep 17 00:00:00 2001 From: Ward Fisher Date: Tue, 28 Jun 2022 16:58:24 -0600 Subject: [PATCH 9/9] Work in a one-line change as originally suggested in https://github.com/Unidata/netcdf-c/pull/2426. --- libsrc/posixio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libsrc/posixio.c b/libsrc/posixio.c index 0e1c185003..5e541faac4 100644 --- a/libsrc/posixio.c +++ b/libsrc/posixio.c @@ -1634,7 +1634,7 @@ posixio_create(const char *path, int ioflags, #endif if(fd < 0) { - status = errno; + status = errno ? errno : ENOENT; goto unwind_new; } *((int *)&nciop->fd) = fd; /* cast away const */