Skip to content

Commit 38a53e5

Browse files
author
Vasileios Karakasis
authored
Merge branch 'master' into bugfix/slurm_filter_nodes
2 parents 0556a10 + 60015c3 commit 38a53e5

File tree

2 files changed

+28
-12
lines changed

2 files changed

+28
-12
lines changed

reframe/core/pipeline.py

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,9 @@ class RegressionTest(metaclass=RegressionTestMeta):
158158
typ.List[str])
159159

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

950952
return ret
951953

952-
def supports_system(self, partition_name):
953-
if '*' in self.valid_systems:
954-
return True
955-
956-
if self.current_system.name in self.valid_systems:
957-
return True
954+
def supports_system(self, name):
955+
if name.find(':') != -1:
956+
system, partition = name.split(':')
957+
else:
958+
system, partition = self.current_system.name, name
958959

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

964-
return partition_name in self.valid_systems
963+
return any(n in self.valid_systems for n in valid_matches)
965964

966965
def supports_environ(self, env_name):
967966
if '*' in self.valid_prog_environs:

unittests/test_pipeline.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,12 @@ def test_supports_system(self):
263263
assert test.supports_system('testsys:gpu')
264264
assert test.supports_system('testsys:login')
265265

266+
test.valid_systems = ['*:*']
267+
assert test.supports_system('gpu')
268+
assert test.supports_system('login')
269+
assert test.supports_system('testsys:gpu')
270+
assert test.supports_system('testsys:login')
271+
266272
test.valid_systems = ['testsys']
267273
assert test.supports_system('gpu')
268274
assert test.supports_system('login')
@@ -287,6 +293,17 @@ def test_supports_system(self):
287293
assert not test.supports_system('testsys:gpu')
288294
assert not test.supports_system('testsys:login')
289295

296+
test.valid_systems = ['*:gpu']
297+
assert test.supports_system('testsys:gpu')
298+
assert test.supports_system('foo:gpu')
299+
assert not test.supports_system('testsys:cpu')
300+
assert not test.supports_system('testsys:login')
301+
302+
test.valid_systems = ['testsys:*']
303+
assert test.supports_system('testsys:login')
304+
assert test.supports_system('gpu')
305+
assert not test.supports_system('foo:gpu')
306+
290307
def test_supports_environ(self):
291308
test = self.loader.load_from_file(
292309
'unittests/resources/checks/hellocheck.py')[0]

0 commit comments

Comments
 (0)