From d37a42f47c97143e8edc9b1f385ca91a9ed2fcc6 Mon Sep 17 00:00:00 2001 From: "Lucas A. M. Magalhaes" <lucas.magalhaes@ess.eu> Date: Wed, 23 Nov 2022 09:39:29 +0100 Subject: [PATCH] Block cell and non cell targets together --- configure/E3/CONFIG_CELL | 5 +++++ tests/test_build.py | 20 ++++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/configure/E3/CONFIG_CELL b/configure/E3/CONFIG_CELL index 4dafb395..f4b7e12c 100644 --- a/configure/E3/CONFIG_CELL +++ b/configure/E3/CONFIG_CELL @@ -1,6 +1,11 @@ # TOP is e3-MODULENAME ifneq (,$(findstring cell,$(MAKECMDGOALS))) +# Check if non cell targets are being called +NON_CELL_TARGETS=install uninstall build debug rebuild vars +ifneq (,$(filter $(NON_CELL_TARGETS),$(MAKECMDGOALS))) + $(error cell targets cannot be called with non cell targets on the same command line) +endif ## Default is e3-MODULENAME/cellMods E3_CELL_PATH=$(TOP)/cellMods ## diff --git a/tests/test_build.py b/tests/test_build.py index ec80caba..74af2b9e 100644 --- a/tests/test_build.py +++ b/tests/test_build.py @@ -607,3 +607,23 @@ def test_double_install_fails(wrapper: Wrapper, module_version): ), errs, ) + + +@pytest.mark.parametrize( + "targets", + [ + ["cellbuild", "build"], + ["cellinstall", "install"], + ["vars", "cellbuild"], + ["debug", "cellinstall"], + ["cellbuild", "uninstall"], + ], + ids=["build", "install", "vars", "debug", "uninstall"], +) +def test_target_fails_with_celltarget(wrapper: Wrapper, targets): + rc, _, errs = wrapper.run_make(targets[0], targets[1]) + assert rc != 0 + assert ( + "cell targets cannot be called with non cell targets on the same command line" + in errs + ) -- GitLab