Skip to content

Commit 74edec8

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 de597e3 commit 74edec8

File tree

6 files changed

+820
-473
lines changed

6 files changed

+820
-473
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: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,17 @@ public func expectFileExists(
3535
)
3636
}
3737

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

Sources/_InternalTestSupport/SwiftTesting+TraitsBug.swift

Lines changed: 21 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",
@@ -75,4 +82,18 @@ extension Trait where Self == Testing.Bug {
7582
relationship: .defect,
7683
)
7784
}
85+
86+
public static var IssueSwiftBuildSpaceInPath: Self {
87+
.issue(
88+
"https://github.com/swiftlang/swift-package-manager/issues/8400",
89+
relationship: .defect,
90+
)
91+
}
92+
93+
public static var IssueSwiftBuildLinuxRunnable: Self {
94+
.issue(
95+
"https://github.com/swiftlang/swift-package-manager/issues/8416",
96+
relationship: .defect,
97+
)
98+
}
7899
}

0 commit comments

Comments
 (0)