Skip to content
Snippets Groups Projects
Commit 5d0e16c4 authored by Anders Lindh Olsson's avatar Anders Lindh Olsson :8ball:
Browse files

remove inclusion of the run_iocsh script and change tests and targets...

remove inclusion of the run_iocsh script and change tests and targets accordingly; idea is that run-iocsh is a required package but not part of require per se
parent fe6fcdef
No related branches found
No related tags found
No related merge requests found
......@@ -4,6 +4,8 @@
* Added back `promptE3Env.bash`, which runs `setE3Env.bash` and then sets the bash prompt.
* Added descriptions for more targets when running `make help`
* Added a new test target for individual modules, available as `make test`
* Added script in `tools/test_installed_modules.sh` that tests all modules in an installation
## Bugfixes
......
......@@ -12,6 +12,7 @@ IOCSH_HASH_VERSION?=$(EPICS_MODULE_TAG)
FILE_FILTER:= %~ %\#
E3_ESSENVCFG_FILE := $(TOP)/tools/ess-env.conf
E3_CONFIG_FILE := $(TOP)/tools/e3.cfg
E3_TEST_SCRIPT := $(TOP)/tools/test_installed_modules.sh
#
E3_SHELL_FILES := $(wildcard $(E3_MODULE_SRC_PATH)/tools/iocsh*.bash)
E3_IOC_CFG_FILES := $(E3_MODULE_SRC_PATH)/tools/iocsh_functions
......
......@@ -5,6 +5,7 @@ include $(REQUIRE_CONFIG)/CONFIG_REQUIRE
include $(REQUIRE_CONFIG)/CONFIG_CELL
include $(REQUIRE_CONFIG)/CONFIG_E3_PATH
include $(REQUIRE_CONFIG)/CONFIG_E3_MAKEFILE
include $(REQUIRE_CONFIG)/CONFIG_TEST
include $(REQUIRE_CONFIG)/CONFIG_EPICS
include $(REQUIRE_CONFIG)/CONFIG_DKMS
include $(REQUIRE_CONFIG)/CONFIG_EXPORT
......
RUN_IOCSH_TEST_COMMAND = run-iocsh --name "${EPICS_BASE}/require/${E3_REQUIRE_VERSION}/bin/iocsh.bash" -r "$(E3_MODULE_NAME),$(E3_MODULE_VERSION)" -l $(TEMP_CELL_PATH)
TEMP_CELL_PATH := $(TOP)/testMods-$(shell date +"%y%m%d%H%M%S")
RMDIR = $(RM) -rf
......@@ -5,6 +5,7 @@ include $(REQUIRE_CONFIG)/RULES_CELL
include $(REQUIRE_CONFIG)/DEFINES_FT
include $(REQUIRE_CONFIG)/RULES_PATCH
include $(REQUIRE_CONFIG)/RULES_E3_SITELIBS
include $(REQUIRE_CONFIG)/RULES_TEST
include $(REQUIRE_CONFIG)/RULES_VLIBS
include $(REQUIRE_CONFIG)/RULES_DKMS
......
.PHONY: test
## Tests the current build
test:
ifeq ($(shell command -v run-iocsh > /dev/null 2>&1 ; echo $$?),0)
test: temp_install run_test module_tests cleanup_test
.PHONY: temp_install
temp_install:
$(MAKE) cellinstall E3_CELL_PATH=$(TEMP_CELL_PATH)
.PHONY: run_test
run_test:
$(RUN_IOCSH_TEST_COMMAND)
.PHONY: module_tests
module_tests:
.PHONY: cleanup_test
cleanup_test:
$(RMDIR) $(TEMP_CELL_PATH)
else # if the if-run-iocsh-exists test fails
test:
$(error run-iocsh must be installed to use the test capability. Please install run-iocsh from PyPI.)
endif
\ No newline at end of file
#!/usr/bin/env bash
# Copyright (c) 2020 European Spallation Source ERIC
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
REQUIRE_DIR=$(cd "$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"/.. || exit; pwd)
REQUIRE_VERSION=${REQUIRE_DIR##*/}
BASE_LOCATION=$(cd "${REQUIRE_DIR}"/../.. || exit; pwd)
if ! $(command -v run-iocsh > /dev/null 2>&1); then
echo "You need to install run-iocsh to use this script" >&2 && exit 1
fi
for d in "$REQUIRE_DIR"/siteMods/*/*; do
mod=$(dirname "$d" | xargs basename)
ver=$(basename "$d")
echo "Running test: $mod,$ver"
echo "======================================================="
if run-iocsh --base_location "${BASE_LOCATION}" --require_version "${REQUIRE_VERSION}" --delay 2 --timeout 5 "$mod,$ver"; then
echo -e "Module $mod, version $ver: \e[32mTEST PASSED\e[0m"
else
echo -e "Module $mod, version $ver: \e[31mFAILED\e[0m" >&2
fi
echo "======================================================="
echo ""
done
\ No newline at end of file
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