From 7e1cd18be4aab4c42fce2ea74e21b92d130ff06f Mon Sep 17 00:00:00 2001 From: Dmitrii Golovanov Date: Sun, 3 Nov 2024 18:26:47 +0100 Subject: [PATCH] twister: Fix NOTRUN status Fix Twister TestCase statuses left not assigned ('NONE') in these 'NOTRUN' situations: * a test suite has `integration platform` which is not available to run. * `--cmake-only` execution. Signed-off-by: Dmitrii Golovanov --- scripts/pylib/twister/twisterlib/runner.py | 8 +++++++- scripts/tests/twister/test_runner.py | 2 +- scripts/tests/twister_blackbox/test_runner.py | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/scripts/pylib/twister/twisterlib/runner.py b/scripts/pylib/twister/twisterlib/runner.py index 7bc45e2df67..201a869a82a 100644 --- a/scripts/pylib/twister/twisterlib/runner.py +++ b/scripts/pylib/twister/twisterlib/runner.py @@ -900,7 +900,9 @@ class ProjectBuilder(FilterBuilder): next_op = 'report' elif self.options.cmake_only: if self.instance.status == TwisterStatus.NONE: - self.instance.status = TwisterStatus.PASS + logger.debug("CMake only: PASS %s" % self.instance.name) + self.instance.status = TwisterStatus.NOTRUN + self.instance.add_missing_case_status(TwisterStatus.NOTRUN, 'CMake only') next_op = 'report' else: # Here we check the runtime filter results coming from running cmake @@ -974,6 +976,10 @@ class ProjectBuilder(FilterBuilder): elif self.instance.run and self.instance.handler.ready: next_op = 'run' else: + if self.instance.status == TwisterStatus.NOTRUN: + run_conditions = f"(run:{self.instance.run}, handler.ready:{self.instance.handler.ready})" + logger.debug(f"Instance {self.instance.name} can't run {run_conditions}") + self.instance.add_missing_case_status(TwisterStatus.NOTRUN, f"Nowhere to run") next_op = 'report' except StatusAttributeError as sae: logger.error(str(sae)) diff --git a/scripts/tests/twister/test_runner.py b/scripts/tests/twister/test_runner.py index 259fd7d1f5b..b6cd151d78a 100644 --- a/scripts/tests/twister/test_runner.py +++ b/scripts/tests/twister/test_runner.py @@ -978,7 +978,7 @@ TESTDATA_6 = [ mock.ANY, [], {'op': 'report', 'test': mock.ANY}, - TwisterStatus.PASS, + TwisterStatus.NOTRUN, mock.ANY, 0, None diff --git a/scripts/tests/twister_blackbox/test_runner.py b/scripts/tests/twister_blackbox/test_runner.py index 6a6645bb5d8..0ace7fb0515 100644 --- a/scripts/tests/twister_blackbox/test_runner.py +++ b/scripts/tests/twister_blackbox/test_runner.py @@ -73,7 +73,7 @@ class TestRunner: os.path.join(TEST_DATA, 'tests', 'dummy', 'agnostic'), ['qemu_x86', 'qemu_x86_64'], { - 'passed_configurations': 6, + 'passed_configurations': 0, 'selected_test_instances': 6, 'executed_on_platform': 0, 'only_built': 6,