Re: [PATCH RESEND v2 5/5] test: wdt: add a test for max_timeout_ms

Juuso Rinta via U-Boot <[email protected]>
Newsgroups org.u-boot-project.lists.u-boot
Message-ID <[email protected]>
Hi Simon,

> This helper reimplements internal wdt-uclass details (the format
> string, the "every %ldms" text, and the hw_margin_ms / 4 calculation
> from wdt_pre_probe()). If any of that drifts, the tests silently rot
> rather than catching a real change. Please drop the string
> reconstruction and either match against a fixed literal...

Agreed, v3 drops the helper and asserts a fixed literal.

> Sandbox does not select
> CONFIG_WATCHDOG, so I suspect the ut_assert_nextline() calls below
> will not match today.

That would be true from sandbox_defconfig alone, but CONFIG_WDT has
'imply WATCHDOG', so the sandbox build ends up with CONFIG_WATCHDOG=y.
ut dm wdt_base prints:
  WDT:   Started wdt@0 with servicing every 50ms (0s timeout)
v3 will expect that line.

> The clamped case only exercises timeout_ms > max_timeout_ms. The
> uclass code has a second branch, the sub-second difference guard, that
> suppresses req_str when the whole-second value would be unchanged. How
> about a case where timeout_ms is greater than max but rounds to the
> same whole second (e.g. max + 100ms), to lock down that behaviour?

Good idea, will be added to v3.

Best,
Juuso
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.