Skip to content

Commit

Permalink
Tools: discard inputs with unexpected json_schema_version
Browse files Browse the repository at this point in the history
  • Loading branch information
LebedevRI committed Jan 23, 2024
1 parent 682bac9 commit 341783b
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions tools/gbench/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,15 @@ def benchmark_wanted(benchmark):

with open(fname, "r") as f:
results = json.load(f)
if "context" in results:
if "json_schema_version" in results["context"]:
json_schema_version = results["context"]["json_schema_version"]
if json_schema_version != 1:
print(
"In %s, got unnsupported JSON schema version: %i, expected 1"
% (fname, json_schema_version)
)
sys.exit(1)
if "benchmarks" in results:
results["benchmarks"] = list(
filter(benchmark_wanted, results["benchmarks"])
Expand Down

0 comments on commit 341783b

Please sign in to comment.