Skip to content

Commit f94d37b

Browse files
committed
Tests: Migrate MiscellaneousTest 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 84e8f44 commit f94d37b

File tree

6 files changed

+833
-474
lines changed

6 files changed

+833
-474
lines changed

Sources/Basics/Process.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ extension ProcessInfo {
3030
.windows
3131
#elseif os(FreeBSD)
3232
.freebsd
33+
#elseif os(Android)
34+
.android
3335
#else
3436
.unknown
3537
#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
@@ -53,7 +53,7 @@ extension SwiftPM {
5353
}
5454

5555
public var xctestBinaryPath: AbsolutePath {
56-
Self.xctestBinaryPath(for: RelativePath("swift-package-manager"))
56+
Self.xctestBinaryPath(for: RelativePath(self.executableName))
5757
}
5858

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

Sources/_InternalTestSupport/SwiftTesting+Helpers.swift

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,18 @@ public func expectFileExists(
1818

1919
#expect(
2020
localFileSystem.exists(path),
21-
"Files '\(path)' does not exist.",
21+
"File '\(path)' does not exist.",
22+
sourceLocation: sourceLocation,
23+
)
24+
}
25+
26+
public func requireFileExists(
27+
at path: AbsolutePath,
28+
sourceLocation: SourceLocation = #_sourceLocation,
29+
) throws {
30+
try #require(
31+
localFileSystem.exists(path),
32+
"File '\(path)' does not exist.",
2233
sourceLocation: sourceLocation,
2334
)
2435
}

Sources/_InternalTestSupport/SwiftTesting+TraitsBug.swift

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,13 @@ extension Trait where Self == Testing.Bug {
4646
)
4747
}
4848

49+
public static var IssueWindowsAbsoluteAndRelativePathTestFailures: Self {
50+
issue(
51+
"https://github.com/swiftlang/swift-package-manager/issues/8511",
52+
relationship: .defect,
53+
)
54+
}
55+
4956
public static var IssueWindowsLongPath: Self {
5057
.issue(
5158
// "https://github.com/swiftlang/swift-tools-support-core/pull/521",
@@ -61,6 +68,13 @@ extension Trait where Self == Testing.Bug {
6168
)
6269
}
6370

71+
public static var IssueSwiftBuildSpaceInPath: Self {
72+
.issue(
73+
"https://github.com/swiftlang/swift-package-manager/issues/8400",
74+
relationship: .defect,
75+
)
76+
}
77+
6478
public static var IssueSwiftBuildLinuxRunnable: Self {
6579
.issue(
6680
"https://github.com/swiftlang/swift-package-manager/issues/8416",

0 commit comments

Comments
 (0)