Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix TRAVIS tests following multi-suite static build #185

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not very pythonic. Any reason you are not using os.path?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess no, no particular reason. Would have to redo the entire file, though, since all other entries are in the same way. I will probably leave this for another cleanup PR, if it gets done at all before moving to cap_gen. Note that I had to change a few more files, including some changes that need to be tested with NEMSfv3gfs. I will conduct the tests in conjunction with upcoming PRs (will be listed below shortly) and have them merged together.


# 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