Skip to content

Commit

Permalink
Fix filtering of blocks, fixes #99
Browse files Browse the repository at this point in the history
  • Loading branch information
Johannes Bechberger committed Nov 14, 2019
1 parent ba1505a commit bb1e417
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
3 changes: 2 additions & 1 deletion temci/run/run_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,9 @@ def __init__(self, runs: t.List[dict] = None, append: bool = None, show_report:
""" Run program blocks for each dictionary in ``runs```"""
for (id, run) in enumerate(runs):
self.run_blocks.append(RunProgramBlock.from_dict(id, copy.deepcopy(run)))
old_blocks = self.run_blocks
self.run_blocks = filter_runs(self.run_blocks, Settings()["run/included_blocks"])
self.runs = [runs[block.id] for block in self.run_blocks]
self.runs = [runs[next(i for i, o in enumerate(old_blocks) if o == b)] for b in self.run_blocks]
self.append = Settings().default(append, "run/append") # type: bool
""" Append to the old benchmarks if there are any in the result file? """
self.show_report = Settings().default(show_report, "run/show_report") # type: bool
Expand Down
28 changes: 28 additions & 0 deletions tests/test_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,3 +109,31 @@ def test_temci_short_shell():

def test_pass_arguments():
assert run_temci("short exec exit --argument 1", expect_success=False).ret_code == ErrorCode.PROGRAM_ERROR.value


def test_included_blocks_single_issue99():
r = run_temci("exec --in in.yaml --included_blocks b --runs 0", files={
"in.yaml":
[
{
"attributes": {
"description": "a"
},
"run_config": {
"cmd": "true"
}
},
{
"attributes": {
"description": "b"
},
"run_config": {
"cmd": "true"
},
"build_config": {
"cmd": "false"
}
}
]
}, expect_success=False)
assert r.ret_code != 0

0 comments on commit bb1e417

Please sign in to comment.