diff --git a/.travis.yml b/.travis.yml index 94d8a9ba55..0ea1afec83 100644 --- a/.travis.yml +++ b/.travis.yml @@ -32,6 +32,7 @@ before_script: - export CPPFLAGS="-I/usr/include -Duse_LARGEFILE -DMAXFIELDMETHODS_=500 ${CPPFLAGS_ADD}" - export FCFLAGS="-fcray-pointer -Waliasing -ffree-line-length-none -fno-range-check ${FCFLAGS_REAL_KIND} ${OPENMP}" - export LDFLAGS='-L/usr/lib' + - export LOG_DRIVER_FLAGS="--comments" script: - autoreconf -i diff --git a/configure.ac b/configure.ac index a9fae9d24d..828b01f257 100644 --- a/configure.ac +++ b/configure.ac @@ -53,6 +53,24 @@ AC_PROG_F77 # Find the install program. AC_PROG_INSTALL +# Is bats installed? It is required for testing. +AC_CHECK_PROGS([FMS_BATS], [bats]) +if test -z "$FMS_BATS"; then + AC_MSG_ERROR([Cannot find bats utility. Install bats and try again.]) +fi + +# Is sed installed? It is required for testing. +AC_CHECK_PROGS([FMS_SED], [sed]) +if test -z "$FMS_SED"; then + AC_MSG_ERROR([Cannot find sed. Install sed and try again.]) +fi + +# Is ncgen installed? It is required for testing. +AC_CHECK_PROGS([FMS_NCGEN], [ncgen]) +if test -z "$FMS_NCGEN"; then + AC_MSG_ERROR([Cannot find ncgen. Install ncgen and try again.]) +fi + # Check to see if any macros must be set to enable large (>2GB) files. AC_SYS_LARGEFILE @@ -136,7 +154,6 @@ AC_CONFIG_FILES([Makefile sat_vapor_pres/Makefile random_numbers/Makefile libFMS/Makefile - test_fms/test_common.sh test_fms/Makefile test_fms/diag_manager/Makefile test_fms/data_override/Makefile diff --git a/test_fms/Makefile.am b/test_fms/Makefile.am index 9e406f4c78..a91b57b824 100644 --- a/test_fms/Makefile.am +++ b/test_fms/Makefile.am @@ -5,8 +5,6 @@ ACLOCAL_AMFLAGS = -I m4 # Make targets will be run in each subdirectory. Order is significant. -SUBDIRS = diag_manager data_override exchange monin_obukhov drifters \ -mosaic interpolator fms mpp mpp_io time_interp time_manager \ +SUBDIRS = diag_manager data_override exchange monin_obukhov drifters \ +mosaic interpolator fms mpp mpp_io time_interp time_manager \ horiz_interp field_manager fft axis_utils - -EXTRA_DIST = test_common.sh.in diff --git a/test_fms/axis_utils/Makefile.am b/test_fms/axis_utils/Makefile.am index 66d865a132..150f4ee54d 100644 --- a/test_fms/axis_utils/Makefile.am +++ b/test_fms/axis_utils/Makefile.am @@ -3,9 +3,15 @@ # uramirez, Ed Hartnett +LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) \ + $(top_srcdir)/tap-driver.sh + +# Set srcdir as evironment variable to be reference in the job script +TESTS_ENVIRONMENT = srcdir="$(top_srcdir)" + # Find the fms and mpp mod files. -AM_CPPFLAGS = -I${top_builddir}/axis_utils -I${top_builddir}/fms \ --I${top_builddir}/mpp +AM_CPPFLAGS = -I${top_builddir}/axis_utils -I${top_builddir}/fms \ + -I${top_builddir}/mpp # Link to the FMS library. LDADD = ${top_builddir}/libFMS/libFMS.la @@ -17,10 +23,10 @@ check_PROGRAMS = test_axis_utils test_axis_utils_SOURCES = test_axis_utils.F90 # Run the test program. -TESTS = test_axis_utils2.sh +TESTS = test_axis_utils.sh # Copy over other needed files to the srcdir -EXTRA_DIST = input_base.nml test_axis_utils2.sh +EXTRA_DIST = test_axis_utils.sh test_axis_utils.bats input_base.nml # Clean up CLEANFILES = input.nml *.out* diff --git a/test_fms/axis_utils/test_axis_utils.bats b/test_fms/axis_utils/test_axis_utils.bats new file mode 100644 index 0000000000..88e80cec71 --- /dev/null +++ b/test_fms/axis_utils/test_axis_utils.bats @@ -0,0 +1,10 @@ +teardown () { + # Echo the output. Will only be done on a test failure. + echo "$output" +} + +@test "1" { + skip "Fails in 32bit/Mixed mode" + run mpirun -n 2 ./test_axis_utils + [ "$status" -eq 0 ] +} diff --git a/test_fms/axis_utils/test_axis_utils.sh b/test_fms/axis_utils/test_axis_utils.sh new file mode 100755 index 0000000000..74ba542621 --- /dev/null +++ b/test_fms/axis_utils/test_axis_utils.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +cp $srcdir/test_fms/axis_utils/input_base.nml input.nml + +bats $srcdir/test_fms/axis_utils/test_axis_utils.bats diff --git a/test_fms/axis_utils/test_axis_utils2.sh b/test_fms/axis_utils/test_axis_utils2.sh deleted file mode 100755 index 711455b544..0000000000 --- a/test_fms/axis_utils/test_axis_utils2.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh - -# This is part of the GFDL FMS package. This is a shell script to -# execute tests in the test_fms/axis_utils directory. - -# Ed Hartnett 11/26/19 - -# Set common test settings. -. ../test_common.sh - -# Copy and rename namelist file. -cp $top_srcdir/test_fms/axis_utils/input_base.nml input.nml - -# Run the test. -# Test skipped in bats file. -#mpirun -n 2 ./test_axis_utils diff --git a/test_fms/data_override/Makefile.am b/test_fms/data_override/Makefile.am index e7562894de..1e0b073446 100644 --- a/test_fms/data_override/Makefile.am +++ b/test_fms/data_override/Makefile.am @@ -3,10 +3,16 @@ # uramirez, Ed Hartnett +LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) \ + $(top_srcdir)/tap-driver.sh + +# Set srcdir as evironment variable to be reference in the job script. +TESTS_ENVIRONMENT = srcdir="$(top_srcdir)" builddir="$(top_builddir)" + # Find the needed mod and .inc files. -AM_CPPFLAGS = -I${top_srcdir}/include -I${top_builddir}/mpp \ --I${top_builddir}/fms -I${top_builddir}/constants \ --I${top_builddir}/time_manager -I${top_builddir}/diag_manager \ +AM_CPPFLAGS = -I${top_srcdir}/include -I${top_builddir}/mpp \ +-I${top_builddir}/fms -I${top_builddir}/constants \ +-I${top_builddir}/time_manager -I${top_builddir}/diag_manager \ -I${top_builddir}/data_override # Link to the FMS library. @@ -19,11 +25,11 @@ check_PROGRAMS = test_data_override test_data_override_SOURCES = test_data_override.F90 # Run the test program. -TESTS = test_data_override2.sh +TESTS = test_data_override.sh # Include these files with the distribution. -EXTRA_DIST = input_base.nml diag_table_base data_table_base \ -test_data_override2.sh +EXTRA_DIST = test_data_override.sh test_data_override.bats \ +input.nml_base diag_table data_table # Clean up -CLEANFILES = input.nml *.nc* *.out diag_table data_table +CLEANFILES = input.nml *.nc* *.out *_table diff --git a/test_fms/data_override/data_table_base b/test_fms/data_override/data_table similarity index 100% rename from test_fms/data_override/data_table_base rename to test_fms/data_override/data_table diff --git a/test_fms/data_override/diag_table_base b/test_fms/data_override/diag_table similarity index 100% rename from test_fms/data_override/diag_table_base rename to test_fms/data_override/diag_table diff --git a/test_fms/data_override/input_base.nml b/test_fms/data_override/input.nml_base similarity index 100% rename from test_fms/data_override/input_base.nml rename to test_fms/data_override/input.nml_base diff --git a/test_fms/data_override/test_data_override.bats b/test_fms/data_override/test_data_override.bats new file mode 100755 index 0000000000..e55624943e --- /dev/null +++ b/test_fms/data_override/test_data_override.bats @@ -0,0 +1,28 @@ +setup() { + # Clear out any previous test files + rm -f input.nml > /dev/null 2>&1 + + # Setup the run directory + tnum=$( printf "%2.2d" ${BATS_TEST_NUMBER} ) + sed "s//${tnum}/" $srcdir/test_fms/data_override/input.nml_base > input.nml +} + +teardown () { + # Echo the output. Will only be done on a test failure. + echo "$output" +} + +@test "Test 1: Cubic-Grid" { + skip "The input file is missing" + cp -r $srcdir/test_fms/data_override/INPUT $builddir/test_fms/data_override/INPUT + run mpirun -n 2 ./test_data_override + [ "$status" -eq 0 ] +} + +@test "Test 2: Latlon-Grid" { + skip "The input file is missing" + run mpirun -n 2 ./test_data_override + [ "$status" -eq 0 ] + chmod 755 $builddir/test_fms/data_override/INPUT + rm -rf $builddir/test_fms/data_override/INPUT +} diff --git a/test_fms/data_override/test_data_override.sh b/test_fms/data_override/test_data_override.sh new file mode 100755 index 0000000000..04c8ea5002 --- /dev/null +++ b/test_fms/data_override/test_data_override.sh @@ -0,0 +1,6 @@ +#!/bin/sh + +cp $srcdir/test_fms/data_override/data_table data_table +cp $srcdir/test_fms/data_override/diag_table diag_table + +bats $srcdir/test_fms/data_override/test_data_override.bats diff --git a/test_fms/data_override/test_data_override2.sh b/test_fms/data_override/test_data_override2.sh deleted file mode 100755 index e2e307e9d6..0000000000 --- a/test_fms/data_override/test_data_override2.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh - -# This is part of the GFDL FMS package. This is a shell script to -# execute tests in the test_fms/data_override directory. - -# Ed Hartnett 11/26/19 - -# Set common test settings. -. ../test_common.sh - -# Copy to builddir and rename data files for tests. -cp $top_srcdir/test_fms/data_override/data_table_base data_table -cp $top_srcdir/test_fms/data_override/diag_table_base diag_table - -# Both tests are skipped in the bats file, so commented out here. -tnum=$( printf "%2.2d" 1 ) -sed "s//${tnum}/" $top_srcdir/test_fms/data_override/input_base.nml > input.nml -#cp -r $top_srcdir/test_fms/data_override/INPUT $top_builddir/test_fms/data_override/INPUT -#mpirun -n 2 ./test_data_override - -tnum=$( printf "%2.2d" 2 ) -sed "s//${tnum}/" $top_srcdir/test_fms/data_override/input_base.nml > input.nml -#mpirun -n 2 ./test_data_override - diff --git a/test_fms/diag_manager/Makefile.am b/test_fms/diag_manager/Makefile.am index 5fcab4fede..68c644ea2e 100644 --- a/test_fms/diag_manager/Makefile.am +++ b/test_fms/diag_manager/Makefile.am @@ -3,9 +3,15 @@ # uramirez, Ed Hartnett +LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) \ + $(top_srcdir)/tap-driver.sh + +# Set srcdir as evironment variable to be reference in the job script +TESTS_ENVIRONMENT = srcdir="$(top_srcdir)" + # Find the needed mod and .inc files. -AM_CPPFLAGS = -I${top_srcdir}/include -I${top_builddir}/mpp \ --I${top_builddir}/fms -I${top_builddir}/diag_manager \ +AM_CPPFLAGS = -I${top_srcdir}/include -I${top_builddir}/mpp \ +-I${top_builddir}/fms -I${top_builddir}/diag_manager \ -I${top_builddir}/time_manager -I${top_builddir}/constants # Link to the FMS library. @@ -17,10 +23,11 @@ check_PROGRAMS = test_diag_manager # This is the source code for the test. test_diag_manager_SOURCES = test_diag_manager.F90 -# Run the test. -TESTS = test_diag_manager2.sh +# Run the test program. +TESTS = test_diag_manager.sh # Copy over other needed files to the srcdir -EXTRA_DIST = input.nml_base diagTables test_diag_manager2.sh +EXTRA_DIST = test_diag_manager.sh input.nml_base diagTables \ +test_diag_manager.bats CLEANFILES = input.nml *.nc *.out diff --git a/test_fms/diag_manager/test_diag_manager.bats b/test_fms/diag_manager/test_diag_manager.bats new file mode 100755 index 0000000000..4a2622a226 --- /dev/null +++ b/test_fms/diag_manager/test_diag_manager.bats @@ -0,0 +1,181 @@ +setup() { + # Clear out any previous test files + rm -f input.nml > /dev/null 2>&1 + rm -f diag_table > /dev/null 2>&1 + + # Setup the run directory + tnum=$( printf "%2.2d" ${BATS_TEST_NUMBER} ) + rm -f diag_test_${tnum}* > /dev/null 2>&1 + sed "s//${tnum}/" $srcdir/test_fms/diag_manager/input.nml_base > input.nml + ln -s $srcdir/test_fms/diag_manager/diagTables/diag_table_${tnum} diag_table +} + +teardown () { + # Echo the output. Will only be done on a test failure. + echo "$output" +} + +@test "Test 1: Data array is too large in x and y direction" { + run mpirun -n 1 ./test_diag_manager + [ "$status" -eq 0 ] + [[ "$output" =~ "test1.1 successful:" ]] + [[ "$output" =~ "test1.2 successful" ]] +} + + +@test "Test 2: Data array is too large in x direction" { + run mpirun -n 1 ./test_diag_manager + [ "$status" -eq 0 ] + [[ "$output" =~ "test2.1 successful." ]] + [[ "$output" =~ "test2.2 successful:" ]] +} + +@test "Test 3: Data array is too large in y direction" { + run mpirun -n 1 ./test_diag_manager + [ "$status" -eq 0 ] + [[ "$output" =~ "test3.1 successful." ]] + [[ "$output" =~ "test3.2 successful:" ]] +} + +@test "Test 4: Data array is too small in x and y direction, checks for 2 time steps" { + run mpirun -n 1 ./test_diag_manager + [ "$status" -eq 0 ] + [[ "$output" =~ "test4.1 successful." ]] + [[ "$output" =~ "test4.2 successful:" ]] +} + +@test "Test 5: Data array is too small in x directions, checks for 2 time steps" { + run mpirun -n 1 ./test_diag_manager + [ "$status" -eq 0 ] + [[ "$output" =~ "test5.1 successful." ]] + [[ "$output" =~ "test5.2 successful:" ]] +} + +@test "Test 6: Data array is too small in y direction, checks for 2 time steps" { + run mpirun -n 1 ./test_diag_manager + [ "$status" -eq 0 ] + [[ "$output" =~ "test6.1 successful." ]] + [[ "$output" =~ "test6.2 successful:" ]] +} + +@test "Test 7: Data array is too large in x and y, with halos, 2 time steps" { + run mpirun -n 1 ./test_diag_manager + [ "$status" -eq 0 ] + [[ "$output" =~ "test7.1 successful." ]] + [[ "$output" =~ "test7.2 successful:" ]] +} + +@test "Test 8: Data array is too small in x and y, with halos, 2 time steps" { + run mpirun -n 1 ./test_diag_manager + [ "$status" -eq 0 ] + [[ "$output" =~ "test8.1 successful." ]] + [[ "$output" =~ "test8.2 successful:" ]] +} + +@test "Test 9: Data array is too small, 1D, static global data" { + run mpirun -n 1 ./test_diag_manager + [ "$status" -eq 0 ] + [[ "$output" =~ "test9.1 successful." ]] + [[ "$output" =~ "test9.2 successful:" ]] +} + +@test "Test 10: Data array is too large, 1D, static global data" { + run mpirun -n 1 ./test_diag_manager + [ "$status" -eq 0 ] + [[ "$output" =~ "test10.1 successful." ]] + [[ "$output" =~ "test10.2 successful:" ]] +} + +@test "Test 11: Missing je_in as an input" { + run mpirun -n 1 ./test_diag_manager + [ "$status" -eq 0 ] + [[ "$output" =~ "test11.1 successful." ]] + [[ "$output" =~ "test11.2 successful." ]] +} + +@test "Test 12: Catch duplicate field in diag_table" { + run mpirun -n 1 ./test_diag_manager + [ "$status" -ne 0 ] + [[ "$output" =~ "test12 successful:" ]] +} + +@test "Test 13: Output interval greater than runlength" { + run mpirun -n 1 ./test_diag_manager + [ "$status" -eq 0 ] + [[ "$output" =~ "NOTE: Potential error in diag_manager_end: dat2 NOT available, check if output interval > runlength. Netcdf fill_values are written" ]] +} + +@test "Test 14: Catch invalid date in register_diag_field call" { + run mpirun -n 1 ./test_diag_manager + [ "$status" -eq 0 ] + [[ "$output" =~ "test14 successful." ]] +} + +@test "Test 15: OpenMP thread test" { + skip + sed -i -e 's/\(numthreads *= *\)[0-9]*/\12/' input.nml + run mpirun -n 1 ./test_diag_manager + [ "$status" -eq 0 ] +} + +@test "Test 16: Filename appendix added" { + run mpirun -n 1 ./test_diag_manager + [ "$status" -eq 0 ] + [ -e diag_test_16.g01.nc ] +} + +@test "Test 17: Root-mean-square" { + run mpirun -n 1 ./test_diag_manager + [ "$status" -eq 0 ] +# run ncdump diag_test_17.nc +# echo "$output" > diag_test_17.out +# run cmp diag_test_17.out test_data/diag_test_17.out +# [ "$status" -eq 0 ] +} + +@test "Test 18: Added attributes, and cell_measures" { + run mpirun -n 1 ./test_diag_manager + [ "$status" -eq 0 ] +# run ncdump diag_test_18_file1.nc +# echo "$output" > diag_test_18_file1.out +# run cmp test_data/diag_test_18_file1.out diag_test_18_file1.out +# [ "$status" -eq 0 ] +} + +@test "Test 19: Area and Volume same field" { + run mpirun -n 1 ./test_diag_manager + [ "$status" -ne 0 ] + [[ "$output" =~ "module/output_field test_mod/dat2h AREA and VOLUME CANNOT be the same variable" ]] +} + +@test "Test 20: Get diag_field_id, ID found and not found" { + run mpirun -n 1 ./test_diag_manager + [ "$status" -eq 0 ] + [[ "$output" =~ "test20.1 Passes, id_dat2.EQ.id_dat2_got" ]] + [[ "$output" =~ "test20.2 Passes, id_none_got.EQ.DIAG_FIELD_NOT_FOUND" ]] +} + +@test "Test 21: Add axis attributes" { + run mpirun -n 1 ./test_diag_manager + [ "$status" -eq 0 ] +# run ncdump diag_test_21_file1.nc +# echo "$output" > diag_test_21_file1.out +# run cmp test_data/diag_test_21_file1.out diag_test_21_file1.out +# [ "$status" -eq 0 ] +} + +@test "Test 22: Get 'nv' axis id" { + run mpirun -n 1 ./test_diag_manager + [ "$status" -eq 0 ] + [[ "$output" =~ "test22.1 Passes: id_nv has a positive value" ]] + [[ "$output" =~ "test22.2 Passes: Can call diag_axis_init on \"nv\" and get same ID" ]] +# run ncdump diag_test_22_file1.nc +# echo "$output" > diag_test_22_file1.out +# run cmp test_data/diag_test_22_file1.out diag_test_22_file1.out +# [ "$status" -eq 0 ] +} + +@test "Test 23: Unstructured grid" { + run mpirun -n 1 ./test_diag_manager + [ "$status" -eq 0 ] +} diff --git a/test_fms/diag_manager/test_diag_manager.sh b/test_fms/diag_manager/test_diag_manager.sh new file mode 100755 index 0000000000..6f8162d9de --- /dev/null +++ b/test_fms/diag_manager/test_diag_manager.sh @@ -0,0 +1,2 @@ +#!/bin/sh +bats $srcdir/test_fms/diag_manager/test_diag_manager.bats diff --git a/test_fms/diag_manager/test_diag_manager2.sh b/test_fms/diag_manager/test_diag_manager2.sh deleted file mode 100755 index 9a53633268..0000000000 --- a/test_fms/diag_manager/test_diag_manager2.sh +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/sh - -# This is part of the GFDL FMS package. This is a shell script to -# execute tests in the test_fms/data_override directory. - -# Ed Hartnett 11/26/19 - -# Set common test settings. -. ../test_common.sh - -copy_files() -{ - - tnum=$( printf "%2.2d" ${1} ) - rm -f diag_test_${tnum}* > /dev/null 2>&1 - sed "s//${tnum}/" $top_srcdir/test_fms/diag_manager/input.nml_base > input.nml - ln -f -s $top_srcdir/test_fms/diag_manager/diagTables/diag_table_${tnum} diag_table -} - -run_test() -{ - echo ${2} - copy_files ${1} - if test "x${3}" = "xfail"; then - if mpirun -n 1 ./test_diag_manager; then exit 1; fi - else - mpirun -n 1 ./test_diag_manager - fi -} - -rm -f input.nml diag_table -run_test 1 "Test 1: Data array is too large in x and y direction" -run_test 2 "Test 2: Data array is too large in x direction" -run_test 3 "Test 3: Data array is too large in y direction" -run_test 4 "Test 4: Data array is too small in x and y direction, checks for 2 time steps" -run_test 5 "Test 5: Data array is too small in x directions, checks for 2 time steps" -run_test 6 "Test 6: Data array is too small in y direction, checks for 2 time steps" -run_test 7 "Test 7: Data array is too large in x and y, with halos, 2 time steps" -run_test 8 "Test 8: Data array is too small in x and y, with halos, 2 time steps" -run_test 9 "Test 9: Data array is too small, 1D, static global data" -run_test 10 "Test 10: Data array is too large, 1D, static global data" -run_test 11 "Test 11: Missing je_in as an input" -run_test 12 "Test 12: Catch duplicate field in diag_table" "fail" -run_test 13 "Test 13: Output interval greater than runlength" -run_test 14 "Test 14: Catch invalid date in register_diag_field call" -run_test 15 "Test 15: OpenMP thread test" -run_test 16 "Test 16: Filename appendix added" -run_test 17 "Test 17: Root-mean-square" -run_test 18 "Test 18: Added attributes, and cell_measures" -run_test 19 "Test 19: Area and Volume same field" "fail" -run_test 20 "Test 20: Get diag_field_id, ID found and not found" -run_test 21 "Test 21: Add axis attributes" -run_test 22 "Test 22: Get 'nv' axis id" -run_test 23 "Test 23: Unstructured grid" diff --git a/test_fms/drifters/Makefile.am b/test_fms/drifters/Makefile.am index f5c909a6b1..9d8848d70d 100644 --- a/test_fms/drifters/Makefile.am +++ b/test_fms/drifters/Makefile.am @@ -3,6 +3,12 @@ # uramirez, Ed Hartnett +LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) \ + $(top_srcdir)/tap-driver.sh + +# Set srcdir as evironment variable to be reference in the job script +TESTS_ENVIRONMENT = srcdir="$(top_srcdir)" + # Find the needed mod and .inc files. AM_CPPFLAGS = -I${top_builddir}/drifters -I${top_builddir}/mpp \ -I${top_srcdir}/include -I${top_builddir}/fms @@ -11,8 +17,8 @@ AM_CPPFLAGS = -I${top_builddir}/drifters -I${top_builddir}/mpp \ LDADD = ${top_builddir}/libFMS/libFMS.la # Build these test programs. -check_PROGRAMS = test_cloud_interpolator test_drifters_input \ -test_drifters_comm test_drifters_core test_drifters_io test_quicksort \ +check_PROGRAMS = test_cloud_interpolator test_drifters_input \ +test_drifters_comm test_drifters_core test_drifters_io test_quicksort \ test_drifters # This is the source code for the tests. @@ -25,11 +31,17 @@ test_quicksort_SOURCES = test_quicksort.F90 test_drifters_SOURCES = test_drifters.F90 # Run the test programs. -TESTS = test_drifters2.sh +TESTS = test_drifters_io.sh test_cloud_interpolator.sh \ +test_drifters_input.sh test_drifters_comm.sh test_drifters_core.sh \ +test_quicksort.sh test_drifters.sh # Include these files in the distribution. -EXTRA_DIST = input_base.nml drifters_inp_test_3d.cdl \ -test_drifters2.sh +EXTRA_DIST = input_base.nml test_cloud_interpolator.bats \ +test_cloud_interpolator.sh test_drifters_io.bats test_drifters_io.sh \ +test_drifters_input.bats test_drifters_input.sh \ +test_drifters_comm.bats test_drifters_comm.sh test_drifters_core.bats \ +test_drifters_core.sh test_quicksort.bats test_quicksort.sh \ +test_drifters.bats test_drifters.sh drifters_inp_test_3d.cdl # Clean up CLEANFILES = *out *__genmod.mod *__genmod.f90 input.nml *.nc diff --git a/test_fms/drifters/test_cloud_interpolator.bats b/test_fms/drifters/test_cloud_interpolator.bats new file mode 100755 index 0000000000..45d91d5c40 --- /dev/null +++ b/test_fms/drifters/test_cloud_interpolator.bats @@ -0,0 +1,9 @@ +teardown () { + # Echo the output. Will only be done on a test failure. + echo "$output" +} + +@test "1" { + run mpirun -n 2 ./test_cloud_interpolator + [ "$status" -eq 0 ] +} diff --git a/test_fms/drifters/test_cloud_interpolator.sh b/test_fms/drifters/test_cloud_interpolator.sh new file mode 100755 index 0000000000..b1b6e83c78 --- /dev/null +++ b/test_fms/drifters/test_cloud_interpolator.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +bats $srcdir/test_fms/drifters/test_cloud_interpolator.bats diff --git a/test_fms/drifters/test_drifters.bats b/test_fms/drifters/test_drifters.bats new file mode 100644 index 0000000000..ef05e69c67 --- /dev/null +++ b/test_fms/drifters/test_drifters.bats @@ -0,0 +1,10 @@ +teardown () { + # Echo the output. Will only be done on a test failure. + echo "$output" +} + +@test "1" { + skip "The input file is missing" + run ./test_drifters + [ "$status" -eq 0 ] +} diff --git a/test_fms/drifters/test_drifters.sh b/test_fms/drifters/test_drifters.sh new file mode 100755 index 0000000000..c4ad6b64a9 --- /dev/null +++ b/test_fms/drifters/test_drifters.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +bats $srcdir/test_fms/drifters/test_drifters.bats diff --git a/test_fms/drifters/test_drifters2.sh b/test_fms/drifters/test_drifters2.sh deleted file mode 100755 index 390e996e01..0000000000 --- a/test_fms/drifters/test_drifters2.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/sh - -# This is part of the GFDL FMS package. This is a shell script to -# execute tests in the test_fms/drifters directory. - -# Ed Hartnett 11/29/19 - -# Set common test settings. -. ../test_common.sh - -# Copy file for test_drifters_io test. -cp $top_srcdir/test_fms/drifters/input_base.nml input.nml - -# Run tests. -mpirun -n 2 ./test_drifters_io -mpirun -n 2 ./test_cloud_interpolator -./test_drifters_comm -mpirun -n 2 ./test_drifters_core -mpirun -n 2 ./test_quicksort diff --git a/test_fms/drifters/test_drifters_comm.bats b/test_fms/drifters/test_drifters_comm.bats new file mode 100644 index 0000000000..f3049bc6da --- /dev/null +++ b/test_fms/drifters/test_drifters_comm.bats @@ -0,0 +1,9 @@ +teardown () { + # Echo the output. Will only be done on a test failure. + echo "$output" +} + +@test "1" { + run ./test_drifters_comm + [ "$status" -eq 0 ] +} diff --git a/test_fms/drifters/test_drifters_comm.sh b/test_fms/drifters/test_drifters_comm.sh new file mode 100755 index 0000000000..302180e60b --- /dev/null +++ b/test_fms/drifters/test_drifters_comm.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +bats $srcdir/test_fms/drifters/test_drifters_comm.bats diff --git a/test_fms/drifters/test_drifters_core.bats b/test_fms/drifters/test_drifters_core.bats new file mode 100644 index 0000000000..c15fa5b763 --- /dev/null +++ b/test_fms/drifters/test_drifters_core.bats @@ -0,0 +1,9 @@ +teardown () { + # Echo the output. Will only be done on a test failure. + echo "$output" +} + +@test "1" { + run mpirun -n 2 ./test_drifters_core + [ "$status" -eq 0 ] +} diff --git a/test_fms/drifters/test_drifters_core.sh b/test_fms/drifters/test_drifters_core.sh new file mode 100755 index 0000000000..76d2228cf2 --- /dev/null +++ b/test_fms/drifters/test_drifters_core.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +bats $srcdir/test_fms/drifters/test_drifters_core.bats diff --git a/test_fms/drifters/test_drifters_input.bats b/test_fms/drifters/test_drifters_input.bats new file mode 100644 index 0000000000..255719eb54 --- /dev/null +++ b/test_fms/drifters/test_drifters_input.bats @@ -0,0 +1,10 @@ +teardown () { + # Echo the output. Will only be done on a test failure. + echo "$output" +} + +@test "1" { + skip "Fails in 32bit/Mixed mode" + run mpirun -n 2 ./test_drifters_input + [ "$status" -eq 0 ] +} diff --git a/test_fms/drifters/test_drifters_input.sh b/test_fms/drifters/test_drifters_input.sh new file mode 100755 index 0000000000..fa98d5c185 --- /dev/null +++ b/test_fms/drifters/test_drifters_input.sh @@ -0,0 +1,4 @@ +#!/bin/sh + +ncgen -o test_drifters_input.nc $srcdir/test_fms/drifters/drifters_inp_test_3d.cdl +bats $srcdir/test_fms/drifters/test_drifters_input.bats diff --git a/test_fms/drifters/test_drifters_io.bats b/test_fms/drifters/test_drifters_io.bats new file mode 100644 index 0000000000..a31decbe14 --- /dev/null +++ b/test_fms/drifters/test_drifters_io.bats @@ -0,0 +1,9 @@ +teardown () { + # Echo the output. Will only be done on a test failure. + echo "$output" +} + +@test "1" { + run mpirun -n 2 ./test_drifters_io + [ "$status" -eq 0 ] +} diff --git a/test_fms/drifters/test_drifters_io.sh b/test_fms/drifters/test_drifters_io.sh new file mode 100755 index 0000000000..7de6b271f2 --- /dev/null +++ b/test_fms/drifters/test_drifters_io.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +cp $srcdir/test_fms/drifters/input_base.nml input.nml + +bats $srcdir/test_fms/drifters/test_drifters_io.bats diff --git a/test_fms/drifters/test_quicksort.bats b/test_fms/drifters/test_quicksort.bats new file mode 100644 index 0000000000..3dec28a105 --- /dev/null +++ b/test_fms/drifters/test_quicksort.bats @@ -0,0 +1,9 @@ +teardown () { + # Echo the output. Will only be done on a test failure. + echo "$output" +} + +@test "1" { + run mpirun -n 2 ./test_quicksort + [ "$status" -eq 0 ] +} diff --git a/test_fms/drifters/test_quicksort.sh b/test_fms/drifters/test_quicksort.sh new file mode 100755 index 0000000000..4f5ce436bc --- /dev/null +++ b/test_fms/drifters/test_quicksort.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +bats $srcdir/test_fms/drifters/test_quicksort.bats diff --git a/test_fms/exchange/Makefile.am b/test_fms/exchange/Makefile.am index fcd9fe55b6..0f14817c90 100644 --- a/test_fms/exchange/Makefile.am +++ b/test_fms/exchange/Makefile.am @@ -3,10 +3,16 @@ # uramirez, Ed Hartnett +LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) \ + $(top_srcdir)/tap-driver.sh + +# Set srcdir as evironment variable to be reference in the job script +TESTS_ENVIRONMENT = srcdir="$(top_srcdir)" builddir="$(top_builddir)" + # Find the needed mod and .inc files. -AM_CPPFLAGS = -I${top_srcdir}/include -I${top_builddir}/mpp \ --I${top_builddir}/fms -I${top_builddir}/constants \ --I${top_builddir}/exchange -I${top_builddir}/mosaic \ +AM_CPPFLAGS = -I${top_srcdir}/include -I${top_builddir}/mpp \ +-I${top_builddir}/fms -I${top_builddir}/constants \ +-I${top_builddir}/exchange -I${top_builddir}/mosaic \ -I${top_builddir}/coupler # Link to FMS library. @@ -19,10 +25,10 @@ check_PROGRAMS = test_xgrid test_xgrid_SOURCES = test_xgrid.F90 # Run the test program. -TESTS = test_xgrid2.sh +TESTS = test_xgrid.sh # Copy over other needed files to the srcdir -EXTRA_DIST = input_base.nml test_xgrid2.sh +EXTRA_DIST = test_xgrid.sh input.nml test_xgrid.bats # Clean up CLEANFILES = input.nml *.nc *.out diff --git a/test_fms/exchange/input_base.nml b/test_fms/exchange/input.nml similarity index 100% rename from test_fms/exchange/input_base.nml rename to test_fms/exchange/input.nml diff --git a/test_fms/exchange/test_xgrid.bats b/test_fms/exchange/test_xgrid.bats new file mode 100755 index 0000000000..0bfc5e9a40 --- /dev/null +++ b/test_fms/exchange/test_xgrid.bats @@ -0,0 +1,15 @@ +teardown () { + # Echo the output. Will only be done on a test failure. + echo "$output" +} + +@test "1" { + skip "The input file is missing" + cp -r $srcdir/test_fms/exchange/INPUT INPUT + + run mpirun -n 2 ./test_xgrid + [ "$status" -eq 0 ] + + chmod 755 $builddir/test_fms/exchange/INPUT + rm -rf $builddir/test_fms/exchange/INPUT +} diff --git a/test_fms/exchange/test_xgrid.sh b/test_fms/exchange/test_xgrid.sh new file mode 100755 index 0000000000..00b7bd8464 --- /dev/null +++ b/test_fms/exchange/test_xgrid.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +cp $srcdir/test_fms/exchange/input.nml input.nml + +bats $srcdir/test_fms/exchange/test_xgrid.bats diff --git a/test_fms/exchange/test_xgrid2.sh b/test_fms/exchange/test_xgrid2.sh deleted file mode 100755 index 8bb7c61bc0..0000000000 --- a/test_fms/exchange/test_xgrid2.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh - -# This is part of the GFDL FMS package. This is a shell script to -# execute tests in the test_fms/drifters directory. - -# Ed Hartnett 11/29/19 - -# Set common test settings. -. ../test_common.sh - -# Copy file for test. -cp $top_srcdir/test_fms/exchange/input_base.nml input.nml - -# This test is skipped in the bats file. -#cp -r $top_srcdir/test_fms/exchange/INPUT INPUT -#mpirun -n 2 ./test_xgrid diff --git a/test_fms/fft/Makefile.am b/test_fms/fft/Makefile.am index 467b225e3f..982af983cc 100644 --- a/test_fms/fft/Makefile.am +++ b/test_fms/fft/Makefile.am @@ -3,6 +3,12 @@ # uramirez, Ed Hartnett +LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) \ + $(top_srcdir)/tap-driver.sh + +# Set srcdir as evironment variable to be reference in the job script +TESTS_ENVIRONMENT = srcdir="$(top_srcdir)" + # Find the needed mod files. AM_CPPFLAGS = -I${top_builddir}/fft -I${top_builddir}/mpp @@ -16,10 +22,10 @@ check_PROGRAMS = test_fft test_fft_SOURCES = test_fft.F90 # Run the test program. -TESTS = test_fft2.sh +TESTS = test_fft.sh # These files are also included in the distribution. -EXTRA_DIST = test_fft2.sh input_base.nml +EXTRA_DIST = test_fft.sh test_fft.bats input_base.nml # Clean up CLEANFILES = input.nml *.out* diff --git a/test_fms/fft/test_fft.bats b/test_fms/fft/test_fft.bats new file mode 100644 index 0000000000..e3faba3b68 --- /dev/null +++ b/test_fms/fft/test_fft.bats @@ -0,0 +1,10 @@ +teardown () { + # Echo the output. Will only be done on a test failure. + echo "$output" +} + +@test "1" { + skip "Fails in 32bit/Mixed mode" + run mpirun -n 2 ./test_fft + [ "$status" -eq 0 ] +} diff --git a/test_fms/fft/test_fft.sh b/test_fms/fft/test_fft.sh new file mode 100755 index 0000000000..e3d216f52d --- /dev/null +++ b/test_fms/fft/test_fft.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +cp $srcdir/test_fms/fft/input_base.nml input.nml + +bats $srcdir/test_fms/fft/test_fft.bats diff --git a/test_fms/fft/test_fft2.sh b/test_fms/fft/test_fft2.sh deleted file mode 100755 index cbdf2229dd..0000000000 --- a/test_fms/fft/test_fft2.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh - -# This is part of the GFDL FMS package. This is a shell script to -# execute tests in the test_fms/fft directory. - -# Ed Hartnett 11/29/19 - -# Set common test settings. -. ../test_common.sh - -# Copy file for test. -cp $top_srcdir/test_fms/fft/input_base.nml input.nml - -# Test is skipped in bats file. -#mpirun -n 2 ./test_fft diff --git a/test_fms/field_manager/Makefile.am b/test_fms/field_manager/Makefile.am index 7cda4458e5..62b90686fb 100644 --- a/test_fms/field_manager/Makefile.am +++ b/test_fms/field_manager/Makefile.am @@ -1,8 +1,14 @@ -# This is an automake file for the test_fms/field_manager directory of -# the FMS package. +# This is an automake file for the test_fms/data_override directory of the FMS +# package. # uramirez, Ed Hartnett +LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) \ + $(top_srcdir)/tap-driver.sh + +# Set srcdir as evironment variable to be reference in the job script +TESTS_ENVIRONMENT = srcdir="$(top_srcdir)" + # Find the needed mod files. AM_CPPFLAGS = -I${top_builddir}/field_manager -I${top_builddir}/mpp @@ -16,10 +22,11 @@ check_PROGRAMS = test_field_manager test_field_manager_SOURCES = test_field_manager.F90 # Run the test program. -TESTS = test_field_manager2.sh +TESTS = test_field_manager.sh # These files will also be included in the distribution. -EXTRA_DIST = test_field_manager2.sh input_base.nml field_table_base +EXTRA_DIST = test_field_manager.sh test_field_manager.bats \ +input_base.nml field_table_base # Clean up CLEANFILES = input.nml *.out* field_table diff --git a/test_fms/field_manager/test_field_manager.bats b/test_fms/field_manager/test_field_manager.bats new file mode 100644 index 0000000000..dc2d954e29 --- /dev/null +++ b/test_fms/field_manager/test_field_manager.bats @@ -0,0 +1,9 @@ +teardown () { + # Echo the output. Will only be done on a test failure. + echo "$output" +} + +@test "1" { + run mpirun -n 2 ./test_field_manager + [ "$status" -eq 0 ] +} diff --git a/test_fms/field_manager/test_field_manager.sh b/test_fms/field_manager/test_field_manager.sh new file mode 100755 index 0000000000..de4c1ee1d1 --- /dev/null +++ b/test_fms/field_manager/test_field_manager.sh @@ -0,0 +1,6 @@ +#!/bin/sh + +cp $srcdir/test_fms/field_manager/input_base.nml input.nml +cp $srcdir/test_fms/field_manager/field_table_base field_table + +bats $srcdir/test_fms/field_manager/test_field_manager.bats diff --git a/test_fms/field_manager/test_field_manager2.sh b/test_fms/field_manager/test_field_manager2.sh deleted file mode 100755 index e8ec2a2836..0000000000 --- a/test_fms/field_manager/test_field_manager2.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh - -# This is part of the GFDL FMS package. This is a shell script to -# execute tests in the test_fms/field_manager directory. - -# Ed Hartnett 11/29/19 - -# Set common test settings. -. ../test_common.sh - -# Copy files for test. -cp $top_srcdir/test_fms/field_manager/input_base.nml input.nml -cp $top_srcdir/test_fms/field_manager/field_table_base field_table - -mpirun -n 2 ./test_field_manager diff --git a/test_fms/fms/Makefile.am b/test_fms/fms/Makefile.am index 2f9c38c03a..645f22563f 100644 --- a/test_fms/fms/Makefile.am +++ b/test_fms/fms/Makefile.am @@ -3,8 +3,14 @@ # uramirez, Ed Hartnett +LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) \ + $(top_srcdir)/tap-driver.sh + +# Set srcdir as evironment variable to be reference in the job script +TESTS_ENVIRONMENT = srcdir="$(top_srcdir)" + # Find the fms_mod.mod file. -AM_CPPFLAGS = -I${top_builddir}/fms -I${top_builddir}/mpp \ +AM_CPPFLAGS = -I${top_builddir}/fms -I${top_builddir}/mpp \ -I${top_srcdir}/include # Link to the FMS library. @@ -18,7 +24,8 @@ test_fms_io_SOURCES = test_fms_io.F90 test_unstructured_fms_io_SOURCES = test_unstructured_fms_io.F90 # Run the test programs. -TESTS = test_fms_io2.sh +TESTS = test_fms_io.sh test_unstructured_fms_io.sh # These will also be included in the distribution. -EXTRA_DIST = test_fms_io2.sh +EXTRA_DIST = test_fms_io.sh test_fms_io.bats \ +test_unstructured_fms_io.sh test_unstructured_fms_io.bats diff --git a/test_fms/fms/test_fms_io.bats b/test_fms/fms/test_fms_io.bats new file mode 100644 index 0000000000..161ca6422d --- /dev/null +++ b/test_fms/fms/test_fms_io.bats @@ -0,0 +1,10 @@ +teardown () { + # Echo the output. Will only be done on a test failure. + echo "$output" +} + +@test "1" { + skip "Missing restart files" + run mpirun -n 2 ./test_fms_io + [ "$status" -eq 0 ] +} diff --git a/test_fms/fms/test_fms_io.sh b/test_fms/fms/test_fms_io.sh new file mode 100755 index 0000000000..806c15b30f --- /dev/null +++ b/test_fms/fms/test_fms_io.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +bats $srcdir/test_fms/fms/test_fms_io.bats diff --git a/test_fms/fms/test_fms_io2.sh b/test_fms/fms/test_fms_io2.sh deleted file mode 100755 index f3e56ef62b..0000000000 --- a/test_fms/fms/test_fms_io2.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh - -# This is part of the GFDL FMS package. This is a shell script to -# execute tests in the test_fms/fms directory. - -# Ed Hartnett 11/29/19 - -# Set common test settings. -. ../test_common.sh - -# Copy files for test. - -# These tests are skipped in bats files. -#mpirun -n 2 ./test_fms_io -#mpirun -n 2 ./test_unstructured_fms_io diff --git a/test_fms/fms/test_unstructured_fms_io.bats b/test_fms/fms/test_unstructured_fms_io.bats new file mode 100644 index 0000000000..3a55234667 --- /dev/null +++ b/test_fms/fms/test_unstructured_fms_io.bats @@ -0,0 +1,10 @@ +teardown () { + # Echo the output. Will only be done on a test failure. + echo "$output" +} + +@test "1" { + skip "This test does not pass" + run mpirun -n 2 ./test_unstructured_fms_io + [ "$status" -eq 0 ] +} diff --git a/test_fms/fms/test_unstructured_fms_io.sh b/test_fms/fms/test_unstructured_fms_io.sh new file mode 100755 index 0000000000..ada84cee53 --- /dev/null +++ b/test_fms/fms/test_unstructured_fms_io.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +bats $srcdir/test_fms/fms/test_unstructured_fms_io.bats diff --git a/test_fms/horiz_interp/Makefile.am b/test_fms/horiz_interp/Makefile.am index fcfb0a0172..848887a3d4 100644 --- a/test_fms/horiz_interp/Makefile.am +++ b/test_fms/horiz_interp/Makefile.am @@ -1,11 +1,17 @@ -# This is an automake file for the test_fms/horiz_interp directory of -# the FMS package. +# This is an automake file for the test_fms/data_override directory of the FMS +# package. # uramirez, Ed Hartnett +LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) \ + $(top_srcdir)/tap-driver.sh + +# Set srcdir as evironment variable to be reference in the job script +TESTS_ENVIRONMENT = srcdir="$(top_srcdir)" + # Find the needed mod files. -AM_CPPFLAGS = -I${top_builddir}/horiz_interp -I${top_builddir}/fms \ --I${top_builddir}/constants -I${top_builddir}/mpp \ +AM_CPPFLAGS = -I${top_builddir}/horiz_interp -I${top_builddir}/fms \ +-I${top_builddir}/constants -I${top_builddir}/mpp \ -I${top_builddir}/mosaic -I${top_builddir}/axis_utils # Link to the FMS library. @@ -19,10 +25,11 @@ test_horiz_interp_SOURCES = test_horiz_interp.F90 test2_horiz_interp_SOURCES = test2_horiz_interp.F90 # Run the test programs. -TESTS = test_horiz_interp2.sh +TESTS = test_horiz_interp.sh test2_horiz_interp.sh # These files will also be included in the distribution. -EXTRA_DIST = input_base.nml test_horiz_interp2.sh +EXTRA_DIST = test_horiz_interp.sh test_horiz_interp.bats \ +test2_horiz_interp.sh test2_horiz_interp.bats input_base.nml # Clean up CLEANFILES = input.nml *.out* diff --git a/test_fms/horiz_interp/test2_horiz_interp.bats b/test_fms/horiz_interp/test2_horiz_interp.bats new file mode 100644 index 0000000000..4b89bea9c6 --- /dev/null +++ b/test_fms/horiz_interp/test2_horiz_interp.bats @@ -0,0 +1,10 @@ +teardown () { + # Echo the output. Will only be done on a test failure. + echo "$output" +} + +@test "1" { + skip "The input files are missing" + run mpirun -n 2 ./test2_horiz_interp + [ "$status" -eq 0 ] +} diff --git a/test_fms/horiz_interp/test2_horiz_interp.sh b/test_fms/horiz_interp/test2_horiz_interp.sh new file mode 100755 index 0000000000..bcd604b7fd --- /dev/null +++ b/test_fms/horiz_interp/test2_horiz_interp.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +bats $srcdir/test_fms/horiz_interp/test2_horiz_interp.bats diff --git a/test_fms/horiz_interp/test_horiz_interp.bats b/test_fms/horiz_interp/test_horiz_interp.bats new file mode 100644 index 0000000000..9cd413d77d --- /dev/null +++ b/test_fms/horiz_interp/test_horiz_interp.bats @@ -0,0 +1,9 @@ +teardown () { + # Echo the output. Will only be done on a test failure. + echo "$output" +} + +@test "1" { + run mpirun -n 2 ./test_horiz_interp + [ "$status" -eq 0 ] +} diff --git a/test_fms/horiz_interp/test_horiz_interp.sh b/test_fms/horiz_interp/test_horiz_interp.sh new file mode 100755 index 0000000000..a31fece2d8 --- /dev/null +++ b/test_fms/horiz_interp/test_horiz_interp.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +cp $srcdir/test_fms/horiz_interp/input_base.nml input.nml + +bats $srcdir/test_fms/horiz_interp/test_horiz_interp.bats diff --git a/test_fms/horiz_interp/test_horiz_interp2.sh b/test_fms/horiz_interp/test_horiz_interp2.sh deleted file mode 100755 index 5f38ba2c18..0000000000 --- a/test_fms/horiz_interp/test_horiz_interp2.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh - -# This is part of the GFDL FMS package. This is a shell script to -# execute tests in the test_fms/horiz_interp directory. - -# Ed Hartnett 11/29/19 - -# Set common test settings. -. ../test_common.sh - -# Copy file for test. -cp $top_srcdir/test_fms/horiz_interp/input_base.nml input.nml - -mpirun -n 2 ./test_horiz_interp - -# Other test is skipped in bats. -#mpirun -n 2 ./test_horiz_interp diff --git a/test_fms/interpolator/Makefile.am b/test_fms/interpolator/Makefile.am index 08d3381225..b63b6eb3e9 100644 --- a/test_fms/interpolator/Makefile.am +++ b/test_fms/interpolator/Makefile.am @@ -3,10 +3,16 @@ # uramirez, Ed Hartnett +LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) \ + $(top_srcdir)/tap-driver.sh + +# Set srcdir as evironment variable to be reference in the job script +TESTS_ENVIRONMENT = srcdir="$(top_srcdir)" + # Find the fms_mod.mod file. -AM_CPPFLAGS = -I${top_builddir}/mpp -I${top_builddir}/fms \ --I${top_builddir}/time_manager -I${top_builddir}/diag_manager \ --I${top_builddir}/interpolator -I${top_builddir}/constants \ +AM_CPPFLAGS = -I${top_builddir}/mpp -I${top_builddir}/fms \ +-I${top_builddir}/time_manager -I${top_builddir}/diag_manager \ +-I${top_builddir}/interpolator -I${top_builddir}/constants \ -I${top_builddir}/time_interp # Link to the FMS library. @@ -19,10 +25,11 @@ check_PROGRAMS = test_interpolator test_interpolator_SOURCES = test_interpolator.F90 # Run the test program. -TESTS = test_interpolator2.sh +TESTS = test_interpolator.sh # These files are also included in the distribution. -EXTRA_DIST = test_interpolator2.sh input_base.nml diag_table_base +EXTRA_DIST = test_interpolator.sh test_interpolator.bats \ +input_base.nml diag_table_base # Clean up CLEANFILES = input.nml diag_table diff --git a/test_fms/interpolator/test_interpolator.bats b/test_fms/interpolator/test_interpolator.bats new file mode 100644 index 0000000000..7e83f6d217 --- /dev/null +++ b/test_fms/interpolator/test_interpolator.bats @@ -0,0 +1,10 @@ +teardown () { + # Echo the output. Will only be done on a test failure. + echo "$output" +} + +@test "1" { + skip "The input files are missing" + run mpirun -n 2 ./test_interpolator + [ "$status" -eq 0 ] +} diff --git a/test_fms/interpolator/test_interpolator.sh b/test_fms/interpolator/test_interpolator.sh new file mode 100755 index 0000000000..06db5935d3 --- /dev/null +++ b/test_fms/interpolator/test_interpolator.sh @@ -0,0 +1,6 @@ +#!/bin/sh + +cp $srcdir/test_fms/interpolator/input_base.nml input.nml +cp $srcdir/test_fms/interpolator/diag_table_base diag_table + +bats $srcdir/test_fms/interpolator/test_interpolator.bats diff --git a/test_fms/interpolator/test_interpolator2.sh b/test_fms/interpolator/test_interpolator2.sh deleted file mode 100755 index f3d3745919..0000000000 --- a/test_fms/interpolator/test_interpolator2.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh - -# This is part of the GFDL FMS package. This is a shell script to -# execute tests in the test_fms/field_manager directory. - -# Ed Hartnett 11/29/19 - -# Set common test settings. -. ../test_common.sh - -# Copy files for test. -cp $top_srcdir/test_fms/interpolator/input_base.nml input.nml -cp $top_srcdir/test_fms/interpolator/diag_table_base diag_table - -# Test is skipped in bats file. -#mpirun -n 2 ./test_interpolator diff --git a/test_fms/monin_obukhov/Makefile.am b/test_fms/monin_obukhov/Makefile.am index 00a451b6de..264fac89f3 100644 --- a/test_fms/monin_obukhov/Makefile.am +++ b/test_fms/monin_obukhov/Makefile.am @@ -3,8 +3,14 @@ # uramirez, Ed Hartnett +LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) \ + $(top_srcdir)/tap-driver.sh + +# Set srcdir as evironment variable to be reference in the job script +TESTS_ENVIRONMENT = srcdir="$(top_srcdir)" + # Find the needed mod files. -AM_CPPFLAGS = -I${top_builddir}/monin_obukhov -I${top_builddir}/fms \ +AM_CPPFLAGS = -I${top_builddir}/monin_obukhov -I${top_builddir}/fms \ -I${top_builddir}/mpp # Link to the FMS library. @@ -17,10 +23,11 @@ check_PROGRAMS = test_monin_obukhov test_monin_obukhov_SOURCES = test_monin_obukhov.F90 # Run the test program. -TESTS = test_monin_obukhov2.sh +TESTS = test_monin_obukhov.sh # These files will also be included in the distribution. -EXTRA_DIST = input_base.nml test_monin_obukhov2.sh +EXTRA_DIST = input_base.nml test_monin_obukhov.sh \ +test_monin_obukhov.bats # Clean up CLEANFILES = input.nml *.out diff --git a/test_fms/monin_obukhov/test_monin_obukhov.bats b/test_fms/monin_obukhov/test_monin_obukhov.bats new file mode 100644 index 0000000000..e302882883 --- /dev/null +++ b/test_fms/monin_obukhov/test_monin_obukhov.bats @@ -0,0 +1,9 @@ +teardown () { + # Echo the output. Will only be done on a test failure. + echo "$output" +} + +@test "1" { + run mpirun -n 2 ./test_monin_obukhov + [ "$status" -eq 0 ] +} diff --git a/test_fms/monin_obukhov/test_monin_obukhov.sh b/test_fms/monin_obukhov/test_monin_obukhov.sh new file mode 100755 index 0000000000..3c26cd8dbf --- /dev/null +++ b/test_fms/monin_obukhov/test_monin_obukhov.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +cp $srcdir/test_fms/monin_obukhov/input_base.nml input.nml + +bats $srcdir/test_fms/monin_obukhov/test_monin_obukhov.bats diff --git a/test_fms/monin_obukhov/test_monin_obukhov2.sh b/test_fms/monin_obukhov/test_monin_obukhov2.sh deleted file mode 100755 index aaf8af2164..0000000000 --- a/test_fms/monin_obukhov/test_monin_obukhov2.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh - -# This is part of the GFDL FMS package. This is a shell script to -# execute tests in the test_fms/monin_obukhov directory. - -# Ed Hartnett 11/29/19 - -# Set common test settings. -. ../test_common.sh - -# Copy file for test. -cp $top_srcdir/test_fms/monin_obukhov/input_base.nml input.nml - -# Run test. -mpirun -n 2 ./test_monin_obukhov diff --git a/test_fms/mosaic/Makefile.am b/test_fms/mosaic/Makefile.am index 52869e6a58..f1a81ccfd2 100644 --- a/test_fms/mosaic/Makefile.am +++ b/test_fms/mosaic/Makefile.am @@ -1,10 +1,16 @@ -# This is an automake file for the test_fms/mosaic directory of the -# FMS package. +# This is an automake file for the test_fms/mosaic directory of the FMS +# package. # uramirez, Ed Hartnett +LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) \ + $(top_srcdir)/tap-driver.sh + +# Set srcdir as evironment variable to be reference in the job script +TESTS_ENVIRONMENT = srcdir="$(top_srcdir)" + # Find the needed mod and include files. -AM_CPPFLAGS = -I${top_builddir}/mosaic -I${top_builddir}/fms \ +AM_CPPFLAGS = -I${top_builddir}/mosaic -I${top_builddir}/fms \ -I${top_srcdir}/include -I${top_builddir}/mpp # Link to the FMS library. @@ -17,7 +23,7 @@ check_PROGRAMS = test_mosaic test_mosaic_SOURCES = test_mosaic.F90 # Run the test program. -TESTS = test_mosaic2.sh +TESTS = test_mosaic.sh # These files are also included in the distribution. -EXTRA_DIST = test_mosaic2.sh input.nml +EXTRA_DIST = test_mosaic.sh test_mosaic.bats input.nml diff --git a/test_fms/mosaic/test_mosaic.bats b/test_fms/mosaic/test_mosaic.bats new file mode 100644 index 0000000000..ee3a4cae71 --- /dev/null +++ b/test_fms/mosaic/test_mosaic.bats @@ -0,0 +1,10 @@ +teardown () { + # Echo the output. Will only be done on a test failure. + echo "$output" +} + +@test "1" { + skip "The input files are missing" + run mpirun -n 2 ./test_mosaic + [ "$status" -eq 0 ] +} diff --git a/test_fms/mosaic/test_mosaic.sh b/test_fms/mosaic/test_mosaic.sh new file mode 100755 index 0000000000..482a5e0683 --- /dev/null +++ b/test_fms/mosaic/test_mosaic.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +cp $srcdir/test_fms/mosaic/input_nml input_nml + +bats $srcdir/test_fms/mosaic/test_mosaic.bats diff --git a/test_fms/mosaic/test_mosaic2.sh b/test_fms/mosaic/test_mosaic2.sh deleted file mode 100755 index 2d937c9326..0000000000 --- a/test_fms/mosaic/test_mosaic2.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh - -# This is part of the GFDL FMS package. This is a shell script to -# execute tests in the test_fms/field_manager directory. - -# Ed Hartnett 11/29/19 - -# Set common test settings. -. ../test_common.sh - -# Test is skipped in bats file. - -# Copy files for test. -#cp $top_srcdir/test_fms/mosaic/input_nml input_nml -#mpirun -n 2 ./test_mosaic diff --git a/test_fms/mpp/Makefile.am b/test_fms/mpp/Makefile.am index 69146ea636..d3e88b35f7 100644 --- a/test_fms/mpp/Makefile.am +++ b/test_fms/mpp/Makefile.am @@ -3,6 +3,12 @@ # uramirez, Ed Hartnett +LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) \ + $(top_srcdir)/tap-driver.sh + +# Set srcdir as evironment variable to be reference in the job script +TESTS_ENVIRONMENT = srcdir="$(top_srcdir)" + # Find the needed mod and inc files. AM_CPPFLAGS = -I${top_srcdir}/include -I${top_builddir}/mpp @@ -18,11 +24,12 @@ test_mpp_domains_SOURCES = test_mpp_domains.F90 test_mpp_pset_SOURCES = test_mpp_pset.F90 # Run the test programs. -TESTS = test_mpp_domains2.sh test_mpp_pset2.sh test_mpp2.sh +TESTS = test_mpp_domains.sh test_mpp_pset.sh test_mpp.sh # These files will also be included in the distribution. -EXTRA_DIST = input_base.nml test_mpp_domains2.sh test_mpp_pset2.sh \ -test_mpp2.sh +EXTRA_DIST = input_base.nml test_mpp.sh test_mpp.bats \ +test_mpp_domains.sh test_mpp_domains.bats test_mpp_pset.sh \ +test_mpp_pset.bats # Clean up -CLEANFILES = input.nml *.out* +CLEANFILES = input.nml *.out* input.nml_base diff --git a/test_fms/mpp/input.nml b/test_fms/mpp/input.nml new file mode 100644 index 0000000000..54a3da98c9 --- /dev/null +++ b/test_fms/mpp/input.nml @@ -0,0 +1,62 @@ +&test_mpp_pset_nml +test_number = 02 +/ + + +&test_mpp_domains_nml +check_parallel = .false. +debug=.FALSE. +do_sleep = .false. +ehalo = 2 +ensemble_size = 1 +extra_halo = 0 +iend_coarse = 10 +iend_fine = 10 +istart_coarse = 1 +istart_fine = 1 +jend_coarse = 10 +jend_fine = 10 +jstart_coarse = 1 +jstart_fine = 1 +layout_cubic = 0,0 +layout_ensemble = 0,0 +layout_tripolar = 0,0 +mix_2D_3D = .false. +mpes = 3 +nhalo = 2 +npes_coarse = 6 +npes_fine = 6 +nthreads = 1 +num_fields = 4 +num_iter = 1 +nx_cubic = 10 +nx=64 +ny_cubic = 10 +ny=64 +nz=10 +shalo = 2 +stackmax=10000000 +test_adjoint = .false. +test_boundary = .false. +test_cubic_grid_redistribute = .false. +test_edge_update = .false. +test_get_nbr = .false. +test_global_sum = .false. +test_group = .false. +test_halosize_performance = .false. +test_interface = .false. +test_nest_domain = .false. +test_nonsym_edge = .false. +test_performance = .false. +test_subset = .false. +test_unstruct = .false. +tile_coarse = 1 +tile_fine = 1 +warn_level = "fatal" +whalo = 2 +wide_halo = .false. +wide_halo_x = 0 +wide_halo_y = 0 +x_cyclic_offset = 3 +y_cyclic_offset = -4 +/ diff --git a/test_fms/mpp/test_mpp.bats b/test_fms/mpp/test_mpp.bats new file mode 100755 index 0000000000..0ab12ec678 --- /dev/null +++ b/test_fms/mpp/test_mpp.bats @@ -0,0 +1,48 @@ +setup () { + # Get the number of available CPUs on the system + if [ $(command -v nproc) ] + then + # Looks like a linux system + nProc=$(nproc) + elif [ $(command -v sysctl) ] + then + # Looks like a Mac OS X system + nProc=$(sysctl -n hw.physicalcpu) + else + nProc=-1 + fi + + # Do we need to oversubscribe + if [ ${nProc} -lt 0 ] + then + # Couldn't get the number of CPUs, skip the test. + skip_test=true + elif [ $nProc -lt 4 ] + then + # Need to oversubscribe the MPI + # + # Is the oversubscribe option known? + mpirun -oversubscribe -version 2>&1 > /dev/null + if [ $? -eq 0 ] + then + # Looks like open MPI mpirun + oversubscribe="-oversubscribe" + fi + fi +} + +teardown () { + # Echo the output. Will only be done on a test failure. + echo "$output" +} + +@test "1" { + if [ "$skip_test" = "true" ] + then + skip "Unable to determine number of available cpus" + fi + # Ensure an input.nml file exists + touch input.nml + run mpirun ${oversubscribe} -n 4 ./test_mpp + [ "$status" -eq 0 ] +} diff --git a/test_fms/mpp/test_mpp.sh b/test_fms/mpp/test_mpp.sh new file mode 100755 index 0000000000..94f47dd510 --- /dev/null +++ b/test_fms/mpp/test_mpp.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +bats $srcdir/test_fms/mpp/test_mpp.bats diff --git a/test_fms/mpp/test_mpp2.sh b/test_fms/mpp/test_mpp2.sh deleted file mode 100755 index daca70add1..0000000000 --- a/test_fms/mpp/test_mpp2.sh +++ /dev/null @@ -1,52 +0,0 @@ -#!/bin/sh - -# This is part of the GFDL FMS package. This is a shell script to -# execute tests in the test_fms/mpp directory. - -# Ed Hartnett 11/29/19 - -# Set common test settings. -. ../test_common.sh - -#bats $srcdir/test_fms/mpp/test_mpp.bats - -# Get the number of available CPUs on the system -if [ $(command -v nproc) ] -then - # Looks like a linux system - nProc=$(nproc) -elif [ $(command -v sysctl) ] -then - # Looks like a Mac OS X system - nProc=$(sysctl -n hw.physicalcpu) -else - nProc=-1 -fi - -# Do we need to oversubscribe -if [ ${nProc} -lt 0 ] -then - # Couldn't get the number of CPUs, skip the test. - skip_test=true -elif [ $nProc -lt 4 ] -then - # Need to oversubscribe the MPI - # - # Is the oversubscribe option known? - mpirun -oversubscribe -version 2>&1 > /dev/null - if [ $? -eq 0 ] - then - # Looks like open MPI mpirun - oversubscribe="-oversubscribe" - fi -fi - -if [ "$skip_test" = "true" ] -then - echo "Unable to determine number of available cpus" - return 0 -fi - -# Ensure an input.nml file exists -touch input.nml -mpirun ${oversubscribe} -n 4 ./test_mpp diff --git a/test_fms/mpp/test_mpp_domains.bats b/test_fms/mpp/test_mpp_domains.bats new file mode 100644 index 0000000000..d1e6add808 --- /dev/null +++ b/test_fms/mpp/test_mpp_domains.bats @@ -0,0 +1,160 @@ +setup () { + if [ "x$(uname -s)" = "xDarwin" ] + then + skip_test=true + else + skip_test=false + fi +} + +teardown () { + # Echo the output. Will only be done on a test failure. + echo "$output" +} + +@test "1: Test update nest domain" { + skip "To do" + sed "s/test_nest_domain = .false./test_nest_domain = .true./" input.nml_base > input.nml + run mpirun -n 2 ./test_mpp_domains + [ "$status" -eq 0 ] +} + +@test "2: Test Subset Update" { + skip "To do" + sed "s/test_subset = .false./test_subset = .true./" input.nml_base > input.nml + run mpirun -n 2 ./test_mpp_domains + [ "$status" -eq 0 ] +} + +@test "3: Test Halosize Performance" { + if [ "$skip_test" = "true" ] + then + skip "Does not work on Darwin" + fi + sed "s/test_halosize_performance = .false./test_halosize_performance = .true./" input.nml_base > input.nml + run mpirun -n 2 ./test_mpp_domains + [ "$status" -eq 0 ] +} + +@test "4: Test Edge Update" { + skip "To do" + sed "s/test_edge_update = .false./test_edge_update = .true./" input.nml_base > input.nml + run mpirun -n 2 ./test_mpp_domains + [ "$status" -eq 0 ] +} + +@test "5: Test Nonsym Edge" { + skip "To do" + sed "s/test_nonsym_edge = .false./test_nonsym_edge = .true./" input.nml_base > input.nml + run mpirun -n 2 ./test_mpp_domains + [ "$status" -eq 0 ] +} + +@test "6: Test Performance" { + if [ "$skip_test" = "true" ] + then + skip "Does not work on Darwin" + elif [ "x$TRAVIS" = "xtrue" ] + then + skip "Fails on Travis" + fi + sed "s/test_performance = .false./test_performance = .true./" input.nml_base > input.nml + run mpirun -n 2 ./test_mpp_domains + [ "$status" -eq 0 ] +} + +@test "7: Test Global Sum" { + if [ "$skip_test" = "true" ] + then + skip "Does not work on Darwin" + fi + sed "s/test_global_sum = .false./test_global_sum = .true./" input.nml_base > input.nml + run mpirun -n 2 ./test_mpp_domains + [ "$status" -eq 0 ] +} + +@test "8: Test Cubic Grid Redistribute" { + if [ "$skip_test" = "true" ] + then + skip "Does not work on Darwin" + elif [ "x$TRAVIS" = "xtrue" ] + then + skip "Fails on Travis" + fi + sed "s/test_cubic_grid_redistribute = .false./test_cubic_grid_redistribute = .true./" input.nml_base > input.nml + run mpirun -n 2 ./test_mpp_domains + [ "$status" -eq 0 ] +} + +@test "9: Test Boundary" { + if [ "$skip_test" = "true" ] + then + skip "Does not work on Darwin" + elif [ "x$TRAVIS" = "xtrue" ] + then + skip "Fails on Travis in 32bit/Mixed mode" + fi + sed "s/test_boundary = .false./test_boundary = .true./" input.nml_base > input.nml + run mpirun -n 2 ./test_mpp_domains + [ "$status" -eq 0 ] +} + +@test "10: Test Adjoint" { + if [ "$skip_test" = "true" ] + then + skip "Does not work on Darwin" + fi + sed "s/test_adjoint = .false./test_adjoint = .true./" input.nml_base > input.nml + run mpirun -n 2 ./test_mpp_domains + [ "$status" -eq 0 ] +} + +@test "11: Test Unstruct" { + skip "To do" + sed "s/test_unstruct = .false./test_unstruct = .true./" input.nml_base > input.nml + run mpirun -n 2 ./test_mpp_domains + [ "$status" -eq 0 ] +} + +@test "12: Test Group" { + if [ "$skip_test" = "true" ] + then + skip "Does not work on Darwin" + fi + sed "s/test_group = .false./test_group = .true./" input.nml_base > input.nml + run mpirun -n 2 ./test_mpp_domains + [ "$status" -eq 0 ] +} + +@test "13: Test Interface" { + if [ "$skip_test" = "true" ] + then + skip "Does not work on Darwin" + fi + sed "s/test_interface = .false./test_interface = .true./" input.nml_base > input.nml + run mpirun -n 2 ./test_mpp_domains + [ "$status" -eq 0 ] +} + +@test "14: Test Check Parallel" { + if [ "$skip_test" = "true" ] + then + skip "Does not work on Darwin" + elif [ "x$TRAVIS" = "xtrue" ] + then + skip "Fails on Travis" + fi + sed "s/check_parallel = .false./check_parallel = .true./" input.nml_base > input.nml + run mpirun -n 2 ./test_mpp_domains + [ "$status" -eq 0 ] +} + +@test "15: Test Get Nbr" { + if [ "$skip_test" = "true" ] + then + skip "Does not work on Darwin" + fi + sed "s/test_get_nbr = .false./test_get_nbr = .true./" input.nml_base > input.nml + run mpirun -n 2 ./test_mpp_domains + [ "$status" -eq 0 ] +} diff --git a/test_fms/mpp/test_mpp_domains.sh b/test_fms/mpp/test_mpp_domains.sh new file mode 100755 index 0000000000..b482f26a00 --- /dev/null +++ b/test_fms/mpp/test_mpp_domains.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +cp $srcdir/test_fms/mpp/input_base.nml input.nml_base + +bats $srcdir/test_fms/mpp/test_mpp_domains.bats diff --git a/test_fms/mpp/test_mpp_domains2.sh b/test_fms/mpp/test_mpp_domains2.sh deleted file mode 100755 index a0d53ca5eb..0000000000 --- a/test_fms/mpp/test_mpp_domains2.sh +++ /dev/null @@ -1,133 +0,0 @@ -#!/bin/sh - -# This is part of the GFDL FMS package. This is a shell script to -# execute tests in the test_fms/mpp directory. - -# Ed Hartnett 11/29/19 - -# Set common test settings. -. ../test_common.sh - -#bats $srcdir/test_fms/mpp/test_mpp_domains.bats - -if [ "x$(uname -s)" = "xDarwin" ] -then - skip_test=true -else - skip_test=false -fi - -#echo "1: Test update nest domain" -#sed "s/test_nest_domain = .false./test_nest_domain = .true./" $top_srcdir/test_fms/mpp/input_base.nml > input.nml -#run mpirun -n 2 ./test_mpp_domains - -#echo "2: Test Subset Update" -#sed "s/test_subset = .false./test_subset = .true./" $top_srcdir/test_fms/mpp/input_base.nml > input.nml -#run mpirun -n 2 ./test_mpp_domains - -echo "3: Test Halosize Performance" -if [ "$skip_test" = "true" ] -then - echo "Does not work on Darwin" -else - sed "s/test_halosize_performance = .false./test_halosize_performance = .true./" $top_srcdir/test_fms/mpp/input_base.nml > input.nml - mpirun -n 2 ./test_mpp_domains -fi - -#echo "4: Test Edge Update" -#sed "s/test_edge_update = .false./test_edge_update = .true./" $top_srcdir/test_fms/mpp/input_base.nml > input.nml -#mpirun -n 2 ./test_mpp_domains - -#echo "5: Test Nonsym Edge" -#sed "s/test_nonsym_edge = .false./test_nonsym_edge = .true./" $top_srcdir/test_fms/mpp/input_base.nml > input.nml -#mpirun -n 2 ./test_mpp_domains - -echo "6: Test Performance" -if [ "$skip_test" = "true" ] -then - echo "Does not work on Darwin" -elif [ "x$TRAVIS" = "xtrue" ] -then - echo "Fails on Travis" -else - sed "s/test_performance = .false./test_performance = .true./" $top_srcdir/test_fms/mpp/input_base.nml > input.nml - mpirun -n 6 ./test_mpp_domains -fi - -echo "7: Test Global Sum" -if [ "$skip_test" = "true" ] -then - echo "Does not work on Darwin" -else - sed "s/test_global_sum = .false./test_global_sum = .true./" $top_srcdir/test_fms/mpp/input_base.nml > input.nml - mpirun -n 2 ./test_mpp_domains -fi - -echo "8: Test Cubic Grid Redistribute" -if [ "$skip_test" = "true" ] -then - echo "Does not work on Darwin" -elif [ "x$TRAVIS" = "xtrue" ] -then - echo "Fails on Travis" -else - sed "s/test_cubic_grid_redistribute = .false./test_cubic_grid_redistribute = .true./" $top_srcdir/test_fms/mpp/input_base.nml > input.nml - mpirun -n 6 ./test_mpp_domains -fi - -echo "9: Test Boundary" -if [ "$skip_test" = "true" ] -then - echo "Does not work on Darwin" -elif [ "x$TRAVIS" = "xtrue" ] -then - echo "Fails on Travis in 32bit/Mixed mode" -else - sed "s/test_boundary = .false./test_boundary = .true./" $top_srcdir/test_fms/mpp/input_base.nml > input.nml - mpirun -n 2 ./test_mpp_domains -fi - -echo "10: Test Adjoint" -if [ "$skip_test" = "true" ] -then - echo "Does not work on Darwin" -else - sed "s/test_adjoint = .false./test_adjoint = .true./" $top_srcdir/test_fms/mpp/input_base.nml > input.nml - mpirun -n 2 ./test_mpp_domains -fi - -#echo "11: Test Unstruct" -#sed "s/test_unstruct = .false./test_unstruct = .true./" $top_srcdir/test_fms/mpp/input_base.nml > input.nml -#mpirun -n 2 ./test_mpp_domains - -echo "12: Test Group" -if [ "$skip_test" = "true" ] -then - echo "Does not work on Darwin" -else - sed "s/test_group = .false./test_group = .true./" $top_srcdir/test_fms/mpp/input_base.nml > input.nml - mpirun -n 2 ./test_mpp_domains -fi - -echo "13: Test Interface" -if [ "$skip_test" = "true" ] -then - echo "Does not work on Darwin" -else - sed "s/test_interface = .false./test_interface = .true./" $top_srcdir/test_fms/mpp/input_base.nml > input.nml - mpirun -n 2 ./test_mpp_domains -fi - -#echo "14: Test Check Parallel" -#echo "Does not work on Darwin or elsewhere" -#sed "s/check_parallel = .false./check_parallel = .true./" $top_srcdir/test_fms/mpp/input_base.nml > input.nml -#mpirun -n 6 ./test_mpp_domains - -echo "15: Test Get Nbr" -if [ "$skip_test" = "true" ] -then - echo "Does not work on Darwin" -else - sed "s/test_get_nbr = .false./test_get_nbr = .true./" $top_srcdir/test_fms/mpp/input_base.nml > input.nml - mpirun -n 2 ./test_mpp_domains -fi diff --git a/test_fms/mpp/test_mpp_pset.bats b/test_fms/mpp/test_mpp_pset.bats new file mode 100644 index 0000000000..4623bc2d32 --- /dev/null +++ b/test_fms/mpp/test_mpp_pset.bats @@ -0,0 +1,30 @@ +#setup() { + ## ************** + ## Commenting out for now, until test run reliably + ## in parallel + ## ************** + # Clear out any previous test files + ##rm -f input.nml > /dev/null 2>&1 + + # Setup the run directory + ##tnum=$( printf "%2.2d" ${BATS_TEST_NUMBER} ) + ##rm -f diag_test_${tnum}* > /dev/null 2>&1 + ##sed "s//${tnum}/" input.nml_base > input.nml +#} + +teardown () { + # Echo the output. Will only be done on a test failure. + echo "$output" +} + +@test "Test 1: Tests how to distribute allocatable arrays" { + skip "Test unreliable for parallel tests" + run mpirun -n 2 ./test_mpp_pset + [ "$status" -eq 0 ] +} + +@test "Test 2: Tests how to distribute automatic arrays" { + skip "Test unreliable for parallel tests" + run mpirun -n 2 ./test_mpp_pset + [ "$status" -eq 0 ] +} diff --git a/test_fms/mpp/test_mpp_pset.sh b/test_fms/mpp/test_mpp_pset.sh new file mode 100755 index 0000000000..8cf9d6bba5 --- /dev/null +++ b/test_fms/mpp/test_mpp_pset.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +bats $srcdir/test_fms/mpp/test_mpp_pset.bats diff --git a/test_fms/mpp/test_mpp_pset2.sh b/test_fms/mpp/test_mpp_pset2.sh deleted file mode 100755 index 0c6a6bf3d6..0000000000 --- a/test_fms/mpp/test_mpp_pset2.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/sh - -# This is part of the GFDL FMS package. This is a shell script to -# execute tests in the test_fms/mpp directory. - -# Ed Hartnett 11/29/19 - -# Set common test settings. -. ../test_common.sh - -# All tests are skipped in bats file. - -# Setup the run directory -##tnum=$( printf "%2.2d" ${BATS_TEST_NUMBER} ) -##rm -f diag_test_${tnum}* > /dev/null 2>&1 -##sed "s//${tnum}/" input.nml_base > input.nml - -#mpirun -n 2 ./test_mpp_pset -#mpirun -n 2 ./test_mpp_pset diff --git a/test_fms/mpp_io/Makefile.am b/test_fms/mpp_io/Makefile.am index 9193b884d4..5c92d8bbe7 100644 --- a/test_fms/mpp_io/Makefile.am +++ b/test_fms/mpp_io/Makefile.am @@ -1,8 +1,14 @@ -# This is an automake file for the test_fms/mpp_io directory of the -# FMS package. +# This is an automake file for the test_fms/mpp directory of the FMS +# package. # uramirez, Ed Hartnett +LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) \ + $(top_srcdir)/tap-driver.sh + +# Set srcdir as evironment variable to be reference in the job script +TESTS_ENVIRONMENT = srcdir="$(top_srcdir)" + # Find the fms_mod.mod file. AM_CPPFLAGS = -I${top_srcdir}/include -I${top_builddir}/mpp @@ -16,10 +22,10 @@ check_PROGRAMS = test_mpp_io test_mpp_io_SOURCES = test_mpp_io.F90 # Run the test program. -TESTS = test_mpp_io2.sh +TESTS = test_mpp_io.sh # These files will also be distributed. -EXTRA_DIST = test_mpp_io2.sh input_base.nml +EXTRA_DIST = test_mpp_io.sh test_mpp_io.bats input_base.nml # Clean up CLEANFILES = input.nml *.nc* *.out diff --git a/test_fms/mpp_io/test_mpp_io.bats b/test_fms/mpp_io/test_mpp_io.bats new file mode 100755 index 0000000000..06b3ffd855 --- /dev/null +++ b/test_fms/mpp_io/test_mpp_io.bats @@ -0,0 +1,27 @@ +setup () { + if [ "x$(uname -s)" = "xDarwin" ] || [ "x$TRAVIS" = "xtrue" ] + then + skip_test=true + else + skip_test=false + fi +} + +teardown () { + # Echo the output. Will only be done on a test failure. + echo "$output" +} + +@test "MPP_IO runs with single MPI processes" { + run mpirun -n 1 ./test_mpp_io + [ "$status" -eq 0 ] +} + +@test "MPP_IO runs with multiple MPI processes" { + if [ "$skip_test" = "true" ] + then + skip "Test not reliable on Darwin" + fi + run mpirun -n 2 ./test_mpp_io + [ "$status" -eq 0 ] +} diff --git a/test_fms/mpp_io/test_mpp_io.sh b/test_fms/mpp_io/test_mpp_io.sh new file mode 100755 index 0000000000..bcb94d9042 --- /dev/null +++ b/test_fms/mpp_io/test_mpp_io.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +cp $srcdir/test_fms/mpp_io/input_base.nml input.nml + +bats $srcdir/test_fms/mpp_io/test_mpp_io.bats diff --git a/test_fms/mpp_io/test_mpp_io2.sh b/test_fms/mpp_io/test_mpp_io2.sh deleted file mode 100755 index dfbb27b697..0000000000 --- a/test_fms/mpp_io/test_mpp_io2.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh - -# This is part of the GFDL FMS package. This is a shell script to -# execute tests in the test_fms/mpp directory. - -# Ed Hartnett 11/29/19 - -# Set common test settings. -. ../test_common.sh - -# Copy file for test. -cp $top_srcdir/test_fms/mpp_io/input_base.nml input.nml - -mpirun -n 1 ./test_mpp_io - -# This test is skipped in bats file. -#run mpirun -n 2 ./test_mpp_io diff --git a/test_fms/test_common.sh.in b/test_fms/test_common.sh.in deleted file mode 100644 index e228509760..0000000000 --- a/test_fms/test_common.sh.in +++ /dev/null @@ -1,13 +0,0 @@ -# This file is part of the GFDL FMS system. It defines some common -# settings for a shell tests. - -# Ed Hartnett 11/26/19 - -# Cause test shell scripts to exit and return error if any command -# fails. -set -e - -# Set the source and build top directories for use in test scripts. -top_srcdir='@abs_top_srcdir@' -top_buildir='@abs_top_builddir@' - diff --git a/test_fms/time_interp/Makefile.am b/test_fms/time_interp/Makefile.am index 970687e948..8434e116ae 100644 --- a/test_fms/time_interp/Makefile.am +++ b/test_fms/time_interp/Makefile.am @@ -3,10 +3,16 @@ # uramirez, Ed Hartnett +LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) \ + $(top_srcdir)/tap-driver.sh + +# Set srcdir as evironment variable to be reference in the job script +TESTS_ENVIRONMENT = srcdir="$(top_srcdir)" + # Find the fms_mod.mod file. -AM_CPPFLAGS = -I${top_builddir}/time_manager -I${top_builddir}/fms \ --I${top_builddir}/time_interp -I${top_builddir}/mpp \ --I${top_builddir}/axis_utils -I${top_builddir}/horiz_interp \ +AM_CPPFLAGS = -I${top_builddir}/time_manager -I${top_builddir}/fms \ +-I${top_builddir}/time_interp -I${top_builddir}/mpp \ +-I${top_builddir}/axis_utils -I${top_builddir}/horiz_interp \ -I${top_builddir}/constants # Link to the FMS library. @@ -20,10 +26,12 @@ test_time_interp_SOURCES = test_time_interp.F90 test_time_interp_external_SOURCES = test_time_interp_external.F90 # Run the test programs. -TESTS = test_time_interp2.sh +TESTS = test_time_interp.sh test_time_interp_external.sh # These files will also be included in the distribution. -EXTRA_DIST = input_base.nml test_time_interp2.sh +EXTRA_DIST = test_time_interp.sh test_time_interp.bats \ +test_time_interp_external.sh test_time_interp_external.bats \ +input_base.nml # Clean up CLEANFILES = input.nml *.out* diff --git a/test_fms/time_interp/test_time_interp.bats b/test_fms/time_interp/test_time_interp.bats new file mode 100644 index 0000000000..d6dd96b622 --- /dev/null +++ b/test_fms/time_interp/test_time_interp.bats @@ -0,0 +1,9 @@ +teardown () { + # Echo the output. Will only be done on a test failure. + echo "$output" +} + +@test "1" { + run mpirun -n 2 ./test_time_interp + [ "$status" -eq 0 ] +} diff --git a/test_fms/time_interp/test_time_interp.sh b/test_fms/time_interp/test_time_interp.sh new file mode 100755 index 0000000000..d6d45ebcf0 --- /dev/null +++ b/test_fms/time_interp/test_time_interp.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +cp $srcdir/test_fms/time_interp/input_base.nml input.nml + +bats $srcdir/test_fms/time_interp/test_time_interp.bats diff --git a/test_fms/time_interp/test_time_interp2.sh b/test_fms/time_interp/test_time_interp2.sh deleted file mode 100755 index f380c58497..0000000000 --- a/test_fms/time_interp/test_time_interp2.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh - -# This is part of the GFDL FMS package. This is a shell script to -# execute tests in the test_fms/mpp directory. - -# Ed Hartnett 11/29/19 - -# Set common test settings. -. ../test_common.sh - -# Copy file for test. -cp $top_srcdir/test_fms/time_interp/input_base.nml input.nml - -mpirun -n 2 ./test_time_interp - -# This test is skipped in bats file. -#mpirun -n 2 ./test_time_interp_external diff --git a/test_fms/time_interp/test_time_interp_external.bats b/test_fms/time_interp/test_time_interp_external.bats new file mode 100644 index 0000000000..c80fcd40c1 --- /dev/null +++ b/test_fms/time_interp/test_time_interp_external.bats @@ -0,0 +1,10 @@ +teardown () { + # Echo the output. Will only be done on a test failure. + echo "$output" +} + +@test "1" { + skip "The input files are missing" + run mpirun -n 2 ./test_time_interp_external + [ "$status" -eq 0 ] +} diff --git a/test_fms/time_interp/test_time_interp_external.sh b/test_fms/time_interp/test_time_interp_external.sh new file mode 100755 index 0000000000..e2c42b93da --- /dev/null +++ b/test_fms/time_interp/test_time_interp_external.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +bats $srcdir/test_fms/time_interp/test_time_interp_external.bats diff --git a/test_fms/time_manager/Makefile.am b/test_fms/time_manager/Makefile.am index 22f820b3c6..3b758ebf36 100644 --- a/test_fms/time_manager/Makefile.am +++ b/test_fms/time_manager/Makefile.am @@ -1,10 +1,16 @@ -# This is an automake file for the test_fms/time_manager directory of the FMS +# This is an automake file for the test_fms/data_override directory of the FMS # package. # uramirez, Ed Hartnett +LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) \ + $(top_srcdir)/tap-driver.sh + +# Set srcdir as evironment variable to be reference in the job script +TESTS_ENVIRONMENT = srcdir="$(top_srcdir)" + # Find the fms_mod.mod file. -AM_CPPFLAGS = -I${top_builddir}/mpp -I${top_builddir}/fms \ +AM_CPPFLAGS = -I${top_builddir}/mpp -I${top_builddir}/fms \ -I${top_builddir}/constants -I${top_builddir}/time_manager # Link to the FMS library. @@ -17,10 +23,11 @@ check_PROGRAMS = test_time_manager test_time_manager_SOURCES = test_time_manager.F90 # Run the test program. -TESTS = test_time_manager2.sh +TESTS = test_time_manager.sh # These files will be included in the distribution. -EXTRA_DIST = test_time_manager2.sh input_base.nml +EXTRA_DIST = test_time_manager.sh test_time_manager.bats \ +input_base.nml # Clean up CLEANFILES = input.nml *.out* diff --git a/test_fms/time_manager/test_time_manager.bats b/test_fms/time_manager/test_time_manager.bats new file mode 100644 index 0000000000..a84a92e013 --- /dev/null +++ b/test_fms/time_manager/test_time_manager.bats @@ -0,0 +1,9 @@ +teardown () { + # Echo the output. Will only be done on a test failure. + echo "$output" +} + +@test "1" { + run mpirun -n 1 ./test_time_manager + [ "$status" -eq 0 ] +} diff --git a/test_fms/time_manager/test_time_manager.sh b/test_fms/time_manager/test_time_manager.sh new file mode 100755 index 0000000000..c80935a12d --- /dev/null +++ b/test_fms/time_manager/test_time_manager.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +cp $srcdir/test_fms/time_manager/input_base.nml input.nml + +bats $srcdir/test_fms/time_manager/test_time_manager.bats diff --git a/test_fms/time_manager/test_time_manager2.sh b/test_fms/time_manager/test_time_manager2.sh deleted file mode 100755 index 40d2a0b285..0000000000 --- a/test_fms/time_manager/test_time_manager2.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/sh - -# This is part of the GFDL FMS package. This is a shell script to -# execute tests in the test_fms/time_manager directory. - -# Ed Hartnett 11/29/19 - -# Set common test settings. -. ../test_common.sh - -# Copy file for test. -cp $top_srcdir/test_fms/time_manager/input_base.nml input.nml - -mpirun -n 1 ./test_time_manager