presets,hil: keep Ninja Multi-Config; make HIL find its output

Per review (HiFiPhile): Ninja Multi-Config is needed for IAR, otherwise the
optimization level can't be lowered to none for debug. Revert gen_presets.py
back to Ninja Multi-Config (keeping only the cmake-build-<board> binaryDir
change), and instead teach hil_test.py to locate <ex>.elf whether it sits
directly in the example dir (single-config) or under a per-config subdir like
RelWithDebInfo/ (multi-config).

Verified: stm32u083nucleo passes 13/13 remote HIL with a multi-config preset
build (rsync preserves the RelWithDebInfo/ subdir; the resolver finds it).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
hathach
2026-06-08 15:42:00 +07:00
parent d38ba79ad4
commit 46aded44af
3 changed files with 16 additions and 6 deletions

View File

@ -1516,10 +1516,20 @@ def test_example(board: Board, f1: str, example: str) -> tuple[int, str]:
f1_str = f1_suffix(f1)
fw_dir = TINYUSB_ROOT / build_dir / f'cmake-build-{name}{f1_str}' / example
fw_name = fw_dir / Path(example).name
base = Path(example).name
test_name = f'{name+f1_str:40} {example:30} ...'
if not fw_dir.exists() or not ((fw_name.with_suffix('.elf')).exists() or (fw_name.with_suffix('.bin')).exists()):
# firmware sits directly in the example dir (single-config Ninja) or under a
# per-config subdir like RelWithDebInfo/ (Ninja Multi-Config); accept either.
fw_name = None
if fw_dir.is_dir():
for cand in [fw_dir / base, fw_dir / 'RelWithDebInfo' / base,
*(p.with_suffix('') for p in sorted(fw_dir.glob(f'*/{base}.elf')))]:
if cand.with_suffix('.elf').exists() or cand.with_suffix('.bin').exists():
fw_name = cand
break
if fw_name is None:
log_line(f'{test_name} Skip (no binary)')
return 0, 'skip'