From 404452728d0be2568c0b2ed4e5fefda9d4989f06 Mon Sep 17 00:00:00 2001 From: Jakub Jelen Date: Thu, 5 Dec 2024 17:18:20 +0100 Subject: [PATCH] tests: Fix random failure on too fast systems On mingw we are frequently getting a failure like this: [ ERROR ] --- 451 is not within the range 1-450 This means the 50ms sleep did not manage to elapse the 50ms in the timeout structure. Extending the range to 460 will give use more wiggle room if the clock is not as it should be. Related: #273 Signed-off-by: Jakub Jelen Reviewed-by: Andreas Schneider (cherry picked from commit 874b75429f035e68f2e197a414df4fdcb4626a22) --- tests/unittests/torture_misc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unittests/torture_misc.c b/tests/unittests/torture_misc.c index 9805187c..4f25f7dc 100644 --- a/tests/unittests/torture_misc.c +++ b/tests/unittests/torture_misc.c @@ -241,7 +241,7 @@ static void torture_timeout_update(void **state){ usleep(50000); assert_int_equal(ssh_timeout_update(&ts,25), 0); assert_in_range(ssh_timeout_update(&ts,30000),29000,29960); - assert_in_range(ssh_timeout_update(&ts,500),1,450); + assert_in_range(ssh_timeout_update(&ts,500),1,460); assert_int_equal(ssh_timeout_update(&ts,0),0); assert_int_equal(ssh_timeout_update(&ts,-1),-1); }