| ... | @@ -395,11 +395,27 @@ test "fstatat" { | ... | @@ -395,11 +395,27 @@ test "fstatat" { |
| 395 | // now repeat but using `fstatat` instead | 395 | // now repeat but using `fstatat` instead |
| 396 | const statat = try posix.fstatat(tmp.dir.fd, "file.txt", posix.AT.SYMLINK_NOFOLLOW); | 396 | const statat = try posix.fstatat(tmp.dir.fd, "file.txt", posix.AT.SYMLINK_NOFOLLOW); |
| 397 | | 397 | |
| 398 | // s390x-linux does not have nanosecond precision for fstat(), but it does for fstatat(). As a | 398 | try expectEqual(stat.dev, statat.dev); |
| 399 | // result, comparing the two structures is doomed to fail. | 399 | try expectEqual(stat.ino, statat.ino); |
| 400 | if (builtin.cpu.arch == .s390x and builtin.os.tag == .linux) return error.SkipZigTest; | 400 | try expectEqual(stat.nlink, statat.nlink); |
| 401 | | 401 | try expectEqual(stat.mode, statat.mode); |
| 402 | try expectEqual(stat, statat); | 402 | try expectEqual(stat.uid, statat.uid); |
| | 403 | try expectEqual(stat.gid, statat.gid); |
| | 404 | try expectEqual(stat.rdev, statat.rdev); |
| | 405 | try expectEqual(stat.size, statat.size); |
| | 406 | try expectEqual(stat.blksize, statat.blksize); |
| | 407 | |
| | 408 | // The stat.blocks/statat.blocks count is managed by the filesystem and may |
| | 409 | // change if the file is stored in a journal or "inline". |
| | 410 | // try expectEqual(stat.blocks, statat.blocks); |
| | 411 | |
| | 412 | // s390x-linux does not have nanosecond precision for fstat(), but it does for |
| | 413 | // fstatat(). As a result, comparing the timestamps isn't worth the effort |
| | 414 | if (!(builtin.cpu.arch == .s390x and builtin.os.tag == .linux)) { |
| | 415 | try expectEqual(stat.atime(), statat.atime()); |
| | 416 | try expectEqual(stat.mtime(), statat.mtime()); |
| | 417 | try expectEqual(stat.ctime(), statat.ctime()); |
| | 418 | } |
| 403 | } | 419 | } |
| 404 | | 420 | |
| 405 | test "readlinkat" { | 421 | test "readlinkat" { |