Skip to content

Commit 474a8cf

Browse files
PerMacnashif
authored andcommitted
twister: bugfix: Make elf scan more precise.
When scanning for available elfs, twister discards ones with `_pre` in their name, to not include prebuilds like 'zephyr_pre0.elf`. However, the scan looks at the whole test name. If _pre is in the name (e.g. _precision) it would be wrongly discarded ending with twister reporting error that no elfs were found. This commit makes the discard to look only at the last part of the name (i.e. not including test name but only a lowest level, where zephyr.elf etc are located.) Signed-off-by: Maciej Perkowski <[email protected]>
1 parent c8c0879 commit 474a8cf

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

scripts/pylib/twister/twisterlib/testinstance.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,9 +253,9 @@ def calculate_sizes(self, from_buildlog: bool = False, generate_warning: bool =
253253
def get_elf_file(self) -> str:
254254
fns = glob.glob(os.path.join(self.build_dir, "zephyr", "*.elf"))
255255
fns.extend(glob.glob(os.path.join(self.build_dir, "zephyr", "*.exe")))
256-
fns = [x for x in fns if '_pre' not in x]
256+
fns = [x for x in fns if '_pre' not in os.path.split(x)[-1]]
257257
# EFI elf files
258-
fns = [x for x in fns if 'zefi' not in x]
258+
fns = [x for x in fns if 'zefi' not in os.path.split(x)[-1]]
259259
if len(fns) != 1:
260260
raise BuildError("Missing/multiple output ELF binary")
261261
return fns[0]

0 commit comments

Comments
 (0)