File tree Expand file tree Collapse file tree 4 files changed +26
-4
lines changed Expand file tree Collapse file tree 4 files changed +26
-4
lines changed Original file line number Diff line number Diff line change @@ -941,9 +941,12 @@ def restrict_logging():
941941 # We lexically split the mode options, because otherwise spaces
942942 # will be treated as part of the option argument;
943943 # see GH bug #1554
944- mode_args = list (
945- itertools .chain .from_iterable (shlex .split (m )
946- for m in mode_args ))
944+ mode_args = list (itertools .chain .from_iterable (
945+ shlex .split (osext .expandvars (arg )) for arg in mode_args )
946+ )
947+ printer .debug (f'Expanding execution mode { options .mode !r} : '
948+ f'{ " " .join (mode_args )} ' )
949+
947950 # Parse the mode's options and reparse the command-line
948951 options = argparser .parse_args (mode_args ,
949952 suppress_required = True )
Original file line number Diff line number Diff line change @@ -275,6 +275,11 @@ def hostname():
275275 '-p builtin' ,
276276 '-S local=1'
277277 ]
278+ },
279+ {
280+ 'name' : 'env_vars' ,
281+ 'options' : ['-n' , '${TEST_NAME_PATTERN}' ,
282+ '-S' , '${VAR}=${VAL}' ]
278283 }
279284 ],
280285 'logging' : [
Original file line number Diff line number Diff line change @@ -542,6 +542,20 @@ def test_execution_modes(run_reframe, run_action):
542542 assert 'Ran 1/1 test case' in stdout
543543
544544
545+ def test_execution_modes_envvar_expansion (run_reframe , monkeypatch ):
546+ monkeypatch .setenv ('TEST_NAME_PATTERN' , '^HelloTest$' )
547+ monkeypatch .setenv ('VAR' , 'x' )
548+ monkeypatch .setenv ('VAL' , '1' )
549+ returncode , stdout , stderr = run_reframe (
550+ mode = 'env_vars' , action = 'list'
551+ )
552+ assert returncode == 0
553+ assert 'Traceback' not in stdout
554+ assert 'Traceback' not in stderr
555+ assert "the following variables were not set: 'x'" in stdout
556+ assert 'Found 1 check(s)' in stdout
557+
558+
545559def test_invalid_mode_error (run_reframe ):
546560 mode = 'invalid'
547561 returncode , stdout , stderr = run_reframe (
Original file line number Diff line number Diff line change @@ -225,7 +225,7 @@ def test_select_subconfig(site_config):
225225 site_config .select_subconfig ('testsys' )
226226 assert len (site_config ['systems' ]) == 1
227227 assert len (site_config ['systems' ][0 ]['partitions' ]) == 2
228- assert len (site_config ['modes' ]) == 1
228+ assert len (site_config ['modes' ]) == 2
229229 assert site_config .get ('systems/0/name' ) == 'testsys'
230230 assert site_config .get ('systems/0/descr' ) == 'Fake system for unit tests'
231231 assert site_config .get ('systems/0/hostnames' ) == ['testsys' ]
You can’t perform that action at this time.
0 commit comments