-
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.
Tests that the example IOC generated by makeBaseApp.pl compiles, run, and is coherent.
- Loading branch information
1 parent
25f2e10
commit 394901a
Showing
4 changed files
with
114 additions
and
0 deletions.
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,69 @@ | ||
{pkgs, ...}: let | ||
inherit (pkgs) epnixLib; | ||
inherit (pkgs.stdenv.hostPlatform) system; | ||
|
||
result = epnixLib.evalEpnixModules { | ||
nixpkgsConfig.system = system; | ||
epnixConfig.imports = [ | ||
(import ./epnix.nix) | ||
]; | ||
}; | ||
|
||
service = result.config.epnix.nixos.services.ioc.config; | ||
|
||
ioc = result.outputs.build; | ||
in | ||
pkgs.nixosTest { | ||
name = "example-ioc"; | ||
meta.maintainers = with epnixLib.maintainers; [minijackson]; | ||
|
||
nodes.machine = { | ||
environment.systemPackages = [pkgs.epnix.epics-base]; | ||
systemd.services.ioc = service; | ||
}; | ||
|
||
testScript = '' | ||
machine.wait_for_unit("default.target") | ||
machine.wait_for_unit("ioc.service") | ||
def logs_has(content: str) -> None: | ||
machine.wait_until_succeeds(f"journalctl --no-pager -u ioc.service | grep -F '{content}'") | ||
with subtest("wait until started"): | ||
machine.wait_until_succeeds("caget -t epnix:aiExample") | ||
with subtest("EPICS revision is correct"): | ||
logs_has("## EPICS R7") | ||
with subtest("ai/calc records"): | ||
ai_example = int(machine.wait_until_succeeds("caget -t epnix:aiExample").strip()) | ||
assert 0 <= ai_example <= 9 | ||
with subtest("version record"): | ||
assert machine.succeed("caget -t epnix:simple:version").strip() == "EPNix" | ||
with subtest("aSub record"): | ||
logs_has("Record epnix:aSubExample called myAsubInit") | ||
logs_has("Record epnix:aSubExample called myAsubProcess") | ||
# Also needs the debug mode activated above | ||
with subtest("sub record"): | ||
logs_has("Record epnix:subExample called mySubInit") | ||
machine.succeed("caput epnix:subExample 42") | ||
logs_has("Record epnix:subExample called mySubProcess") | ||
with subtest("Sequencer program is running"): | ||
logs_has("sncExample: Startup delay over") | ||
logs_has("sncExample: Changing to") | ||
with subtest("Sequencer program is running"): | ||
machine.succeed("echo 'hello world' | nc localhost 2000 -N") | ||
logs_has("Hello world, from simple") | ||
# TODO: test QSRV, but it feels flaky, pvget times-out most of the time | ||
''; | ||
|
||
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,23 @@ | ||
{pkgs, ...}: { | ||
epnix = { | ||
meta.name = "checks-example-ioc"; | ||
buildConfig.src = | ||
pkgs.runCommand "example-top" { | ||
nativeBuildInputs = [pkgs.epnix.epics-base]; | ||
} '' | ||
mkdir $out | ||
cd $out | ||
makeBaseApp.pl -u epnix -t example simple | ||
makeBaseApp.pl -u epnix -t example -i -a linux-x86_64 -p simple Simple | ||
''; | ||
|
||
buildConfig.attrs.patches = [./example-top.patch]; | ||
|
||
support.modules = with pkgs.epnix.support; [seq]; | ||
|
||
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,21 @@ | ||
diff --git a/iocBoot/iocSimple/st.cmd b/iocBoot/iocSimple/st.cmd | ||
index af59327..bc12277 100755 | ||
--- a/iocBoot/iocSimple/st.cmd | ||
+++ b/iocBoot/iocSimple/st.cmd | ||
@@ -17,13 +17,13 @@ dbLoadRecords "db/simpleVersion.db", "user=epnix" | ||
dbLoadRecords "db/dbSubExample.db", "user=epnix" | ||
|
||
#- Set this to see messages from mySub | ||
-#-var mySubDebug 1 | ||
+var mySubDebug 1 | ||
|
||
#- Run this to trace the stages of iocInit | ||
-#-traceIocInit | ||
+traceIocInit | ||
|
||
cd "${TOP}/iocBoot/${IOC}" | ||
iocInit | ||
|
||
## Start any sequence programs | ||
-#seq sncExample, "user=epnix" | ||
+seq sncExample, "user=epnix" |