From 8527e306c3bb87dc720684abd95169e0d8b8553b Mon Sep 17 00:00:00 2001 From: whitequark Date: Tue, 24 Nov 2015 02:02:34 +0800 Subject: [PATCH] testbench.embedding: use dmgr to get core and export it. --- artiq/compiler/testbench/embedding.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/artiq/compiler/testbench/embedding.py b/artiq/compiler/testbench/embedding.py index 52932ff93..abe5f2fd3 100644 --- a/artiq/compiler/testbench/embedding.py +++ b/artiq/compiler/testbench/embedding.py @@ -12,15 +12,16 @@ def main(): else: compile_only = False + ddb_path = os.path.join(os.path.dirname(sys.argv[1]), "device_db.pyon") + dmgr = DeviceManager(DeviceDB(ddb_path)) + with open(sys.argv[1]) as f: testcase_code = compile(f.read(), f.name, "exec") - testcase_vars = {'__name__': 'testbench'} + testcase_vars = {'__name__': 'testbench', 'dmgr': dmgr} exec(testcase_code, testcase_vars) - ddb_path = os.path.join(os.path.dirname(sys.argv[1]), "device_db.pyon") - try: - core = DeviceManager(DeviceDB(ddb_path)).get("core") + core = dmgr.get("core") if compile_only: core.compile(testcase_vars["entrypoint"], (), {}) else: