From 5b8788b95e2c4b98f623190ccf8285de36600c80 Mon Sep 17 00:00:00 2001 From: James Edwards Date: Wed, 6 Dec 2023 08:23:36 -0700 Subject: [PATCH 1/3] currently only reads the first Macros file found, this fixes that so that it reads all available Macros files --- CIME/tests/test_sys_unittest.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CIME/tests/test_sys_unittest.py b/CIME/tests/test_sys_unittest.py index af43654454c..de079218e2f 100755 --- a/CIME/tests/test_sys_unittest.py +++ b/CIME/tests/test_sys_unittest.py @@ -37,8 +37,8 @@ def _has_unit_test_support(self): for macro_to_check in macros_to_check: if os.path.exists(macro_to_check): macro_text = open(macro_to_check, "r").read() - - return "PFUNIT_PATH" in macro_text + if "PFUNIT_PATH" in macro_text: + return True return False From 4d70147a32e853f00f88b9ad5ff54aba3d02c9c3 Mon Sep 17 00:00:00 2001 From: Jason Boutte Date: Wed, 6 Dec 2023 10:01:55 -0800 Subject: [PATCH 2/3] Fixes passing compiler/comp-interace to run_tests.py --- CIME/tests/test_sys_unittest.py | 35 +++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/CIME/tests/test_sys_unittest.py b/CIME/tests/test_sys_unittest.py index de079218e2f..238c7355469 100755 --- a/CIME/tests/test_sys_unittest.py +++ b/CIME/tests/test_sys_unittest.py @@ -16,22 +16,29 @@ def setUpClass(cls): cls._testroot = os.path.join(cls.TEST_ROOT, "TestUnitTests") cls._testdirs = [] - def _has_unit_test_support(self): - if self.TEST_COMPILER is None: - compiler = self.MACHINE.get_default_compiler() - else: - compiler = self.TEST_COMPILER + def setUp(self): + super().setUp() + + self._driver = utils.get_cime_default_driver() + self._has_pfunit = self._has_unit_test_support() - mach = self.MACHINE.get_machine_name() + def _has_unit_test_support(self): cmake_macros_dir = Files().get_value("CMAKE_MACROS_DIR") macros_to_check = [ - os.path.join(cmake_macros_dir, "{}_{}.cmake".format(compiler, mach)), - os.path.join(cmake_macros_dir, "{}.cmake".format(mach)), os.path.join( - os.environ.get("HOME"), ".cime", "{}_{}.cmake".format(compiler, mach) + cmake_macros_dir, + "{}_{}.cmake".format(self._compiler, self._machine), + ), + os.path.join(cmake_macros_dir, "{}.cmake".format(self._machine)), + os.path.join( + os.environ.get("HOME"), + ".cime", + "{}_{}.cmake".format(self._compiler, self._machine), + ), + os.path.join( + os.environ.get("HOME"), ".cime", "{}.cmake".format(self._machine) ), - os.path.join(os.environ.get("HOME"), ".cime", "{}.cmake".format(mach)), ] for macro_to_check in macros_to_check: @@ -44,7 +51,7 @@ def _has_unit_test_support(self): def test_a_unit_test(self): cls = self.__class__ - if not self._has_unit_test_support(): + if not self._has_pfunit: self.skipTest( "Skipping TestUnitTest - PFUNIT_PATH not found for the default compiler on this machine" ) @@ -59,8 +66,7 @@ def test_a_unit_test(self): test_spec_dir = os.path.join( os.path.dirname(unit_test_tool), "Examples", "interpolate_1d", "tests" ) - args = "--build-dir {} --test-spec-dir {}".format(test_dir, test_spec_dir) - args += " --machine {}".format(self.MACHINE.get_machine_name()) + args = f"--build-dir {test_dir} --test-spec-dir {test_spec_dir} --machine {self._machine} --compiler {self._compiler} --comp-interface {self._driver}" utils.run_cmd_no_fail("{} {}".format(unit_test_tool, args)) cls._do_teardown.append(test_dir) @@ -83,8 +89,7 @@ def test_b_cime_f90_unit_tests(self): test_spec_dir, "scripts", "fortran_unit_testing", "run_tests.py" ) ) - args = "--build-dir {} --test-spec-dir {}".format(test_dir, test_spec_dir) - args += " --machine {}".format(self.MACHINE.get_machine_name()) + args = f"--build-dir {test_dir} --test-spec-dir {test_spec_dir} --machine {self._machine} --compiler {self._compiler} --comp-interface {self._driver}" utils.run_cmd_no_fail("{} {}".format(unit_test_tool, args)) cls._do_teardown.append(test_dir) From 68742fa7854deb4758ef28700d7d682a7d6f67a5 Mon Sep 17 00:00:00 2001 From: Jason Boutte Date: Wed, 6 Dec 2023 10:22:11 -0800 Subject: [PATCH 3/3] Fixes loading model customize earlier --- CIME/tests/scripts_regression_tests.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CIME/tests/scripts_regression_tests.py b/CIME/tests/scripts_regression_tests.py index 039f13c7718..66f4c015298 100755 --- a/CIME/tests/scripts_regression_tests.py +++ b/CIME/tests/scripts_regression_tests.py @@ -44,6 +44,7 @@ from CIME.provenance import get_test_success, save_test_success from CIME import utils from CIME.tests.base import BaseTestCase +from CIME.config import Config os.environ["CIME_GLOBAL_WALLTIME"] = "0:05:00" @@ -151,6 +152,9 @@ def configure_tests( ): config = CIME.utils.get_cime_config() + customize_path = os.path.join(utils.get_src_root(), "cime_config", "customize") + Config.load(customize_path) + if timeout: BaseTestCase.GLOBAL_TIMEOUT = str(timeout)