summaryrefslogtreecommitdiff
path: root/tests/run-perfbench.py
diff options
context:
space:
mode:
authorJim Mussared <jim.mussared@gmail.com>2023-06-02 15:40:03 +1000
committerJim Mussared <jim.mussared@gmail.com>2023-06-08 17:54:24 +1000
commit339f02a5947e79347014b4d34adbf8a120b184bc (patch)
tree4113da0673a1652b3b8a04d8e43c09ebee87d145 /tests/run-perfbench.py
parent109717457edbf49421af3848ea26e26fff567289 (diff)
tests/run-perfbench.py: Don't allow imports from the cwd.
Make tests run in an isolated environment (i.e. `import io` would otherwise get the `tests/io` directory). This work was funded through GitHub Sponsors. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
Diffstat (limited to 'tests/run-perfbench.py')
-rwxr-xr-xtests/run-perfbench.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/tests/run-perfbench.py b/tests/run-perfbench.py
index 578f975bb..81d873c45 100755
--- a/tests/run-perfbench.py
+++ b/tests/run-perfbench.py
@@ -109,8 +109,9 @@ def run_benchmarks(args, target, param_n, param_m, n_average, test_list):
continue
# Create test script
+ test_script = b"import sys\nsys.path.remove('')\n\n"
with open(test_file, "rb") as f:
- test_script = f.read()
+ test_script += f.read()
with open(BENCH_SCRIPT_DIR + "benchrun.py", "rb") as f:
test_script += f.read()
test_script += b"bm_run(%u, %u)\n" % (param_n, param_m)