Skip to content

Commit

Permalink
Merge pull request #37 from NOAA-EMC/ejh_test_2
Browse files Browse the repository at this point in the history
Remove pFUnit test framework
  • Loading branch information
edwardhartnett authored Oct 5, 2020
2 parents d2f7257 + f52defe commit 4e1cace
Show file tree
Hide file tree
Showing 6 changed files with 76 additions and 67 deletions.
30 changes: 2 additions & 28 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,37 +1,11 @@
name: Build and Test
name: with OPENMP
on: [push, pull_request]

jobs:
build:
runs-on: ubuntu-latest
steps:

- name: checkout-pfunit
uses: actions/checkout@v2
with:
repository: Goddard-Fortran-Ecosystem/pFUnit
path: pfunit

- name: cache pfunit
id: cache-pfunit
uses: actions/cache@v2
with:
path: ~/pfunit
key: pfunit-${{ runner.os }}-${{ hashFiles('pfunit/VERSION') }}

- name: build_pfunit
env:
FC: gfortran-9
if: steps.cache-pfunit.outputs.cache-hit != 'true'
run: |
pwd
cd pfunit
mkdir build
cd build
cmake .. -DSKIP_MPI=YES -DSKIP_ESMF=YES -DSKIP_FHAMCREST=YES -DCMAKE_INSTALL_PREFIX=~/pfunit
make -j2
make install
- name: checkout-sp
uses: actions/checkout@v2
with:
Expand All @@ -45,7 +19,7 @@ jobs:
cd sp
mkdir build
cd build
cmake .. -DENABLE_TESTS=ON -DOPENMP=ON -DCMAKE_PREFIX_PATH=~/pfunit
cmake .. -DOPENMP=ON
make -j2
- name: test_sp
Expand Down
29 changes: 29 additions & 0 deletions .github/workflows/no_openmp.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: without OPENMP
on: [push, pull_request]

jobs:
build:
runs-on: ubuntu-latest
steps:

- name: checkout-sp
uses: actions/checkout@v2
with:
path: sp

- name: build_sp
env:
FC: gfortran-9
CC: gcc-9
run: |
cd sp
mkdir build
cd build
cmake ..
make -j2
- name: test_sp
run: |
cd $GITHUB_WORKSPACE/sp/build
make test
20 changes: 8 additions & 12 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@
# Mark Potts, Kyle Gerheiser
cmake_minimum_required(VERSION 3.15)

# Get the version from the VERSION file.
file(STRINGS "VERSION" pVersion)

project(sp VERSION ${pVersion} LANGUAGES Fortran)

# Set the version for the documentation.
SET(PACKAGE_VERSION ${pVersion})

option(OPENMP "use OpenMP threading" OFF)
option(ENABLE_TESTS "Enable tests" OFF)

# Check build type.
if(NOT CMAKE_BUILD_TYPE MATCHES "^(Debug|Release|RelWithDebInfo|MinSizeRel)$")
message(STATUS "Setting build type to 'Release' as none was specified.")
set(CMAKE_BUILD_TYPE
Expand All @@ -22,19 +22,15 @@ if(NOT CMAKE_BUILD_TYPE MATCHES "^(Debug|Release|RelWithDebInfo|MinSizeRel)$")
"MinSizeRel" "RelWithDebInfo")
endif()

if(NOT CMAKE_Fortran_COMPILER_ID MATCHES "^(Intel|GNU)$")
message(
WARNING "Compiler not officially supported: ${CMAKE_Fortran_COMPILER_ID}")
endif()

# This is where the library code is.
add_subdirectory(src)

if (${ENABLE_TESTS})
find_package(PFUNIT REQUIRED)
enable_testing()
add_subdirectory(tests)
# Build and run tests.
include(CTest)
if (BUILD_TESTING)
add_subdirectory(tests)
endif()

# Determine whether or not to generate documentation.
OPTION(ENABLE_DOCS "Enable generation of doxygen-based documentation." OFF)
IF(ENABLE_DOCS)
Expand Down
12 changes: 7 additions & 5 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
set(test_srcs test_sp.pf)
# This is the CMake build file for the test directory of NCEPLIBS-sp.

# Kyle Gerheiser, Ed Hartnett

add_executable (tst_sp tst_sp.F)
add_test(tst_sp tst_sp)
target_link_libraries (tst_sp sp_d)

add_pfunit_ctest (sp_mod_test
TEST_SOURCES test_sp_mod.pf
LINK_LIBRARIES sp::sp_4
)
22 changes: 0 additions & 22 deletions tests/test_sp_mod.pf

This file was deleted.

30 changes: 30 additions & 0 deletions tests/tst_sp.F
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
C This is a test program for NCEPLIBS-sp.
C
C Ed Hartnett, Kyle Gerheiser

C Test of splat().
subroutine test_splat()
integer :: j, jmax
real*8 slat(384), wlat(384)

jmax = 384 ! t382 grid

call splat(0, jmax,slat,wlat)

do j = 2, jmax-1
if (slat(j) < slat(j+1)) stop 2
end do

end subroutine test_splat

C Run all the tests.
program tst_sp
implicit none

print *, ''
print *,'*** Testing NCEPLIBS-sp.'

call test_splat()

print *,'*** SUCCESS!'
end program

0 comments on commit 4e1cace

Please sign in to comment.