diff options
Diffstat (limited to 'xml')
-rw-r--r-- | xml/scripts/test_script.py | 10 | ||||
-rw-r--r-- | xml/scripts/test_script2.py | 4 | ||||
-rw-r--r-- | xml/test/props.xml | 6 | ||||
-rw-r--r-- | xml/test/test_prop2.py | 3 | ||||
-rw-r--r-- | xml/test/test_prop4.py (renamed from xml/test/test_prop_mt.py) | 15 |
5 files changed, 9 insertions, 29 deletions
diff --git a/xml/scripts/test_script.py b/xml/scripts/test_script.py deleted file mode 100644 index 8f236e9..0000000 --- a/xml/scripts/test_script.py +++ /dev/null @@ -1,10 +0,0 @@ -import sys -if sys.version_info >= (3,0): - import binascii - -def run(ctx, inpt): - if sys.version_info >= (3,0): - return binascii.a2b_uu('111') - else: - return bytearray('111') - diff --git a/xml/scripts/test_script2.py b/xml/scripts/test_script2.py deleted file mode 100644 index 16e4adb..0000000 --- a/xml/scripts/test_script2.py +++ /dev/null @@ -1,4 +0,0 @@ -description='this is a test script' - -def run(ctx, inpt): - return ctx.get_registers_list(); diff --git a/xml/test/props.xml b/xml/test/props.xml index dc08cbe..750881d 100644 --- a/xml/test/props.xml +++ b/xml/test/props.xml @@ -3,9 +3,5 @@ <transform path="/test/prop1" register="test_prop1" unit="C" read_from_register="(503975./1024000)*${/registers/fpga/sensor_temperature:C} - 27315./100" description="formula to get real fpga temperature from the fpga_temperature register in decimal"/> <transform path="/test/prop2" register="test_prop2" unit="C" script="test_prop2.py" description="test python script #1" write_verification="0" /> <transform path="/test/prop3" register="test_prop3" unit="C" script="test_prop3.py" description="test python script #2" /> - <transform path="/test/prop_mt" - register="test_prop_mt" - unit="C" - script="test_prop_mt.py" - description="Example of thread safe python property"/> + <transform path="/test/prop4" register="test_prop4" unit="C" script="test_prop4.py" description="Example of thread safe python property"/> </model> diff --git a/xml/test/test_prop2.py b/xml/test/test_prop2.py index d78dbea..8a3ebf6 100644 --- a/xml/test/test_prop2.py +++ b/xml/test/test_prop2.py @@ -1,6 +1,5 @@ def read_from_register(ctx, value): return ctx.get_property('/test/prop3') / 2 - + def write_to_register(ctx, value): ctx.set_property(value*2, '/test/prop3') - diff --git a/xml/test/test_prop_mt.py b/xml/test/test_prop4.py index 224a80c..30e9ece 100644 --- a/xml/test/test_prop_mt.py +++ b/xml/test/test_prop4.py @@ -4,21 +4,20 @@ lock = threading.Lock() def read_from_register(ctx, value): with lock: - ctx.lock('lock12') - + ctx.lock('test_prop4') + cur = read_from_register.counter read_from_register.counter += 1 for i in range (0, 5): time.sleep(0.1) - print(cur) out = ctx.get_property('/test/prop3') / 2 - ctx.unlock('lock12') - + + ctx.unlock('test_prop4') + return out - - + read_from_register.counter = 0 - + def write_to_register(ctx, value): with lock: ctx.set_property(value*2, '/test/prop3') |