Skip to content
Snippets Groups Projects
Commit d5051870 authored by Simon Rose's avatar Simon Rose
Browse files

Add test for debug architecture

parent 75406f26
No related branches found
No related tags found
No related merge requests found
......@@ -12,5 +12,7 @@ VARS_EXCLUDES+=TEMP_CELL_PATH
ifneq (,$(findstring test,$(MAKECMDGOALS)))
TEST_DEBUG_ARCH:=$(if $(and $(findstring debug,$(EPICS_HOST_ARCH)),$(wildcard $(EPICS_BASE)/bin/$(EPICS_HOST_ARCH)/softIocPVA)),$(EPICS_HOST_ARCH))
EXPORT_VARS+=TEST_DEBUG_ARCH
E3_MODULES_PATH=$(TEMP_CELL_PATH)/$(notdir $(EPICS_BASE))/require-$(E3_REQUIRE_VERSION)
endif
import pytest
from .utils import Wrapper
......@@ -49,3 +51,24 @@ def test_warning_if_building_from_sitemods(wrapper: Wrapper):
assert (
"It is ill-advised to build a module from the module install location." in errs
)
def test_debug_arch_is_not_used_when_unspecified(wrapper: Wrapper):
rc, _, errs = wrapper.run_make("test")
assert rc == 0
# Note that output from run-iocsh goes to stderr
assert f'EPICS_HOST_ARCH = "{wrapper.host_arch}"' in errs
def test_debug_arch_is_used_when_specified(wrapper: Wrapper):
debug_arch = f"{wrapper.host_arch}-debug"
softioc_exec = wrapper.epics_base / "bin" / debug_arch / "softIocPVA"
if not softioc_exec.exists():
pytest.skip("No debug arch installed")
rc, _, errs = wrapper.run_make("test", EPICS_HOST_ARCH=debug_arch)
assert rc == 0
# Note that output from run-iocsh goes to stderr
assert f'EPICS_HOST_ARCH = "{debug_arch}"' in errs
......@@ -78,8 +78,6 @@ include $(REQUIRE_CONFIG)/RULES_SITEMODS
module_makefile_contents = """
where_am_I := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
include $(E3_REQUIRE_TOOLS)/driver.makefile
EXCLUDE_ARCHS+=debug
"""
self.module_makefile.write_text(module_makefile_contents)
......@@ -138,6 +136,9 @@ EXCLUDE_ARCHS+=debug
args = list(args)
if module_version:
args.append(f"E3_MODULE_VERSION={module_version}")
if not ("TEST_DEBUG_ARCH" in env and not env["TEST_DEBUG_ARCH"]):
args.append("EXCLUDE_ARCHS=debug")
if cell_path:
self.write_dot_local_data("CONFIG_CELL", {"E3_CELL_PATH": cell_path})
make_cmd = ["make", "-C", self.path, target] + args
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment