From 9d4ef2565d0cc567f060b8228a59c8f59cf2ce05 Mon Sep 17 00:00:00 2001 From: climbfuji Date: Fri, 19 Apr 2019 14:14:57 -0600 Subject: [PATCH 1/4] schemes/check/ccpp_prebuild_config.py: bugfix for travis build, add missing SUITES_DIR variable in CCPP prebuild config --- schemes/check/ccpp_prebuild_config.py | 3 +++ 1 file changed, 3 insertions(+) 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 From a3d66dfd3d9a421a2bcb8d91e9b9ff0e83e5eb8d Mon Sep 17 00:00:00 2001 From: climbfuji Date: Fri, 19 Apr 2019 15:39:15 -0600 Subject: [PATCH 2/4] Change suite names to match the requirement that suite XYZ must reside in file suite_XYZ.xml --- src/tests/suite_check_1.xml | 2 +- src/tests/suite_check_2.xml | 2 +- src/tests/suite_check_3.xml | 2 +- src/tests/suite_noop_1.xml | 2 +- src/tests/suite_noop_2.xml | 2 +- src/tests/suite_noop_3.xml | 2 +- src/tests/suite_noop_4.xml | 2 +- src/tests/suite_noop_5.xml | 2 +- src/tests/suite_noop_6.xml | 2 +- src/tests/suite_noop_7.xml | 10 ++++++++++ 10 files changed, 19 insertions(+), 9 deletions(-) create mode 100644 src/tests/suite_noop_7.xml 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/suite_noop_7.xml b/src/tests/suite_noop_7.xml new file mode 100644 index 00000000..711ee02e --- /dev/null +++ b/src/tests/suite_noop_7.xml @@ -0,0 +1,10 @@ + + + + + + noop + + + + From bcc78045415260fb74ac6dd19f14dee524c9d6ef Mon Sep 17 00:00:00 2001 From: climbfuji Date: Fri, 19 Apr 2019 15:39:41 -0600 Subject: [PATCH 3/4] Add switch for ccpp_init to interpret suitename as filename/filepath (dynamic build only) --- src/ccpp.F90 | 34 +++++++++++++++++++++++--------- src/tests/test_check.f90 | 5 +++-- src/tests/test_init_finalize.f90 | 2 +- 3 files changed, 29 insertions(+), 12 deletions(-) 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/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 From 22897304cf0314c24a17250e2318aabe7ac941b4 Mon Sep 17 00:00:00 2001 From: climbfuji Date: Fri, 19 Apr 2019 15:44:37 -0600 Subject: [PATCH 4/4] Remove file src/tests/suite_noop_7.xml that was added accidentally --- src/tests/suite_noop_7.xml | 10 ---------- 1 file changed, 10 deletions(-) delete mode 100644 src/tests/suite_noop_7.xml diff --git a/src/tests/suite_noop_7.xml b/src/tests/suite_noop_7.xml deleted file mode 100644 index 711ee02e..00000000 --- a/src/tests/suite_noop_7.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - noop - - - -