Skip to content

Commit 68a1427

Browse files
author
Vasileios Karakasis
authored
Merge pull request #2533 from ekouts/bugfix/id_filtering
[bugfix] Improve test selection by their variant id
2 parents 1d85917 + cecd915 commit 68a1427

File tree

5 files changed

+25
-11
lines changed

5 files changed

+25
-11
lines changed

reframe/frontend/filters.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,10 @@ def have_any_name(names):
4949
regex_matches = []
5050
for n in names:
5151
if has_compact_names and '@' in n:
52-
exact_matches.append(n.replace('@', '_'))
52+
test, _, variant = n.rpartition('@')
53+
if variant.isdigit():
54+
exact_matches.append((test, int(variant)))
55+
5356
else:
5457
regex_matches.append(n)
5558

@@ -61,7 +64,8 @@ def have_any_name(names):
6164
def _fn(case):
6265
# Check if we have an exact match
6366
for m in exact_matches:
64-
if m == case.check.unique_name:
67+
cls_name = type(case.check).__name__
68+
if (cls_name, case.check.variant_num) == m:
6569
return True
6670

6771
display_name = case.check.display_name.replace(' ', '')

reframe/frontend/runreport.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
# The schema data version
1919
# Major version bumps are expected to break the validation of previous schemas
2020

21-
DATA_VERSION = '2.0'
21+
DATA_VERSION = '2.1'
2222
_SCHEMA = os.path.join(rfm.INSTALL_PREFIX, 'reframe/schemas/runreport.json')
2323

2424

reframe/frontend/statistics.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ def json(self, force=False):
110110
'environment': None,
111111
'fail_phase': None,
112112
'fail_reason': None,
113+
'fixture': check.is_fixture(),
113114
'jobid': None,
114115
'job_stderr': None,
115116
'job_stdout': None,
@@ -234,7 +235,7 @@ def print_failure_report(self, printer, rerun_info=True):
234235
f"{r['dependencies_actual']}")
235236
printer.info(f" * Maintainers: {r['maintainers']}")
236237
printer.info(f" * Failing phase: {r['fail_phase']}")
237-
if rerun_info:
238+
if rerun_info and not r['fixture']:
238239
if rt.runtime().get_option('general/0/compact_test_names'):
239240
cls = r['display_name'].split(' ')[0]
240241
variant = r['unique_name'].replace(cls, '')

reframe/schemas/runreport.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
"fail_reason": {"type": ["string", "null"]},
4141
"fail_severe": {"type": "boolean"},
4242
"filename": {"type": "string"},
43+
"fixture": {"type": "boolean"},
4344
"jobid": {"type": ["string", "null"]},
4445
"job_stderr": {"type": ["string", "null"]},
4546
"job_stdout": {"type": ["string", "null"]},

unittests/test_filters.py

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def use_compact_names(make_exec_ctx_g):
5252
@pytest.fixture
5353
def sample_param_cases(use_compact_names):
5454
class _X(rfm.RegressionTest):
55-
p = parameter([1, 1, 3])
55+
p = parameter([1] + list(range(11)))
5656
valid_systems = ['*']
5757
valid_prog_environs = ['*']
5858

@@ -66,7 +66,7 @@ def sample_param_cases_compat():
6666
# `general/compact_test_names=False`
6767

6868
class _X(rfm.RegressionTest):
69-
p = parameter([1, 1, 3])
69+
p = parameter([1] + list(range(11)))
7070
valid_systems = ['*']
7171
valid_prog_environs = ['*']
7272

@@ -87,17 +87,22 @@ def test_have_any_name(sample_cases):
8787

8888

8989
def test_have_any_name_param_test(sample_param_cases):
90-
assert 2 == count_checks(filters.have_any_name(['.*%p=1']),
90+
# The regex will match "_X%p=1" as well as "_X%p=10"
91+
assert 3 == count_checks(filters.have_any_name(['.*%p=1']),
92+
sample_param_cases)
93+
assert 2 == count_checks(filters.have_any_name(['.*%p=1$']),
9194
sample_param_cases)
9295
assert 1 == count_checks(filters.have_any_name(['_X%p=3']),
9396
sample_param_cases)
9497
assert 1 == count_checks(filters.have_any_name(['_X@2']),
9598
sample_param_cases)
96-
assert 0 == count_checks(filters.have_any_name(['_X@3']),
99+
assert 1 == count_checks(filters.have_any_name(['_X@002']),
100+
sample_param_cases)
101+
assert 0 == count_checks(filters.have_any_name(['_X@12']),
97102
sample_param_cases)
98103
assert 2 == count_checks(filters.have_any_name(['_X@0', '_X@1']),
99104
sample_param_cases)
100-
assert 3 == count_checks(filters.have_any_name(['_X@0', '_X.*']),
105+
assert 12 == count_checks(filters.have_any_name(['_X@0', '_X.*']),
101106
sample_param_cases)
102107

103108

@@ -108,11 +113,14 @@ def test_have_any_name_param_test_compat(sample_param_cases_compat):
108113
sample_param_cases_compat)
109114
assert 0 == count_checks(filters.have_any_name(['_X@2']),
110115
sample_param_cases_compat)
111-
assert 2 == count_checks(filters.have_any_name(['_X_1']),
116+
# The regex will match "_X_1" as well as "_X_10"
117+
assert 3 == count_checks(filters.have_any_name(['_X_1']),
118+
sample_param_cases_compat)
119+
assert 2 == count_checks(filters.have_any_name(['_X_1$']),
112120
sample_param_cases_compat)
113121
assert 0 == count_checks(filters.have_any_name(['_X@0', '_X@1']),
114122
sample_param_cases_compat)
115-
assert 3 == count_checks(filters.have_any_name(['_X@0', '_X.*']),
123+
assert 12 == count_checks(filters.have_any_name(['_X@0', '_X.*']),
116124
sample_param_cases_compat)
117125

118126

0 commit comments

Comments
 (0)