From 7f55fa12f488406f63013e9ec7f04dfb04bfd792 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20R=C3=B8nne=20Petersen?= Date: Tue, 1 Oct 2024 13:10:56 +0200 Subject: [PATCH] std.posix: Skip Stat struct comparison in fstatat test for s390x-linux. On s390x-linux, fstat() does not have nanosecond precision, but fstatat() does. As a result, comparing Stat structs returned from these syscalls is doomed to fail. --- lib/std/posix/test.zig | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/std/posix/test.zig b/lib/std/posix/test.zig index e62ffa39ca..dba7dcde6d 100644 --- a/lib/std/posix/test.zig +++ b/lib/std/posix/test.zig @@ -368,6 +368,11 @@ test "fstatat" { // now repeat but using `fstatat` instead const flags = if (native_os == .wasi) 0x0 else posix.AT.SYMLINK_NOFOLLOW; const statat = try posix.fstatat(tmp.dir.fd, "file.txt", flags); + + // s390x-linux does not have nanosecond precision for fstat(), but it does for fstatat(). As a + // result, comparing the two structures is doomed to fail. + if (builtin.cpu.arch == .s390x and builtin.os.tag == .linux) return error.SkipZigTest; + try expectEqual(stat, statat); }