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
23 changes: 11 additions & 12 deletions reframe/core/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,9 @@ class RegressionTest(metaclass=RegressionTestMeta):
typ.List[str])

#: List of systems supported by this test.
#: The general syntax for systems is ``<sysname>[:<partname]``.
#: The general syntax for systems is ``<sysname>[:<partname>]``.
#: Both <sysname> and <partname> accept the value ``*`` to mean any value.
#: ``*`` is an alias of ``*:*``
#:
#: :type: :class:`List[str]`
#: :default: ``[]``
Expand Down Expand Up @@ -949,19 +951,16 @@ def info(self):

return ret

def supports_system(self, partition_name):
if '*' in self.valid_systems:
return True

if self.current_system.name in self.valid_systems:
return True
def supports_system(self, name):
if name.find(':') != -1:
system, partition = name.split(':')
else:
system, partition = self.current_system.name, name

# Check if this is a relative name
if partition_name.find(':') == -1:
partition_name = '%s:%s' % (self.current_system.name,
partition_name)
valid_matches = ['*', '*:*', system, f'{system}:*',
f'*:{partition}', f'{system}:{partition}']

return partition_name in self.valid_systems
return any(n in self.valid_systems for n in valid_matches)

def supports_environ(self, env_name):
if '*' in self.valid_prog_environs:
Expand Down
17 changes: 17 additions & 0 deletions unittests/test_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,12 @@ def test_supports_system(self):
assert test.supports_system('testsys:gpu')
assert test.supports_system('testsys:login')

test.valid_systems = ['*:*']
assert test.supports_system('gpu')
assert test.supports_system('login')
assert test.supports_system('testsys:gpu')
assert test.supports_system('testsys:login')

test.valid_systems = ['testsys']
assert test.supports_system('gpu')
assert test.supports_system('login')
Expand All @@ -287,6 +293,17 @@ def test_supports_system(self):
assert not test.supports_system('testsys:gpu')
assert not test.supports_system('testsys:login')

test.valid_systems = ['*:gpu']
assert test.supports_system('testsys:gpu')
assert test.supports_system('foo:gpu')
assert not test.supports_system('testsys:cpu')
assert not test.supports_system('testsys:login')

test.valid_systems = ['testsys:*']
assert test.supports_system('testsys:login')
assert test.supports_system('gpu')
assert not test.supports_system('foo:gpu')

def test_supports_environ(self):
test = self.loader.load_from_file(
'unittests/resources/checks/hellocheck.py')[0]
Expand Down