Skip to content
Open
Show file tree
Hide file tree
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
11 changes: 6 additions & 5 deletions benchmark/testall.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@
import time

# ================= 配置路径与规则 =================
CONFIG_DIR = "config"
RUNNERS_DIR = "runners"
TARGET_SCRIPT = "mcoplib_mxbenchmark_ops.py"
OUTPUT_FILE = "teslalloutput.txt"
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
CONFIG_DIR = os.path.join(SCRIPT_DIR, "config")
RUNNERS_DIR = os.path.join(SCRIPT_DIR, "runners")
TARGET_SCRIPT = os.path.join(SCRIPT_DIR, "mcoplib_mxbenchmark_ops.py")
OUTPUT_FILE = os.path.join(SCRIPT_DIR, "testalloutput.txt")

STATISTICS_DIR = "statistics"
STATISTICS_DIR = os.path.join(SCRIPT_DIR, "statistics")
CSV_FILENAME = "mcoplib_ops_performance_C500.csv"
CSV_SAVE_PATH = os.path.join(STATISTICS_DIR, CSV_FILENAME)

Expand Down
20 changes: 20 additions & 0 deletions unit_test/test_benchmark_testall_paths.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import os
from pathlib import Path

from benchmark import testall


def test_testall_paths_are_script_relative():
script_dir = Path(testall.__file__).resolve().parent

for path in (
testall.CONFIG_DIR,
testall.RUNNERS_DIR,
testall.TARGET_SCRIPT,
testall.OUTPUT_FILE,
testall.STATISTICS_DIR,
testall.CSV_SAVE_PATH,
):
assert os.path.isabs(path)
resolved = Path(path).resolve()
assert resolved == script_dir or script_dir in resolved.parents