Skip to content

Commit 43f7a9b

Browse files
committed
Tests: Update expectation
Update test expectation for executing SwiftPM tests using the build.ps1 script found in swiftlang/swift/utils/build.ps1. Relates to: swiftlang/swift#80405
1 parent 2bf2948 commit 43f7a9b

File tree

4 files changed

+19
-26
lines changed

4 files changed

+19
-26
lines changed

Tests/CommandsTests/BuildCommandTests.swift

Lines changed: 13 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -489,18 +489,14 @@ struct BuildCommandTestCases {
489489
return
490490
}
491491

492-
try withKnownIssue {
493-
if .native == buildSystem {
494-
#expect(stderr.contains("error: no product named '\(productName)'"))
495-
} else {
496-
let expectedErrorMessageRegex = try Regex("error: Could not find target named '\(productName).*'")
497-
#expect(
498-
stderr.contains(expectedErrorMessageRegex),
499-
"expect log not emitted.\nstdout: '\(stdout)'\n\nstderr: '\(stderr)'",
500-
)
501-
}
502-
} when: {
503-
buildSystem == .swiftbuild && ProcessInfo.hostOperatingSystem == .windows && CiEnvironment.runningInSmokeTestPipeline
492+
if .native == buildSystem {
493+
#expect(stderr.contains("error: no product named '\(productName)'"))
494+
} else {
495+
let expectedErrorMessageRegex = try Regex("error: Could not find target named '\(productName).*'")
496+
#expect(
497+
stderr.contains(expectedErrorMessageRegex),
498+
"expect log not emitted.\nstdout: '\(stdout)'\n\nstderr: '\(stderr)'",
499+
)
504500
}
505501
}
506502
}
@@ -530,14 +526,10 @@ struct BuildCommandTestCases {
530526
} else {
531527
expectedErrorMessage = "error: Could not find target named '\(targetName)'"
532528
}
533-
withKnownIssue{
534-
#expect(
535-
stderr.contains(expectedErrorMessage),
536-
"expect log not emitted.\nstdout: '\(stdout)'\n\nstderr: '\(stderr)'",
537-
)
538-
} when: {
539-
buildSystem == .swiftbuild && ProcessInfo.hostOperatingSystem == .windows && CiEnvironment.runningInSmokeTestPipeline
540-
}
529+
#expect(
530+
stderr.contains(expectedErrorMessage),
531+
"expect log not emitted.\nstdout: '\(stdout)'\n\nstderr: '\(stderr)'",
532+
)
541533
}
542534
}
543535

@@ -748,7 +740,7 @@ struct BuildCommandTestCases {
748740
result.stdout.contains("Building for \(expectedString)"),
749741
"expect log not emitted. got stdout: '\(result.stdout)'\n\nstderr '\(result.stderr)'")
750742
} when: {
751-
buildSystem == .xcode || (buildSystem == .swiftbuild && ProcessInfo.hostOperatingSystem == .windows && CiEnvironment.runningInSmokeTestPipeline)
743+
buildSystem == .xcode
752744
}
753745
}
754746
}

Tests/CommandsTests/RunCommandTests.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@ struct RunCommandTests {
169169
}
170170
} when: {
171171
(.windows == ProcessInfo.hostOperatingSystem && buildSystem == .swiftbuild)
172+
|| (.windows == ProcessInfo.hostOperatingSystem && buildSystem == .native && CiEnvironment.runningInSmokeTestPipeline)
172173
|| (.linux == ProcessInfo.hostOperatingSystem && buildSystem == .swiftbuild && CiEnvironment.runningInSelfHostedPipeline)
173174
}
174175
}
@@ -230,7 +231,8 @@ struct RunCommandTests {
230231
#expect(runOutput.contains("2"))
231232
}
232233
} when: {
233-
[.windows, .linux].contains(ProcessInfo.hostOperatingSystem) && buildSystem == .swiftbuild && CiEnvironment.runningInSelfHostedPipeline
234+
([.windows, .linux].contains(ProcessInfo.hostOperatingSystem) && buildSystem == .swiftbuild && CiEnvironment.runningInSelfHostedPipeline)
235+
|| (.windows == ProcessInfo.hostOperatingSystem && [.native, .swiftbuild].contains(buildSystem) && CiEnvironment.runningInSmokeTestPipeline)
234236
}
235237
}
236238

@@ -250,7 +252,7 @@ struct RunCommandTests {
250252
#expect(String(outputLines[0]).contains("BTarget2"))
251253
}
252254
} when: {
253-
(ProcessInfo.hostOperatingSystem == .windows && CiEnvironment.runningInSmokeTestPipeline && buildSystem == .native)
255+
(ProcessInfo.hostOperatingSystem == .windows && CiEnvironment.runningInSmokeTestPipeline && [.native, .swiftbuild].contains(buildSystem))
254256
|| (ProcessInfo.hostOperatingSystem == .linux && buildSystem == .swiftbuild && CiEnvironment.runningInSelfHostedPipeline)
255257
}
256258
}

Tests/FunctionalTests/PluginTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ final class PluginTests {
6464
#expect(stderr.contains("file(s) which are unhandled; explicitly declare them as resources or exclude from the target"), "expected warning not emitted")
6565
}
6666
} when: {
67-
ProcessInfo.hostOperatingSystem == .windows
67+
ProcessInfo.hostOperatingSystem == .windows && CiEnvironment.runningInSelfHostedPipeline
6868
}
6969

7070
// Try again with the Swift Build build system

Tests/FunctionalTests/TraitTests.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -494,8 +494,7 @@ struct TraitTests {
494494
#expect(stdout.contains(expectedOut))
495495
}
496496
} when: {
497-
ProcessInfo.hostOperatingSystem == .windows && CiEnvironment.runningInSmokeTestPipeline
498-
|| (buildSystem == .swiftbuild && [.windows].contains(ProcessInfo.hostOperatingSystem))
497+
(buildSystem == .swiftbuild && [.windows].contains(ProcessInfo.hostOperatingSystem))
499498
}
500499
}
501500

0 commit comments

Comments
 (0)