Skip to content

Commit 950dccc

Browse files
nashifmmahadevan108
authored andcommitted
twister: status inconsistencies are now warnings
Do not report status issues as errors, very confusing and developer end up looking at the wrong thing, instead, treat those as warnings and count them and report them at the end. Signed-off-by: Anas Nashif <[email protected]>
1 parent 5ad5b95 commit 950dccc

File tree

2 files changed

+22
-4
lines changed

2 files changed

+22
-4
lines changed

scripts/pylib/twister/twisterlib/reports.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -596,7 +596,7 @@ def summary(self, results, ignore_unrecognized_sections, duration):
596596
f" {f'{TwisterStatus.get_color(TwisterStatus.NOTRUN)}{results.notrun}{Fore.RESET}' if results.notrun else f'{results.notrun}'} built (not run),"
597597
f" {f'{TwisterStatus.get_color(TwisterStatus.FAIL)}{results.failed}{Fore.RESET}' if results.failed else f'{results.failed}'} failed,"
598598
f" {f'{TwisterStatus.get_color(TwisterStatus.ERROR)}{results.error}{Fore.RESET}' if results.error else f'{results.error}'} errored,"
599-
f" with {f'{Fore.YELLOW}{self.plan.warnings}{Fore.RESET}' if self.plan.warnings else 'no'} warnings"
599+
f" with {f'{Fore.YELLOW}{self.plan.warnings + results.warnings}{Fore.RESET}' if (self.plan.warnings + results.warnings) else 'no'} warnings"
600600
f" in {duration:.2f} seconds."
601601
)
602602

scripts/pylib/twister/twisterlib/runner.py

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ def __init__(self, total=0):
129129
self._none_cases = Value('i', 0)
130130
self._started_cases = Value('i', 0)
131131

132+
self._warnings = Value('i', 0)
132133

133134
self.lock = Lock()
134135

@@ -186,6 +187,20 @@ def summary(self):
186187
print(f" └─ {'Test cases only started: ':<25}{self.started_cases:>{executed_cases_n_length}}")
187188
print("--------------------------------------------------")
188189

190+
@property
191+
def warnings(self):
192+
with self._warnings.get_lock():
193+
return self._warnings.value
194+
195+
@warnings.setter
196+
def warnings(self, value):
197+
with self._warnings.get_lock():
198+
self._warnings.value = value
199+
200+
def warnings_increment(self, value=1):
201+
with self._warnings.get_lock():
202+
self._warnings.value += value
203+
189204
@property
190205
def cases(self):
191206
with self._cases.get_lock():
@@ -1324,15 +1339,18 @@ def _add_instance_testcases_to_status_counts(instance, results, decrement=False)
13241339
# but having those statuses in this part of processing is an error.
13251340
case TwisterStatus.NONE:
13261341
results.none_cases_increment(increment_value)
1327-
logger.error(f'A None status detected in instance {instance.name},'
1342+
logger.warning(f'A None status detected in instance {instance.name},'
13281343
f' test case {tc.name}.')
1344+
results.warnings_increment(1)
13291345
case TwisterStatus.STARTED:
13301346
results.started_cases_increment(increment_value)
1331-
logger.error(f'A started status detected in instance {instance.name},'
1347+
logger.warning(f'A started status detected in instance {instance.name},'
13321348
f' test case {tc.name}.')
1349+
results.warnings_increment(1)
13331350
case _:
1334-
logger.error(f'An unknown status "{tc.status}" detected in instance {instance.name},'
1351+
logger.warning(f'An unknown status "{tc.status}" detected in instance {instance.name},'
13351352
f' test case {tc.name}.')
1353+
results.warnings_increment(1)
13361354

13371355

13381356
def report_out(self, results):

0 commit comments

Comments
 (0)