Skip to content

Commit 179ec0e

Browse files
authored
docs: use static data for test files (#157)
1 parent fe2db62 commit 179ec0e

File tree

2 files changed

+248
-13
lines changed

2 files changed

+248
-13
lines changed

book/compatibility_report.py

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,13 @@
22

33
from dataclasses import dataclass
44
from os import path, walk
5-
from posixpath import basename
65
from typing import Iterable
76

87

9-
def get_tests_filenames_from_subdir(tests_dir: str):
10-
for root, _, files in walk(tests_dir):
11-
for file in files:
12-
if file.endswith(".t"):
13-
yield path.join(basename(root), file)
8+
def get_tests_filenames_from_spec(tests_list: str):
9+
with open(tests_list, "r") as file:
10+
for line in file:
11+
yield tuple(line.split("\t"))
1412

1513

1614
def get_rust_files(rust_dir: str):
@@ -58,22 +56,22 @@ class Test:
5856

5957
def main():
6058
rust_dir = "../../rust/src/tests"
61-
tests_dir = "../../tests"
62-
tests_files = set(get_tests_filenames_from_subdir(tests_dir))
59+
tests_dir = "../old_testcases.tsv"
60+
tests_files = set(get_tests_filenames_from_spec(tests_dir))
6361
tests_with_rust_files, _ = (
64-
get_tests_with_and_without_rust_files(rust_dir, tests_files)
62+
get_tests_with_and_without_rust_files(rust_dir, map(lambda v: v[0], tests_files))
6563
)
6664
syscalls: dict[str, list[Test]] = {}
67-
for tests_file in tests_files:
68-
syscall, test_name = tests_file.split("/")
65+
for testfile, desc in tests_files:
66+
syscall, test_name = testfile.split("/")
6967
if syscall not in syscalls:
7068
syscalls[syscall] = []
7169

7270
syscalls[syscall].append(
7371
Test(
7472
test_name,
75-
tests_file in tests_with_rust_files,
76-
find_file_description(path.join(tests_dir, tests_file)),
73+
testfile in tests_with_rust_files,
74+
desc,
7775
)
7876
)
7977

0 commit comments

Comments
 (0)