From 8b762407daf7407b9893a0a0cc7f7460d13ebcd0 Mon Sep 17 00:00:00 2001 From: Vasileios Karakasis Date: Tue, 28 Jun 2022 11:37:14 +0200 Subject: [PATCH 1/2] Treat undefined variables correctly in run report --- reframe/frontend/statistics.py | 5 ++++- unittests/resources/checks/frontend_checks.py | 9 +++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/reframe/frontend/statistics.py b/reframe/frontend/statistics.py index 15b62375a9..e5b81b1d7e 100644 --- a/reframe/frontend/statistics.py +++ b/reframe/frontend/statistics.py @@ -196,7 +196,10 @@ def json(self, force=False): test_cls = type(check) for name, var in test_cls.var_space.items(): if var.is_loggable(): - entry['check_vars'][name] = getattr(check, name) + try: + entry['check_vars'][name] = getattr(check, name) + except AttributeError: + entry['check_vars'][name] = '' entry['check_params'] = {} test_cls = type(check) diff --git a/unittests/resources/checks/frontend_checks.py b/unittests/resources/checks/frontend_checks.py index 6a3eb8bc0e..1efb359e62 100644 --- a/unittests/resources/checks/frontend_checks.py +++ b/unittests/resources/checks/frontend_checks.py @@ -23,6 +23,15 @@ class BaseFrontendCheck(rfm.RunOnlyRegressionTest): executable = 'echo hello && echo perf: 10 Gflop/s' local = True + # Add two required variables that may affect the final run report + x = variable(int) + xlog = variable(int, loggable=True) + + @run_after('setup') + def setx(self): + self.x = 1 + self.xlog = 1 + @sanity_function def validate_output(self): return sn.assert_found('hello', self.stdout) From b268ff23433b06f120f6bc5a325c9b2e2beca30a Mon Sep 17 00:00:00 2001 From: Vasileios Karakasis Date: Tue, 28 Jun 2022 12:41:16 +0200 Subject: [PATCH 2/2] Mark additional unit test as flaky --- unittests/test_schedulers.py | 1 + 1 file changed, 1 insertion(+) diff --git a/unittests/test_schedulers.py b/unittests/test_schedulers.py index 70a45b2c29..aebce08d10 100644 --- a/unittests/test_schedulers.py +++ b/unittests/test_schedulers.py @@ -616,6 +616,7 @@ def _read_pid(job, attempts=3): f'{attempts} attempts') +@pytest.mark.flaky(reruns=3) def test_cancel_with_grace(minimal_job, scheduler, local_only): # This test emulates a spawned process that ignores the SIGTERM signal # and also spawns another process: