Skip to content

Commit a7e49b9

Browse files
authored
Merge pull request #2716 from ekouts/bugfix/perflog_compat
[bugfix] Fix cleanup crash for non-performance tests when the `perflog_compat` option is on
2 parents 1724a35 + 5820c42 commit a7e49b9

File tree

2 files changed

+22
-6
lines changed

2 files changed

+22
-6
lines changed

reframe/frontend/executors/__init__.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -386,8 +386,9 @@ def finalize(self):
386386

387387
self._current_stage = 'finalize'
388388
self._notify_listeners('on_task_success')
389-
self._perflogger.log_performance(logging.INFO, self,
390-
multiline=self._perflog_compat)
389+
if self.check.is_performance_check():
390+
self._perflogger.log_performance(logging.INFO, self,
391+
multiline=self._perflog_compat)
391392

392393
@logging.time_function
393394
def cleanup(self, *args, **kwargs):
@@ -397,8 +398,9 @@ def fail(self, exc_info=None):
397398
self._failed_stage = self._current_stage
398399
self._exc_info = exc_info or sys.exc_info()
399400
self._notify_listeners('on_task_failure')
400-
self._perflogger.log_performance(logging.INFO, self,
401-
multiline=self._perflog_compat)
401+
if self.check.is_performance_check():
402+
self._perflogger.log_performance(logging.INFO, self,
403+
multiline=self._perflog_compat)
402404

403405
def skip(self, exc_info=None):
404406
self._skipped = True

unittests/test_policies.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -989,6 +989,20 @@ def perf1(self):
989989
return _MyTest()
990990

991991

992+
@pytest.fixture
993+
def simple_test():
994+
class _MySimpleTest(rfm.RunOnlyRegressionTest):
995+
valid_systems = ['*']
996+
valid_prog_environs = ['*']
997+
executable = 'echo hello'
998+
999+
@sanity_function
1000+
def validate(self):
1001+
return sn.assert_found(r'hello', self.stdout)
1002+
1003+
return _MySimpleTest()
1004+
1005+
9921006
@pytest.fixture
9931007
def config_perflog(make_config_file):
9941008
def _config_perflog(fmt, perffmt=None, logging_opts=None):
@@ -1178,7 +1192,7 @@ def test_perf_logging_no_perfvars(make_runner, make_exec_ctx, perf_test,
11781192

11791193

11801194
def test_perf_logging_multiline(make_runner, make_exec_ctx, perf_test,
1181-
config_perflog, tmp_path):
1195+
simple_test, config_perflog, tmp_path):
11821196
make_exec_ctx(
11831197
config_perflog(
11841198
fmt=(
@@ -1193,7 +1207,7 @@ def test_perf_logging_multiline(make_runner, make_exec_ctx, perf_test,
11931207
)
11941208
logging.configure_logging(rt.runtime().site_config)
11951209
runner = make_runner()
1196-
testcases = executors.generate_testcases([perf_test])
1210+
testcases = executors.generate_testcases([perf_test, simple_test])
11971211
runner.runall(testcases)
11981212

11991213
logfile = tmp_path / 'perflogs' / 'generic' / 'default' / '_MyTest.log'

0 commit comments

Comments
 (0)