Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions tools/benchcomp/benchcomp/visualizers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import yaml

import benchcomp
import benchcomp.visualizers.utils as viz_utils


Expand Down Expand Up @@ -54,15 +55,24 @@ def __call__(self, results):



@dataclasses.dataclass
class dump_yaml:
"""Print the YAML-formatted results to stdout
"""Print the YAML-formatted results to a file.

The 'out_file' key is mandatory; specify '-' to print to stdout.

Sample configuration:

visualize:
- type: dump_yaml
out_file: '-'
"""


def __init__(self, out_file):
self.get_out_file = benchcomp.Outfile(out_file)


def __call__(self, results):
print(yaml.dump(results, default_flow_style=False))
with self.get_out_file() as handle:
print(
yaml.dump(results, default_flow_style=False), file=handle)
1 change: 1 addition & 0 deletions tools/benchcomp/configs/perf-regression.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ run:

visualize:
- type: dump_yaml
out_file: '/tmp/result.yaml'

- type: error_on_regression
variant_pairs: [[kani_old, kani_new]]
Expand Down
7 changes: 6 additions & 1 deletion tools/benchcomp/test/test_regression.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,10 @@ def _run_kani_perf_test(self, command, expected_pass):
}
}
},
"visualize": [{"type": "dump_yaml"}],
"visualize": [{
"type": "dump_yaml",
"out_file": "-"
}],
})
run_bc()
self.assertEqual(run_bc.proc.returncode, 0, msg=run_bc.stderr)
Expand Down Expand Up @@ -423,6 +426,7 @@ def test_only_dump_yaml(self):
},
"visualize": [{
"type": "dump_yaml",
"out_file": "-",
}, {
"type": "error_on_regression",
"variant_pairs": [["passed", "failed"]],
Expand Down Expand Up @@ -471,6 +475,7 @@ def test_ignore_dump_yaml(self):
},
"visualize": [{
"type": "dump_yaml",
"out_file": "-",
}],
})
run_bc(flags=["--except", "dump_yaml"])
Expand Down