Skip to content

Commit ec94b77

Browse files
authored
Update BuildToolTests.testBuildCompleteMessage (#3496)
Motivation: The build output on Linux for Swift >= 5.5 has changed. Causing self hosted Linux test to fail ([example](https://ci.swift.org/job/swift-package-manager-self-hosted-Linux-smoke-test/2051/)): ``` 21:29:49 Test Case 'BuildToolTests.testBuildCompleteMessage' started at 2021-05-13 04:29:06.495 21:29:49 /home/buildnode/jenkins/workspace/swift-package-manager-self-hosted-Linux-smoke-test/branch-main/swiftpm/Tests/CommandsTests/BuildToolTests.swift:256: error: BuildToolTests.testBuildCompleteMessage : XCTAssertTrue failed - [1/4] Compiling Bar Bar.swift 21:29:49 [3/6] Merging module Bar 21:29:49 [5/7] Wrapping AST for Bar for debugging 21:29:49 [6/9] Compiling Foo Foo.swift 21:29:49 [7/9] Compiling Foo main.swift 21:29:49 [9/11] Merging module Foo 21:29:49 [11/12] Wrapping AST for Foo for debugging 21:29:49 [12/12] Linking Foo 21:29:49 [12/12] Build complete! 21:29:49 21:29:49 Test Case 'BuildToolTests.testBuildCompleteMessage' failed (5.24 seconds) ``` Modification: Update expected output in `BuildToolTests.testBuildCompleteMessage`.
1 parent 1248164 commit ec94b77

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

Tests/CommandsTests/BuildToolTests.swift

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -250,15 +250,13 @@ final class BuildToolTests: XCTestCase {
250250
fixture(name: "DependencyResolution/Internal/Simple") { path in
251251
do {
252252
let result = try execute([], packagePath: path)
253-
#if os(macOS)
254-
XCTAssertTrue(result.stdout.contains("[6/6] Build complete!"), result.stdout)
255-
#else
256-
XCTAssertTrue(result.stdout.contains("[8/8] Build complete!"), result.stdout)
257-
#endif
253+
// Number of steps must be greater than 0. e.g., [8/8] Build complete!
254+
XCTAssertMatch(result.stdout, .regex("\\[[1-9][0-9]*\\/[1-9][0-9]*\\] Build complete!"))
258255
}
259256

260257
do {
261258
let result = try execute([], packagePath: path)
259+
// test second time, to make sure message is presented even when nothing to build (cached)
262260
XCTAssertTrue(result.stdout.contains("[0/0] Build complete!"), result.stdout)
263261
}
264262
}

0 commit comments

Comments
 (0)