-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ioc/tests/pvxs: add test for using PVXS inside an IOC
- Loading branch information
1 parent
ed01996
commit 5319734
Showing
22 changed files
with
470 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
{pkgs, ...}: let | ||
inherit (pkgs) epnixLib; | ||
inherit (pkgs.stdenv.hostPlatform) system; | ||
|
||
result = epnixLib.evalEpnixModules { | ||
nixpkgsConfig.system = system; | ||
epnixConfig.imports = [./pvxsIocTestTop/epnix.nix]; | ||
}; | ||
|
||
service = result.config.epnix.nixos.services.ioc.config; | ||
|
||
ioc = result.outputs.build; | ||
in | ||
pkgs.nixosTest { | ||
name = "support-pvxs-ioc"; | ||
meta.maintainers = with epnixLib.maintainers; [minijackson]; | ||
|
||
nodes = { | ||
client = { | ||
environment.systemPackages = [ | ||
pkgs.epnix.epics-base | ||
pkgs.epnix.support.pvxs | ||
]; | ||
networking.firewall.allowedTCPPorts = [5075]; | ||
networking.firewall.allowedUDPPorts = [5076]; | ||
}; | ||
machine = { | ||
systemd.services.ioc = service; | ||
networking.firewall.allowedTCPPorts = [5075]; | ||
networking.firewall.allowedUDPPorts = [5076]; | ||
}; | ||
}; | ||
|
||
testScript = '' | ||
import json | ||
start_all() | ||
addr_list = "EPICS_PVA_ADDR_LIST=192.168.1.2" | ||
def pvget(name: str): | ||
return json.loads(client.succeed(f"{addr_list} pvget {name} -M json | cut -d' ' -f2-")) | ||
def pvxget(name: str): | ||
output = client.succeed(f"{addr_list} pvxget {name}") | ||
return output.splitlines()[1].split()[-1] | ||
def _pvput(utility: str, name: str, value: str): | ||
client.succeed(f"{addr_list} {utility} {name} {value}") | ||
def pvput(name: str, value: str): | ||
_pvput("pvput", name, value) | ||
def pvxput(name: str, value: str): | ||
_pvput("pvxput", name, value) | ||
with subtest("wait until IOC starts"): | ||
machine.wait_for_unit("ioc.service") | ||
client.wait_until_succeeds("EPICS_PVA_ADDR_LIST=192.168.1.2 pvget my:pv:name", timeout=60) | ||
with subtest("PV has the correct value"): | ||
value = pvget("my:pv:name") | ||
assert value["value"] == 42 | ||
assert value["display"]["description"] == "My PV description" | ||
with subtest("PV can be set"): | ||
pvput("my:pv:name", "1337") | ||
assert pvget("my:pv:name")["value"] == 1337 | ||
with subtest("PVXS command-line utilities work"): | ||
assert pvxget("my:pv:name") == "1337" | ||
pvxput("my:pv:name", "42") | ||
assert pvxget("my:pv:name") == "42" | ||
client.succeed(f"{addr_list} pvxinfo my:pv:name") | ||
''; | ||
|
||
passthru = { | ||
inherit ioc; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Install directories | ||
/bin/ | ||
/cfg/ | ||
/db/ | ||
/dbd/ | ||
/html/ | ||
/include/ | ||
/lib/ | ||
/templates/ | ||
|
||
# Local configuration files | ||
/configure/*.local | ||
|
||
# iocBoot generated files | ||
/iocBoot/*ioc*/cdCommands | ||
/iocBoot/*ioc*/dllPath.bat | ||
/iocBoot/*ioc*/envPaths | ||
/iocBoot/*ioc*/relPaths.sh | ||
|
||
# Build directories | ||
O.*/ | ||
|
||
# Common files created by other tools | ||
/QtC-* | ||
/.vscode/ | ||
*.orig | ||
*.log | ||
.*.swp | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Makefile at top of application tree | ||
TOP = . | ||
include $(TOP)/configure/CONFIG | ||
|
||
# Directories to build, any order | ||
DIRS += configure | ||
DIRS += $(wildcard *Sup) | ||
DIRS += $(wildcard *App) | ||
DIRS += $(wildcard *Top) | ||
DIRS += $(wildcard iocBoot) | ||
|
||
# The build order is controlled by these dependency rules: | ||
|
||
# All dirs except configure depend on configure | ||
$(foreach dir, $(filter-out configure, $(DIRS)), \ | ||
$(eval $(dir)_DEPEND_DIRS += configure)) | ||
|
||
# Any *App dirs depend on all *Sup dirs | ||
$(foreach dir, $(filter %App, $(DIRS)), \ | ||
$(eval $(dir)_DEPEND_DIRS += $(filter %Sup, $(DIRS)))) | ||
|
||
# Any *Top dirs depend on all *Sup and *App dirs | ||
$(foreach dir, $(filter %Top, $(DIRS)), \ | ||
$(eval $(dir)_DEPEND_DIRS += $(filter %Sup %App, $(DIRS)))) | ||
|
||
# iocBoot depends on all *App dirs | ||
iocBoot_DEPEND_DIRS += $(filter %App,$(DIRS)) | ||
|
||
# Add any additional dependency rules here: | ||
|
||
include $(TOP)/configure/RULES_TOP |
45 changes: 45 additions & 0 deletions
45
ioc/tests/support/pvxs/ioc/pvxsIocTestTop/configure/CONFIG
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# CONFIG - Load build configuration data | ||
# | ||
# Do not make changes to this file! | ||
|
||
# Allow user to override where the build rules come from | ||
RULES = $(EPICS_BASE) | ||
|
||
# RELEASE files point to other application tops | ||
include $(TOP)/configure/RELEASE | ||
-include $(TOP)/configure/RELEASE.$(EPICS_HOST_ARCH).Common | ||
|
||
ifdef T_A | ||
-include $(TOP)/configure/RELEASE.Common.$(T_A) | ||
-include $(TOP)/configure/RELEASE.$(EPICS_HOST_ARCH).$(T_A) | ||
endif | ||
|
||
# Check EPICS_BASE is set properly | ||
ifneq (file,$(origin EPICS_BASE)) | ||
$(error EPICS_BASE must be set in a configure/RELEASE file) | ||
else | ||
ifeq ($(wildcard $(EPICS_BASE)/configure/CONFIG_BASE),) | ||
$(error EPICS_BASE does not point to an EPICS installation) | ||
endif | ||
endif | ||
|
||
CONFIG = $(RULES)/configure | ||
include $(CONFIG)/CONFIG | ||
|
||
# Override the Base definition: | ||
INSTALL_LOCATION = $(TOP) | ||
|
||
# CONFIG_SITE files contain local build configuration settings | ||
include $(TOP)/configure/CONFIG_SITE | ||
|
||
# Host-arch specific settings | ||
-include $(TOP)/configure/CONFIG_SITE.$(EPICS_HOST_ARCH).Common | ||
|
||
ifdef T_A | ||
# Target-arch specific settings | ||
-include $(TOP)/configure/CONFIG_SITE.Common.$(T_A) | ||
|
||
# Host & target specific settings | ||
-include $(TOP)/configure/CONFIG_SITE.$(EPICS_HOST_ARCH).$(T_A) | ||
endif | ||
|
43 changes: 43 additions & 0 deletions
43
ioc/tests/support/pvxs/ioc/pvxsIocTestTop/configure/CONFIG_SITE
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# CONFIG_SITE | ||
|
||
# Make any application-specific changes to the EPICS build | ||
# configuration variables in this file. | ||
# | ||
# Host/target specific settings can be specified in files named | ||
# CONFIG_SITE.$(EPICS_HOST_ARCH).Common | ||
# CONFIG_SITE.Common.$(T_A) | ||
# CONFIG_SITE.$(EPICS_HOST_ARCH).$(T_A) | ||
|
||
# CHECK_RELEASE controls the consistency checking of the support | ||
# applications pointed to by the RELEASE* files. | ||
# Normally CHECK_RELEASE should be set to YES. | ||
# Set CHECK_RELEASE to NO to disable checking completely. | ||
# Set CHECK_RELEASE to WARN to perform consistency checking but | ||
# continue building even if conflicts are found. | ||
CHECK_RELEASE = YES | ||
|
||
# Set this when you only want to compile this application | ||
# for a subset of the cross-compiled target architectures | ||
# that Base is built for. | ||
#CROSS_COMPILER_TARGET_ARCHS = vxWorks-ppc32 | ||
|
||
# To install files into a location other than $(TOP) define | ||
# INSTALL_LOCATION here. | ||
#INSTALL_LOCATION=</absolute/path/to/install/top> | ||
|
||
# Set this when the IOC and build host use different paths | ||
# to the install location. This may be needed to boot from | ||
# a Microsoft FTP server say, or on some NFS configurations. | ||
#IOCS_APPL_TOP = </IOC's/absolute/path/to/install/top> | ||
|
||
# For application debugging purposes, override the HOST_OPT and/ | ||
# or CROSS_OPT settings from base/configure/CONFIG_SITE | ||
#HOST_OPT = NO | ||
#CROSS_OPT = NO | ||
|
||
# These allow developers to override the CONFIG_SITE variable | ||
# settings without having to modify the configure/CONFIG_SITE | ||
# file itself. | ||
-include $(TOP)/../CONFIG_SITE.local | ||
-include $(TOP)/configure/CONFIG_SITE.local | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
TOP=.. | ||
|
||
include $(TOP)/configure/CONFIG | ||
|
||
TARGETS = $(CONFIG_TARGETS) | ||
CONFIGS += $(subst ../,,$(wildcard $(CONFIG_INSTALLS))) | ||
|
||
include $(TOP)/configure/RULES |
42 changes: 42 additions & 0 deletions
42
ioc/tests/support/pvxs/ioc/pvxsIocTestTop/configure/RELEASE
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# RELEASE - Location of external support modules | ||
# | ||
# IF YOU CHANGE ANY PATHS in this file or make API changes to | ||
# any modules it refers to, you should do a "make rebuild" in | ||
# this application's top level directory. | ||
# | ||
# The EPICS build process does not check dependencies against | ||
# any files from outside the application, so it is safest to | ||
# rebuild it completely if any modules it depends on change. | ||
# | ||
# Host- or target-specific settings can be given in files named | ||
# RELEASE.$(EPICS_HOST_ARCH).Common | ||
# RELEASE.Common.$(T_A) | ||
# RELEASE.$(EPICS_HOST_ARCH).$(T_A) | ||
# | ||
# This file is parsed by both GNUmake and an EPICS Perl script, | ||
# so it may ONLY contain definititions of paths to other support | ||
# modules, variable definitions that are used in module paths, | ||
# and include statements that pull in other RELEASE files. | ||
# Variables may be used before their values have been set. | ||
# Build variables that are NOT used in paths should be set in | ||
# the CONFIG_SITE file. | ||
|
||
# Variables and paths to dependent modules: | ||
#MODULES = /path/to/modules | ||
#MYMODULE = $(MODULES)/my-module | ||
|
||
# If using the sequencer, point SNCSEQ at its top directory: | ||
#SNCSEQ = $(MODULES)/seq-ver | ||
|
||
# EPICS_BASE should appear last so earlier modules can override stuff: | ||
EPICS_BASE = /nix/store/9g8q47p14l33kbcz7agz8nz914ghmnzq-epics-base-7.0.7 | ||
|
||
# Set RULES here if you want to use build rules from somewhere | ||
# other than EPICS_BASE: | ||
#RULES = $(MODULES)/build-rules | ||
|
||
# These lines allow developers to override these RELEASE settings | ||
# without having to modify this file directly. | ||
-include $(TOP)/../RELEASE.local | ||
-include $(TOP)/../RELEASE.$(EPICS_HOST_ARCH).local | ||
-include $(TOP)/configure/RELEASE.local |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# RULES | ||
|
||
include $(CONFIG)/RULES | ||
|
||
# Library should be rebuilt because LIBOBJS may have changed. | ||
$(LIBNAME): ../Makefile |
2 changes: 2 additions & 0 deletions
2
ioc/tests/support/pvxs/ioc/pvxsIocTestTop/configure/RULES.ioc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#RULES.ioc | ||
include $(CONFIG)/RULES.ioc |
2 changes: 2 additions & 0 deletions
2
ioc/tests/support/pvxs/ioc/pvxsIocTestTop/configure/RULES_DIRS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#RULES_DIRS | ||
include $(CONFIG)/RULES_DIRS |
3 changes: 3 additions & 0 deletions
3
ioc/tests/support/pvxs/ioc/pvxsIocTestTop/configure/RULES_TOP
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#RULES_TOP | ||
include $(CONFIG)/RULES_TOP | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{pkgs, ...}: { | ||
epnix = { | ||
meta.name = "checks-support-pvxs-ioc"; | ||
buildConfig.src = ./.; | ||
|
||
support.modules = with pkgs.epnix.support; [pvxs]; | ||
|
||
nixos.services.ioc = { | ||
app = "simple"; | ||
ioc = "iocSimple"; | ||
}; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
TOP = .. | ||
include $(TOP)/configure/CONFIG | ||
DIRS += $(wildcard *ioc*) | ||
DIRS += $(wildcard as*) | ||
include $(CONFIG)/RULES_DIRS | ||
|
5 changes: 5 additions & 0 deletions
5
ioc/tests/support/pvxs/ioc/pvxsIocTestTop/iocBoot/iocSimple/Makefile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
TOP = ../.. | ||
include $(TOP)/configure/CONFIG | ||
ARCH = $(EPICS_HOST_ARCH) | ||
TARGETS = envPaths | ||
include $(TOP)/configure/RULES.ioc |
11 changes: 11 additions & 0 deletions
11
ioc/tests/support/pvxs/ioc/pvxsIocTestTop/iocBoot/iocSimple/st.cmd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!../../bin/linux-x86_64/simple | ||
|
||
< envPaths | ||
|
||
epicsEnvSet("PREFIX", "autosave:test") | ||
|
||
## Register all support components | ||
dbLoadDatabase("$(TOP)/dbd/simple.dbd") | ||
simple_registerRecordDeviceDriver(pdbbase) | ||
|
||
iocInit() |
18 changes: 18 additions & 0 deletions
18
ioc/tests/support/pvxs/ioc/pvxsIocTestTop/simpleApp/Db/Makefile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
TOP=../.. | ||
include $(TOP)/configure/CONFIG | ||
#---------------------------------------- | ||
# ADD MACRO DEFINITIONS AFTER THIS LINE | ||
|
||
#---------------------------------------------------- | ||
# Create and install (or just install) into <top>/db | ||
# databases, templates, substitutions like this | ||
#DB += xxx.db | ||
|
||
#---------------------------------------------------- | ||
# If <anyname>.db template is not named <anyname>*.template add | ||
# <anyname>_template = <templatename> | ||
|
||
include $(TOP)/configure/RULES | ||
#---------------------------------------- | ||
# ADD RULES AFTER THIS LINE | ||
|
14 changes: 14 additions & 0 deletions
14
ioc/tests/support/pvxs/ioc/pvxsIocTestTop/simpleApp/Makefile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Makefile at top of application tree | ||
TOP = .. | ||
include $(TOP)/configure/CONFIG | ||
|
||
# Directories to be built, in any order. | ||
# You can replace these wildcards with an explicit list | ||
DIRS += $(wildcard src* *Src*) | ||
DIRS += $(wildcard db* *Db*) | ||
|
||
# If the build order matters, add dependency rules like this, | ||
# which specifies that xxxSrc must be built after src: | ||
#xxxSrc_DEPEND_DIRS += src | ||
|
||
include $(TOP)/configure/RULES_DIRS |
Oops, something went wrong.