diff options
author | Jo-Philipp Wich <jo@mein.io> | 2022-11-29 10:10:04 +0100 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2022-11-29 10:16:47 +0100 |
commit | eef83d3e849743911b29133e6ef873f7e0d34c1c (patch) | |
tree | 92c6ba42a47fc5fade977679871695c10b57aad4 | |
parent | 191a536c04382270538bc2973c6a97d4d66725f3 (diff) |
tests: relax sleep() test
Invoking `sleep(1000)` in the CI container often sleeps slightly longer
than exactly 1000ms, causing the test output to mismatch.
Relax the test requirement to simply ensure that t2 > t1.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
-rw-r--r-- | tests/custom/03_stdlib/41_sleep | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/tests/custom/03_stdlib/41_sleep b/tests/custom/03_stdlib/41_sleep index bca6f0d..0f918d3 100644 --- a/tests/custom/03_stdlib/41_sleep +++ b/tests/custom/03_stdlib/41_sleep @@ -14,12 +14,15 @@ negative or zero. let t2 = time(); - printf("Slept for %d second(s).\n", t2 - t1); + if (t2 > t1) + printf("Slept for at least one second.\n"); + else + printf("Unexpected time delta: %d\n", t2 - t1); %} -- End -- -- Expect stdout -- -Slept for 1 second(s). +Slept for at least one second. -- End -- |