From fc36772b068834435f0061f8b95ee95fedc374b5 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Sun, 24 Oct 2021 22:13:30 +0200 Subject: [PATCH] Tests: minor updates to benchmark script for running on buildbot * graph command accepts folder of json files as input * reset command clears log files --- tests/performance/benchmark | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/tests/performance/benchmark b/tests/performance/benchmark index a58c339e9f8..80556674dcc 100755 --- a/tests/performance/benchmark +++ b/tests/performance/benchmark @@ -4,6 +4,7 @@ import api import argparse import fnmatch +import glob import pathlib import shutil import sys @@ -228,6 +229,9 @@ def cmd_reset(env: api.TestEnvironment, argv: List): config.queue.write() + if args.test == '*': + shutil.rmtree(config.logs_dir) + def cmd_run(env: api.TestEnvironment, argv: List, update_only: bool): # Run tests. parser = argparse.ArgumentParser() @@ -274,7 +278,17 @@ def cmd_graph(argv: List): parser.add_argument('-o', '--output', type=str, required=True) args = parser.parse_args(argv) - graph = api.TestGraph([pathlib.Path(path) for path in args.json_file]) + # For directories, use all json files in the directory. + json_files = [] + for path in args.json_file: + path = pathlib.Path(path) + if path.is_dir(): + for filepath in glob.iglob(str(path / '*.json')): + json_files.append(pathlib.Path(filepath)) + else: + json_files.append(path) + + graph = api.TestGraph(json_files) graph.write(pathlib.Path(args.output)) def main():