Skip to content

Commit

Permalink
Merge pull request #185 from climbfuji/multi-suite-static-build_follo…
Browse files Browse the repository at this point in the history
…wup_fix_travis

Fix TRAVIS tests following multi-suite static build
  • Loading branch information
grantfirl authored Apr 22, 2019
2 parents 50f2084 + 2289730 commit f007196
Show file tree
Hide file tree
Showing 13 changed files with 41 additions and 21 deletions.
3 changes: 3 additions & 0 deletions schemes/check/ccpp_prebuild_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@
# Directory where to put all auto-generated physics caps
CAPS_DIR = '.'

# Directory where the suite definition files are stored
SUITES_DIR = '../../../../../src/tests'

# Optional arguments - only required for schemes that use
# optional arguments. ccpp_prebuild.py will throw an exception
# if it encounters a scheme subroutine with optional arguments
Expand Down
34 changes: 25 additions & 9 deletions src/ccpp.F90
Original file line number Diff line number Diff line change
Expand Up @@ -44,29 +44,45 @@ module ccpp
!! @param[in,out] cdata The ccpp_t type data.
!! @param[ out] ierr Integer error flag.
!! @param[in] cdata_target An optional cdata instance to cope the suite from
!! @param[in] filename The file name of the XML scheme file to load,
!! derive from suitename if not present; can include
!! an absolute or relative path to the suite def. file
!! @param[in] is_filename Switch to interpret suitename as filename/filepath
!! (for dynamic build only, default value .false.)
!
subroutine ccpp_init(suitename, cdata, ierr, cdata_target)
subroutine ccpp_init(suitename, cdata, ierr, cdata_target, is_filename)
character(len=*), intent(in) :: suitename
type(ccpp_t), target, intent(inout) :: cdata
integer, intent( out) :: ierr
type(ccpp_t), target, intent(in), optional :: cdata_target
logical, intent(in), optional :: is_filename
! Local variables
logical :: is_filename_local
character(len=256) :: filename_local

ierr = 0

call ccpp_debug('Called ccpp_init')

#ifndef STATIC
if (len('./suite_' // trim(suitename) // '.xml')>len(filename_local)) then
call ccpp_error('Length of suitename + 12 exceeds length of local filename variable')
ierr = 1
return
if (present(is_filename)) then
is_filename_local = is_filename
else
is_filename_local = .false.
end if

if (is_filename_local) then
if (len(trim(suitename))>len(filename_local)) then
call ccpp_error('Length of suitename=filename exceeds length of local filename variable')
ierr = 1
return
end if
filename_local = trim(suitename)
else
if (len('./suite_' // trim(suitename) // '.xml')>len(filename_local)) then
call ccpp_error('Length of suitename + 12 exceeds length of local filename variable')
ierr = 1
return
end if
filename_local = './suite_' // trim(suitename) // '.xml'
end if
filename_local = './suite_' // trim(suitename) // '.xml'

if (present(cdata_target)) then
! Copy the suite from the target cdata instance
Expand Down
2 changes: 1 addition & 1 deletion src/tests/suite_check_1.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>

<suite name="Check Cap">
<suite name="check_1">
<group name="testgroup">
<subcycle loop="1">
<scheme lib="check">test</scheme>
Expand Down
2 changes: 1 addition & 1 deletion src/tests/suite_check_2.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>

<suite name="Check Cap" lib="check">
<suite name="check_2" lib="check">
<group name="testgroup">
<subcycle loop="1">
<scheme>test</scheme>
Expand Down
2 changes: 1 addition & 1 deletion src/tests/suite_check_3.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>

<suite name="Check Cap" lib="check">
<suite name="check_3" lib="check">
<group name="testgroup">
<subcycle loop="1">
<scheme lib="check">test</scheme>
Expand Down
2 changes: 1 addition & 1 deletion src/tests/suite_noop_1.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>

<suite name="TEST_1">
<suite name="noop_1">
<group name="noopgroup">
<subcycle loop="1">
<scheme lib="check">noop</scheme>
Expand Down
2 changes: 1 addition & 1 deletion src/tests/suite_noop_2.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>

<suite name="TEST_2">
<suite name="noop_2">
<group name="noopgroup">
<subcycle loop="3">
<scheme lib="check">noop</scheme>
Expand Down
2 changes: 1 addition & 1 deletion src/tests/suite_noop_3.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>

<suite name="TEST_3">
<suite name="noop_3">
<group name="noopgroup">
<subcycle>
<scheme lib="check">noop</scheme>
Expand Down
2 changes: 1 addition & 1 deletion src/tests/suite_noop_4.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>

<suite name="TEST_4">
<suite name="noop_4">
<group name="noopgroup1">
<subcycle loop="1">
<scheme lib="check">noop</scheme>
Expand Down
2 changes: 1 addition & 1 deletion src/tests/suite_noop_5.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>

<suite name="TEST_5">
<suite name="noop_5">
<group name="noopgroup">
<subcycle loop="1">
<scheme lib="check">noop</scheme>
Expand Down
2 changes: 1 addition & 1 deletion src/tests/suite_noop_6.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>

<suite name="TEST_6" lib="check">
<suite name="noop_6" lib="check">
<group name="noopgroup">
<subcycle loop="1">
<scheme>noop</scheme>
Expand Down
5 changes: 3 additions & 2 deletions src/tests/test_check.f90
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,9 @@ program test_check
u = 0.0
v = 10.0

! Initalize the CCPP framework (with the filename of the suite to load)
call ccpp_init(filename, cdata, ierr)
! Initalize the CCPP framework (with the filename
! of the suite to load instead of the suite name)
call ccpp_init(trim(filename), cdata, ierr, is_filename=.true.)
if (ierr /= 0) then
call exit(1)
end if
Expand Down
2 changes: 1 addition & 1 deletion src/tests/test_init_finalize.f90
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ program test_init_finalize
call exit(ierr)
end if

call ccpp_init(filename, cdata, ierr)
call ccpp_init(trim(filename), cdata, ierr, is_filename=.true.)
if (ierr /= 0) then
call exit(ierr)
end if
Expand Down

0 comments on commit f007196

Please sign in to comment.