diff --git a/.github/workflows/build_cmake_gnu.yml b/.github/workflows/build_cmake_gnu.yml index f649345d8a..d4f7e2a248 100644 --- a/.github/workflows/build_cmake_gnu.yml +++ b/.github/workflows/build_cmake_gnu.yml @@ -9,10 +9,11 @@ jobs: matrix: omp-flags: [ -DOPENMP=on, -DOPENMP=off ] libyaml-flag: [ "", -DWITH_YAML=on ] + io-flag: [ "", -DUSE_DEPRECATED_IO=on ] container: image: noaagfdl/hpc-me.ubuntu-minimal:cmake env: - CMAKE_FLAGS: "${{ matrix.omp-flags }} ${{ matrix.libyaml-flag }} -D64BIT=on" + CMAKE_FLAGS: "${{ matrix.omp-flags }} ${{ matrix.io-flag }} ${{ matrix.libyaml-flag }} -D64BIT=on" steps: - name: Checkout code uses: actions/checkout@v2 diff --git a/.github/workflows/build_ubuntu_gnu.yml b/.github/workflows/build_ubuntu_gnu.yml index f4dc48225f..7c53895b15 100644 --- a/.github/workflows/build_ubuntu_gnu.yml +++ b/.github/workflows/build_ubuntu_gnu.yml @@ -12,11 +12,12 @@ jobs: matrix: conf-flags: [--disable-openmp, --enable-mixed-mode, --disable-setting-flags, --with-mpi=no] input-flag: [--with-yaml, --enable-test-input=/home/unit_tests_input] + io-flag: [ --enable-deprecated-io, --disable-deprecated-io] container: image: noaagfdl/hpc-me.ubuntu-minimal:gnu-input env: TEST_VERBOSE: 1 - DISTCHECK_CONFIGURE_FLAGS: "${{ matrix.conf-flags }} ${{ matrix.input-flag }}" + DISTCHECK_CONFIGURE_FLAGS: "${{ matrix.conf-flags }} ${{ matrix.input-flag }} ${{ matrix.io-flag }}" steps: - name: Checkout code uses: actions/checkout@v2 diff --git a/CMakeLists.txt b/CMakeLists.txt index cc60d914c2..270539cd4d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -66,6 +66,7 @@ option(ENABLE_QUAD_PRECISION "Enable compiler definition -DENABLE_QUAD_PRECISION option(GFS_PHYS "Enable compiler definition -DGFS_PHYS" OFF) option(LARGEFILE "Enable compiler definition -Duse_LARGEFILE" OFF) option(WITH_YAML "Enable compiler definition -Duse_yaml" OFF) +option(USE_DEPRECATED_IO "Enable compiler definition -Duse_deprecated_io (compile with fms_io/mpp_io)" OFF) if(32BIT) list(APPEND kinds "r4") @@ -246,6 +247,10 @@ if(WITH_YAML) list(APPEND fms_defs use_yaml) endif() +if(USE_DEPRECATED_IO) + list(APPEND fms_defs use_deprecated_io) +endif() + if(INTERNAL_FILE_NML) list(APPEND fms_defs INTERNAL_FILE_NML) endif() diff --git a/configure.ac b/configure.ac index 241e08d079..82588b6c84 100644 --- a/configure.ac +++ b/configure.ac @@ -110,6 +110,13 @@ AS_IF([test ${enable_8byte_int:-no} = yes], [enable_8byte_int=yes], [enable_8byte_int=no]) +AC_ARG_ENABLE([deprecated-io], + [AS_HELP_STRING([--enable-deprecated-io], + [Enables compilation of deprecated mpp_io and fms_io modules in addition to the updated fms2_io modules (default no)])]) +AS_IF([test ${enable_deprecated_io:-no} = yes], + [enable_deprecated_io=yes], + [enable_deprecated_io=no]) + # user enabled testing with input files AC_MSG_CHECKING([whether to enable tests with input files]) AC_ARG_ENABLE([test-input], @@ -203,7 +210,6 @@ AC_MSG_CHECKING([if netCDF was built with HDF5]) AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[ #include #if !(NC_HAS_NC4) - choke me #endif]])], [nc_has_nc4=yes], [nc_has_nc4=no]) AC_MSG_RESULT([$nc_has_nc4]) if test $nc_has_nc4 = no; then @@ -281,6 +287,15 @@ if test $with_mpi = yes; then AC_DEFINE([use_libMPI], [1], [This is required for the library to build]) fi +# check if compiling old io +if test $enable_deprecated_io = yes; then + #If the test pass, define use_deprecated_io macro and skip it's unit tests + AC_DEFINE([use_deprecated_io], [1], [This is required to use mpp_io and fms_io modules]) + AM_CONDITIONAL([SKIP_DEPRECATED_IO_TESTS], true) +else + AM_CONDITIONAL([SKIP_DEPRECATED_IO_TESTS], false) +fi + # Set any required compile flags. This will not be done if the user wants to # define all their own flags. if test $enable_setting_flags = yes; then diff --git a/test_fms/mpp_io/Makefile.am b/test_fms/mpp_io/Makefile.am index af5ec8d488..2357549cfa 100644 --- a/test_fms/mpp_io/Makefile.am +++ b/test_fms/mpp_io/Makefile.am @@ -38,6 +38,10 @@ test_mpp_io_SOURCES = test_mpp_io.F90 test_io_R4_R8_SOURCES = test_io_R4_R8.F90 test_io_mosaic_R4_R8_SOURCES = test_io_mosaic_R4_R8.F90 +if SKIP_DEPRECATED_IO_TESTS +TESTS_ENVIRONMENT= SKIP_TESTS="test_mpp_io2.1 test_io_R4_R8.1 test_io_mosaic_R4_R8.1" +endif + # Run the test program. TESTS = test_mpp_io2.sh \ test_io_R4_R8.sh \