Skip to content

Commit bdb844b

Browse files
authored
Merge pull request #2688 from teojgo/bugfix/filter_test_with_hash
[bugfix] Fix filtering of tests with hashcode
2 parents 32f9e25 + bfdfc57 commit bdb844b

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed

reframe/frontend/filters.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ def _fn(case):
2626
if '@' in patt:
2727
# Do an exact match on the unique name
2828
return patt.replace('@', '_') == case.check.unique_name
29+
elif patt.startswith('/'):
30+
# Do an exact match on the hashcode
31+
return patt[1:] == case.check.hashcode
2932
else:
3033
return regex.match(display_name)
3134

unittests/test_cli.py

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -574,7 +574,7 @@ def test_list_tags(run_reframe):
574574
assert returncode == 0
575575

576576

577-
def test_filtering_multiple_criteria(run_reframe):
577+
def test_filtering_multiple_criteria_name(run_reframe):
578578
returncode, stdout, stderr = run_reframe(
579579
checkpath=['unittests/resources/checks'],
580580
action='list',
@@ -586,6 +586,30 @@ def test_filtering_multiple_criteria(run_reframe):
586586
assert returncode == 0
587587

588588

589+
def test_filtering_multiple_criteria_hash(run_reframe):
590+
returncode, stdout, stderr = run_reframe(
591+
checkpath=['unittests/resources/checks'],
592+
action='list',
593+
more_options=['-t', 'foo', '-n', '/2b3e4546']
594+
)
595+
assert 'Traceback' not in stdout
596+
assert 'Traceback' not in stderr
597+
assert 'Found 1 check(s)' in stdout
598+
assert returncode == 0
599+
600+
601+
def test_filtering_exclude_hash(run_reframe):
602+
returncode, stdout, stderr = run_reframe(
603+
checkpath=['unittests/resources/checks'],
604+
action='list',
605+
more_options=['-x', '/2b3e4546']
606+
)
607+
assert 'Traceback' not in stdout
608+
assert 'Traceback' not in stderr
609+
assert 'Found 8 check(s)' in stdout
610+
assert returncode == 0
611+
612+
589613
def test_show_config_all(run_reframe):
590614
# Just make sure that this option does not make the frontend crash
591615
returncode, stdout, stderr = run_reframe(

0 commit comments

Comments
 (0)