diff --git a/reframe/frontend/cli.py b/reframe/frontend/cli.py index 3932ab1ed2..217a5f6922 100644 --- a/reframe/frontend/cli.py +++ b/reframe/frontend/cli.py @@ -1,6 +1,7 @@ import inspect import json import os +import re import socket import sys import traceback @@ -452,6 +453,12 @@ def main(): checks_matched = [c for c in checks_matched] + # Determine the programming environments to run with + run_environs = {e.name + for env_patt in options.prgenv + for p in rt.system.partitions + for e in p.environs if re.match(env_patt, e.name)} + # Act on checks # Unload regression's module and load user-specified modules @@ -496,7 +503,7 @@ def main(): exec_policy.skip_environ_check = options.skip_prgenv_check exec_policy.skip_sanity_check = options.skip_sanity_check exec_policy.skip_performance_check = options.skip_performance_check - exec_policy.only_environs = options.prgenv + exec_policy.only_environs = run_environs exec_policy.keep_stage_files = options.keep_stage_files try: errmsg = "invalid option for --flex-alloc-tasks: '{0}'" diff --git a/unittests/test_cli.py b/unittests/test_cli.py index cb644160a5..416e626ed9 100644 --- a/unittests/test_cli.py +++ b/unittests/test_cli.py @@ -148,12 +148,16 @@ def test_check_submit_success(self): self.local = False self.system = partition.fullname - # pick up the programming environment of the partition - self.environs = [partition.environs[0].name] + # Pick up the programming environment of the partition + # Prepend ^ and append $ so as to much exactly the given name + self.environs = ['^' + partition.environs[0].name + '$'] returncode, stdout, _ = self._run_reframe() self.assertNotIn('FAILED', stdout) self.assertIn('PASSED', stdout) + + # Assert that we have run only one test case + self.assertIn('Ran 1 test case(s)', stdout) self.assertEqual(0, returncode) def test_check_failure(self):