diff --git a/schemes/check/ccpp_prebuild_config.py b/schemes/check/ccpp_prebuild_config.py index 0d642fad..4e94b478 100755 --- a/schemes/check/ccpp_prebuild_config.py +++ b/schemes/check/ccpp_prebuild_config.py @@ -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 diff --git a/src/ccpp.F90 b/src/ccpp.F90 index 4077e2f5..22cbad87 100644 --- a/src/ccpp.F90 +++ b/src/ccpp.F90 @@ -44,16 +44,17 @@ 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 @@ -61,12 +62,27 @@ subroutine ccpp_init(suitename, cdata, ierr, cdata_target) 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 diff --git a/src/tests/suite_check_1.xml b/src/tests/suite_check_1.xml index 753c2f7d..b77e1be5 100644 --- a/src/tests/suite_check_1.xml +++ b/src/tests/suite_check_1.xml @@ -1,6 +1,6 @@ - + test diff --git a/src/tests/suite_check_2.xml b/src/tests/suite_check_2.xml index f5144726..562c1b7c 100644 --- a/src/tests/suite_check_2.xml +++ b/src/tests/suite_check_2.xml @@ -1,6 +1,6 @@ - + test diff --git a/src/tests/suite_check_3.xml b/src/tests/suite_check_3.xml index 10e1b595..ae6949b9 100644 --- a/src/tests/suite_check_3.xml +++ b/src/tests/suite_check_3.xml @@ -1,6 +1,6 @@ - + test diff --git a/src/tests/suite_noop_1.xml b/src/tests/suite_noop_1.xml index 80e8fc80..8066e51c 100644 --- a/src/tests/suite_noop_1.xml +++ b/src/tests/suite_noop_1.xml @@ -1,6 +1,6 @@ - + noop diff --git a/src/tests/suite_noop_2.xml b/src/tests/suite_noop_2.xml index 1c0a4447..2cdcce84 100644 --- a/src/tests/suite_noop_2.xml +++ b/src/tests/suite_noop_2.xml @@ -1,6 +1,6 @@ - + noop diff --git a/src/tests/suite_noop_3.xml b/src/tests/suite_noop_3.xml index a9e5ec81..36e6d4d9 100644 --- a/src/tests/suite_noop_3.xml +++ b/src/tests/suite_noop_3.xml @@ -1,6 +1,6 @@ - + noop diff --git a/src/tests/suite_noop_4.xml b/src/tests/suite_noop_4.xml index 405ac330..a53ee1df 100644 --- a/src/tests/suite_noop_4.xml +++ b/src/tests/suite_noop_4.xml @@ -1,6 +1,6 @@ - + noop diff --git a/src/tests/suite_noop_5.xml b/src/tests/suite_noop_5.xml index b854898d..2aeb67c2 100644 --- a/src/tests/suite_noop_5.xml +++ b/src/tests/suite_noop_5.xml @@ -1,6 +1,6 @@ - + noop diff --git a/src/tests/suite_noop_6.xml b/src/tests/suite_noop_6.xml index 1996517b..711ee02e 100644 --- a/src/tests/suite_noop_6.xml +++ b/src/tests/suite_noop_6.xml @@ -1,6 +1,6 @@ - + noop diff --git a/src/tests/test_check.f90 b/src/tests/test_check.f90 index bedb0314..68016019 100644 --- a/src/tests/test_check.f90 +++ b/src/tests/test_check.f90 @@ -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 diff --git a/src/tests/test_init_finalize.f90 b/src/tests/test_init_finalize.f90 index 3e32be1c..b922173f 100644 --- a/src/tests/test_init_finalize.f90 +++ b/src/tests/test_init_finalize.f90 @@ -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