Skip to content

Commit 7b78a73

Browse files
rem1776underwooUriel Ramirez
authored
test: Test script updates and input tests (#800)
Rewrites test script to use added testing shell functions Adds previously skipped or removed unit tests and support for testing with input files Co-authored-by: Seth Underwood <[email protected]> Co-authored-by: Uriel Ramirez <[email protected]>
1 parent 6deed0a commit 7b78a73

File tree

160 files changed

+9894
-6862
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

160 files changed

+9894
-6862
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ Makefile.in
3636
/mdate-sh
3737
/py-compile
3838
/test-driver
39-
/tap-driver.sh
4039
/ylwrap
4140
*.log
4241
*.trs

affinity/affinity.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,14 @@
1919
* License along with FMS. If not, see <http://www.gnu.org/licenses/>.
2020
**********************************************************************/
2121

22+
#ifndef _GNU_SOURCE
2223
#define _GNU_SOURCE
24+
#endif
2325

2426
#include <stdio.h>
2527
#include <stdlib.h>
2628
#include <string.h>
29+
#include <stdbool.h>
2730
#include <unistd.h>
2831
#include <sched.h>
2932
#include <errno.h>

configure.ac

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,32 @@ AS_IF([test ${enable_code_coverage:-no} = no],
8686
[enable_code_coverage=no],
8787
[enable_code_coverage=yes])
8888

89+
# user enabled testing with input files
90+
AC_MSG_CHECKING([whether to enable tests with input files])
91+
AC_ARG_ENABLE([test-input],
92+
[AS_HELP_STRING([--enable-test-input="path/to/input"],
93+
[Enable tests using input netcdf files, if present in the given full directory.])])
94+
AC_MSG_RESULT([$enable_test_input])
95+
96+
# require path to be given
97+
AS_IF([test "x$enable_test_input" = "xyes"],
98+
[AC_MSG_ERROR([Test input enabled, but no directory given with --enable-test-input=/path])],
99+
[AS_IF([test "x$enable_test_input" != "xno"],
100+
[TEST_INPUT_PATH="$enable_test_input"],[])]
101+
)
102+
103+
# if set, check directory exists
104+
AS_IF([test "$TEST_INPUT_PATH" = ""],
105+
[],
106+
[AS_IF([test -d $TEST_INPUT_PATH],[],
107+
[AC_MSG_ERROR([Test input enabled, but directory $TEST_INPUT_PATH not found]) ]
108+
)])
109+
110+
# substitute path for input
111+
AC_SUBST([TEST_INPUT_PATH])
112+
89113
# Does the user want to build documentation?
90-
AC_MSG_CHECKING([whether documentation should be build (requires doxygen)])
114+
AC_MSG_CHECKING([whether documentation should be built (requires doxygen)])
91115
AC_ARG_ENABLE([docs],
92116
[AS_HELP_STRING([--enable-docs],
93117
[enable building of documentation with doxygen.])])
@@ -262,9 +286,6 @@ if test $enable_setting_flags = yes; then
262286
fi
263287
fi
264288

265-
# Define an AM_CONDITIONAL to determine if you are on a CRAY
266-
AM_CONDITIONAL([CRAY], [test `env | grep CRAY | wc -l` -gt 0])
267-
268289
# Find which mpi launcher to use
269290
AC_CHECK_PROGS([MPI_LAUNCHER],[srun aprun mpirun])
270291

@@ -379,7 +400,7 @@ AC_CONFIG_FILES([
379400
libFMS/Makefile
380401
docs/Makefile
381402
parser/Makefile
382-
test_fms/test_common.sh
403+
test_fms/test-lib.sh
383404
test_fms/intel_coverage.sh
384405
test_fms/Makefile
385406
test_fms/diag_manager/Makefile

libFMS/Makefile.am

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,5 +65,5 @@ libFMS_la_LIBADD += $(top_builddir)/sat_vapor_pres/libsat_vapor_pres.la
6565
libFMS_la_LIBADD += $(top_builddir)/parser/libparser.la
6666
libFMS_la_LIBADD += $(top_builddir)/libFMS_mod.la
6767

68-
# At least one source file must be included to please Automake.
69-
libFMS_la_SOURCES = $(top_builddir)/include/file_version.h
68+
libFMS_la_SOURCES =
69+
nodist_EXTRA_libFMS_la_SOURCES = dummy.f90

mkmods.mk

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# Ensure the $(MODDIR) exists
2-
$(shell test -d $(MODDIR) || mkdir -p $(MODDIR))
32

43
SUFFIXES = .$(FC_MODEXT) _mod.$(FC_MODEXT)
54
.F90.$(FC_MODEXT) .F90_mod.$(FC_MODEXT) .f90.$(FC_MODEXT) .f90_mod.$(FC_MODEXT):
5+
test -d $(MODDIR) || mkdir -p $(MODDIR)
66
$(PPFCCOMPILE) -c $<
7-
@cp $(MODDIR)/$@ .
7+
@if test -e $(MODDIR)/$@; then cp $(MODDIR)/$@ .; fi
88

99
CLEANFILES = *.$(FC_MODEXT) $(BUILT_SOURCES:%=$(MODDIR)/%) *__genmod.$(FC_MODEXT) *__genmod.f90 *.dyn *.spi *.dpi *.spl

mosaic/read_mosaic.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ void handle_netcdf_error(const char *msg, int status )
5454
void get_file_dir(const char *file, char *dir)
5555
{
5656
int len;
57-
char *strptr = NULL;
57+
const char *strptr = NULL;
5858

5959
/* get the diretory */
6060

@@ -259,13 +259,13 @@ void get_var_data(const char *file, const char *name, void *data)
259259
switch (vartype) {
260260
case NC_DOUBLE:case NC_FLOAT:
261261
#ifdef OVERLOAD_R4
262-
status = nc_get_var_float(ncid, varid, data);
262+
status = nc_get_var_float(ncid, varid, (float *)data);
263263
#else
264-
status = nc_get_var_double(ncid, varid, data);
264+
status = nc_get_var_double(ncid, varid, (double *)data);
265265
#endif
266266
break;
267267
case NC_INT:
268-
status = nc_get_var_int(ncid, varid, data);
268+
status = nc_get_var_int(ncid, varid, (int *)data);
269269
break;
270270
default:
271271
sprintf(msg, "get_var_data: field %s in file %s has an invalid type, "
@@ -319,13 +319,13 @@ void get_var_data_region(const char *file, const char *name, const size_t *start
319319
switch (vartype) {
320320
case NC_DOUBLE:case NC_FLOAT:
321321
#ifdef OVERLOAD_R4
322-
status = nc_get_vara_float(ncid, varid, start, nread, data);
322+
status = nc_get_vara_float(ncid, varid, start, nread, (float *)data);
323323
#else
324-
status = nc_get_vara_double(ncid, varid, start, nread, data);
324+
status = nc_get_vara_double(ncid, varid, start, nread, (double *)data);
325325
#endif
326326
break;
327327
case NC_INT:
328-
status = nc_get_vara_int(ncid, varid, start, nread, data);
328+
status = nc_get_vara_int(ncid, varid, start, nread, (int *)data);
329329
break;
330330
default:
331331
sprintf(msg, "get_var_data_region: field %s in file %s has an invalid type, "

mpp/include/mpp_update_domains2D.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,6 @@
262262
MPP_TYPE_ :: d_type
263263
integer(i8_kind) :: floc_in, floc_out
264264

265-
field_out = 0
266265
floc_in = 0
267266
floc_out = 0
268267
if(domain_in%initialized) floc_in = LOC(field_in)

0 commit comments

Comments
 (0)