From 981e13e638ab5f71751f01c85a99b257b486e45c Mon Sep 17 00:00:00 2001 From: Bjarki Arge Andreasen Date: Tue, 2 Dec 2025 12:32:41 +0100 Subject: [PATCH] [nrf fromtree] tests: drivers: spi: loopback: wait for idle before timed test Wait a bit before performing timed spi_loopback_transceive() in test_spi_complete_multiple_timed to ensure the console is idle, otherwise the console completing and suspending in the "background" near the end of the spi transaction can introduce latency. Signed-off-by: Bjarki Arge Andreasen (cherry picked from commit 5dec22a5efb0cab4eb9d512736ef7c717bb5a68e) --- tests/drivers/spi/spi_loopback/src/spi.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/drivers/spi/spi_loopback/src/spi.c b/tests/drivers/spi/spi_loopback/src/spi.c index 6ca688484a28..f840488a0861 100644 --- a/tests/drivers/spi/spi_loopback/src/spi.c +++ b/tests/drivers/spi/spi_loopback/src/spi.c @@ -315,7 +315,13 @@ ZTEST(spi_loopback, test_spi_complete_multiple_timed) */ zassert_ok(pm_device_runtime_get(spec->bus)); - /* since this is a test program, there shouldn't be much to interfere with measurement */ + /* + * since this is a test program, there shouldn't be much to interfere with measurement. + * still let's wait for the console to complete printing so it does not complete and + * suspend near the end of the spi transaction. + */ + k_msleep(10); + start_time = k_cycle_get_32(); spi_loopback_transceive(spec, &tx, &rx, 2); end_time = k_cycle_get_32();