@@ -78,33 +78,3 @@ struct Ext4FormatCreateTests {
7878 } // should create /parent automatically
7979 }
8080}
81-
82- @Suite ( . serialized)
83- struct NegativeTimestampRoundtripTests {
84- private let fsPath = FilePath (
85- FileManager . default. temporaryDirectory
86- . appendingPathComponent ( " ext4-pre1970-roundtrip.img " , isDirectory: false ) )
87- private let apollo11MoonLanding : Date = {
88- let f = ISO8601DateFormatter ( )
89- f. formatOptions = [ . withInternetDateTime, . withFractionalSeconds]
90- return f. date ( from: " 1969-07-20T20:17:39.9Z " ) !
91- } ( )
92-
93- @Test func encodeNegativeTimestamp( ) throws {
94- let formatter = try EXT4 . Formatter ( fsPath, minDiskSize: 32 . kib ( ) )
95- defer { try ? formatter. close ( ) }
96- let ts = FileTimestamps ( access: apollo11MoonLanding, modification: apollo11MoonLanding, creation: apollo11MoonLanding)
97- try formatter. create ( path: FilePath ( " /file " ) , mode: EXT4 . Inode. Mode ( . S_IFREG, 0o755 ) , ts: ts, buf: nil )
98- }
99-
100- @Test func decodeNegativeTimestamp( ) throws {
101- let reader = try EXT4 . EXT4Reader ( blockDevice: fsPath)
102- let ( _, inode) = try reader. stat ( FilePath ( " /file " ) )
103- let mtime = Date ( fsTimestamp: UInt64 ( inode. mtime) | ( UInt64 ( inode. mtimeExtra) << 32 ) )
104- let atime = Date ( fsTimestamp: UInt64 ( inode. atime) | ( UInt64 ( inode. atimeExtra) << 32 ) )
105- let crtime = Date ( fsTimestamp: UInt64 ( inode. crtime) | ( UInt64 ( inode. crtimeExtra) << 32 ) )
106- #expect( mtime == apollo11MoonLanding)
107- #expect( atime == apollo11MoonLanding)
108- #expect( crtime == apollo11MoonLanding)
109- }
110- }
0 commit comments