Skip to content

Commit 3e398cb

Browse files
PerMacnashif
authored andcommitted
twister: bugfix: Make BuildError exception cause test to report error
When no/too many elf files are detected after a build a BuildError exception is raised. However, it was not being counted as an issue with a test. With the patch satuses of tests' with such exception are reported as errors. Whithout it, twister finished without reported errors and was getting green CI checks. Signed-off-by: Maciej Perkowski <[email protected]>
1 parent 3d37cc3 commit 3e398cb

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

scripts/pylib/twister/twisterlib/runner.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
from domains import Domains
2626
from twisterlib.cmakecache import CMakeCache
2727
from twisterlib.environment import canonical_zephyr_base
28+
from twisterlib.error import BuildError
2829

2930
import elftools
3031
from elftools.elf.elffile import ELFFile
@@ -618,8 +619,14 @@ def process(self, pipeline, done, message, lock, results):
618619
pipeline.put({"op": "report", "test": self.instance})
619620
else:
620621
logger.debug(f"Determine test cases for test instance: {self.instance.name}")
621-
self.determine_testcases(results)
622-
pipeline.put({"op": "gather_metrics", "test": self.instance})
622+
try:
623+
self.determine_testcases(results)
624+
pipeline.put({"op": "gather_metrics", "test": self.instance})
625+
except BuildError as e:
626+
logger.error(str(e))
627+
self.instance.status = "error"
628+
self.instance.reason = str(e)
629+
pipeline.put({"op": "report", "test": self.instance})
623630

624631
elif op == "gather_metrics":
625632
self.gather_metrics(self.instance)

0 commit comments

Comments
 (0)