Skip to content

Commit 19d36b0

Browse files
committed
Update NIO Filesystem patch for upstream changes on CI
1 parent 7618f50 commit 19d36b0

File tree

1 file changed

+28
-27
lines changed

1 file changed

+28
-27
lines changed

swift-nio-filesystem.patch

Lines changed: 28 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ index c18e2c8e..65872fb9 100644
6060
let temporaryDirectory = try await FileSystem.shared.temporaryDirectory
6161
@@ -1013,7 +1012,7 @@ final class FileHandleTests: XCTestCase {
6262
try await handle.close()
63-
let info = try await FileSystem.shared.info(forFileAt: path)
63+
let info = try await FileSystem.shared.info(forFileAt: NIOFilePath(path))
6464
XCTAssertNotNil(info)
6565
- }
6666
+ }*/
@@ -71,23 +71,24 @@ diff --git a/Tests/NIOFileSystemIntegrationTests/FileSystemTests.swift b/Tests/N
7171
index f24736a7..310d9691 100644
7272
--- a/Tests/NIOFileSystemIntegrationTests/FileSystemTests.swift
7373
+++ b/Tests/NIOFileSystemIntegrationTests/FileSystemTests.swift
74-
@@ -19,8 +19,8 @@ import NIOCore
75-
@_spi(Testing) @testable import _NIOFileSystem
76-
77-
extension FilePath {
78-
- static let testData = FilePath(#filePath)
79-
- .removingLastComponent() // FileHandleTests.swift
80-
+ static let testFile = FilePath("/data/data/com.termux/pack/FileHandleTests.swift")
81-
+ static let testData = FilePath("/data/data/com.termux/pack/")
82-
.appending("Test Data")
83-
.lexicallyNormalized()
74+
@@ -19,9 +19,8 @@ import NIOCore
75+
import XCTest
8476

77+
extension NIOFilePath {
78+
- static let testData = NIOFilePath(
79+
- FilePath(#filePath)
80+
- .removingLastComponent() // FileHandleTests.swift
81+
+ static let testFile = NIOFilePath("/data/data/com.termux/pack/FileHandleTests.swift")
82+
+ static let testData = NIOFilePath(FilePath("/data/data/com.termux/pack/")
83+
.appending("Test Data")
84+
.lexicallyNormalized()
85+
)
8586
@@ -100,7 +100,7 @@ final class FileSystemTests: XCTestCase {
8687
}
8788

8889
func testOpenFileWhereIntermediateIsNotADirectory() async throws {
89-
- let path = FilePath(#filePath).appending("foobar")
90-
+ let path = FilePath.testFile.appending("foobar")
90+
- let path = NIOFilePath(FilePath(#filePath).appending("foobar"))
91+
+ let path = NIOFilePath(FilePath(NIOFilePath.testFile).appending("foobar"))
9192

9293
// For reading:
9394
await XCTAssertThrowsFileSystemErrorAsync {
@@ -99,7 +100,7 @@ index f24736a7..310d9691 100644
99100
+ /*func testOpenNonExistentFileForWritingWithMaterialization() async throws {
100101
for isAbsolute in [true, false] {
101102
let path = try await self.fs.temporaryFilePath(inTemporaryDirectory: isAbsolute)
102-
XCTAssertEqual(path.isAbsolute, isAbsolute)
103+
XCTAssertEqual(path.underlying.isAbsolute, isAbsolute)
103104
@@ -256,7 +256,7 @@ final class FileSystemTests: XCTestCase {
104105
XCTAssertEqual(buffer.readBytes(length: 1024), Array(repeating: 0, count: 1024))
105106
XCTAssertEqual(buffer.readBytes(length: 1024), Array(repeating: 1, count: 1024))
@@ -149,53 +150,53 @@ index f24736a7..310d9691 100644
149150
}
150151

151152
func testReadChunksRange() async throws {
152-
- try await self.fs.withFileHandle(forReadingAt: FilePath(#filePath)) { handle in
153-
+ try await self.fs.withFileHandle(forReadingAt: FilePath.testFile) { handle in
153+
- try await self.fs.withFileHandle(forReadingAt: NIOFilePath(#filePath)) { handle in
154+
+ try await self.fs.withFileHandle(forReadingAt: NIOFilePath.testFile) { handle in
154155
let info = try await handle.info()
155156
let size = info.size
156157
let endIndex = size + 1
157158
@@ -1310,7 +1310,7 @@ extension FileSystemTests {
158159
}
159160

160161
func testReadChunksClosedRange() async throws {
161-
- try await self.fs.withFileHandle(forReadingAt: FilePath(#filePath)) { handle in
162-
+ try await self.fs.withFileHandle(forReadingAt: FilePath.testFile) { handle in
162+
- try await self.fs.withFileHandle(forReadingAt: NIOFilePath(#filePath)) { handle in
163+
+ try await self.fs.withFileHandle(forReadingAt: NIOFilePath.testFile) { handle in
163164
let info = try await handle.info()
164165
let size = info.size
165166
let endIndex = size + 1
166167
@@ -1337,7 +1337,7 @@ extension FileSystemTests {
167168
}
168169

169170
func testReadChunksPartialRangeUpTo() async throws {
170-
- try await self.fs.withFileHandle(forReadingAt: FilePath(#filePath)) { handle in
171-
+ try await self.fs.withFileHandle(forReadingAt: FilePath.testFile) { handle in
171+
- try await self.fs.withFileHandle(forReadingAt: NIOFilePath(#filePath)) { handle in
172+
+ try await self.fs.withFileHandle(forReadingAt: NIOFilePath.testFile) { handle in
172173
let info = try await handle.info()
173174
let size = info.size
174175
let endIndex = size + 1
175176
@@ -1365,7 +1365,7 @@ extension FileSystemTests {
176177
}
177178

178179
func testReadChunksPartialRangeThrough() async throws {
179-
- try await self.fs.withFileHandle(forReadingAt: FilePath(#filePath)) { handle in
180-
+ try await self.fs.withFileHandle(forReadingAt: FilePath.testFile) { handle in
180+
- try await self.fs.withFileHandle(forReadingAt: NIOFilePath(#filePath)) { handle in
181+
+ try await self.fs.withFileHandle(forReadingAt: NIOFilePath.testFile) { handle in
181182
let info = try await handle.info()
182183
let size = info.size
183184
let endIndex = size + 1
184185
@@ -1394,7 +1394,7 @@ extension FileSystemTests {
185186
}
186187

187188
func testReadChunksPartialRangeFrom() async throws {
188-
- try await self.fs.withFileHandle(forReadingAt: FilePath(#filePath)) { handle in
189-
+ try await self.fs.withFileHandle(forReadingAt: FilePath.testFile) { handle in
189+
- try await self.fs.withFileHandle(forReadingAt: NIOFilePath(#filePath)) { handle in
190+
+ try await self.fs.withFileHandle(forReadingAt: NIOFilePath.testFile) { handle in
190191
let info = try await handle.info()
191192
let size = info.size
192193
let endIndex = size + 1
193194
@@ -1418,7 +1418,7 @@ extension FileSystemTests {
194195
}
195196

196197
func testReadChunksUnboundedRange() async throws {
197-
- try await self.fs.withFileHandle(forReadingAt: FilePath(#filePath)) { handle in
198-
+ try await self.fs.withFileHandle(forReadingAt: FilePath.testFile) { handle in
198+
- try await self.fs.withFileHandle(forReadingAt: NIOFilePath(#filePath)) { handle in
199+
+ try await self.fs.withFileHandle(forReadingAt: NIOFilePath.testFile) { handle in
199200
let info = try await handle.info()
200201
let size = info.size
201202

@@ -204,8 +205,8 @@ index 66ed1171..5253a650 100644
204205
--- a/Tests/NIOFileSystemTests/Internal/SyscallTests.swift
205206
+++ b/Tests/NIOFileSystemTests/Internal/SyscallTests.swift
206207
@@ -17,6 +17,10 @@
208+
import SystemPackage
207209
import XCTest
208-
@_spi(Testing) import _NIOFileSystem
209210

210211
+#if canImport(Android)
211212
+import Android

0 commit comments

Comments
 (0)