Re: [PATCH 6/9] test: Probe RTC early in dm_test_host()
Simon Glass <[email protected]>
| Newsgroups | org.ozlabs.lists.linux-erofs,org.u-boot-project.lists.u-boot |
|---|---|
| Message-ID | <CAFLszThEXe_dskFi4nNCnEq6-75GcRo6YNA2CCgt1tmacs_S7g@mail.gmail.com> |
Hi Heinrich, On 2026-05-18T05:57:19, Heinrich Schuchardt <[email protected]> wrote: > test: Probe RTC early in dm_test_host() > > The ext4 driver probes and reads the RTC which allocates memory. > > Ensure that the device is already probed and read once in dm_test_hook() > to avoid false positives. > > Signed-off-by: Heinrich Schuchardt <[email protected]> > > test/dm/host.c | 13 +++++++++++++ > 1 file changed, 13 insertions(+) > diff --git a/test/dm/host.c b/test/dm/host.c > @@ -26,6 +27,18 @@ static int dm_test_host(struct unit_test_state *uts) > ulong mem_start; > loff_t actwrite; > > + /* > + * Probing and first read from the RTC allocates memory. > + * Do it before the measurement. > + */ Please mention here (and in the commit message) which call inside this test ends up touching the RTC. It is non-obvious that fs_write() further down now reaches into the RTC via patch 5, and a future reader will not understand why an RTC probe belongs in a host test. > diff --git a/test/dm/host.c b/test/dm/host.c > @@ -26,6 +27,18 @@ static int dm_test_host(struct unit_test_state *uts) > + if (CONFIG_IS_ENABLED(DM_RTC)) { > + struct rtc_time tm; > + > + uclass_first_device(UCLASS_RTC, &dev); > + if (dev) > + dm_rtc_get(dev, &tm); > + } Since this is a DM test you should assert each of these calls. Also, would it be simpler to take a second mem_start sample after the warm-up, so the RTC allocation is naturally outside the measured window without needing to know it exists? > Ensure that the device is already probed and read once in dm_test_hook() > to avoid false positives. Should be dm_test_host(). Also spell out that it is the ut_check_delta() leak check at the end of the test that gets fooled by the RTC's one-shot allocation. Regards, Simon