Skip to content

Commit d28a243

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 94b14f2 commit d28a243

File tree

4 files changed

+21
-27
lines changed

4 files changed

+21
-27
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: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,8 @@ struct RunCommandTests {
129129
}
130130
}
131131
} when: {
132-
.swiftbuild == buildSystem && ProcessInfo.hostOperatingSystem == .windows
132+
(.swiftbuild == buildSystem && ProcessInfo.hostOperatingSystem == .windows)
133+
|| (.native == buildSystem && ProcessInfo.hostOperatingSystem == .windows && CiEnvironment.runningInSmokeTestPipeline)
133134
}
134135
}
135136

@@ -168,6 +169,7 @@ struct RunCommandTests {
168169
}
169170
} when: {
170171
(.windows == ProcessInfo.hostOperatingSystem && buildSystem == .swiftbuild)
172+
|| (.windows == ProcessInfo.hostOperatingSystem && buildSystem == .native && CiEnvironment.runningInSmokeTestPipeline)
171173
|| (.linux == ProcessInfo.hostOperatingSystem && buildSystem == .swiftbuild && CiEnvironment.runningInSelfHostedPipeline)
172174
}
173175
}
@@ -229,7 +231,8 @@ struct RunCommandTests {
229231
#expect(runOutput.contains("2"))
230232
}
231233
} when: {
232-
[.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)
233236
}
234237
}
235238

@@ -249,7 +252,7 @@ struct RunCommandTests {
249252
#expect(String(outputLines[0]).contains("BTarget2"))
250253
}
251254
} when: {
252-
(ProcessInfo.hostOperatingSystem == .windows && CiEnvironment.runningInSmokeTestPipeline && buildSystem == .native)
255+
(ProcessInfo.hostOperatingSystem == .windows && CiEnvironment.runningInSmokeTestPipeline && [.native, .swiftbuild].contains(buildSystem))
253256
|| (ProcessInfo.hostOperatingSystem == .linux && buildSystem == .swiftbuild && CiEnvironment.runningInSelfHostedPipeline)
254257
}
255258
}

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)