From 41b4ce5a7e19134d4d82f88b906d0d4d246e7086 Mon Sep 17 00:00:00 2001 From: Aki Van Ness Date: Thu, 18 Aug 2022 05:51:03 -0400 Subject: [PATCH] sby: fixed issue where engine index would be out of range --- sbysrc/sby_core.py | 7 ++++--- sbysrc/sby_mode_bmc.py | 3 +-- sbysrc/sby_mode_cover.py | 4 +--- sbysrc/sby_mode_live.py | 3 +-- sbysrc/sby_mode_prove.py | 3 +-- 5 files changed, 8 insertions(+), 12 deletions(-) diff --git a/sbysrc/sby_core.py b/sbysrc/sby_core.py index 8c1ebac..e4d58a5 100644 --- a/sbysrc/sby_core.py +++ b/sbysrc/sby_core.py @@ -246,8 +246,7 @@ class SbyAbort(BaseException): class SbyConfig: def __init__(self): self.options = dict() - # Define a default case for the engine block - self.engines = { None: list() } + self.engines = dict() self.setup = dict() self.stage = dict() self.script = list() @@ -263,7 +262,7 @@ class SbyConfig: for line in f: raw_line = line - if mode in ["options", "engines", "files", "autotune"]: + if mode in ["options", "engines", "files", "autotune", "setup", "stage"]: line = re.sub(r"\s*(\s#.*)?$", "", line) if line == "" or line[0] == "#": continue @@ -404,6 +403,8 @@ class SbyConfig: if mode == "engines": args = line.strip().split() + if engine_mode not in self.engines: + self.engines[engine_mode] = list() self.engines[engine_mode].append(args) continue diff --git a/sbysrc/sby_mode_bmc.py b/sbysrc/sby_mode_bmc.py index e9afbc5..2613efa 100644 --- a/sbysrc/sby_mode_bmc.py +++ b/sbysrc/sby_mode_bmc.py @@ -29,14 +29,13 @@ def run(task): engine = engine_section engine_name = None else: + assert len(engine_section[1]) > 0 engine = engine_section[1][0] engine_name = engine_section[0] if engine_name is None: engine_name = engine_idx - assert len(engine) > 0 - task.log(f"""engine_{engine_name}: {" ".join(engine)}""") task.makedirs(f"{task.workdir}/engine_{engine_idx}") diff --git a/sbysrc/sby_mode_cover.py b/sbysrc/sby_mode_cover.py index f1e6ff5..61d0b07 100644 --- a/sbysrc/sby_mode_cover.py +++ b/sbysrc/sby_mode_cover.py @@ -28,15 +28,13 @@ def run(task): engine = engine_section engine_name = None else: + assert len(engine_section[1]) > 0 engine = engine_section[1][0] engine_name = engine_section[0] if engine_name is None: engine_name = engine_idx - - assert len(engine) > 0 - task.log(f"""engine_{engine_name}: {" ".join(engine)}""") task.makedirs(f"{task.workdir}/engine_{engine_idx}") diff --git a/sbysrc/sby_mode_live.py b/sbysrc/sby_mode_live.py index bdc772c..c624ec5 100644 --- a/sbysrc/sby_mode_live.py +++ b/sbysrc/sby_mode_live.py @@ -29,14 +29,13 @@ def run(task): engine = engine_section engine_name = None else: + assert len(engine_section[1]) > 0 engine = engine_section[1][0] engine_name = engine_section[0] if engine_name is None: engine_name = engine_idx - assert len(engine) > 0 - task.log(f"""engine_{engine_name}: {" ".join(engine)}""") task.makedirs(f"{task.workdir}/engine_{engine_idx}") diff --git a/sbysrc/sby_mode_prove.py b/sbysrc/sby_mode_prove.py index 36f9929..f3dc1b7 100644 --- a/sbysrc/sby_mode_prove.py +++ b/sbysrc/sby_mode_prove.py @@ -36,14 +36,13 @@ def run(task): engine = engine_section engine_name = None else: + assert len(engine_section[1]) > 0 engine = engine_section[1][0] engine_name = engine_section[0] if engine_name is None: engine_name = engine_idx - assert len(engine) > 0 - task.log(f"""engine_{engine_name}: {" ".join(engine)}""") task.makedirs(f"{task.workdir}/engine_{engine_idx}")