Skip to content

Commit 283c2af

Browse files
committed
Use test_cases.txt file to determine the tests to run
1 parent bd83b02 commit 283c2af

File tree

4 files changed

+169
-1
lines changed

4 files changed

+169
-1
lines changed

conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def reference_output_data():
4343

4444
def pytest_generate_tests(metafunc):
4545
if "test_id" in metafunc.fixturenames:
46-
test_ids = list(util.get_reference_output_data_map().keys())
46+
test_ids = [" ".join(line) for line in util.get_test_cases()]
4747
max_num_tests = metafunc.config.getoption("max_num_tests")
4848
if max_num_tests:
4949
test_ids = test_ids[:max_num_tests]

make_reference_output.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ fi
1616

1717
TIMEOUT_DURATION=2
1818
OUTPUT_DIRECTORY='./reference_output'
19+
TEST_CASES_FILE='./test_cases.txt'
1920

2021
PARAM_NUM_RANGE=(1)
2122
PARAM_METHOD_RANGE=(1 2)
@@ -39,6 +40,7 @@ function run_partdiff {
3940
output_filename="$(printf '%s/partdiff_%s_%s_%s_%s_%s_%s.txt\n' "$OUTPUT_DIRECTORY" "$num" "$method" "$lines" "$func" "$term" "$preciter")"
4041
echo "$output" > "$output_filename"
4142
echo ' (OK)'
43+
echo "$num" "$method" "$lines" "$func" "$term" "$preciter" >> "$TEST_CASES_FILE"
4244
return
4345
fi
4446
timed_out="$((exit_code == 124))"
@@ -51,6 +53,7 @@ function run_partdiff {
5153
}
5254

5355
mkdir -p "$OUTPUT_DIRECTORY"
56+
true > "$TEST_CASES_FILE"
5457

5558
(
5659
param_term_range=(2)

test_cases.txt

Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
1 1 0 1 2 1
2+
1 1 0 1 2 10
3+
1 1 0 1 2 100
4+
1 1 0 1 2 1000
5+
1 1 0 1 2 10000
6+
1 1 0 1 2 100000
7+
1 1 0 2 2 1
8+
1 1 0 2 2 10
9+
1 1 0 2 2 100
10+
1 1 0 2 2 1000
11+
1 1 0 2 2 10000
12+
1 1 0 2 2 100000
13+
1 1 1 1 2 1
14+
1 1 1 1 2 10
15+
1 1 1 1 2 100
16+
1 1 1 1 2 1000
17+
1 1 1 1 2 10000
18+
1 1 1 1 2 100000
19+
1 1 1 2 2 1
20+
1 1 1 2 2 10
21+
1 1 1 2 2 100
22+
1 1 1 2 2 1000
23+
1 1 1 2 2 10000
24+
1 1 1 2 2 100000
25+
1 1 10 1 2 1
26+
1 1 10 1 2 10
27+
1 1 10 1 2 100
28+
1 1 10 1 2 1000
29+
1 1 10 1 2 10000
30+
1 1 10 2 2 1
31+
1 1 10 2 2 10
32+
1 1 10 2 2 100
33+
1 1 10 2 2 1000
34+
1 1 10 2 2 10000
35+
1 1 100 1 2 1
36+
1 1 100 1 2 10
37+
1 1 100 1 2 100
38+
1 1 100 2 2 1
39+
1 1 100 2 2 10
40+
1 1 100 2 2 100
41+
1 1 1000 1 2 1
42+
1 1 1000 2 2 1
43+
1 2 0 1 2 1
44+
1 2 0 1 2 10
45+
1 2 0 1 2 100
46+
1 2 0 1 2 1000
47+
1 2 0 1 2 10000
48+
1 2 0 1 2 100000
49+
1 2 0 2 2 1
50+
1 2 0 2 2 10
51+
1 2 0 2 2 100
52+
1 2 0 2 2 1000
53+
1 2 0 2 2 10000
54+
1 2 0 2 2 100000
55+
1 2 1 1 2 1
56+
1 2 1 1 2 10
57+
1 2 1 1 2 100
58+
1 2 1 1 2 1000
59+
1 2 1 1 2 10000
60+
1 2 1 1 2 100000
61+
1 2 1 2 2 1
62+
1 2 1 2 2 10
63+
1 2 1 2 2 100
64+
1 2 1 2 2 1000
65+
1 2 1 2 2 10000
66+
1 2 1 2 2 100000
67+
1 2 10 1 2 1
68+
1 2 10 1 2 10
69+
1 2 10 1 2 100
70+
1 2 10 1 2 1000
71+
1 2 10 1 2 10000
72+
1 2 10 1 2 100000
73+
1 2 10 2 2 1
74+
1 2 10 2 2 10
75+
1 2 10 2 2 100
76+
1 2 10 2 2 1000
77+
1 2 10 2 2 10000
78+
1 2 100 1 2 1
79+
1 2 100 1 2 10
80+
1 2 100 1 2 100
81+
1 2 100 1 2 1000
82+
1 2 100 2 2 1
83+
1 2 100 2 2 10
84+
1 2 100 2 2 100
85+
1 2 1000 1 2 1
86+
1 2 1000 1 2 10
87+
1 2 1000 2 2 1
88+
1 1 0 1 1 1e-4
89+
1 1 0 1 1 1e-8
90+
1 1 0 1 1 1e-12
91+
1 1 0 1 1 1e-16
92+
1 1 0 1 1 1e-20
93+
1 1 0 2 1 1e-4
94+
1 1 0 2 1 1e-8
95+
1 1 0 2 1 1e-12
96+
1 1 0 2 1 1e-16
97+
1 1 0 2 1 1e-20
98+
1 1 1 1 1 1e-4
99+
1 1 1 1 1 1e-8
100+
1 1 1 1 1 1e-12
101+
1 1 1 1 1 1e-16
102+
1 1 1 1 1 1e-20
103+
1 1 1 2 1 1e-4
104+
1 1 1 2 1 1e-8
105+
1 1 1 2 1 1e-12
106+
1 1 1 2 1 1e-16
107+
1 1 1 2 1 1e-20
108+
1 1 10 1 1 1e-4
109+
1 1 10 1 1 1e-8
110+
1 1 10 1 1 1e-12
111+
1 1 10 1 1 1e-16
112+
1 1 10 1 1 1e-20
113+
1 1 10 2 1 1e-4
114+
1 1 10 2 1 1e-8
115+
1 1 10 2 1 1e-12
116+
1 1 10 2 1 1e-16
117+
1 1 10 2 1 1e-20
118+
1 1 100 2 1 1e-4
119+
1 1 1000 2 1 1e-4
120+
1 2 0 1 1 1e-4
121+
1 2 0 1 1 1e-8
122+
1 2 0 1 1 1e-12
123+
1 2 0 1 1 1e-16
124+
1 2 0 1 1 1e-20
125+
1 2 0 2 1 1e-4
126+
1 2 0 2 1 1e-8
127+
1 2 0 2 1 1e-12
128+
1 2 0 2 1 1e-16
129+
1 2 0 2 1 1e-20
130+
1 2 1 1 1 1e-4
131+
1 2 1 1 1 1e-8
132+
1 2 1 1 1 1e-12
133+
1 2 1 1 1 1e-16
134+
1 2 1 1 1 1e-20
135+
1 2 1 2 1 1e-4
136+
1 2 1 2 1 1e-8
137+
1 2 1 2 1 1e-12
138+
1 2 1 2 1 1e-16
139+
1 2 1 2 1 1e-20
140+
1 2 10 1 1 1e-4
141+
1 2 10 1 1 1e-8
142+
1 2 10 1 1 1e-12
143+
1 2 10 1 1 1e-16
144+
1 2 10 1 1 1e-20
145+
1 2 10 2 1 1e-4
146+
1 2 10 2 1 1e-8
147+
1 2 100 2 1 1e-4
148+
1 2 1000 2 1 1e-4

util.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@
128128
]
129129

130130
REFERENCE_OUTPUT_PATH = Path.cwd() / "reference_output"
131+
TEST_CASES_FILE_PATH = Path.cwd() / "test_cases.txt"
131132

132133
RE_REF_OUTPUT_FILE = re.compile(
133134
r"""
@@ -157,6 +158,22 @@ def iter_reference_output_data():
157158
yield (partdiff_params, reference_output)
158159

159160

161+
def iter_test_cases():
162+
with TEST_CASES_FILE_PATH.open() as f:
163+
for line in f:
164+
line = line.strip()
165+
if not line:
166+
continue
167+
fields = line.split()
168+
assert len(fields) == 6
169+
yield tuple(fields)
170+
171+
172+
@cache
173+
def get_test_cases():
174+
return list(iter_test_cases())
175+
176+
160177
@cache
161178
def get_reference_output_data_map():
162179
return {

0 commit comments

Comments
 (0)