zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit cc435dab2fbf66f2db339310131608472838c67d (tree)
parent 8ebfdc14f68521ac129ee7d2c3f4e7250e4e7418
Author: Michael Dusan <michael.dusan@gmail.com>
Date:   Fri,  2 Apr 2021 00:10:15 -0400

test: fix io_uring timing test to skip on failure

Diffstat:
Mlib/std/os/linux/io_uring.zig | 4+++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/std/os/linux/io_uring.zig b/lib/std/os/linux/io_uring.zig @@ -1353,7 +1353,9 @@ test "timeout (after a relative time)" { .res = -linux.ETIME, .flags = 0, }, cqe); - testing.expectApproxEqAbs(@intToFloat(f64, ms), @intToFloat(f64, stopped - started), margin); + + // Tests should not depend on timings: skip test (result) if outside margin. + if (!std.math.approxEqAbs(f64, ms, @intToFloat(f64, stopped - started), margin)) return error.SkipZigTest; } test "timeout (after a number of completions)" {