authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2024-10-01 13:10:56+02:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2024-10-04 00:26:55+02:00
log7f55fa12f488406f63013e9ec7f04dfb04bfd792
treea0dd73092a03f36a4b2bd576d5f4277a32766f24
parentf4c23726a34e1f8f0bf4527bf4cafd6d0d14f2ec
signaturebadge-check Signed by SSH key SHA256:7B/LJ7bpR1eX8aCXSr4mtd5M45VMPKcx9zY8e95b5QM

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.

1 files changed, 5 insertions(+), 0 deletions(-)

lib/std/posix/test.zig+5
...@@ -368,6 +368,11 @@ test "fstatat" {...@@ -368,6 +368,11 @@ test "fstatat" {
368 // now repeat but using `fstatat` instead368 // now repeat but using `fstatat` instead
369 const flags = if (native_os == .wasi) 0x0 else posix.AT.SYMLINK_NOFOLLOW;369 const flags = if (native_os == .wasi) 0x0 else posix.AT.SYMLINK_NOFOLLOW;
370 const statat = try posix.fstatat(tmp.dir.fd, "file.txt", flags);370 const statat = try posix.fstatat(tmp.dir.fd, "file.txt", flags);
371
372 // s390x-linux does not have nanosecond precision for fstat(), but it does for fstatat(). As a
373 // result, comparing the two structures is doomed to fail.
374 if (builtin.cpu.arch == .s390x and builtin.os.tag == .linux) return error.SkipZigTest;
375
371 try expectEqual(stat, statat);376 try expectEqual(stat, statat);
372}377}
373378