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

Merge branch 'fix_test_arch' into 'master'

E3-1186: Allow tests to be run with debug architecture if specified

See merge request e3/e3-require!129
parents 7eebd77a 2c2626c8
No related branches found
No related tags found
1 merge request!129E3-1186: Allow tests to be run with debug architecture if specified
Pipeline #146422 passed
......@@ -11,5 +11,8 @@ VARS_EXCLUDES+=RMDIR
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
......@@ -5,6 +5,10 @@ test:
ifeq ($(shell command -v run-iocsh > /dev/null 2>&1 ; echo $$?),0)
test: temp_install run_test module_tests cleanup_test
ifneq ($(strip $(TEST_DEBUG_ARCH)),)
run_test: EPICS_HOST_ARCH = $(TEST_DEBUG_ARCH)
module_tests: EPICS_HOST_ARCH = $(TEST_DEBUG_ARCH)
endif
.PHONY: temp_install
temp_install:
......
#!/bin/bash
#
# Copyright (c) 2004 - 2017 Paul Scherrer Institute
# Copyright (c) 2017 - 2019 European Spallation Source ERIC
# Copyright (c) 2004 - 2017 Paul Scherrer Institute
# Copyright (c) 2017 - Present European Spallation Source ERIC
#
# The program is free software: you can redistribute
# it and/or modify it under the terms of the GNU General Public License
......@@ -16,34 +16,6 @@
# You should have received a copy of the GNU General Public License along with
# this program. If not, see https://www.gnu.org/licenses/gpl-2.0.txt
#
#
# PSI original iocsh author : Dirk Zimoch
# ESS specific iocsh author : Jeong Han Lee
# email : han.lee@esss.se
#
# Add IOCSH_TOP in order to access where the iocsh is executed
# Thursday, May 31 00:04:07 CEST 2018, jhlee
#
# Add PVA support to call softIOCPVA if BASE >= 7.0.1.1
# Tuesday, October 2 14:26:49 CEST 2018, jhlee
# Tweak REQUIRE PVs to be an unique per a single IOC in OS
# Set Hostname up to 30 chars
# Thursday, October 4 17:00:53 CEST 2018, jhlee
#
# 0.3.5 : Set the proper limitation of REQUIRE PV name
# 0.3.6 : In case, we know where $0 is, sourcing setE3Env.bash by itself
# 0.3.7 : Introduce the local mode with -l
# 0.3.8 : Use mktemp, and protect iocsh when there is no diskspace
# 0.3.9 : LD_BIND_NOW=1 for resolving symbols at startup.
# 0.4.0 : - Fixed registryJLinkAdd failed pva error from base 7.0.3
# - Enable an exit subroutine for sotfioc
# Wednesday, September 11 17:27:59 CEST 2019
# 0.4.1 : - Use the one BASHPID for iocsh
# 0.4.2 : - Use the secure path within tmp, but it may create "disk full" in the long
# term if each IOC cannot be closed properly
# 0.4.3 : - Tune REQUIRE-* PV in order to replace - with . easily
#
SC_SCRIPT="$(readlink -e "$0")"
SC_SCRIPTNAME=${0##*/}
......@@ -51,7 +23,6 @@ SC_TOP="${SC_SCRIPT%/*}"
TMP_PATH="/tmp/systemd-private-e3-iocsh-$(whoami)"
declare -r SC_SCRIPT SC_SCRIPTNAME SC_TOP TMP_PATH
declare SC_VERSION="${E3_REQUIRE_VERSION}"
declare BASECODE=""
# shellcheck source=require-ess/tools/iocsh_functions.bash
. "${SC_TOP}"/iocsh_functions.bash
......@@ -80,8 +51,6 @@ if [ "${E3_REQUIRE_BIN}" != "${SC_TOP}" ]; then
die 2
fi
BASECODE="$(basecode_generator)"
check_mandatory_env_settings
# ${BASHPID} returns iocsh PID
......@@ -154,13 +123,5 @@ if [ "$REALTIME" == "RT" ]; then
printf "##\n"
fi
if [[ ${BASECODE} -ge 07000101 ]]; then
__PVA__="PVA"
else
__PVA__=""
fi
#
#
# shellcheck disable=SC2086
${__LOADER__}${EPICS_BASE}/bin/${EPICS_HOST_ARCH}/softIoc${__PVA__} -D ${EPICS_BASE}/dbd/softIoc${__PVA__}.dbd "${IOC_STARTUP}" 2>&1
${__LOADER__}${EPICS_BASE}/bin/${EPICS_HOST_ARCH}/softIocPVA -D ${EPICS_BASE}/dbd/softIocPVA.dbd "${IOC_STARTUP}" 2>&1
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