Skip to content

Commit 20544c7

Browse files
authored
Merge pull request #716 from vkarak/bugfix/regex-select-run-prgenv
[bugfix] Define the set of run environments correctly when `-p` option is used with regular expressions
2 parents 64b8f37 + 3ed3d71 commit 20544c7

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

reframe/frontend/cli.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import inspect
22
import json
33
import os
4+
import re
45
import socket
56
import sys
67
import traceback
@@ -452,6 +453,12 @@ def main():
452453

453454
checks_matched = [c for c in checks_matched]
454455

456+
# Determine the programming environments to run with
457+
run_environs = {e.name
458+
for env_patt in options.prgenv
459+
for p in rt.system.partitions
460+
for e in p.environs if re.match(env_patt, e.name)}
461+
455462
# Act on checks
456463

457464
# Unload regression's module and load user-specified modules
@@ -496,7 +503,7 @@ def main():
496503
exec_policy.skip_environ_check = options.skip_prgenv_check
497504
exec_policy.skip_sanity_check = options.skip_sanity_check
498505
exec_policy.skip_performance_check = options.skip_performance_check
499-
exec_policy.only_environs = options.prgenv
506+
exec_policy.only_environs = run_environs
500507
exec_policy.keep_stage_files = options.keep_stage_files
501508
try:
502509
errmsg = "invalid option for --flex-alloc-tasks: '{0}'"

unittests/test_cli.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,12 +148,16 @@ def test_check_submit_success(self):
148148
self.local = False
149149
self.system = partition.fullname
150150

151-
# pick up the programming environment of the partition
152-
self.environs = [partition.environs[0].name]
151+
# Pick up the programming environment of the partition
152+
# Prepend ^ and append $ so as to much exactly the given name
153+
self.environs = ['^' + partition.environs[0].name + '$']
153154

154155
returncode, stdout, _ = self._run_reframe()
155156
self.assertNotIn('FAILED', stdout)
156157
self.assertIn('PASSED', stdout)
158+
159+
# Assert that we have run only one test case
160+
self.assertIn('Ran 1 test case(s)', stdout)
157161
self.assertEqual(0, returncode)
158162

159163
def test_check_failure(self):

0 commit comments

Comments
 (0)