Skip to content

Commit

Permalink
Merge pull request #2437 from WardF/gh2435.wif
Browse files Browse the repository at this point in the history
Fix pnetcdf tests in cmake
  • Loading branch information
WardF authored Jun 29, 2022
2 parents f414e51 + 9d44421 commit 5794ae4
Show file tree
Hide file tree
Showing 4 changed files with 98 additions and 4 deletions.
84 changes: 82 additions & 2 deletions .github/workflows/run_tests_ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -351,9 +351,89 @@ 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-parallel-${{ 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 ]
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:
Expand Down Expand Up @@ -460,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-ac-tests-oneoff-parallel ]
runs-on: ubuntu-latest

strategy:
Expand Down
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
2 changes: 1 addition & 1 deletion libsrc/posixio.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
10 changes: 9 additions & 1 deletion nc_test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,17 @@ 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)
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_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)
Expand Down

0 comments on commit 5794ae4

Please sign in to comment.