testbench.embedding: use dmgr to get core and export it.

This commit is contained in:
whitequark 2015-11-24 02:02:34 +08:00
parent 2bfc72fba9
commit 8527e306c3

View File

@ -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: