Skip to content

Commit 0803cce

Browse files
author
Vasileios Karakasis
authored
Merge pull request #1659 from vkarak/bugfix/perflodir-expandvars
[bugfix] Properly expand environment variables for the filelog log handler
2 parents e90017a + e6ecd1e commit 0803cce

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed

reframe/core/logging.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,8 +247,10 @@ def _create_file_handler(site_config, config_prefix):
247247

248248

249249
def _create_filelog_handler(site_config, config_prefix):
250-
basedir = os.path.abspath(site_config.get(f'{config_prefix}/basedir'))
251-
prefix = site_config.get(f'{config_prefix}/prefix')
250+
basedir = os.path.abspath(
251+
osext.expandvars(site_config.get(f'{config_prefix}/basedir'))
252+
)
253+
prefix = osext.expandvars(site_config.get(f'{config_prefix}/prefix'))
252254
filename_patt = os.path.join(basedir, prefix)
253255
append = site_config.get(f'{config_prefix}/append')
254256
return MultiFileHandler(filename_patt, mode='a+' if append else 'w+')

unittests/test_cli.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,8 +364,22 @@ def test_performance_check_failure(run_reframe, tmp_path, perflogdir):
364364
'default' / 'PerformanceFailureCheck.log')
365365

366366

367-
def test_performance_report(run_reframe):
367+
def test_perflogdir_from_env(run_reframe, tmp_path, monkeypatch):
368+
monkeypatch.setenv('FOODIR', str(tmp_path / 'perflogs'))
368369
returncode, stdout, stderr = run_reframe(
370+
checkpath=['unittests/resources/checks/frontend_checks.py'],
371+
more_options=['-t', 'PerformanceFailureCheck'],
372+
perflogdir='$FOODIR'
373+
)
374+
assert returncode == 1
375+
assert 'Traceback' not in stdout
376+
assert 'Traceback' not in stderr
377+
assert os.path.exists(tmp_path / 'perflogs' / 'generic' /
378+
'default' / 'PerformanceFailureCheck.log')
379+
380+
381+
def test_performance_report(run_reframe):
382+
returncode, stdout, _ = run_reframe(
369383
checkpath=['unittests/resources/checks/frontend_checks.py'],
370384
more_options=['-t', 'PerformanceFailureCheck', '--performance-report']
371385
)

0 commit comments

Comments
 (0)