From 9cb2db7d4e1ac034a3cd438a1af87074c29be75a Mon Sep 17 00:00:00 2001 From: Nicolas Date: Tue, 14 Oct 2025 23:04:20 +0200 Subject: [PATCH] changed test_compile for reading all result variables instead of a fixed memory region --- src/copapy/__init__.py | 2 +- tests/test_compile.py | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/copapy/__init__.py b/src/copapy/__init__.py index 395d82e..3ac106a 100644 --- a/src/copapy/__init__.py +++ b/src/copapy/__init__.py @@ -529,7 +529,7 @@ class Target(): else: raise ValueError(f"Unsupported variable type: {var_type}") - def read_variable_remote(self, net: Net) -> None: + def read_value_remote(self, net: Net) -> None: dw = binw.data_writer(self.sdb.byteorder) add_read_command(dw, self._variables, net) assert coparun(dw.get_data()) > 0 diff --git a/tests/test_compile.py b/tests/test_compile.py index 2470c87..258970c 100644 --- a/tests/test_compile.py +++ b/tests/test_compile.py @@ -7,6 +7,7 @@ from copapy import binwrite def run_command(command: list[str]) -> str: result = subprocess.run(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, encoding='utf8', check=False) + assert result.returncode != 11, f"SIGSEGV (segmentation fault)\n -Error occurred: {result.stderr}\n -Output: {result.stdout}" assert result.returncode == 0, f"\n -Error occurred: {result.stderr}\n -Output: {result.stdout}" return result.stdout @@ -51,14 +52,13 @@ def test_compile(): out = [Write(r) for r in ret] - il, _ = copapy.compile_to_instruction_list(out, copapy.generic_sdb) + il, variables = copapy.compile_to_instruction_list(out, copapy.generic_sdb) # run program command il.write_com(binwrite.Command.RUN_PROG) - il.write_com(binwrite.Command.READ_DATA) - il.write_int(0) - il.write_int(36) + for net in ret: + copapy.add_read_command(il, variables, net) il.write_com(binwrite.Command.END_COM)