Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix potential security issue in benchmark script #295

Merged
merged 1 commit into from
Dec 16, 2023
Merged
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: 11 additions & 5 deletions tests/bench-aggregator.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,30 @@
import json
import subprocess

def run_benchmark(cmd):
subprocess.run(cmd, shell=True, check=True)
def run_benchmark(b):
interp = None
if "sh" in b:
interp = "bash"
elif "py" in b:
interp = "python3"

subprocess.run(args=[interp, b], shell=False, check=True)

def load_benchmark(file):
f = open(file, "r")
return json.load(f)

# run benchmarks
benchmarks = [
"bash tests/dhrystone.sh",
"python3 tests/coremark.py"
"tests/dhrystone.sh",
"tests/coremark.py"
]
for b in benchmarks:
run_benchmark(b)

# combine benchmarks output data
benchmarks_output = [
"dhrystone_output.json",
"dhrystone_output.json",
"coremark_output.json"
]
benchmark_data = [load_benchmark(bo) for bo in benchmarks_output]
Expand Down