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

E3-121

parent ee93a3f3
No related branches found
No related tags found
No related merge requests found
---
stages:
- check
- build
- test
default:
tags:
- docker
image: registry.esss.lu.se/ics-docker/centos-e3:0.3.2
### stage: check
shellcheck:
image: pipelinecomponents/shellcheck:latest
stage: check
before_script:
- shellcheck --version
script:
# anything ending on .*sh, should be shell script
- |
find . -name .git -type d -prune -o -type f -name \*.\*sh -print0 |
xargs -0 -P $(nproc) -r -n1 shellcheck --format=gcc -x
# magic, any file with a valid shebang should be scanned aswell
- |
find . -name .git -type d -prune -o -type f -regex '.*/[^.]*$' -print0 |
xargs -0 -P $(nproc) -r -n1 sh -c 'FILE="$0"; if head -n1 "$FILE" |grep -q "^#\\! \?/.\+\(ba|d|k\)\?sh" ; then shellcheck "$FILE" --format=gcc -x ; else /bin/true ; fi '
shfmt:
image: mvdan/shfmt:v3.2.0-alpine
stage: check
before_script:
- shfmt -version
script:
- shfmt -i 2 -ci -d . # 2 spaces indent, indent switch-case statements, show diff (don't apply change)
build require:
stage: build
when: always
before_script:
- curl -L -o epics.zip https://gitlab.esss.lu.se/e3/e3-base/-/jobs/artifacts/master/download?job=build
- unzip epics.zip
- export BASE_PATH=$(ls -d $(pwd)/epics/base-*)
- echo "EPICS_BASE:=${BASE_PATH}" >> configure/RELEASE.local
- chmod +w "${BASE_PATH}"/configure/CONFIG_SITE
- echo 'INSTALL_LOCATION:=$(TOP)' >> "${BASE_PATH}"/configure/CONFIG_SITE
- export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${BASE_PATH}/lib/linux-x86_64"
- make vars
script:
- make build
- make install
artifacts:
paths:
- epics
test require:
stage: test
before_script:
- source $(pwd)/epics/base-*/require/*/bin/setE3Env.bash
script:
- echo exit | iocsh.bash
\ No newline at end of file
......@@ -11,7 +11,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_CONFIG_FILE := $(E3_MODULE_SRC_PATH)/tools/e3.cfg
E3_TEST_SCRIPT := $(TOP)/tools/test_installed_modules.sh
#
E3_SHELL_FILES := $(wildcard $(E3_MODULE_SRC_PATH)/tools/iocsh*.bash)
......
......@@ -2,7 +2,7 @@
# Small script to fetch current build nuber for a given module. If you pass a numeric version
# but no build number, it fetches the latest build number installed from the target e3 env.
#
# Arguments:
# Arguments:
# $1: require module path e.g. /epics/base-$BASE_VERSION/require/$REQUIRE_VERSION/siteMods
# $2: module name
# $3: module version
......@@ -19,4 +19,4 @@ if [[ $v =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
basename "$(ls -dvr "$p/$m/$v"?(++([0-9])) 2>/dev/null | head -n 1)"
else
echo "$v"
fi
\ No newline at end of file
fi
#!/bin/bash
#
# Copyright (c) 2004 - 2017 Paul Scherrer Institute
# Copyright (c) 2004 - 2017 Paul Scherrer Institute
# Copyright (c) 2017 - 2019 European Spallation Source ERIC
#
# The program is free software: you can redistribute
......@@ -23,7 +23,7 @@
#
# Add IOCSH_TOP in order to access where the iocsh.bash 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
......@@ -44,16 +44,16 @@
# term if each IOC cannot be closed properly
# 0.4.3 : - Tune REQUIRE-* PV in order to replace - with . easily
#
declare -r SC_SCRIPT="$(readlink -e "$0")"
declare -r SC_SCRIPTNAME=${0##*/}
declare -r SC_TOP="${SC_SCRIPT%/*}"
SC_SCRIPT="$(readlink -e "$0")"
SC_SCRIPTNAME=${0##*/}
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 STARTUP=""
declare BASECODE=""
declare -r TMP_PATH="/tmp/systemd-private-e3-iocsh-$(whoami)"
. ${SC_TOP}/iocsh_functions.bash
# shellcheck source=require-ess/tools/iocsh_functions.bash
. "${SC_TOP}"/iocsh_functions.bash
# To get the absolute path where iocsh.bash is executed
IOCSH_TOP=${PWD}
......@@ -63,10 +63,11 @@ loadEnv "$@"
# The most unique environment variable for e3 is EPICS_DRIVER_PATH
#
if [[ $(checkIfVar ${EPICS_DRIVER_PATH}) -eq "$NON_EXIST" ]]; then
set -a
. ${SC_TOP}/setE3Env.bash "no_msg"
set +a
if [[ -z "${EPICS_DRIVER_PATH}" ]]; then
set -a
# shellcheck source=require-ess/tools/setE3Env.bash
. "${SC_TOP}"/setE3Env.bash "no_msg"
set +a
fi
BASECODE="$(basecode_generator)"
......@@ -80,73 +81,74 @@ SC_VERSION+=-PID-${iocsh_bash_id}
#
# We define HOSTNAME + iocsh_bash_id
IOCSH_PS1=$(iocsh_ps1 "${iocsh_bash_id}")
IOCSH_PS1=$(iocsh_ps1 "${iocsh_bash_id}")
REQUIRE_IOC=$(require_ioc "${iocsh_bash_id}")
#
# Default Initial Startup file for REQUIRE and minimal environment
# Create TMP_PATH path in order to keep tmp files secure until
# an IOC will be closed.
mkdir -p ${TMP_PATH}
mkdir -p "${TMP_PATH}"
IOC_STARTUP=$(mktemp -p ${TMP_PATH} -q --suffix=_iocsh_${SC_VERSION}) || die 1 "${SC_SCRIPTNAME} CANNOT create the startup file, please check the disk space";
IOC_STARTUP=$(mktemp -p "${TMP_PATH}" -q --suffix=_iocsh_${SC_VERSION}) || die 1 "${SC_SCRIPTNAME} CANNOT create the startup file, please check the disk space"
# EPICS_DRIVER_PATH defined in iocsh and startup.script_common
# Remember, driver is equal to module, so EPICS_DRIVER_PATH is the module directory
# In our jargon. It is the same as ${EPICS_MODULES}
# shellcheck disable=SC2064
trap "softIoc_end ${IOC_STARTUP}" EXIT HUP INT TERM
{
printIocEnv;
printf "# Set REQUIRE_IOC for its internal PVs\n";
printf "epicsEnvSet REQUIRE_IOC \"${REQUIRE_IOC}\"\n";
printf "#\n";
printf "# Enable an exit subroutine for sotfioc\n";
printf "dbLoadRecords \"${EPICS_BASE}/db/softIocExit.db\" \"IOC=${REQUIRE_IOC}\"\n";
printf "#\n";
printf "# Set E3_IOCSH_TOP for the absolute path where %s is executed.\n" "${SC_SCRIPTNAME}"
printf "epicsEnvSet E3_IOCSH_TOP \"${IOCSH_TOP}\"\n";
printf "#\n";
loadRequire;
loadFiles "$@";
printf "# Set the IOC Prompt String One \n";
printf "epicsEnvSet IOCSH_PS1 \"$IOCSH_PS1\"\n";
printf "#\n";
if [ "$REALTIME" == "RT" ]; then
printf "# Real Time \"$REALTIME\"\n";
fi
if [ "$init" != NO ]; then
printf "# \n";
printf "iocInit\n"
fi
} > ${IOC_STARTUP}
printIocEnv
printf "# Set REQUIRE_IOC for its internal PVs\n"
printf "epicsEnvSet REQUIRE_IOC \"%s\"\n" "${REQUIRE_IOC}"
printf "#\n"
printf "# Enable an exit subroutine for sotfioc\n"
printf "dbLoadRecords \"%s/db/softIocExit.db\" \"IOC=%s\"\n" "${EPICS_BASE}" "${REQUIRE_IOC}"
printf "#\n"
printf "# Set E3_IOCSH_TOP for the absolute path where %s is executed.\n" "${SC_SCRIPTNAME}"
printf "epicsEnvSet E3_IOCSH_TOP \"%s\"\n" "${IOCSH_TOP}"
printf "#\n"
loadRequire
loadFiles "$@"
printf "# Set the IOC Prompt String One \n"
printf "epicsEnvSet IOCSH_PS1 \"%s\"\n" "$IOCSH_PS1"
printf "#\n"
if [ "$REALTIME" == "RT" ]; then
printf "# Real Time \"%s\"\n" "$REALTIME"
fi
if [ "$init" != NO ]; then
printf "# \n"
printf "iocInit\n"
fi
} >"${IOC_STARTUP}"
ulimit -c unlimited
if [ "$REALTIME" == "RT" ]; then
export LD_BIND_NOW=1;
printf "## \n";
printf "## Better support for Real-Time IOC Application.\n"
printf "## Now we set 'export LD_BIND_NOW=%s'\n" "$LD_BIND_NOW";
printf "## If one may meet the 'Operation not permitted' message, \n";
printf "## please run %s without the real-time option\n" "$SC_SCRIPTNAME";
printf "##\n";
export LD_BIND_NOW=1
printf "## \n"
printf "## Better support for Real-Time IOC Application.\n"
printf "## Now we set 'export LD_BIND_NOW=%s'\n" "$LD_BIND_NOW"
printf "## If one may meet the 'Operation not permitted' message, \n"
printf "## please run %s without the real-time option\n" "$SC_SCRIPTNAME"
printf "##\n"
fi
if [[ ${BASECODE} -ge 07000101 ]]; then
__PVA__="PVA"
if [[ ${BASECODE} -ge 07000101 ]]; then
__PVA__="PVA"
else
__PVA__=""
__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
#!/usr/bin/env bash
_iocsh_bash_completion()
{
local cur prev opts mods
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
_iocsh_bash_completion() {
local cur prev opts mods
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD - 1]}"
# -l should only autocomplete to directories
if [[ ${prev} == -l ]]; then
COMPREPLY=($(compgen -d -- ${cur}))
return 0
fi
# -l should only autocomplete to directories
if [[ ${prev} == -l ]]; then
mapfile -t COMPREPLY < <(compgen -d -- "${cur}")
return 0
fi
# -e should only autcomplete to filenames
if [[ ${prev} == -e ]]; then
COMPREPLY=($(compgen -f -- ${cur}))
return 0
fi
# -e should only autcomplete to filenames
if [[ ${prev} == -e ]]; then
mapfile -t COMPREPLY < <(compgen -f -- "${cur}")
return 0
fi
# -r should try to determine modules
# Note that this does not return anything in cellMods, which would require us to
# determine what cellpath to use.
if [[ ${prev} == -r ]]; then
if [ -n "${EPICS_BASE}" ] && [ -n "${E3_REQUIRE_VERSION}" ]; then
mods=$(ls "${EPICS_BASE}/require/${E3_REQUIRE_VERSION}/siteMods/" 2>/dev/null)
COMPREPLY=($(compgen -W "$mods" -- ${cur}))
fi
return 0
# -r should try to determine modules
# Note that this does not return anything in cellMods, which would require us to
# determine what cellpath to use.
if [[ ${prev} == -r ]]; then
if [ -n "${EPICS_BASE}" ] && [ -n "${E3_REQUIRE_VERSION}" ]; then
mods=$(ls "${EPICS_BASE}/require/${E3_REQUIRE_VERSION}/siteMods/" 2>/dev/null)
mapfile -t COMPREPLY < <(compgen -W "${mods}" -- "${cur}")
fi
return 0
fi
opts="-h -v -c -s -r -e -dg -dv -l -n"
if [[ ${cur} == -* ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
return 0
fi
opts="-h -v -c -s -r -e -dg -dv -l -n"
if [[ ${cur} == -* ]]; then
mapfile -t COMPREPLY < <(compgen -W "${opts}" -- "${cur}")
return 0
fi
COMPREPLY=($(compgen -f -- ${cur}))
mapfile -t COMPREPLY < <(compgen -f -- "${cur}")
}
complete -o filenames -o nospace -o bashdefault -F _iocsh_bash_completion iocsh.bash
This diff is collapsed.
#!/bin/bash
# Script to show in the prompt the EPICS Base Version
# Script to show in the prompt the EPICS Base Version
#
# Author : Alfio Rizzo
# Author : Alfio Rizzo
# email : alfio.rizzo@ess.eu
# date : Fri Oct 16 12:28:22 CEST 2020
#
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
# shellcheck source=require-ess/tools/setE3Env.bash
source "$DIR"/setE3Env.bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
source $DIR/setE3Env.bash
IFS='/' read -ra base <<< "$EPICS_BASE"
PS1=(EPICS-${base[-1]})$PS1
IFS='/' read -ra base <<<"$EPICS_BASE"
PS1="(EPICS-${base[-1]})$PS1"
......@@ -15,7 +15,7 @@
#
# 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
#
#
# Shell : setE3Env.bash
# Author : Jeong Han Lee
# email : jeonghan.lee@gmail.com
......@@ -27,286 +27,266 @@
# the following function drop_from_path was copied from
# the ROOT build system in ${ROOTSYS}/bin/, and modified
# a little to return its result
# Wednesday, July 11 23:19:00 CEST 2018, jhlee
drop_from_path ()
{
#
# Assert that we got enough arguments
if test $# -ne 2 ; then
echo "drop_from_path: needs 2 arguments"
return 1
fi
local p="$1"
local drop="$2"
local new_path=`echo "$p" | sed -e "s;:${drop}:;:;g" \
-e "s;:${drop};;g" \
-e "s;${drop}:;;g" \
-e "s;${drop};;g";`
echo ${new_path}
# a little to return its result
# Wednesday, July 11 23:19:00 CEST 2018, jhlee
drop_from_path() {
#
# Assert that we got enough arguments
if test $# -ne 2; then
echo "drop_from_path: needs 2 arguments"
return 1
fi
local p="$1"
local drop="$2"
echo "$p" | sed -e "s;:${drop}:;:;g" \
-e "s;:${drop};;g" \
-e "s;${drop}:;;g" \
-e "s;${drop};;g"
}
set_variable() {
if test $# -ne 2; then
echo "set_variable: needs 2 arguments"
return 1
fi
set_variable ()
{
if test $# -ne 2 ; then
echo "set_variable: needs 2 arguments"
return 1
fi
local old_path="$1"
local add_path="$2"
local old_path="$1"
local add_path="$2"
local new_path=""
local system_old_path=""
local new_path=""
local system_old_path=""
if [ -z "$old_path" ]; then
new_path=${add_path}
if [ -z "$old_path" ]; then
new_path=${add_path}
else
system_old_path=$(drop_from_path "${old_path}" "${add_path}")
if [ -z "$system_old_path" ]; then
new_path=${add_path}
else
system_old_path=$(drop_from_path "${old_path}" "${add_path}")
if [ -z "$system_old_path" ]; then
new_path=${add_path}
else
new_path=${add_path}:${system_old_path}
fi
new_path=${add_path}:${system_old_path}
fi
echo "${new_path}"
}
fi
print_env ()
{
echo "${new_path}"
local disabled="$1";shift;
}
if [ "$disabled" = "no_msg" ]; then
printf "\n";
else
printf "\nSet the ESS EPICS Environment as follows:\n";
printf "THIS Source NAME : %s\n" "${SRC_NAME}"
printf "THIS Source PATH : %s\n" "${SRC_PATH}"
printf "EPICS_BASE : %s\n" "${EPICS_BASE}"
printf "EPICS_HOST_ARCH : %s\n" "${EPICS_HOST_ARCH}"
printf "E3_REQUIRE_LOCATION : %s\n" "${E3_REQUIRE_LOCATION}"
printf "PATH : %s\n" "${PATH}"
printf "LD_LIBRARY_PATH : %s\n" "${LD_LIBRARY_PATH}"
printf "\n";
printf "Enjoy E3!\n";
fi
print_env() {
local disabled="$1"
shift
if [ "$disabled" = "no_msg" ]; then
printf "\n"
else
printf "\nSet the ESS EPICS Environment as follows:\n"
printf "THIS Source NAME : %s\n" "${SRC_NAME}"
printf "THIS Source PATH : %s\n" "${SRC_PATH}"
printf "EPICS_BASE : %s\n" "${EPICS_BASE}"
printf "EPICS_HOST_ARCH : %s\n" "${EPICS_HOST_ARCH}"
printf "E3_REQUIRE_LOCATION : %s\n" "${E3_REQUIRE_LOCATION}"
printf "PATH : %s\n" "${PATH}"
printf "LD_LIBRARY_PATH : %s\n" "${LD_LIBRARY_PATH}"
printf "\n"
printf "Enjoy E3!\n"
fi
}
# Reset all EPICS, E3, and EEE related PRE-EXIST VARIABLES
# Remove them from PATH and LD_LIBRARY_PATH
#
#
# If EPICS_BASE is defined,
# 1) Remove EPICS_BASE bin in the system PATH
# 2) Remove EPICS_BASE lib in the system LD_LIBRARY_PATH
# 3) Unset EPICS_BASE, EPICS_HOST_ARCH, and so on
if [ -n "$EPICS_BASE" ]; then
system_path=${PATH}
drop_base_path="${EPICS_BASE}/bin/${EPICS_HOST_ARCH}"
PATH=$(drop_from_path "${system_path}" "${drop_base_path}")
system_path=${PATH}
drop_base_path="${EPICS_BASE}/bin/${EPICS_HOST_ARCH}"
PATH=$(drop_from_path "${system_path}" "${drop_base_path}")
export PATH
system_ld_path=${LD_LIBRARY_PATH}
drop_ld_path="${EPICS_BASE}/lib/${EPICS_HOST_ARCH}"
LD_LIBRARY_PATH=$(drop_from_path "${system_ld_path}" "${drop_ld_path}")
export LD_LIBRARY_PATH
# If EPICS_ENTENSIONS, it is epics_builder
if [ -n "$EPICS_EXTENSIONS" ]; then
ext_path=${PATH}
drop_ext_path="${EPICS_EXTENSIONS}/bin/${EPICS_HOST_ARCH}"
PATH=$(drop_from_path "${ext_path}" "${drop_ext_path}")
export PATH
system_ld_path=${LD_LIBRARY_PATH}
drop_ld_path="${EPICS_BASE}/lib/${EPICS_HOST_ARCH}"
LD_LIBRARY_PATH=$(drop_from_path "${system_ld_path}" "${drop_ld_path}")
export LD_LIBRARY_PATH
# If EPICS_ENTENSIONS, it is epics_builder
if [ -n "$EPICS_EXTENSIONS" ]; then
ext_path=${PATH}
drop_ext_path="${EPICS_EXTENSIONS}/bin/${EPICS_HOST_ARCH}"
PATH=$(drop_from_path "${ext_path}" "${drop_ext_path}")
export PATH
unset EPICS_EXTENSIONS
unset EPICS_PATH
unset EPICS_MODULES
unset EPICS_EXTENSIONS
unset EPICS_AREADETECTOR
unset EPICS_APPS
fi
# If E3_REQUIRE_NAME, it is E3
if [ -n "$E3_REQUIRE_NAME" ]; then
e3_path=${PATH}
PATH=$(drop_from_path "${e3_path}" "${E3_REQUIRE_BIN}")
export PATH
# If CONDA_EXE, it is trouble to find the correct tclsh
if [ -n "$CONDA_EXE" ]; then
# Decouple PATH from ESS Conda Env1 due to tclsh
ess_conda_path1=${PATH}
drop_ess_conda_path1="/opt/conda/envs/python37/bin"
PATH=$(drop_from_path "${ess_conda_path1}" "${drop_ess_conda_path1}")
export PATH
# Decouple PATH from ESS Conda Env2 due to tclsh
ess_conda_path2=${PATH}
drop_ess_conda_path2="/opt/conda/condabin"
PATH=$(drop_from_path "${ess_conda_path2}" "${drop_ess_conda_path2}")
export PATH
fi
e3_ld_path=${LD_LIBRARY_PATH}
drop_e3_ld_path="${E3_REQUIRE_LIB}/${EPICS_HOST_ARCH}"
LD_LIBRARY_PATH=$(drop_from_path "${e3_ld_path}" "${drop_e3_ld_path}")
export LD_LIBRARY_PATH
unset E3_REQUIRE_NAME
unset E3_REQUIRE_VERSION
unset E3_REQUIRE_LOCATION
unset E3_REQUIRE_BIN
unset E3_REQUIRE_LIB
unset E3_REQUIRE_INC
unset E3_REQUIRE_DB
unset E3_SITEMODS_PATH
unset E3_SITELIBS_PATH
unset E3_SITEAPPS_PATH
unset EPICS_DRIVER_PATH
unset SCRIPT_DIR
fi
unset EPICS_EXTENSIONS
unset EPICS_PATH
unset EPICS_MODULES
unset EPICS_EXTENSIONS
unset EPICS_AREADETECTOR
unset EPICS_APPS
fi
# If E3_REQUIRE_NAME, it is E3
if [ -n "$E3_REQUIRE_NAME" ]; then
e3_path=${PATH}
PATH=$(drop_from_path "${e3_path}" "${E3_REQUIRE_BIN}")
export PATH
# If CONDA_EXE, it is trouble to find the correct tclsh
if [ -n "$CONDA_EXE" ]; then
# Decouple PATH from ESS Conda Env1 due to tclsh
ess_conda_path1=${PATH}
drop_ess_conda_path1="/opt/conda/envs/python37/bin"
PATH=$(drop_from_path "${ess_conda_path1}" "${drop_ess_conda_path1}")
export PATH
# Decouple PATH from ESS Conda Env2 due to tclsh
ess_conda_path2=${PATH}
drop_ess_conda_path2="/opt/conda/condabin"
PATH=$(drop_from_path "${ess_conda_path2}" "${drop_ess_conda_path2}")
export PATH
# If EPICS_ENV_PATH, it is EEE
if [ -n "$EPICS_ENV_PATH" ]; then
# Decouple PATH from EPICS_ENV_PATH
eee_path=${PATH}
PATH=$(drop_from_path "${eee_path}" "${EPICS_ENV_PATH}")
export PATH
# Decouple PATH from pvAccessCPP
eee_pvaccess_path=${PATH}
drop_eee_pvaccess_path="${EPICS_MODULES_PATH}/pvAccessCPP/5.0.0/${BASE}/bin/${EPICS_HOST_ARCH}"
PATH=$(drop_from_path "${eee_pvaccess_path}" "${drop_eee_pvaccess_path}")
export PATH
# Decouple PYTHONPATH from pyaPy
eee_python_path=${PYTHONPATH}
drop_eee_python_path="${EPICS_MODULES_PATH}/pvaPy/0.6.0/${BASE}/lib/${EPICS_HOST_ARCH}"
PYTHONPATH=$(drop_from_path "${eee_python_path}" "${drop_eee_python_path}")
export PYTHONPATH
# Unset all unique EEE variables
unset BASE
unset EPICS_BASES_PATH
unset EPICS_DB_INCLUDE_PATH
unset EPICS_MODULES_PATH
unset EPICS_ENV_PATH
fi
unset EPICS_BASE
unset EPICS_HOST_ARCH
fi
e3_ld_path=${LD_LIBRARY_PATH}
drop_e3_ld_path="${E3_REQUIRE_LIB}/${EPICS_HOST_ARCH}"
LD_LIBRARY_PATH=$(drop_from_path "${e3_ld_path}" "${drop_e3_ld_path}")
export LD_LIBRARY_PATH
THIS_SRC=${BASH_SOURCE[0]:-${0}}
unset E3_REQUIRE_NAME
unset E3_REQUIRE_VERSION
unset E3_REQUIRE_LOCATION
unset E3_REQUIRE_BIN
unset E3_REQUIRE_LIB
unset E3_REQUIRE_INC
unset E3_REQUIRE_DB
if [ -L $THIS_SRC ]; then
SRC_PATH="$( cd -P "$( dirname $(readlink -f "$THIS_SRC") )" && pwd )"
unset E3_SITEMODS_PATH
unset E3_SITELIBS_PATH
unset E3_SITEAPPS_PATH
unset EPICS_DRIVER_PATH
unset SCRIPT_DIR
fi
# If EPICS_ENV_PATH, it is EEE
if [ -n "$EPICS_ENV_PATH" ]; then
# Decouple PATH from EPICS_ENV_PATH
eee_path=${PATH}
PATH=$(drop_from_path "${eee_path}" "${EPICS_ENV_PATH}")
export PATH
# Decouple PATH from pvAccessCPP
eee_pvaccess_path=${PATH}
drop_eee_pvaccess_path="${EPICS_MODULES_PATH}/pvAccessCPP/5.0.0/${BASE}/bin/${EPICS_HOST_ARCH}"
PATH=$(drop_from_path "${eee_pvaccess_path}" "${drop_eee_pvaccess_path}")
export PATH
# Decouple PYTHONPATH from pyaPy
eee_python_path=${PYTHONPATH}
drop_eee_python_path="${EPICS_MODULES_PATH}/pvaPy/0.6.0/${BASE}/lib/${EPICS_HOST_ARCH}"
PYTHONPATH=$(drop_from_path "${eee_python_path}" "${drop_eee_python_path}")
export PYTHONPATH
# Unset all unique EEE variables
unset BASE
unset EPICS_BASES_PATH
unset EPICS_DB_INCLUDE_PATH
unset EPICS_MODULES_PATH
unset EPICS_ENV_PATH
fi
unset EPICS_BASE
unset EPICS_HOST_ARCH
fi
THIS_SRC=${BASH_SOURCE[0]:-${0}}
if [ -L "$THIS_SRC" ]; then
SRC_PATH="$(cd -P "$(dirname "$(readlink -f "$THIS_SRC")")" && pwd)"
else
SRC_PATH="$( cd -P "$( dirname "$THIS_SRC" )" && pwd )"
SRC_PATH="$(cd -P "$(dirname "$THIS_SRC")" && pwd)"
fi
SRC_NAME=${THIS_SRC##*/}
# e3.cfg will be generated via make e3-site-conf
# The Global Variables are defined in configure/E3/DEFINES_REQUIRE
# RULES is defined in configure/E3/RULES_REQUIRE
#
# Dynamic Changes according to the time when one installs REQUIRE
#
#
# declare -g DEFAULT_EPICS_BASE=/epics/base-3.15.5
# declare -g DEFAULT_REQUIRE_NAME=require
# declare -g DEFAULT_REQUIRE_VERSION=3.0.0
GENERATED_E3_CFG=$SRC_PATH/e3.cfg
# don't install e3.cfg when make install is executed,
# so all varaibles are found according to the existent location
# the symbolic link path doesn't work
#
if [ ! -f ${GENERATED_E3_CFG} ]; then
e3_REQUIRE_BIN_NAME=${SRC_PATH##*/}
E3_REQUIRE_LOCATION=${SRC_PATH%/*}
E3_REQUIRE_VERSION=${E3_REQUIRE_LOCATION##*/}
e3_REQUIRE_PATH=${E3_REQUIRE_LOCATION%/*}
E3_REQUIRE_NAME=${e3_REQUIRE_PATH##*/}
EPICS_BASE=${e3_REQUIRE_PATH%/*}
#
if [ ! -f "${GENERATED_E3_CFG}" ]; then
E3_REQUIRE_LOCATION=${SRC_PATH%/*}
E3_REQUIRE_VERSION=${E3_REQUIRE_LOCATION##*/}
e3_REQUIRE_PATH=${E3_REQUIRE_LOCATION%/*}
E3_REQUIRE_NAME=${e3_REQUIRE_PATH##*/}
EPICS_BASE=${e3_REQUIRE_PATH%/*}
else
# in e3-require/tools
# in case, source within e3-require
set -a
source $GENERATED_E3_CFG
set +a
# in e3-require/tools
# in case, source within e3-require
set -a
# shellcheck disable=SC1090,SC1091
source "$GENERATED_E3_CFG"
set +a
EPICS_BASE=${DEFAULT_EPICS_BASE}
E3_REQUIRE_NAME=${DEFAULT_REQUIRE_NAME}
E3_REQUIRE_VERSION=${DEFAULT_REQUIRE_VERSION}
E3_REQUIRE_LOCATION=${EPICS_BASE}/${E3_REQUIRE_NAME}/${E3_REQUIRE_VERSION}
EPICS_BASE=${DEFAULT_EPICS_BASE}
E3_REQUIRE_NAME=${DEFAULT_REQUIRE_NAME}
E3_REQUIRE_VERSION=${DEFAULT_REQUIRE_VERSION}
E3_REQUIRE_LOCATION=${EPICS_BASE}/${E3_REQUIRE_NAME}/${E3_REQUIRE_VERSION}
fi
epics_host_arch_file="${EPICS_BASE}/startup/EpicsHostArch.pl"
if [ -e "$epics_host_arch_file" ]; then
EPICS_HOST_ARCH=$("${EPICS_BASE}/startup/EpicsHostArch.pl")
EPICS_HOST_ARCH=$("${EPICS_BASE}/startup/EpicsHostArch.pl")
else
EPICS_HOST_ARCH=$(perl ${EPICS_BASE}/lib/perl/EpicsHostArch.pl)
EPICS_HOST_ARCH=$(perl "${EPICS_BASE}"/lib/perl/EpicsHostArch.pl)
fi
E3_REQUIRE_BIN=${E3_REQUIRE_LOCATION}/bin
E3_REQUIRE_LIB=${E3_REQUIRE_LOCATION}/lib
E3_REQUIRE_INC=${E3_REQUIRE_LOCATION}/include
E3_REQUIRE_DB=${E3_REQUIRE_LOCATION}/db
E3_REQUIRE_DBD=${E3_REQUIRE_LOCATION}/dbd
E3_SITEMODS_PATH=${E3_REQUIRE_LOCATION}/siteMods
E3_SITELIBS_PATH=${E3_REQUIRE_LOCATION}/siteLibs
E3_SITEAPPS_PATH=${E3_REQUIRE_LOCATION}/siteApps
if [ -n "${SITE_SYSTEMAPPS_PATH}" ]; then
EPICS_DRIVER_PATH=${E3_SITEMODS_PATH}:${E3_SITEAPPS_PATH}:${SITE_SYSTEMAPPS_PATH}
EPICS_DRIVER_PATH=${E3_SITEMODS_PATH}:${E3_SITEAPPS_PATH}:${SITE_SYSTEMAPPS_PATH}
else
EPICS_DRIVER_PATH=${E3_SITEMODS_PATH}:${E3_SITEAPPS_PATH}
EPICS_DRIVER_PATH=${E3_SITEMODS_PATH}:${E3_SITEAPPS_PATH}
fi
export EPICS_BASE
export E3_REQUIRE_NAME
export E3_REQUIRE_VERSION
......@@ -326,7 +306,6 @@ export E3_SITEAPPS_PATH
export EPICS_DRIVER_PATH
old_path=${PATH}
E3_PATH="${E3_REQUIRE_BIN}:${EPICS_BASE}/bin/${EPICS_HOST_ARCH}"
......@@ -336,7 +315,7 @@ PATH=$(set_variable "${old_path}" "${E3_PATH}")
# # "echo" selects the lower version number by default. And if the version is used with a string,
# # we don't rely upon echo result.
# # Rethink how we handle each binary files within a module
# #
# #
# E3_SITELIBS_BINS=`echo ${E3_SITELIBS_PATH}/*_bin`;
# for each_bins in ${E3_SITELIBS_BINS}; do
......@@ -353,7 +332,7 @@ LD_LIBRARY_PATH=$(set_variable "${old_ld_path}" "${E3_LD_LIBRARY_PATH}")
export LD_LIBRARY_PATH
# Add iocsh.bash autocompletion
# shellcheck source=require-ess/tools/iocsh_complete.bash
source "${SRC_PATH}"/iocsh_complete.bash
print_env "$1"
#!/usr/bin/env bash
# Copyright (c) 2020 European Spallation Source ERIC
# Copyright (c) 2020-Present 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
......@@ -19,25 +19,31 @@
# 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_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)
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
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 "======================================================="
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
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
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