From d7bf2535684d2333408cdd045084dfc929c40984 Mon Sep 17 00:00:00 2001 From: Giles Knap Date: Thu, 9 Nov 2023 19:19:51 +0000 Subject: [PATCH] remove full path from pvi template entries in ioc.subst. This makes the tests work from different local paths. The runtime folder is added to the db include path to make this work. --- .gitignore | 5 ++++ src/ibek/runtime_cmds/commands.py | 2 +- src/ibek/templates/ioc/start.sh | 4 +-- tests/samples/outputs/all.db.subst | 32 ------------------------ tests/samples/outputs/all.ioc.subst | 7 ++++++ tests/samples/outputs/objects.db.subst | 17 ------------- tests/samples/outputs/utils.db.subst | 3 --- tests/samples/yaml/all.ibek.support.yaml | 1 + 8 files changed, 16 insertions(+), 55 deletions(-) delete mode 100644 tests/samples/outputs/all.db.subst delete mode 100644 tests/samples/outputs/objects.db.subst delete mode 100644 tests/samples/outputs/utils.db.subst diff --git a/.gitignore b/.gitignore index 5c2412702..7205062ce 100644 --- a/.gitignore +++ b/.gitignore @@ -75,3 +75,8 @@ lockfiles/ # this file may be created accidentally by ibek being run in its own directory # so we ignore it config/ + +# generated test files +tests/samples/epics/opi +tests/samples/epics/runtime + diff --git a/src/ibek/runtime_cmds/commands.py b/src/ibek/runtime_cmds/commands.py index 288d56a7f..8b1899b47 100644 --- a/src/ibek/runtime_cmds/commands.py +++ b/src/ibek/runtime_cmds/commands.py @@ -107,7 +107,7 @@ def generate_pvi(ioc: IOC) -> Tuple[List[IndexEntry], List[Tuple[Database, Entit # Add to extra databases to be added into substitution file databases.append( - (Database(file=output_template.as_posix(), args=macros), entity) + (Database(file=output_template.name, args=macros), entity) ) if device_name not in formatted_pvi_devices: diff --git a/src/ibek/templates/ioc/start.sh b/src/ibek/templates/ioc/start.sh index c633fbb2f..17939c779 100755 --- a/src/ibek/templates/ioc/start.sh +++ b/src/ibek/templates/ioc/start.sh @@ -83,7 +83,7 @@ if [ -f ${ibek_src} ]; then # build expanded database using msi if [ -f ${db_src} ]; then includes=$(for i in ${SUPPORT}/*/db; do echo -n "-I $i "; done) - bash -c "msi -o${epics_db} ${includes} -S${db_src}" + bash -c "msi -o${epics_db} ${includes} -I${RUNTIME_DIR} -S${db_src}" fi # 2. st.cmd + ioc.subst ************************************************ @@ -92,7 +92,7 @@ elif [ -f ${ioc_startup} ] ; then if [ -f ${CONFIG_DIR}/ioc.subst ]; then # generate ioc.db from ioc.subst, including all templates from SUPPORT includes=$(for i in ${SUPPORT}/*/db; do echo -n "-I $i "; done) - msi ${includes} -S ${CONFIG_DIR}/ioc.subst -o ${epics_db} + msi ${includes} -I${RUNTIME_DIR} -S ${CONFIG_DIR}/ioc.subst -o ${epics_db} fi final_ioc_startup=${ioc_startup} diff --git a/tests/samples/outputs/all.db.subst b/tests/samples/outputs/all.db.subst deleted file mode 100644 index 18768ef31..000000000 --- a/tests/samples/outputs/all.db.subst +++ /dev/null @@ -1,32 +0,0 @@ -############################################################################# -# DB substitution file generated by http://github.com/epics-containers/ibek # -############################################################################# - -file "another_test.db" { -pattern - { "name", "my_int_enum", "clock_rate", "db_calculated", "calculated_one" } - { "AllObject One", "2", "dummy", "HELLO AllObject One", "AllObject One.AllObject One String.1.1.0.True" } - { "AllObject Two", "1", "1", "HELLO AllObject Two", "AllObject Two.AllObject Two String.1.1.0.True" } -} - -file "yet_another.db" { -pattern - { "name", "my_object", "my_float", "my_bool" } - { "AllObject One", "Ref1", "1.0", "True" } - { "AllObject Two", "Ref1", "1.0", "True" } -} - -file "test.db" { -pattern - { "name", "ip", "value" } - { "Consumer Two With DB", "127.0.0.1", "Ref1.127.0.0.1" } -} - -file "/epics/pvi/simple.pvi.template" { -pattern - { "prefix" } - { "Ref1" } - { "AllObject One" } - { "AllObject Two" } - { "Disabled RefObject" } -} diff --git a/tests/samples/outputs/all.ioc.subst b/tests/samples/outputs/all.ioc.subst index 13ad05aaa..3f64c0324 100644 --- a/tests/samples/outputs/all.ioc.subst +++ b/tests/samples/outputs/all.ioc.subst @@ -28,3 +28,10 @@ pattern { "name", "ip", "value" } { "Consumer Two With DB", "127.0.0.1", "Ref1.127.0.0.1" } } + +file "simple.pvi.template" { +pattern + { "prefix" } + { "AllObject One" } + { "AllObject Two" } +} diff --git a/tests/samples/outputs/objects.db.subst b/tests/samples/outputs/objects.db.subst deleted file mode 100644 index 119777883..000000000 --- a/tests/samples/outputs/objects.db.subst +++ /dev/null @@ -1,17 +0,0 @@ -############################################################################# -# DB substitution file generated by http://github.com/epics-containers/ibek # -############################################################################# - -file "test.db" { -pattern - { "name", "ip", "value" } - { "Consumer of another port", "10.0.0.2", "AsynPort2.10.0.0.2" } - { "Another Consumer of the 2nd port", "10.0.0.2", "AsynPort2.10.0.0.2" } -} - -file "/epics/pvi/simple.pvi.template" { -pattern - { "prefix" } - { "AsynPort1" } - { "AsynPort2" } -} diff --git a/tests/samples/outputs/utils.db.subst b/tests/samples/outputs/utils.db.subst deleted file mode 100644 index 535e1a86b..000000000 --- a/tests/samples/outputs/utils.db.subst +++ /dev/null @@ -1,3 +0,0 @@ -############################################################################# -# DB substitution file generated by http://github.com/epics-containers/ibek # -############################################################################# diff --git a/tests/samples/yaml/all.ibek.support.yaml b/tests/samples/yaml/all.ibek.support.yaml index 437265629..fbff68342 100644 --- a/tests/samples/yaml/all.ibek.support.yaml +++ b/tests/samples/yaml/all.ibek.support.yaml @@ -122,3 +122,4 @@ defs: pvi: yaml_path: simple.pvi.device.yaml prefix: "{{ name }}" + pva: true