[PATCH 6/9] test: Probe RTC early in dm_test_host()
Heinrich Schuchardt
heinrich.schuchardt at canonical.com
Mon May 18 07:57:25 CEST 2026
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 <heinrich.schuchardt at canonical.com>
---
test/dm/host.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/test/dm/host.c b/test/dm/host.c
index f577377da6a..32a9818248a 100644
--- a/test/dm/host.c
+++ b/test/dm/host.c
@@ -8,6 +8,7 @@
#include <dm.h>
#include <fs.h>
#include <os.h>
+#include <rtc.h>
#include <sandbox_host.h>
#include <asm/test.h>
#include <dm/device-internal.h>
@@ -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.
+ */
+ if (CONFIG_IS_ENABLED(DM_RTC)) {
+ struct rtc_time tm;
+
+ uclass_first_device(UCLASS_RTC, &dev);
+ if (dev)
+ dm_rtc_get(dev, &tm);
+ }
+
ut_asserteq(-ENODEV, uclass_first_device_err(UCLASS_HOST, &dev));
ut_asserteq(-ENODEV, uclass_first_device_err(UCLASS_PARTITION, &part));
--
2.53.0
More information about the U-Boot
mailing list