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

Chris Rauer posted 1 patch 7 months, 1 week ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20230929000831.691559-1-crauer@google.com
Maintainers: Tyrone Ting <kfting@nuvoton.com>, Hao Wu <wuhaotsh@google.com>, Thomas Huth <thuth@redhat.com>, Laurent Vivier <lvivier@redhat.com>, Paolo Bonzini <pbonzini@redhat.com>
tests/qtest/npcm7xx_timer-test.c | 1 +
1 file changed, 1 insertion(+)
[PATCH v2] tests/qtest: Fix npcm7xx_timer-test.c flaky test
Posted by Chris Rauer 7 months, 1 week ago
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.

Fixes: https://gitlab.com/qemu-project/qemu/-/issues/1897
Signed-off-by: Chris Rauer <crauer@google.com>
---
 tests/qtest/npcm7xx_timer-test.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tests/qtest/npcm7xx_timer-test.c b/tests/qtest/npcm7xx_timer-test.c
index 43711049ca..58f58c2f71 100644
--- a/tests/qtest/npcm7xx_timer-test.c
+++ b/tests/qtest/npcm7xx_timer-test.c
@@ -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));
-- 
2.42.0.515.g380fc7ccd1-goog
Re: [PATCH v2] tests/qtest: Fix npcm7xx_timer-test.c flaky test
Posted by Thomas Huth 7 months, 1 week ago
On 29/09/2023 02.08, Chris Rauer wrote:
> 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.
> 
> Fixes: https://gitlab.com/qemu-project/qemu/-/issues/1897
> Signed-off-by: Chris Rauer <crauer@google.com>
> ---
>   tests/qtest/npcm7xx_timer-test.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/tests/qtest/npcm7xx_timer-test.c b/tests/qtest/npcm7xx_timer-test.c
> index 43711049ca..58f58c2f71 100644
> --- a/tests/qtest/npcm7xx_timer-test.c
> +++ b/tests/qtest/npcm7xx_timer-test.c
> @@ -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.

Acked-by: Thomas Huth <thuth@redhat.com>