Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions docs/manpage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,11 @@ This happens recursively so that if test ``T1`` depends on ``T2`` and ``T2`` dep

.. versionadded:: 3.9.1

.. versionchanged:: 4.1.0

The ``MAINTAINER`` pattern is matched anywhere in the maintainer's name and not at its beginning.
If you want to match at the beginning of the name, you should prepend ``^``.

.. option:: -n, --name=NAME

Filter tests by name.
Expand Down Expand Up @@ -126,6 +131,11 @@ This happens recursively so that if test ``T1`` depends on ``T2`` and ``T2`` dep

Support selecting tests by their hash code.

.. versionchanged:: 4.1.0

The ``NAME`` pattern is matched anywhere in the test name and not at its beginning.
If you want to match at the beginning of a test name, you should prepend ``^``.


.. option:: -p, --prgenv=NAME

Expand Down Expand Up @@ -158,6 +168,11 @@ This happens recursively so that if test ``T1`` depends on ``T2`` and ``T2`` dep
This option may be specified multiple times, in which case tests with *any* of the specified tags will be excluded:
``-T TAG1 -T TAG2`` is therefore equivalent to ``-T 'TAG1|TAG2'``.

.. versionchanged:: 4.1.0

The ``TAG`` pattern is matched anywhere in the tag name and not at its beginning.
If you want to match at the beginning of a tag, you should prepend ``^``.

.. option:: -t, --tag=TAG

Filter tests by tag.
Expand All @@ -168,6 +183,11 @@ This happens recursively so that if test ``T1`` depends on ``T2`` and ``T2`` dep

This option may be specified multiple times, in which case only tests defining or matching *all* tags will be selected.

.. versionchanged:: 4.1.0

The ``TAG`` pattern is matched anywhere in the tag name and not at its beginning.
If you want to match at the beginning of a tag, you should prepend ``^``.

.. option:: -x, --exclude=NAME

Exclude tests by name.
Expand All @@ -178,6 +198,10 @@ This happens recursively so that if test ``T1`` depends on ``T2`` and ``T2`` dep
This option may be specified multiple times, in which case tests with *any* of the specified names will be excluded:
``-x NAME1 -x NAME2`` is therefore equivalent to ``-x 'NAME1|NAME2'``.

.. versionchanged:: 4.1.0

The ``NAME`` pattern is matched anywhere in the test name and not at its beginning.
If you want to match at the beginning of a test name, you should prepend ``^``.

------------
Test actions
Expand Down
8 changes: 4 additions & 4 deletions reframe/frontend/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def _fn(case):
# Do an exact match on the hashcode
return patt[1:] == case.check.hashcode
else:
return regex.match(display_name)
return regex.search(display_name)

return _fn

Expand Down Expand Up @@ -76,7 +76,7 @@ def _fn(case):

display_name = case.check.display_name.replace(' ', '')
if regex:
return regex.match(display_name)
return regex.search(display_name)

return False

Expand All @@ -87,7 +87,7 @@ def have_tag(patt):
regex = re_compile(patt)

def _fn(case):
return any(regex.match(p) for p in case.check.tags)
return any(regex.search(p) for p in case.check.tags)

return _fn

Expand All @@ -103,7 +103,7 @@ def have_maintainer(patt):
regex = re_compile(patt)

def _fn(case):
return any(regex.match(p) for p in case.check.maintainers)
return any(regex.search(p) for p in case.check.maintainers)

return _fn

Expand Down
14 changes: 7 additions & 7 deletions unittests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -834,7 +834,7 @@ def test_maxfail_negative(run_reframe):

def test_repeat_option(run_reframe):
returncode, stdout, stderr = run_reframe(
more_options=['--repeat', '2', '-n', 'HelloTest'],
more_options=['--repeat', '2', '-n', '^HelloTest'],
checkpath=['unittests/resources/checks/hellocheck.py']
)
assert 'Traceback' not in stdout
Expand Down Expand Up @@ -877,7 +877,7 @@ def test_exec_order(run_reframe, exec_order):
import reframe.utility.sanity as sn

returncode, stdout, stderr = run_reframe(
more_options=['--repeat', '11', '-n', 'HelloTest',
more_options=['--repeat', '11', '-n', '^HelloTest',
f'--exec-order={exec_order}'],
checkpath=['unittests/resources/checks/hellocheck.py'],
action='list_detailed',
Expand Down Expand Up @@ -973,7 +973,7 @@ def test_fixture_registry_env_sys(run_reframe):
system='sys1:p0',
environs=['e3'],
checkpath=['unittests/resources/checks_unlisted/fixtures_simple.py'],
more_options=['-n', 'HelloFixture'],
more_options=['-n', '^HelloFixture'],
action='list_detailed'
)
assert returncode == 0
Expand All @@ -983,7 +983,7 @@ def test_fixture_registry_env_sys(run_reframe):
system='sys1:p0',
environs=['e1'],
checkpath=['unittests/resources/checks_unlisted/fixtures_simple.py'],
more_options=['-n', 'HelloFixture'],
more_options=['-n', '^HelloFixture'],
action='list_detailed'
)
assert returncode == 0
Expand All @@ -993,7 +993,7 @@ def test_fixture_registry_env_sys(run_reframe):
system='sys1:p1',
environs=['e1'],
checkpath=['unittests/resources/checks_unlisted/fixtures_simple.py'],
more_options=['-n', 'HelloFixture'],
more_options=['-n', '^HelloFixture'],
action='list_detailed'
)
assert returncode == 0
Expand All @@ -1003,7 +1003,7 @@ def test_fixture_registry_env_sys(run_reframe):
system='sys1:p1',
environs=['e2'],
checkpath=['unittests/resources/checks_unlisted/fixtures_simple.py'],
more_options=['-n', 'HelloFixture'],
more_options=['-n', '^HelloFixture'],
action='list_detailed'
)
assert returncode == 0
Expand All @@ -1027,7 +1027,7 @@ def test_dynamic_tests(run_reframe, tmp_path):
environs=[],
checkpath=['unittests/resources/checks_unlisted/distribute.py'],
action='run',
more_options=['-n', 'Complex', '--distribute=idle']
more_options=['-n', '^Complex', '--distribute=idle']
)
assert returncode == 0
assert 'Ran 10/10 test case(s)' in stdout
Expand Down
2 changes: 1 addition & 1 deletion unittests/test_testgenerators.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def test_distribute_testcases(sys0_exec_ctx):
])
testcases = executors.generate_testcases(loader.load_all())
testcases = filter(
filters.have_any_name('Simple'), testcases
filters.have_any_name(['Simple']), testcases
)

testcases = list(testcases)
Expand Down