Skip to contentSkip to conversation

tests/qtest: Fix npcm7xx_timer-test.c flaky test

PATCH In review Chris Rauer 2 participants 2 messages Sep 29, 2023

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 tests/qtest: Fix npcm7xx_timer-test.c flaky test

npcm7xx_timer-test occasionally fails due to the state of the timers from the previous test iteration. Advancing the clock step after the reset resolves this issue.

---
 tests/qtest/npcm7xx_timer-test.c | 1 +
 1 file changed, 1 insertion(+)
tests/qtest/npcm7xx_timer-test.c +1 -0
index 43711049ca..58f58c2f71 100644
@@ -465,6 +465,7 @@ static void test_periodic_interrupt(gconstpointer test_data)
     int i;
 
     tim_reset(td);
+    clock_step_next();
 
     tim_write_ticr(td, count);
     tim_write_tcsr(td, CEN | IE | MODE_PERIODIC | PRESCALE(ps));
Signature · 1 line
2.42.0.515.g380fc7ccd1-goog
Acked-by on v2 1/1
#1 lore raw
Quoted 15 lines · Chris Rauer

npcm7xx_timer-test occasionally fails due to the state of the timers from the previous test iteration. Advancing the clock step after the reset resolves this issue.

---
  tests/qtest/npcm7xx_timer-test.c | 1 +
  1 file changed, 1 insertion(+)
tests/qtest/npcm7xx_timer-test.c +0 -0
index 43711049ca..58f58c2f71 100644

tests/qtest/npcm7xx_timer-test.c static void test_periodic_interrupt(gconstpointer test_data) · line 471

Quoted 7 lines
tests/qtest/npcm7xx_timer-test.c +1 -0
@@ -465,6 +465,7 @@ static void test_periodic_interrupt(gconstpointer test_data)
      int i;
 
      tim_reset(td);
+    clock_step_next();
 
      tim_write_ticr(td, count);
      tim_write_tcsr(td, CEN | IE | MODE_PERIODIC | PRESCALE(ps));

Thanks! I'll queue it for my next pull request.