Skip to content

Commit d009c4c

Browse files
committed
Tests: Migrate MiscellaneousTests to Swift Testing and augment
Migrate the `MiscellaneousTests` suite to Swift Testing and augment the test to run against both the Native and SwiftBuild build system, in addition to the `debug`` and `release` build configuration. Depends on: #9013 Relates to: #8997 issue: rdar://157669245
1 parent 240f501 commit d009c4c

File tree

6 files changed

+809
-473
lines changed

6 files changed

+809
-473
lines changed

Sources/Basics/Process.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ extension ProcessInfo {
3535
.freebsd
3636
#elseif os(OpenBSD)
3737
.openbsd
38+
#elseif os(Android)
39+
.android
3840
#else
3941
.unknown
4042
#endif

Sources/_InternalTestSupport/BuildSystemProvider+Configuration.swift

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,7 @@ extension BuildSystemProvider.Kind {
5656
if let triple {
5757
tripleString = triple
5858
} else {
59-
do {
60-
tripleString = try UserToolchain.default.targetTriple.platformBuildPathComponent
61-
} catch {
62-
tripleString = ""
63-
}
59+
tripleString = try UserToolchain.default.targetTriple.platformBuildPathComponent
6460
}
6561
switch self {
6662
case .native:

Sources/_InternalTestSupport/SwiftPMProduct.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ extension SwiftPM {
5656
}
5757

5858
public var xctestBinaryPath: AbsolutePath {
59-
Self.xctestBinaryPath(for: RelativePath("swift-package-manager"))
59+
Self.xctestBinaryPath(for: RelativePath(self.executableName))
6060
}
6161

6262
public static func xctestBinaryPath(for executableName: RelativePath) -> AbsolutePath {

Sources/_InternalTestSupport/SwiftTesting+Helpers.swift

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,17 @@ public func expectFileExists(
3737
)
3838
}
3939

40+
public func requireFileExists(
41+
at path: AbsolutePath,
42+
sourceLocation: SourceLocation = #_sourceLocation,
43+
) throws {
44+
try #require(
45+
localFileSystem.exists(path),
46+
"File '\(path)' does not exist.",
47+
sourceLocation: sourceLocation,
48+
)
49+
}
50+
4051
public func expectFileDoesNotExists(
4152
at path: AbsolutePath,
4253
_ comment: Comment? = nil,

Sources/_InternalTestSupport/SwiftTesting+TraitsBug.swift

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,13 @@ extension Trait where Self == Testing.Bug {
4848
)
4949
}
5050

51+
public static var IssueWindowsAbsoluteAndRelativePathTestFailures: Self {
52+
issue(
53+
"https://github.com/swiftlang/swift-package-manager/issues/8511",
54+
relationship: .defect,
55+
)
56+
}
57+
5158
public static var IssueWindowsLongPath: Self {
5259
.issue(
5360
// "https://github.com/swiftlang/swift-tools-support-core/pull/521",
@@ -84,4 +91,12 @@ extension Trait where Self == Testing.Bug {
8491
relationship: .defect,
8592
)
8693
}
94+
95+
public static var IssueSwiftBuildSpaceInPath: Self {
96+
.issue(
97+
"https://github.com/swiftlang/swift-package-manager/issues/8400",
98+
relationship: .defect,
99+
)
100+
}
101+
87102
}

0 commit comments

Comments
 (0)