All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1] tests/qtest: Avoid timers from default devices
@ 2026-04-28 16:01 Fabiano Rosas
  2026-04-28 18:23 ` Stefan Hajnoczi
  0 siblings, 1 reply; 3+ messages in thread
From: Fabiano Rosas @ 2026-04-28 16:01 UTC (permalink / raw)
  To: qemu-devel
  Cc: Alex Bennée, Stefan Hajnoczi, Tyrone Ting, Hao Wu,
	Laurent Vivier, Paolo Bonzini

Having default devices enabled while testing timers leads to
non-deterministic behavior on the usage of the QTest
qtest_clock_step_next() command as the implicit devices can have
timers of their own that may have a deadline more recent than the
tested device.

In the particular case of npcm7xx-timer-test, having SLIRP enabled in
the QEMU binary may cause the net_slirp_timer to shadow the clock
advance that was expected to trigger the NPCM7xx timer:

npcm7xx_timer-test.c:475:test_periodic_interrupt:
  assertion failed (tim_read(td, TISR) == tim_timer_bit(td)): (0x00000000 == 0x00000010)
npcm7xx_timer-test.c:476:test_periodic_interrupt:
'qtest_get_irq(global_qtest, tim_timer_irq(td))' should be TRUE

Add the -nodefaults command line option to all tests that invoke
qtest_clock_step_next.

CC: Alex Bennée <alex.bennee@linaro.org>
Reported-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Fabiano Rosas <farosas@suse.de>
---
 tests/qtest/npcm7xx_timer-test.c | 2 +-
 tests/qtest/pflash-cfi02-test.c  | 4 ++--
 tests/qtest/rtc-test.c           | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/tests/qtest/npcm7xx_timer-test.c b/tests/qtest/npcm7xx_timer-test.c
index 43711049ca..0e2284669d 100644
--- a/tests/qtest/npcm7xx_timer-test.c
+++ b/tests/qtest/npcm7xx_timer-test.c
@@ -551,7 +551,7 @@ int main(int argc, char **argv)
         }
     }
 
-    qtest_start("-machine npcm750-evb");
+    qtest_start("-machine npcm750-evb -nodefaults");
     qtest_irq_intercept_in(global_qtest, "/machine/soc/a9mpcore/gic");
     ret = g_test_run();
     qtest_end();
diff --git a/tests/qtest/pflash-cfi02-test.c b/tests/qtest/pflash-cfi02-test.c
index 8c073efcb4..65b35811fa 100644
--- a/tests/qtest/pflash-cfi02-test.c
+++ b/tests/qtest/pflash-cfi02-test.c
@@ -260,7 +260,7 @@ static void test_geometry(const void *opaque)
 {
     const FlashConfig *config = opaque;
     QTestState *qtest;
-    qtest = qtest_initf("-M musicpal"
+    qtest = qtest_initf("-M musicpal -nodefaults"
                         " -drive if=pflash,file=%s,format=raw,copy-on-read=on"
                         /* Device geometry properties. */
                         " -global driver=cfi.pflash02,"
@@ -580,7 +580,7 @@ static void test_cfi_in_autoselect(const void *opaque)
 {
     const FlashConfig *config = opaque;
     QTestState *qtest;
-    qtest = qtest_initf("-M musicpal"
+    qtest = qtest_initf("-M musicpal -nodefaults"
                         " -drive if=pflash,file=%s,format=raw,copy-on-read=on",
                         image_path);
     FlashConfig explicit_config = expand_config_defaults(config);
diff --git a/tests/qtest/rtc-test.c b/tests/qtest/rtc-test.c
index 02ed4e1238..09b6de9166 100644
--- a/tests/qtest/rtc-test.c
+++ b/tests/qtest/rtc-test.c
@@ -691,7 +691,7 @@ int main(int argc, char **argv)
 
     g_test_init(&argc, &argv, NULL);
 
-    s = qtest_start("-rtc clock=vm");
+    s = qtest_start("-rtc clock=vm -nodefaults");
     qtest_irq_intercept_in(s, "ioapic");
 
     qtest_add_func("/rtc/check-time/bcd", bcd_check_time);
-- 
2.51.0



^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-04-28 18:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-28 16:01 [PATCH v1] tests/qtest: Avoid timers from default devices Fabiano Rosas
2026-04-28 18:23 ` Stefan Hajnoczi
2026-04-28 18:45   ` Fabiano Rosas

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.