Skip to content

Commit

Permalink
adding run_tests.sh script in fncint test directory
Browse files Browse the repository at this point in the history
  • Loading branch information
edhartnett committed Jul 8, 2019
1 parent 116f7de commit e03d43f
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 12 deletions.
17 changes: 6 additions & 11 deletions tests/fncint/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,19 @@

# Put together AM_CPPFLAGS and AM_LDFLAGS.
AM_FCFLAGS = -I$(top_srcdir)/src/flib
LDADD = ${top_builddir}/src/clib/libpioc.la
AM_LDADD = ${top_builddir}/src/clib/libpioc.la

# Build the test for make check.
check_PROGRAMS = ftst_pio
ftst_pio_SOURCES = ftst_pio.f90

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

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

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

# Clean up files produced during testing.
#CLEANFILES = *.nc *.log
CLEANFILES = *.nc *.log
13 changes: 12 additions & 1 deletion tests/fncint/ftst_pio.f90
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,17 @@
program ftst_pio
use pio
implicit none
include 'mpif.h'

print *, '*** SUCCESS running ftst_pio!'
integer :: myRank, ntasks
integer :: ierr

call MPI_Init(ierr)
call MPI_Comm_rank(MPI_COMM_WORLD, myRank, ierr)
call MPI_Comm_size(MPI_COMM_WORLD, ntasks, ierr)

call MPI_Finalize(ierr)
if (myRank .eq. 0) then
print *, '*** SUCCESS running ftst_pio!'
endif
end program ftst_pio
30 changes: 30 additions & 0 deletions tests/fncint/run_tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/sh
# This is a test script for PIO.
# Ed Hartnett

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

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

printf 'running Fortran tests for PIO netCDF integration...\n'

PIO_TESTS='ftst_pio'

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 e03d43f

Please sign in to comment.