Skip to content

Commit 3253e06

Browse files
committed
Add script to filter test list
1 parent 30d29c7 commit 3253e06

File tree

3 files changed

+44
-0
lines changed

3 files changed

+44
-0
lines changed

riscof/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,5 @@ $(WORK_DIR)/test_list.yaml: $(DB_DIR)/test_list.yaml
3737
$(DB_DIR)/test_list.yaml: mlogv32/mlogv32_isa.yaml mlogv32/mlogv32_platform.yaml $(CONFIG)
3838
rm -rf $(DB_DIR)
3939
riscof testlist $(ARGS)
40+
python filter_test_list.py --work-dir $(WORK_DIR) --config $(CONFIG)
4041
mv $(WORK_DIR) $(DB_DIR)

riscof/config.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ ispec=./mlogv32/mlogv32_isa.yaml
1010
pspec=./mlogv32/mlogv32_platform.yaml
1111
target_run=1
1212
jobs=8
13+
skip_tests=/vm_sv32/
1314
# change these when running the tests on another computer (FIXME: hack)
1415
host_repo_path=/Users/object/Git/mlogv32
1516
riscof_repo_path=/workspaces/mlogv32

riscof/filter_test_list.py

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
from configparser import ConfigParser
2+
from pathlib import Path
3+
from typing import Any
4+
5+
import yaml
6+
from typer import Typer
7+
8+
app = Typer()
9+
10+
11+
@app.command()
12+
def main(
13+
work_dir: Path = Path("riscof_work"),
14+
config: Path = Path("config.ini"),
15+
):
16+
with open(config, "r") as f:
17+
cfg = ConfigParser()
18+
cfg.read_file(f)
19+
skip_tests = cfg.get("mlogv32", "skip_tests").split(",")
20+
21+
with open(work_dir / "test_list.yaml", "rb") as f:
22+
test_list: dict[str, Any] = yaml.load(f, yaml.Loader)
23+
24+
filtered_list = dict[str, Any]()
25+
for testname, value in test_list.items():
26+
for skip in skip_tests:
27+
if skip in testname:
28+
break
29+
else:
30+
filtered_list[testname] = value
31+
continue
32+
_, _, test_display_name = testname.partition(
33+
"riscv-arch-test/riscv-test-suite/"
34+
)
35+
print(f"Skipping test: {test_display_name}")
36+
37+
with open(work_dir / "test_list.yaml", "w") as f:
38+
yaml.dump(filtered_list, f)
39+
40+
41+
if __name__ == "__main__":
42+
app()

0 commit comments

Comments
 (0)