From 844d37ff1837f8d4175b920fa6bcf2740d1b2836 Mon Sep 17 00:00:00 2001 From: whitequark Date: Fri, 9 Oct 2015 01:24:44 +0300 Subject: [PATCH] compiler.testbench.embedding: allow compiling only. --- artiq/compiler/testbench/embedding.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/artiq/compiler/testbench/embedding.py b/artiq/compiler/testbench/embedding.py index 7df21af21..8817711c0 100644 --- a/artiq/compiler/testbench/embedding.py +++ b/artiq/compiler/testbench/embedding.py @@ -6,6 +6,12 @@ from artiq.master.worker_db import DeviceManager from artiq.coredevice.core import Core, CompileError def main(): + if len(sys.argv) > 1 and sys.argv[1] == "+compile": + del sys.argv[1] + compile_only = True + else: + compile_only = False + with open(sys.argv[1]) as f: testcase_code = compile(f.read(), f.name, "exec") testcase_vars = {'__name__': 'testbench'} @@ -15,9 +21,12 @@ def main(): try: core = Core(dmgr=DeviceManager(FlatFileDB(ddb_path))) - core.run(testcase_vars["entrypoint"], (), {}) - print(core.comm.get_log()) - core.comm.clear_log() + if compile_only: + core.compile(testcase_vars["entrypoint"], (), {}) + else: + core.run(testcase_vars["entrypoint"], (), {}) + print(core.comm.get_log()) + core.comm.clear_log() except CompileError as error: print("\n".join(error.__cause__.diagnostic.render(only_line=True)))