scripts: twisterlib: extend testcase schema for reboots
Extend the testcase schema to provide a way to communicate that a given test is expected to reboot during execution. The generic harness takes that information and suppresses `already STARTED` warnings if the restart is expected. Signed-off-by: Jordan Yates <jordan@embeint.com>
This commit is contained in:
parent
a29c0afaa8
commit
a5ffd7f7a3
3 changed files with 11 additions and 2 deletions
|
@ -734,6 +734,11 @@ required_snippets: <list of needed snippets>
|
||||||
- cdc-acm-console
|
- cdc-acm-console
|
||||||
- user-snippet-example
|
- user-snippet-example
|
||||||
|
|
||||||
|
expect_reboot: <True|False> (default False)
|
||||||
|
Notify twister that the test scenario is expected to reboot while executing.
|
||||||
|
When enabled, twister will suppress warnings about unexpected multiple runs
|
||||||
|
of a testsuite or testcase.
|
||||||
|
|
||||||
The set of test scenarios that actually run depends on directives in the test scenario
|
The set of test scenarios that actually run depends on directives in the test scenario
|
||||||
filed and options passed in on the command line. If there is any confusion,
|
filed and options passed in on the command line. If there is any confusion,
|
||||||
running with ``-v`` or examining the discard report
|
running with ``-v`` or examining the discard report
|
||||||
|
|
|
@ -91,6 +91,7 @@ class Harness:
|
||||||
config = instance.testsuite.harness_config
|
config = instance.testsuite.harness_config
|
||||||
self.id = instance.testsuite.id
|
self.id = instance.testsuite.id
|
||||||
self.run_id = instance.run_id
|
self.run_id = instance.run_id
|
||||||
|
self.expect_reboot = getattr(instance.testsuite, 'expect_reboot', False)
|
||||||
if instance.testsuite.ignore_faults:
|
if instance.testsuite.ignore_faults:
|
||||||
self.fail_on_fault = False
|
self.fail_on_fault = False
|
||||||
|
|
||||||
|
@ -848,7 +849,7 @@ class Test(Harness):
|
||||||
logger.debug(f"{phase}: unexpected Ztest suite '{suite_name}' is "
|
logger.debug(f"{phase}: unexpected Ztest suite '{suite_name}' is "
|
||||||
f"not present among: {self.instance.testsuite.ztest_suite_names}")
|
f"not present among: {self.instance.testsuite.ztest_suite_names}")
|
||||||
if suite_name in self.started_suites:
|
if suite_name in self.started_suites:
|
||||||
if self.started_suites[suite_name]['count'] > 0:
|
if self.started_suites[suite_name]['count'] > 0 and not self.expect_reboot:
|
||||||
# Either the suite restarts itself or unexpected state transition.
|
# Either the suite restarts itself or unexpected state transition.
|
||||||
logger.warning(f"{phase}: already STARTED '{suite_name}':"
|
logger.warning(f"{phase}: already STARTED '{suite_name}':"
|
||||||
f"{self.started_suites[suite_name]}")
|
f"{self.started_suites[suite_name]}")
|
||||||
|
@ -878,7 +879,7 @@ class Test(Harness):
|
||||||
|
|
||||||
def start_case(self, tc_name, phase='TC_START'):
|
def start_case(self, tc_name, phase='TC_START'):
|
||||||
if tc_name in self.started_cases:
|
if tc_name in self.started_cases:
|
||||||
if self.started_cases[tc_name]['count'] > 0:
|
if self.started_cases[tc_name]['count'] > 0 and not self.expect_reboot:
|
||||||
logger.warning(f"{phase}: already STARTED case "
|
logger.warning(f"{phase}: already STARTED case "
|
||||||
f"'{tc_name}':{self.started_cases[tc_name]}")
|
f"'{tc_name}':{self.started_cases[tc_name]}")
|
||||||
self.started_cases[tc_name]['count'] += 1
|
self.started_cases[tc_name]['count'] += 1
|
||||||
|
|
|
@ -70,6 +70,9 @@ schema;scenario-schema:
|
||||||
"extra_sections":
|
"extra_sections":
|
||||||
type: any
|
type: any
|
||||||
required: false
|
required: false
|
||||||
|
"expect_reboot":
|
||||||
|
type: bool
|
||||||
|
required: false
|
||||||
"required_snippets":
|
"required_snippets":
|
||||||
type: seq
|
type: seq
|
||||||
required: false
|
required: false
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue