diff --git a/docs/developer/explanations/entities.rst b/docs/developer/explanations/entities.rst index 2f748f4c3..ef73b3484 100644 --- a/docs/developer/explanations/entities.rst +++ b/docs/developer/explanations/entities.rst @@ -149,7 +149,7 @@ Click the arrows to reveal the files.
all.ibek.ioc.yaml - .. include:: ../../../tests/samples/iocs/ibek-mo-ioc-01.yaml + .. include:: ../../../tests/samples/iocs/motorSim.ibek.ioc.yaml :literal: .. raw:: html diff --git a/src/ibek/args.py b/src/ibek/args.py index a9ccef2e7..2154e73cd 100644 --- a/src/ibek/args.py +++ b/src/ibek/args.py @@ -34,6 +34,13 @@ class Arg(BaseSettings): ) +class ListArg(Arg): + """An argument with a float value""" + + type: Literal["list"] = "list" + default: Optional[list] = None + + class FloatArg(Arg): """An argument with a float value""" diff --git a/tests/generate_samples.sh b/tests/generate_samples.sh index 67de2c414..5caf63cc3 100755 --- a/tests/generate_samples.sh +++ b/tests/generate_samples.sh @@ -42,7 +42,7 @@ echo making an ioc schema using ADCore and quadem support yaml ibek ioc generate-schema --no-ibek-defs support/ADCore.ibek.support.yaml support/quadem.ibek.support.yaml --output schemas/quadem.ibek.ioc.schema.json echo making ioc based on ibek-mo-ioc-01.yaml -EPICS_ROOT=`pwd`/epics ibek runtime generate iocs/ibek-mo-ioc-01.yaml support/asyn.ibek.support.yaml support/motorSim.ibek.support.yaml +EPICS_ROOT=`pwd`/epics ibek runtime generate iocs/motorSim.ibek.ioc.yaml support/asyn.ibek.support.yaml support/motorSim.ibek.support.yaml mv `pwd`/epics/{runtime,opi}/* `pwd`/outputs/motorSim echo making ioc based on utils support yaml @@ -50,8 +50,8 @@ EPICS_ROOT=`pwd`/epics ibek runtime generate iocs/utils.ibek.ioc.yaml support/ut mv `pwd`/epics/{runtime,opi}/* `pwd`/outputs/utils echo making ioc based on ipac support yaml -EPICS_ROOT=`pwd`/epics ibek runtime generate iocs/ipac-test.yaml support/ipac.ibek.support.yaml support/epics.ibek.support.yaml -mv `pwd`/epics/{runtime,opi}/* `pwd`/outputs/ipac +EPICS_ROOT=`pwd`/epics ibek runtime generate iocs/ipac-test.ibek.ioc.yaml support/ipac.ibek.support.yaml support/epics.ibek.support.yaml +mv `pwd`/epics/{runtime,opi}/* `pwd`/outputs/ipac-test echo making ioc based on gauges support yaml EPICS_ROOT=`pwd`/epics ibek runtime generate iocs/gauges.ibek.ioc.yaml support/asyn.ibek.support.yaml support/gauges.ibek.support.yaml diff --git a/tests/samples/iocs/ipac-test.yaml b/tests/samples/iocs/ipac-test.ibek.ioc.yaml similarity index 100% rename from tests/samples/iocs/ipac-test.yaml rename to tests/samples/iocs/ipac-test.ibek.ioc.yaml diff --git a/tests/samples/iocs/ibek-mo-ioc-01.yaml b/tests/samples/iocs/motorSim.ibek.ioc.yaml similarity index 100% rename from tests/samples/iocs/ibek-mo-ioc-01.yaml rename to tests/samples/iocs/motorSim.ibek.ioc.yaml diff --git a/tests/samples/outputs/ipac/index.bob b/tests/samples/outputs/ipac-test/index.bob similarity index 100% rename from tests/samples/outputs/ipac/index.bob rename to tests/samples/outputs/ipac-test/index.bob diff --git a/tests/samples/outputs/ipac/ioc.subst b/tests/samples/outputs/ipac-test/ioc.subst similarity index 100% rename from tests/samples/outputs/ipac/ioc.subst rename to tests/samples/outputs/ipac-test/ioc.subst diff --git a/tests/samples/outputs/ipac/st.cmd b/tests/samples/outputs/ipac-test/st.cmd similarity index 100% rename from tests/samples/outputs/ipac/st.cmd rename to tests/samples/outputs/ipac-test/st.cmd diff --git a/tests/samples/outputs/motorSim/index.bob b/tests/samples/outputs/motorSim/index.bob index ad7f566bc..3dac9f034 100644 --- a/tests/samples/outputs/motorSim/index.bob +++ b/tests/samples/outputs/motorSim/index.bob @@ -1,5 +1,5 @@ - ibek-mo-ioc-01 + motorSim.ibek.ioc 0 0 388 @@ -9,7 +9,7 @@ Title TITLE - ibek-mo-ioc-01 + motorSim.ibek.ioc 0 0 388 diff --git a/tests/samples/outputs/motorSim/ioc.subst b/tests/samples/outputs/motorSim/ioc.subst index b56b1a843..30222bf52 100644 --- a/tests/samples/outputs/motorSim/ioc.subst +++ b/tests/samples/outputs/motorSim/ioc.subst @@ -11,7 +11,7 @@ pattern file "basic_asyn_motor.db" { pattern { "P", "M", "DTYP", "PORT", "ADDR", "DESC", "EGU", "DIR", "VELO", "VMAX", "MRES", "DHLM", "DLLM", "INIT" } - { "IBEK-MO-TST-01:", "M0", "asynMotor", "controllerOne", "0", "Motor 0 for ioc ibek-mo-ioc-01", "degrees", "0", "10.0", "10.0", ".01", "20000", "-20000", "" } + { "IBEK-MO-TST-01:", "M0", "asynMotor", "controllerOne", "0", "Motor 0 for ioc motorSim.ibek.ioc", "degrees", "0", "10.0", "10.0", ".01", "20000", "-20000", "" } { "IBEK-MO-TST-01:", "M1", "asynMotor", "controllerOne", "1", "Motor 1 {{enclosed in escaped curly braces}} ", "degrees", "0", "10.0", "10.0", ".01", "20000", "-20000", "" } { "IBEK-MO-TST-01:", "M2", "asynMotor", "controllerOne", "2", "Motor 2", "degrees", "0", "10.0", "10.0", ".01", "20000", "-20000", "" } { "IBEK-MO-TST-01:", "M3", "asynMotor", "controllerOne", "3", "Motor 3", "degrees", "0", "10.0", "10.0", ".01", "20000", "-20000", "" } diff --git a/tests/samples/outputs/technosoft/reference.cmd b/tests/samples/outputs/technosoft/reference.cmd deleted file mode 100644 index 33b4dc5f8..000000000 --- a/tests/samples/outputs/technosoft/reference.cmd +++ /dev/null @@ -1,6 +0,0 @@ -ndsCreateDevice "TechnosoftTML", "", "FILE=/tmp/,NAXIS=4,DEV_PATH=/dev/ttyS0,HOST_ID=1, - AXIS_SETUP_0=$(SUPPORT)/motorTechnosoft/tml_lib/config/config.txt,AXIS_ID_0=1,AXIS_HOMING_SW_0=LSN, - AXIS_SETUP_1=$(SUPPORT)/motorTechnosoft/tml_lib/config/config.txt,AXIS_ID_1=2,AXIS_HOMING_SW_1=LSN, - AXIS_SETUP_2=$(SUPPORT)/motorTechnosoft/tml_lib/config/config.txt,AXIS_ID_2=3,AXIS_HOMING_SW_2=LSN, - AXIS_SETUP_3=$(SUPPORT)/motorTechnosoft/tml_lib/config/config.txt,AXIS_ID_3=4,AXIS_HOMING_SW_3=LSN" - diff --git a/tests/test_cli.py b/tests/test_cli.py index 36c8e6c1c..37f9df86a 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -88,50 +88,25 @@ def test_build_runtime_motorSim(tmp_epics_root: Path, samples: Path): Also verifies database subst file generation for multiple entity instantiations. """ - ioc_yaml = samples / "iocs" / "ibek-mo-ioc-01.yaml" - support_yaml1 = samples / "support" / "asyn.ibek.support.yaml" - support_yaml2 = samples / "support" / "motorSim.ibek.support.yaml" - expected_outputs = samples / "outputs" / "motorSim" - generate(ioc_yaml, [support_yaml1, support_yaml2]) - - example_boot = (expected_outputs / "st.cmd").read_text() - actual_boot = (tmp_epics_root / "runtime" / "st.cmd").read_text() - assert example_boot == actual_boot - - example_db = (expected_outputs / "ioc.subst").read_text() - actual_db = (tmp_epics_root / "runtime" / "ioc.subst").read_text() - assert example_db == actual_db - - example_index = (expected_outputs / "index.bob").read_text() - actual_index = (tmp_epics_root / "opi" / "index.bob").read_text() - assert example_index == actual_index - - example_bob = (expected_outputs / "simple.pvi.bob").read_text() - actual_bob = (tmp_epics_root / "opi" / "simple.pvi.bob").read_text() - assert example_bob == actual_bob - - example_template = (expected_outputs / "simple.pvi.template").read_text() - actual_template = (tmp_epics_root / "runtime" / "simple.pvi.template").read_text() - assert example_template == actual_template + generic_generate( + tmp_epics_root, + samples, + "motorSim", + ["motorSim", "asyn"], + ) def test_build_utils_features(tmp_epics_root: Path, samples: Path): """ build an ioc runtime script to verify utils features """ - ioc_yaml = samples / "iocs" / "utils.ibek.ioc.yaml" - support_yaml = samples / "support" / "utils.ibek.support.yaml" - - run_cli("runtime", "generate", ioc_yaml, support_yaml) - - example_boot = (samples / "outputs" / "utils" / "st.cmd").read_text() - actual_boot = (tmp_epics_root / "runtime" / "st.cmd").read_text() - assert example_boot == actual_boot - - example_db = (samples / "outputs" / "utils" / "ioc.subst").read_text() - actual_db = (tmp_epics_root / "runtime" / "ioc.subst").read_text() - assert example_db == actual_db + generic_generate( + tmp_epics_root, + samples, + "utils", + ["utils"], + ) def test_generate_links_ibek(samples: Path, mocker: MockerFixture): @@ -152,36 +127,28 @@ def test_ipac(tmp_epics_root: Path, samples: Path): Tests that an id argument can include another argument in its default value """ - ioc_yaml = samples / "iocs" / "ipac-test.yaml" - support_yaml1 = samples / "support" / "ipac.ibek.support.yaml" - support_yaml2 = samples / "support" / "epics.ibek.support.yaml" - expected_outputs = samples / "outputs" / "ipac" - # reset the InterruptVector counter to its initial state (if already used) if "InterruptVector" in utils.UTILS.counters: utils.UTILS.counters["InterruptVector"].current = 192 - generate(ioc_yaml, [support_yaml1, support_yaml2]) - - example_boot = (expected_outputs / "st.cmd").read_text() - actual_boot = (tmp_epics_root / "runtime" / "st.cmd").read_text() - assert example_boot == actual_boot + generic_generate( + tmp_epics_root, + samples, + "ipac-test", + ["ipac", "epics"], + ) def test_gauges(tmp_epics_root: Path, samples: Path): """ Tests that an id argument can include another argument in its default value """ - ioc_yaml = samples / "iocs" / "gauges.ibek.ioc.yaml" - support_yaml1 = samples / "support" / "asyn.ibek.support.yaml" - support_yaml2 = samples / "support" / "gauges.ibek.support.yaml" - expected_outputs = samples / "outputs" / "gauges" - - generate(ioc_yaml, [support_yaml1, support_yaml2]) - - example_boot = (expected_outputs / "st.cmd").read_text() - actual_boot = (tmp_epics_root / "runtime" / "st.cmd").read_text() - assert example_boot == actual_boot + generic_generate( + tmp_epics_root, + samples, + "gauges", + ["asyn", "gauges"], + ) def test_quadem(tmp_epics_root: Path, samples: Path): @@ -189,20 +156,12 @@ def test_quadem(tmp_epics_root: Path, samples: Path): Tests the use of CollectionDefinitions in an IOC instance this example uses the tetramm beam position monitor module """ - ioc_yaml = samples / "iocs" / "quadem.ibek.ioc.yaml" - support_yaml1 = samples / "support" / "ADCore.ibek.support.yaml" - support_yaml2 = samples / "support" / "quadem.ibek.support.yaml" - expected_outputs = samples / "outputs" / "quadem" - - generate(ioc_yaml, [support_yaml1, support_yaml2]) - - example_boot = (expected_outputs / "st.cmd").read_text() - actual_boot = (tmp_epics_root / "runtime" / "st.cmd").read_text() - assert example_boot == actual_boot - - example_db = (samples / "outputs" / "quadem" / "ioc.subst").read_text() - actual_db = (tmp_epics_root / "runtime" / "ioc.subst").read_text() - assert example_db == actual_db + generic_generate( + tmp_epics_root, + samples, + "quadem", + ["ADCore", "quadem"], + ) def generic_generate( @@ -216,13 +175,12 @@ def generic_generate( generate(ioc_yaml, support_yamls) - example_boot = (expected_outputs / "st.cmd").read_text() - actual_boot = (epics_root / "runtime" / "st.cmd").read_text() - assert example_boot == actual_boot - - example_db = (expected_outputs / "ioc.subst").read_text() - actual_db = (epics_root / "runtime" / "ioc.subst").read_text() - assert example_db == actual_db + for output in expected_outputs.glob("*"): + actual = epics_root / "runtime" / output.name + if not actual.exists(): + actual = epics_root / "opi" / output.name + assert actual.exists(), "Missing output file" + assert output.read_text() == actual.read_text() def test_andreas_motors(tmp_epics_root: Path, samples: Path): diff --git a/tests/test_support.py b/tests/test_support.py index 5386cb543..287ced9ab 100644 --- a/tests/test_support.py +++ b/tests/test_support.py @@ -19,6 +19,7 @@ def test_symlink_ibek(tmp_path: Path, samples: Path): "epics.ibek.support.yaml", "gauges.ibek.support.yaml", "ipac.ibek.support.yaml", + "listarg.ibek.support.yaml", "motorSim.ibek.support.yaml", "quadem.ibek.support.yaml", "technosoft.ibek.support.yaml",