10
10
11
11
import Foundation
12
12
import Testing
13
- // import TSCBasic
14
13
import _InternalTestSupport
15
14
import TSCTestSupport
16
15
import enum TSCUtility. Git
@@ -109,26 +108,6 @@ public let lldb: AbsolutePath = {
109
108
#endif
110
109
} ( )
111
110
112
- // public let swiftpmBinaryDirectory: AbsolutePath = {
113
- // if let environmentPath = ProcessInfo.processInfo.environment["SWIFTPM_CUSTOM_BIN_DIR"] {
114
- // return try! AbsolutePath(validating: environmentPath)
115
- // }
116
-
117
- // return swift.parentDirectory
118
- // }()
119
-
120
- // public let swiftBuild: AbsolutePath = swiftpmBinaryDirectory.appending(component: "swift-build")
121
-
122
- // public let swiftPackage: AbsolutePath = swiftpmBinaryDirectory.appending(component: "swift-package")
123
-
124
- // public let swiftTest: AbsolutePath = swiftpmBinaryDirectory.appending(component: "swift-test")
125
-
126
- // public let swiftRun: AbsolutePath = swiftpmBinaryDirectory.appending(component: "swift-run")
127
-
128
- // public let isSelfHosted: Bool = {
129
- // ProcessInfo.processInfo.environment["SWIFTCI_IS_SELF_HOSTED"] != nil
130
- // }()
131
-
132
111
@discardableResult
133
112
package func sh(
134
113
_ arguments: CustomStringConvertible ... ,
@@ -152,29 +131,6 @@ package func sh(
152
131
return ( stdout, stderr, result. exitStatus)
153
132
}
154
133
155
- // @discardableResult
156
- // package func shFails(
157
- // _ arguments: CustomStringConvertible...,
158
- // env: [String: String] = [:],
159
- // file: StaticString = #file,
160
- // line: UInt = #line
161
- // ) throws -> ShReturnType {
162
- // let result = try _sh(arguments, env: env, file: file, line: line)
163
- // let stdout = try result.utf8Output()
164
- // let stderr = try result.utf8stderrOutput()
165
-
166
- // if result.exitStatus == .terminated(code: 0) {
167
- // Issue
168
- // .record(
169
- // Comment(
170
- // "Command unexpectedly succeeded with exit code: \(result.exitStatus) - \(result.integrationTests_debugDescription)"
171
- // )
172
- // )
173
- // }
174
-
175
- // return (stdout, stderr, result.exitStatus)
176
- // }
177
-
178
134
@discardableResult
179
135
package func _sh(
180
136
_ arguments: [ CustomStringConvertible ] ,
@@ -198,125 +154,6 @@ package func _sh(
198
154
return result
199
155
}
200
156
201
- // /// Test-helper function that runs a block of code on a copy of a test fixture
202
- // /// package. The copy is made into a temporary directory, and the block is
203
- // /// given a path to that directory. The block is permitted to modify the copy.
204
- // /// The temporary copy is deleted after the block returns. The fixture name may
205
- // /// contain `/` characters, which are treated as path separators, exactly as if
206
- // /// the name were a relative path.
207
- // public func fixture(
208
- // name: String,
209
- // file: StaticString = #file,
210
- // line: UInt = #line,
211
- // body: (AbsolutePath) throws -> Void
212
- // ) {
213
- // do {
214
- // // Make a suitable test directory name from the fixture subpath.
215
- // let fixtureSubpath = try RelativePath(validating: name)
216
- // let copyName = fixtureSubpath.components.joined(separator: "_")
217
-
218
- // // Create a temporary directory for the duration of the block.
219
- // try withTemporaryDirectory(prefix: copyName) { tmpDirPath in
220
-
221
- // defer {
222
- // // Unblock and remove the tmp dir on deinit.
223
- // try? localFileSystem.chmod(.userWritable, path: tmpDirPath, options: [.recursive])
224
- // try? localFileSystem.removeFileTree(tmpDirPath)
225
- // }
226
-
227
- // // Construct the expected path of the fixture.
228
- // // FIXME: This seems quite hacky; we should provide some control over where fixtures are found.
229
- // let fixtureDir = try AbsolutePath(
230
- // validating: "../../../Fixtures/\(name)",
231
- // relativeTo: AbsolutePath(validating: #file)
232
- // )
233
-
234
- // // Check that the fixture is really there.
235
- // guard localFileSystem.isDirectory(fixtureDir) else {
236
- // Issue.record(Comment("No such fixture: \(fixtureDir)"))
237
- // return
238
- // }
239
-
240
- // // The fixture contains either a checkout or just a Git directory.
241
- // if localFileSystem.isFile(fixtureDir.appending(component: "Package.swift")) {
242
- // // It's a single package, so copy the whole directory as-is.
243
- // let dstDir = tmpDirPath.appending(component: copyName)
244
- // #if os(Windows)
245
- // try localFileSystem.copy(from: fixtureDir, to: dstDir)
246
- // #else
247
- // try systemQuietly("cp", "-R", "-H", fixtureDir.pathString, dstDir.pathString)
248
- // #endif
249
-
250
- // // Invoke the block, passing it the path of the copied fixture.
251
- // try body(dstDir)
252
- // } else {
253
- // // Copy each of the package directories and construct a git repo in it.
254
- // for fileName in try! localFileSystem.getDirectoryContents(fixtureDir).sorted() {
255
- // let srcDir = fixtureDir.appending(component: fileName)
256
- // guard localFileSystem.isDirectory(srcDir) else { continue }
257
- // let dstDir = tmpDirPath.appending(component: fileName)
258
- // #if os(Windows)
259
- // try localFileSystem.copy(from: srcDir, to: dstDir)
260
- // #else
261
- // try systemQuietly("cp", "-R", "-H", srcDir.pathString, dstDir.pathString)
262
- // #endif
263
- // initGitRepo(dstDir, tag: "1.2.3", addFile: false)
264
- // }
265
-
266
- // // Invoke the block, passing it the path of the copied fixture.
267
- // try body(tmpDirPath)
268
- // }
269
- // }
270
- // } catch {
271
- // Issue.record(error)
272
- // }
273
- // }
274
-
275
- // /// Test-helper function that creates a new Git repository in a directory. The new repository will contain
276
- // /// exactly one empty file unless `addFile` is `false`, and if a tag name is provided, a tag with that name will be
277
- // /// created.
278
- // public func initGitRepo(
279
- // _ dir: AbsolutePath,
280
- // tag: String? = nil,
281
- // addFile: Bool = true,
282
- // file: StaticString = #file,
283
- // line: UInt = #line
284
- // ) {
285
- // initGitRepo(dir, tags: tag.flatMap { [$0] } ?? [], addFile: addFile, file: file, line: line)
286
- // }
287
-
288
- // public func initGitRepo(
289
- // _ dir: AbsolutePath,
290
- // tags: [String],
291
- // addFile: Bool = true,
292
- // file: StaticString = #file,
293
- // line: UInt = #line
294
- // ) {
295
- // do {
296
- // if addFile {
297
- // let file = dir.appending(component: "file.swift")
298
- // try localFileSystem.writeFileContents(file, bytes: "")
299
- // }
300
-
301
- // try systemQuietly([Git.tool, "-C", dir.pathString, "init"])
302
- // try systemQuietly([
303
- // Git.tool, "-C", dir.pathString, "config", "user.email", "
[email protected] ",
304
- // ])
305
- // try systemQuietly([
306
- // Git.tool, "-C", dir.pathString, "config", "user.name", "Example Example",
307
- // ])
308
- // try systemQuietly([Git.tool, "-C", dir.pathString, "config", "commit.gpgsign", "false"])
309
- // try systemQuietly([Git.tool, "-C", dir.pathString, "add", "."])
310
- // try systemQuietly([Git.tool, "-C", dir.pathString, "commit", "-m", "Add some files."])
311
-
312
- // for tag in tags {
313
- // try systemQuietly([Git.tool, "-C", dir.pathString, "tag", tag])
314
- // }
315
- // } catch {
316
- // Issue.record(error)
317
- // }
318
- // }
319
-
320
157
public func binaryTargetsFixture( _ closure: ( AbsolutePath ) async throws -> Void ) async throws {
321
158
try await fixture ( name: " BinaryTargets " ) { fixturePath in
322
159
let inputsPath = fixturePath. appending ( component: " Inputs " )
0 commit comments