From 73f3cb81a2de24aa36cf3b032fcd8e934d63f964 Mon Sep 17 00:00:00 2001 From: Meagan Lang Date: Fri, 28 Jun 2024 14:45:03 -0400 Subject: [PATCH] Mark additional cmake tests as requiring C++ Raise an expection from build drivers if the target language driver is not installed Don't capture log messages for RMQ testing jobs --- .github/workflows/test-install.yml | 4 ++-- tests/drivers/test_CMakeModelDriver.py | 13 ++++++++++++- utils/test-install-base.yml | 2 +- yggdrasil/drivers/BuildModelDriver.py | 3 +++ 4 files changed, 18 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test-install.yml b/.github/workflows/test-install.yml index b646d8c4d..599c8b73c 100644 --- a/.github/workflows/test-install.yml +++ b/.github/workflows/test-install.yml @@ -243,8 +243,8 @@ jobs: --parametrize-language=sbml\", \"long-remote-service\":\"--long-running --remote-service\", \"examples-rpc-lesson3\":\"--suites examples top --parametrize-example-name=rpc_lesson3\", \"tools\":\"tests/test_tools.py\", \"long-interp\":\"--long-running --languages - python R matlab\", \"services\":\"tests/test_services.py --nocapture\"}" >> - $GITHUB_OUTPUT + python R matlab --nocapture\", \"services\":\"tests/test_services.py --nocapture\"}" + >> $GITHUB_OUTPUT schema: if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') name: Update the schema used by the model submission form diff --git a/tests/drivers/test_CMakeModelDriver.py b/tests/drivers/test_CMakeModelDriver.py index f29503270..330ec8963 100644 --- a/tests/drivers/test_CMakeModelDriver.py +++ b/tests/drivers/test_CMakeModelDriver.py @@ -33,13 +33,22 @@ def test_CMakeBuilder(scripts): @pytest.mark.absent_language('cmake') +def test_CMakeModelDriver_no_cmake(scripts): # pragma: windows + r"""Test CMakeModelDriver error when cmake not installed.""" + with pytest.raises(RuntimeError): + CMakeModelDriver('test', scripts['cmake']) + + +@pytest.mark.language('cmake') +@pytest.mark.absent_language('c++') def test_CMakeModelDriver_no_C_library(scripts): # pragma: windows - r"""Test CMakeModelDriver error when C library not installed.""" + r"""Test CMakeModelDriver error when C++ library not installed.""" with pytest.raises(RuntimeError): CMakeModelDriver('test', scripts['cmake']) @pytest.mark.language('cmake') +@pytest.mark.language('c++') def test_CMakeModelDriver_error_cmake(scripts): r"""Test CMakeModelDriver error for invalid cmake args.""" makedir, target = os.path.split(scripts['cmake']) @@ -54,6 +63,7 @@ def test_CMakeModelDriver_error_cmake(scripts): @pytest.mark.language('cmake') +@pytest.mark.language('c++') def test_CMakeModelDriver_error_notarget(scripts): r"""Test CMakeModelDriver error for invalid target.""" makedir, target = os.path.split(scripts['cmake']) @@ -67,6 +77,7 @@ def test_CMakeModelDriver_error_notarget(scripts): @pytest.mark.language('cmake') +@pytest.mark.language('c++') def test_CMakeModelDriver_error_nofile(): r"""Test CMakeModelDriver error for missing CMakeLists.txt.""" sourcedir = os.path.dirname(__file__) diff --git a/utils/test-install-base.yml b/utils/test-install-base.yml index 5890f661d..b0c12bde1 100644 --- a/utils/test-install-base.yml +++ b/utils/test-install-base.yml @@ -48,7 +48,7 @@ jobs: - id: set-os-versions run: echo "versions={\"ubuntu\":\"latest\", \"macos\":\"latest\", \"windows\":\"latest\"}" >> $GITHUB_OUTPUT - id: set-test-flags - run: echo "testflags={\"empty\":\"\", \"basic\":\"--long-running --suites timing demos top\", \"examples\":\"--suite=examples --extra-examples --mpi-script=run_mpi.sh --mpi-nproc=3\", \"types-no-c\":\"--suite=types --skip-languages c cpp\", \"types-c\":\"--suite=types --languages c cpp\", \"long\":\"--long-running\", \"long-mpi\":\"--long-running --mpi-script=run_mpi.sh\", \"examples-backwards\":\"--suite=examples --parametrize-example-name=backwards\", \"examples-sbml\":\"--suites examples --parametrize-language=sbml\", \"long-remote-service\":\"--long-running --remote-service\", \"examples-rpc-lesson3\":\"--suites examples top --parametrize-example-name=rpc_lesson3\", \"tools\":\"tests/test_tools.py\", \"long-interp\":\"--long-running --languages python R matlab\", \"services\":\"tests/test_services.py --nocapture\"}" >> $GITHUB_OUTPUT + run: echo "testflags={\"empty\":\"\", \"basic\":\"--long-running --suites timing demos top\", \"examples\":\"--suite=examples --extra-examples --mpi-script=run_mpi.sh --mpi-nproc=3\", \"types-no-c\":\"--suite=types --skip-languages c cpp\", \"types-c\":\"--suite=types --languages c cpp\", \"long\":\"--long-running\", \"long-mpi\":\"--long-running --mpi-script=run_mpi.sh\", \"examples-backwards\":\"--suite=examples --parametrize-example-name=backwards\", \"examples-sbml\":\"--suites examples --parametrize-language=sbml\", \"long-remote-service\":\"--long-running --remote-service\", \"examples-rpc-lesson3\":\"--suites examples top --parametrize-example-name=rpc_lesson3\", \"tools\":\"tests/test_tools.py\", \"long-interp\":\"--long-running --languages python R matlab --nocapture\", \"services\":\"tests/test_services.py --nocapture\"}" >> $GITHUB_OUTPUT test_pip: needs: params name: Test (${{ matrix.python-version }}, ${{ matrix.os-base }}, ${{ matrix.install-method }}, ${{ matrix.test-flags1 }}, ${{ matrix.test-flags2 }}), Install C = ${{ matrix.install-c }} diff --git a/yggdrasil/drivers/BuildModelDriver.py b/yggdrasil/drivers/BuildModelDriver.py index aeadc3843..9b6b76110 100644 --- a/yggdrasil/drivers/BuildModelDriver.py +++ b/yggdrasil/drivers/BuildModelDriver.py @@ -381,6 +381,9 @@ def init_model_dep(self, **kwargs): self.target_language_driver = ( components.import_component( 'model', self.target_language)) + if not self.target_language_driver.is_installed(): + raise RuntimeError(f"Target language \"{self.language}\" is " + f"not installed") if self.target_compiler is None: self.target_compiler = self.target_language_driver.get_tool( 'compiler', return_prop='name')