Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add ioc instance test #7

Merged
merged 1 commit into from
Oct 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions tests/ioc_instance/ioc.db
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#############################################################################
# DB substitution file generated by http://github.com/epics-containers/ibek #
#############################################################################

file "$(ADARAVIS)/db/aravisCamera.template" {
pattern
{ "P", "R", "PORT", "TIMEOUT", "ADDR" }
{ "BL45P-EA-MAP-01", ":DET:", "DET.DET", "1", "0" }
}

file "$(ADGENICAM)/db/AVT_Mako_G234B.template" {
pattern
{ "P", "R", "PORT", "TIMEOUT", "ADDR" }
{ "BL45P-EA-MAP-01", ":DET:", "DET.DET", "1", "0" }
}

file "$(ADCORE)/db/NDPva.template" {
pattern
{ "NDARRAY_PORT", "ADDR", "SCANRATE", "NDARRAY_ADDR", "ENABLED", "P", "R", "TIMEOUT", "PORT" }
{ "DET.DET", "0", "I/O Intr", "0", "0", "BL45P-EA-MAP-01", ":PVA:", "1", "DET.PVA" }
}

file "$(ADCORE)/db/NDFileHDF5.template" {
pattern
{ "NDARRAY_PORT", "ADDR", "SCANRATE", "NDARRAY_ADDR", "ENABLED", "XMLSIZE", "P", "R", "TIMEOUT", "PORT" }
{ "DET.DET", "0", "I/O Intr", "0", "0", "2048", "BL45P-EA-MAP-01", ":HDF5:", "1", "DET.HDF5" }
}
35 changes: 35 additions & 0 deletions tests/ioc_instance/ioc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# yaml-language-server: $schema=https://github.com/epics-containers/ioc-adaravis/releases/download/23.9.4/ibek.ioc.schema.json

ioc_name: bl45p-ea-ioc-01
description: Sample camera IOC for BL45P

entities:
- type: epics.EpicsCaMaxArrayBytes
max_bytes: 6000000

- type: ADAravis.aravisCamera
CLASS: AVT_Mako_G234B
PORT: DET.DET
P: BL45P-EA-MAP-01
R: ":DET:"
ID: 172.23.59.11
PV_ALIAS: "0" # TODO this ARG should have default

- type: ADCore.NDPvaPlugin
PORT: DET.PVA
PVNAME: BL45P-EA-MAP-01:PVA:OUTPUT
P: BL45P-EA-MAP-01
R: ":PVA:"
NDARRAY_PORT: DET.DET
BLOCK: 1 # TODO remaining ARGS should have defaults
PRIORITY: 0
STACKSIZE: 0
NDARRAY_ADDR: 0

- type: ADCore.NDFileHDF5
PORT: DET.HDF5
P: BL45P-EA-MAP-01
R: ":HDF5:"
NDARRAY_PORT: DET.DET
BLOCK: 1
NDARRAY_ADDR: 0
20 changes: 20 additions & 0 deletions tests/ioc_instance/st.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# EPICS IOC Startup Script generated by https://github.com/epics-containers/ibek

cd "/epics/ioc"

epicsEnvSet EPICS_CA_MAX_ARRAY_BYTES 6000000

dbLoadDatabase dbd/ioc.dbd
ioc_registerRecordDeviceDriver pdbbase

aravisConfig(const char *portName, const char *cameraName, size_t maxMemory, int priority, int stackSize)
aravisConfig("DET.DET", "172.23.59.11", -1, 0, 1)
# NDPvaConfigure(portName, queueSize, blockingCallbacks, NDArrayPort, NDArrayAddr, pvName, maxBuffers, maxMemory, priority, stackSize)
NDPvaConfigure("DET.PVA", 2, 1, "DET.DET", 0, BL45P-EA-MAP-01:PVA:OUTPUT, 0, 0, 0, 0)
startPVAServer
# NDFileHDF5Configure(portName, queueSize, blockingCallbacks, NDArrayPort, NDArrayAddr)
NDFileHDF5Configure("DET.HDF5", 2, 1, "DET.DET", 0)

dbLoadRecords /tmp/ioc.db
iocInit

23 changes: 23 additions & 0 deletions tests/test_ioc_instance.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash

set -xe

THIS_DIR=$(dirname ${0})
cd ${THIS_DIR}/ioc_instance

if ! ibek --version; then
pip install ibek
fi

tmpdir=$(mktemp -d)

ibek startup generate ioc.yaml ../../*/*.support.yaml --out ${tmpdir}/st.cmd \
--db-out ${tmpdir}/ioc.db

if not diff ${tmpdir}/st.cmd ./st.cmd || not diff ${tmpdir}/ioc.db ./ioc.db; then
echo "ERROR: Generated files st.cmd / db.subst differ from expected"
exit 1
fi

rm -r ${tmpdir}

Loading