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

Merge branch 'e3-691_rename_iocsh' into 'master'

E3-691: rename iocsh

See merge request e3/e3-require!77
parents 8d2f800e 1c9689bf
No related branches found
No related tags found
No related merge requests found
......@@ -48,6 +48,7 @@ build require:
- tar -zxvf epics.tar.gz
- export BASE_PATH=$(ls -d $(pwd)/epics/base-*)
- echo "EPICS_BASE:=${BASE_PATH}" >> configure/RELEASE.local
- echo "E3_REQUIRE_VERSION:=${CI_COMMIT_SHORT_SHA}" >> configure/CONFIG_MODULE.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"
......
......@@ -32,6 +32,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* Fixed issue where consecutive builds might not track updated dependencies
### Other changes
* Rename `iocsh.bash` to `iocsh`
* Removed `<module>_TEMPLATES` in favour of `<module>_DB`
* Removed unnecessary code from `make init`.
* removed `e3.cfg`, `ess-env.conf` and `DEFINES_REQUIRE` files and associated codes in `RULES_REQUIRE`, `setE3Env.bash` and `.gitignore`.
......
......@@ -26,7 +26,7 @@ The main parts that we have taken from PSI `require` are `require.c` and `driver
load modules dynamically at run-time, and which run the custom build process. However, both of these have been
modified significantly for the purposes of e3.
Furthermore, we have added the custom startup script `iocsh.bash` which sets up the IOC's environment before
Furthermore, we have added the custom startup script `iocsh` which sets up the IOC's environment before
running `softIocPVA` from EPICS base.
## Building `require`
......@@ -41,7 +41,7 @@ $ make install
To test your build, run
```bash
$ source ${EPICS_BASE}/require/${E3_REQUIRE_VERSION}/bin/setE3Env.bash
$ iocsh.bash
$ iocsh
```
which should start up an IOC and load require.
TEST_DIR:=$(TOP)/tests
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)
RUN_IOCSH_TEST_COMMAND = run-iocsh --name "${EPICS_BASE}/require/${E3_REQUIRE_VERSION}/bin/iocsh" -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
......
......@@ -7,7 +7,7 @@
FILE_FILTER:= %~ %\#
E3_TEST_SCRIPT := $(TOP)/tools/test_installed_modules.sh
#
E3_SHELL_FILES := $(wildcard $(E3_MODULE_SRC_PATH)/tools/iocsh*.bash)
E3_SHELL_FILES := $(wildcard $(E3_MODULE_SRC_PATH)/tools/iocsh*)
E3_IOC_CFG_FILES += $(E3_MODULE_SRC_PATH)/tools/setE3Env.bash
E3_IOC_CFG_FILES += $(E3_MODULE_SRC_PATH)/tools/promptE3Env.bash
E3_REQUIRE_CONF_FILES := $(filter-out $(FILE_FILTER), $(wildcard $(TOP)/configure/E3/*))
......
iocsh.bash
iocsh
====
## E3 Unique Variables
```
E3_CMD_TOP : the absolute path where a startup script (cmd file) is
E3_IOCSH_TOP : the absolute path where the iocsh.bash is executed
E3_IOCSH_TOP : the absolute path where the iocsh is executed
```
For example, one executes the iocsh.bash ```${HOME}``` to call ```e3_local/cmds``` via
For example, one executes the iocsh ```${HOME}``` to call ```e3_local/cmds``` via
```sh
$ iocsh.bash e3_local/cmds/iocStats.cmd
$ iocsh e3_local/cmds/iocStats.cmd
```
In this case,
```E3_CMD_TOP``` is defined as ```"${HOME}/e3_local/cmds"```
......
......@@ -21,7 +21,7 @@
# ESS specific iocsh author : Jeong Han Lee
# email : han.lee@esss.se
#
# Add IOCSH_TOP in order to access where the iocsh.bash is executed
# 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
......@@ -34,16 +34,17 @@
# 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.bash when there is no diskspace
# 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.bash
# 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##*/}
SC_TOP="${SC_SCRIPT%/*}"
......@@ -55,7 +56,7 @@ declare BASECODE=""
# shellcheck source=require-ess/tools/iocsh_functions.bash
. "${SC_TOP}"/iocsh_functions.bash
# To get the absolute path where iocsh.bash is executed
# To get the absolute path where iocsh is executed
IOCSH_TOP=${PWD}
# Check whether an expected e3 environment variable is defined.
......@@ -70,12 +71,12 @@ fi
# Check that the e3 environment definition and the path for this script
# are consistent
if [ "${E3_REQUIRE_BIN}" != "${SC_TOP}" ]; then
echo "Error: Configured e3 environment does not match path for iocsh.bash executable."
echo "Please source the appropriate setE3Env.bash file for the version"
echo "of iocsh.bash you wish to use, or run iocsh.bash from a clean"
echo "environment so it can set the environment correctly."
echo "Expected path to iocsh.bash from environment = ${E3_REQUIRE_BIN}"
echo "Actual path to iocsh.bash = ${SC_TOP}"
echo "Error: Configured e3 environment does not match path for iocsh executable."
echo "Please source the appropriate setE3Env.bash file for the version of iocsh"
echo "you wish to use, or run iocsh from a clean environment so it can set the"
echo "environment correctly."
echo "Expected path to iocsh from environment = ${E3_REQUIRE_BIN}"
echo "Actual path to iocsh = ${SC_TOP}"
die 2
fi
......@@ -83,15 +84,15 @@ BASECODE="$(basecode_generator)"
check_mandatory_env_settings
# ${BASHPID} returns iocsh.bash PID
iocsh_bash_id=${BASHPID}
# ${BASHPID} returns iocsh PID
iocsh_id=${BASHPID}
#
SC_VERSION+=-PID-${iocsh_bash_id}
SC_VERSION+=-PID-${iocsh_id}
#
# We define HOSTNAME + iocsh_bash_id
IOCSH_PS1=$(iocsh_ps1 "${iocsh_bash_id}")
REQUIRE_IOC=$(require_ioc "${iocsh_bash_id}")
# We define HOSTNAME + iocsh_id
IOCSH_PS1=$(iocsh_ps1 "${iocsh_id}")
REQUIRE_IOC=$(require_ioc "${iocsh_id}")
#
# Default Initial Startup file for REQUIRE and minimal environment
# Create TMP_PATH path in order to keep tmp files secure until
......
#!/usr/bin/env bash
_iocsh_bash_completion() {
_iocsh_completion() {
local cur prev opts mods
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
......@@ -38,4 +38,4 @@ _iocsh_bash_completion() {
mapfile -t COMPREPLY < <(compgen -f -- "${cur}")
}
complete -o filenames -o nospace -o bashdefault -F _iocsh_bash_completion iocsh.bash
complete -o filenames -o nospace -o bashdefault -F _iocsh_completion iocsh
......@@ -25,7 +25,6 @@
# email : simon.rose@ess.eu
# date : 2021-12-10
#
#
REALTIME=
__LOADER__=
......@@ -432,9 +431,9 @@ function set_e3_cmd_top() {
function help() {
{
printf "\n"
printf "USAGE: iocsh.bash [startup files]\n"
printf "USAGE: iocsh [startup files]\n"
printf "\n"
printf "Start the ESS iocsh.bash and load startup scripts.\n\n"
printf "Start the ESS iocsh and load startup scripts.\n\n"
printf "Options:\n\n"
printf " -?, -h, --help Show this page and exit.\n"
printf " -v, --version Show version and exit.\n"
......@@ -461,13 +460,13 @@ function help() {
printf "All other files are executed as startup scripts by the EPICS shell.\n"
printf "After a file you can specify substitutions like m1=v1 m2=v1 for that file.\n\n"
printf "Examples:\n"
printf " iocsh.bash st.cmd\n"
printf " iocsh.bash my_database.template P=XY M=3\n"
printf " iocsh.bash -r my_module,version -c 'initModule()'\n"
printf " iocsh.bash -c 'var requireDebug 1' st.cmd\n"
printf " iocsh.bash -i st.cmd\n"
printf " iocsh.bash -dv --dvarg='--vgdb=full'\n"
printf " iocsh.bash -dv st.cmd\n\n"
printf " iocsh st.cmd\n"
printf " iocsh my_database.template P=XY M=3\n"
printf " iocsh -r my_module,version -c 'initModule()'\n"
printf " iocsh -c 'var requireDebug 1' st.cmd\n"
printf " iocsh -i st.cmd\n"
printf " iocsh -dv --dvarg='--vgdb=full'\n"
printf " iocsh -dv st.cmd\n\n"
} >&2
exit
}
......
......@@ -220,7 +220,7 @@ LD_LIBRARY_PATH=$(set_variable "${old_ld_path}" "${E3_LD_LIBRARY_PATH}")
export LD_LIBRARY_PATH
# Add iocsh.bash autocompletion
# Add iocsh autocompletion
# shellcheck source=require-ess/tools/iocsh_complete.bash
source "${SRC_PATH}"/iocsh_complete.bash
......
......@@ -7,6 +7,8 @@ def run_ioc_get_output(module, version, cell_path):
"""
Run an IOC and try to load the test module
"""
with IOC("-r", f"{module},{version}", "-l", cell_path) as ioc:
with IOC(
"-r", f"{module},{version}", "-l", cell_path, ioc_executable="iocsh"
) as ioc:
time.sleep(1)
return ioc.proc.returncode, ioc.outs, ioc.errs
iocsh.bash
iocsh
====
## E3 Unique Variables
```
E3_CMD_TOP : the absolute path where a startup script (cmd file) is
E3_IOCSH_TOP : the absolute path where the iocsh.bash is executed
E3_IOCSH_TOP : the absolute path where the iocsh is executed
```
For example, one executes the iocsh.bash ```${HOME}``` to call ```e3_local/cmds``` via
For example, one executes the iocsh ```${HOME}``` to call ```e3_local/cmds``` via
```sh
$ iocsh.bash e3_local/cmds/iocStats.cmd
$ iocsh e3_local/cmds/iocStats.cmd
```
In this case,
```E3_CMD_TOP``` is defined as ```"${HOME}/e3_local/cmds"```
......
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