fix(fatfsgen): stabilize host read-flash after UART close in pytest

This commit is contained in:
sonika.rathi
2026-05-11 19:52:57 +02:00
parent dcea0b55a0
commit c21f1f3e64
@@ -6,6 +6,7 @@ import shutil
import sys
import typing as t
from datetime import datetime
from subprocess import CalledProcessError
from subprocess import run
from subprocess import STDOUT
from time import sleep
@@ -202,8 +203,18 @@ def test_examples_fatfsgen(config: str, dut: Dut) -> None:
dut.serial.close()
sleep(1)
target = ParttoolTarget(dut.serial.port, 1843200)
target.read_partition(PartitionName('storage'), 'temp.img')
# Host read-flash after closing the test UART can fail at very high baud (e.g. exit code 2 on
# multi-Mbit reads). Use the same order of magnitude as post-stub flash programming (921600).
read_baud = 921600
for attempt in range(3):
try:
target = ParttoolTarget(dut.serial.port, read_baud)
target.read_partition(PartitionName('storage'), 'temp.img')
break
except CalledProcessError:
if attempt == 2:
raise
sleep(2)
if config_long_names:
run(['python', fatfs_parser_path, '--long-name-support', 'temp.img'], stderr=STDOUT)
else: