Skip to content

Commit 428912c

Browse files
authored
Merge pull request #3201 from vkarak/bugfix/perflog-compat-headers
[bugfix] Fix perflog header formatting when `perflog_compat` is used
2 parents 4d8753a + e1003e8 commit 428912c

File tree

2 files changed

+18
-10
lines changed

2 files changed

+18
-10
lines changed

reframe/core/logging.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ def __init__(self, prefix, mode='a', encoding=None, fmt=None,
169169
# Format specifiers
170170
self.__fmt = fmt
171171
self.__perffmt = perffmt
172-
self.__attr_patt = re.compile(r'\%\((.*?)\)s(.)?')
172+
self.__attr_patt = re.compile(r'\%\((.*?)\)s(.*?(?=%|$))?')
173173
self.__ignore_keys = set(ignore_keys) if ignore_keys else set()
174174

175175
def __generate_header(self, record):

unittests/test_policies.py

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1291,13 +1291,10 @@ def test_perf_logging_multiline(make_runner, make_exec_ctx, perf_test,
12911291
config_perflog, tmp_path):
12921292
make_exec_ctx(
12931293
config_perflog(
1294-
fmt=(
1295-
'%(check_job_completion_time)s,%(version)s,'
1296-
'%(check_display_name)s,%(check_system)s,'
1297-
'%(check_partition)s,%(check_environ)s,'
1298-
'%(check_jobid)s,%(check_result)s,'
1299-
'%(check_perf_var)s=%(check_perf_value)s,%(check_perf_unit)s'
1300-
),
1294+
fmt=('%(check_job_completion_time)s|reframe %(version)s|'
1295+
'%(check_name)s|%(check_perf_var)s=%(check_perf_value)s|'
1296+
'ref=%(check_perf_ref)s (l=%(check_perf_lower_thres)s, '
1297+
'u=%(check_perf_upper_thres)s)|%(check_perf_unit)s'),
13011298
logging_opts={'perflog_compat': True}
13021299
)
13031300
)
@@ -1315,8 +1312,19 @@ def test_perf_logging_multiline(make_runner, make_exec_ctx, perf_test,
13151312
# assert that the emitted lines are correct
13161313
with open(logfile) as fp:
13171314
lines = fp.readlines()
1318-
assert ',perf0=100.0,unit0' in lines[1]
1319-
assert ',perf1=50.0,unit1' in lines[2]
1315+
1316+
version = osext.reframe_version()
1317+
assert lines[0] == ('job_completion_time|reframe version|name|'
1318+
'perf_var=perf_value|ref=perf_ref '
1319+
'(l=perf_lower_thres, u=perf_upper_thres)|perf_unit\n')
1320+
assert lines[1].endswith(
1321+
f'|reframe {version}|_MyPerfTest|'
1322+
f'perf0=100.0|ref=0 (l=null, u=null)|unit0\n'
1323+
)
1324+
assert lines[2].endswith(
1325+
f'|reframe {version}|_MyPerfTest|'
1326+
f'perf1=50.0|ref=0 (l=null, u=null)|unit1\n'
1327+
)
13201328

13211329

13221330
def test_perf_logging_lazy(make_runner, make_exec_ctx, lazy_perf_test,

0 commit comments

Comments
 (0)