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 a063fc7
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tools/gbench/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,12 @@ 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 a063fc7

Please sign in to comment.