Skip to content

Tests: Update expectation #8891

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 13 additions & 21 deletions Tests/CommandsTests/BuildCommandTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -489,18 +489,14 @@ struct BuildCommandTestCases {
return
}

try withKnownIssue {
if .native == buildSystem {
#expect(stderr.contains("error: no product named '\(productName)'"))
} else {
let expectedErrorMessageRegex = try Regex("error: Could not find target named '\(productName).*'")
#expect(
stderr.contains(expectedErrorMessageRegex),
"expect log not emitted.\nstdout: '\(stdout)'\n\nstderr: '\(stderr)'",
)
}
} when: {
buildSystem == .swiftbuild && ProcessInfo.hostOperatingSystem == .windows && CiEnvironment.runningInSmokeTestPipeline
if .native == buildSystem {
#expect(stderr.contains("error: no product named '\(productName)'"))
} else {
let expectedErrorMessageRegex = try Regex("error: Could not find target named '\(productName).*'")
#expect(
stderr.contains(expectedErrorMessageRegex),
"expect log not emitted.\nstdout: '\(stdout)'\n\nstderr: '\(stderr)'",
)
}
}
}
Expand Down Expand Up @@ -530,14 +526,10 @@ struct BuildCommandTestCases {
} else {
expectedErrorMessage = "error: Could not find target named '\(targetName)'"
}
withKnownIssue{
#expect(
stderr.contains(expectedErrorMessage),
"expect log not emitted.\nstdout: '\(stdout)'\n\nstderr: '\(stderr)'",
)
} when: {
buildSystem == .swiftbuild && ProcessInfo.hostOperatingSystem == .windows && CiEnvironment.runningInSmokeTestPipeline
}
#expect(
stderr.contains(expectedErrorMessage),
"expect log not emitted.\nstdout: '\(stdout)'\n\nstderr: '\(stderr)'",
)
}
}

Expand Down Expand Up @@ -748,7 +740,7 @@ struct BuildCommandTestCases {
result.stdout.contains("Building for \(expectedString)"),
"expect log not emitted. got stdout: '\(result.stdout)'\n\nstderr '\(result.stderr)'")
} when: {
buildSystem == .xcode || (buildSystem == .swiftbuild && ProcessInfo.hostOperatingSystem == .windows && CiEnvironment.runningInSmokeTestPipeline)
buildSystem == .xcode
}
}
}
Expand Down
9 changes: 6 additions & 3 deletions Tests/CommandsTests/RunCommandTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,8 @@ struct RunCommandTests {
}
}
} when: {
.swiftbuild == buildSystem && ProcessInfo.hostOperatingSystem == .windows
(.swiftbuild == buildSystem && ProcessInfo.hostOperatingSystem == .windows)
|| (.native == buildSystem && ProcessInfo.hostOperatingSystem == .windows && CiEnvironment.runningInSmokeTestPipeline)
}
}

Expand Down Expand Up @@ -168,6 +169,7 @@ struct RunCommandTests {
}
} when: {
(.windows == ProcessInfo.hostOperatingSystem && buildSystem == .swiftbuild)
|| (.windows == ProcessInfo.hostOperatingSystem && buildSystem == .native && CiEnvironment.runningInSmokeTestPipeline)
|| (.linux == ProcessInfo.hostOperatingSystem && buildSystem == .swiftbuild && CiEnvironment.runningInSelfHostedPipeline)
}
}
Expand Down Expand Up @@ -229,7 +231,8 @@ struct RunCommandTests {
#expect(runOutput.contains("2"))
}
} when: {
[.windows, .linux].contains(ProcessInfo.hostOperatingSystem) && buildSystem == .swiftbuild && CiEnvironment.runningInSelfHostedPipeline
([.windows, .linux].contains(ProcessInfo.hostOperatingSystem) && buildSystem == .swiftbuild && CiEnvironment.runningInSelfHostedPipeline)
|| (.windows == ProcessInfo.hostOperatingSystem && [.native, .swiftbuild].contains(buildSystem) && CiEnvironment.runningInSmokeTestPipeline)
}
}

Expand All @@ -249,7 +252,7 @@ struct RunCommandTests {
#expect(String(outputLines[0]).contains("BTarget2"))
}
} when: {
(ProcessInfo.hostOperatingSystem == .windows && CiEnvironment.runningInSmokeTestPipeline && buildSystem == .native)
(ProcessInfo.hostOperatingSystem == .windows && CiEnvironment.runningInSmokeTestPipeline && [.native, .swiftbuild].contains(buildSystem))
|| (ProcessInfo.hostOperatingSystem == .linux && buildSystem == .swiftbuild && CiEnvironment.runningInSelfHostedPipeline)
}
}
Expand Down
2 changes: 1 addition & 1 deletion Tests/FunctionalTests/PluginTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ final class PluginTests {
#expect(stderr.contains("file(s) which are unhandled; explicitly declare them as resources or exclude from the target"), "expected warning not emitted")
}
} when: {
ProcessInfo.hostOperatingSystem == .windows
ProcessInfo.hostOperatingSystem == .windows && CiEnvironment.runningInSelfHostedPipeline
}

// Try again with the Swift Build build system
Expand Down
3 changes: 1 addition & 2 deletions Tests/FunctionalTests/TraitTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -494,8 +494,7 @@ struct TraitTests {
#expect(stdout.contains(expectedOut))
}
} when: {
ProcessInfo.hostOperatingSystem == .windows && CiEnvironment.runningInSmokeTestPipeline
|| (buildSystem == .swiftbuild && [.windows].contains(ProcessInfo.hostOperatingSystem))
(buildSystem == .swiftbuild && [.windows].contains(ProcessInfo.hostOperatingSystem))
}
}

Expand Down