From 9c626b01e8124273fb1527ac25b5a1b8d98576f4 Mon Sep 17 00:00:00 2001 From: Kaushik Malapati Date: Thu, 18 Jul 2024 20:42:08 -0700 Subject: [PATCH 1/3] Adding input records to NO_WRITE asg --- pytmc/templates/asyn_standard_record.jinja2 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pytmc/templates/asyn_standard_record.jinja2 b/pytmc/templates/asyn_standard_record.jinja2 index 08453bd1..ace0edee 100644 --- a/pytmc/templates/asyn_standard_record.jinja2 +++ b/pytmc/templates/asyn_standard_record.jinja2 @@ -22,4 +22,7 @@ record({{record.record_type}}, "{{record.pvname}}") { info(archive, "{{ record.archive_settings['method'] }} {{ record.archive_settings['seconds'] }}: {{ record.archive_settings['fields'] | join(' ') }}") {% endif %} {% endif %} +{% if record.direction == "input" %} + field(ASG, "NO_WRITE") +{% endif %} } From 36beb2553bb9ef0879d152e74ca95aec7f21970a Mon Sep 17 00:00:00 2001 From: Kaushik Malapati Date: Mon, 22 Jul 2024 20:00:22 -0700 Subject: [PATCH 2/3] Adding test cases for input/output record write access --- pytmc/tests/test_record.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/pytmc/tests/test_record.py b/pytmc/tests/test_record.py index decf5416..dfb7fa32 100644 --- a/pytmc/tests/test_record.py +++ b/pytmc/tests/test_record.py @@ -35,6 +35,31 @@ def test_epics_record_with_linter(dbd_file): assert not (linted.errors) +def test_input_record_without_write_access(): + kwargs = { + "pvname": "Tst:pv", + "record_type": "ai", + "direction": "input", + } + + ec = EPICSRecord(**kwargs) + record = ec.render() + assert "ASG" in record + assert "NO_WRITE" in record + + +def test_output_record_with_write_access(): + kwargs = { + "pvname": "Tst:pv", + "record_type": "ao", + "direction": "output", + } + + ec = EPICSRecord(**kwargs) + record = ec.render() + assert "ASG" not in record + + def test_sort_fields(): unsorted_entry = OrderedDict( [ From e83b1ef61820187bcdbcc59b12145bd95f997d5c Mon Sep 17 00:00:00 2001 From: Kaushik Malapati Date: Mon, 22 Jul 2024 22:16:59 -0700 Subject: [PATCH 3/3] Fixing pre-commit errors --- pytmc/tests/test_record.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pytmc/tests/test_record.py b/pytmc/tests/test_record.py index dfb7fa32..f1584f9a 100644 --- a/pytmc/tests/test_record.py +++ b/pytmc/tests/test_record.py @@ -54,11 +54,10 @@ def test_output_record_with_write_access(): "record_type": "ao", "direction": "output", } - ec = EPICSRecord(**kwargs) record = ec.render() assert "ASG" not in record - + def test_sort_fields(): unsorted_entry = OrderedDict(