Skip to content

Commit

Permalink
Merge pull request ESMCI#1573 from NCAR/ejh_example
Browse files Browse the repository at this point in the history
got fortran example working in autotools build
  • Loading branch information
edhartnett authored Jul 22, 2019
2 parents 5404452 + 1ef2e37 commit f067353
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 1 deletion.
1 change: 1 addition & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -313,4 +313,5 @@ AC_OUTPUT(Makefile
doc/images/Makefile
examples/Makefile
examples/c/Makefile
examples/f03/Makefile
scripts/Makefile)
5 changes: 4 additions & 1 deletion examples/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,8 @@

# Ed Hartnett

SUBDIRS = c
if BUILD_FORTRAN
F03 = f03
endif # BUILD_FORTRAN

SUBDIRS = c ${F03}
28 changes: 28 additions & 0 deletions examples/f03/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
## This is the automake file for building the Fortran examples
## for the PIO library.

# Ed Hartnett 7/17/19

# Put together AM_CPPFLAGS and AM_LDFLAGS.
include $(top_srcdir)/set_flags.am

AM_FCFLAGS = -I$(top_srcdir)/src/flib

LDADD = ${top_builddir}/src/flib/libpiof.la \
${top_builddir}/src/clib/libpioc.la

# Build the test for make check.
check_PROGRAMS = examplePio

examplePio_SOURCES = examplePio.f90

if RUN_TESTS
# Tests will run from a bash script.
TESTS = run_tests.sh
endif # RUN_TESTS

# Distribute the test script.
EXTRA_DIST = CMakeLists.txt run_tests.sh

# Clean up files produced during testing.
CLEANFILES = *.nc *.log *.mod
31 changes: 31 additions & 0 deletions examples/f03/run_tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/sh
# This is a test script for PIO for tests/general directory.
# Ed Hartnett 7/22/19

# Stop execution of script if error is returned.
set -e

# Stop loop if ctrl-c is pressed.
trap exit INT TERM

printf 'running PIO Fortran examples...\n'

PIO_TESTS='examplePio '
# pio_rearr_opts pio_rearr_opts2

success1=true
for TEST in $PIO_TESTS
do
success1=false
echo "running ${TEST}"
mpiexec -n 4 ./${TEST} && success1=true
if test $success1 = false; then
break
fi
done

# Did we succeed?
if test x$success1 = xtrue; then
exit 0
fi
exit 1

0 comments on commit f067353

Please sign in to comment.