diff --git a/configure/E3/CONFIG_TEST b/configure/E3/CONFIG_TEST index 473f438126209c29dfa12914951f398b1202c636..1836a92d02b51dabb0004f57a7e230a1c8c14859 100644 --- a/configure/E3/CONFIG_TEST +++ b/configure/E3/CONFIG_TEST @@ -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 diff --git a/configure/E3/RULES_TEST b/configure/E3/RULES_TEST index f542ecb693592fb72d2be104a9af22ee88f25880..148d424b06dc20ffc490de59a5d8815aaeeed049 100644 --- a/configure/E3/RULES_TEST +++ b/configure/E3/RULES_TEST @@ -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: diff --git a/require-ess/tools/iocsh b/require-ess/tools/iocsh index 56abb27a7c0f8764418c4b078fdbc765b79c4347..383006b0a3a8917c32c833b1d38c2aa05a719fb5 100644 --- a/require-ess/tools/iocsh +++ b/require-ess/tools/iocsh @@ -1,7 +1,7 @@ #!/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 diff --git a/tests/test_e3.py b/tests/test_e3.py index 54e1e079488ecb5d658dfb84387c5f8780bc5650..b79327fd6921423deb1327fb8d710b7317e40ef2 100644 --- a/tests/test_e3.py +++ b/tests/test_e3.py @@ -1,3 +1,5 @@ +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 diff --git a/tests/utils.py b/tests/utils.py index b837ab55ce5e1c06586e80104b1eae00bdca0759..7223776e3374142be837fd24748dbb923a6957db 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -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