Skip to content

Commit 3590999

Browse files
authored
Update tests expecting a merge-module job to also accept emit-module (#3735)
Recent Swift drivers may schedule an emit-module job to build module-wide files instead of merging partial swiftmodules. Let's update tests hard coded to expect a merge-module job.
1 parent 2821ae5 commit 3590999

File tree

3 files changed

+15
-11
lines changed

3 files changed

+15
-11
lines changed

Sources/Build/BuildOperationBuildSystemDelegateHandler.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -729,6 +729,8 @@ fileprivate struct CommandTaskTracker {
729729
return "Linking \(targetName)"
730730
case "merge-module":
731731
return "Merging module \(targetName)"
732+
case "emit-module":
733+
return "Emitting module \(targetName)"
732734
case "generate-dsym":
733735
return "Generating \(targetName) dSYM"
734736
case "generate-pch":

Tests/FunctionalTests/MiscellaneousTests.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,11 @@ class MiscellaneousTestCase: XCTestCase {
3333
let (output, _) = try executeSwiftBuild(prefix.appending(component: "Bar"))
3434
XCTAssertMatch(output, .regex("Computed .* at 1\\.2\\.3"))
3535
XCTAssertMatch(output, .contains("Compiling Foo Foo.swift"))
36-
XCTAssertMatch(output, .contains("Merging module Foo"))
36+
XCTAssertMatch(output, .or(.contains("Merging module Foo"),
37+
.contains("Emitting module Foo")))
3738
XCTAssertMatch(output, .contains("Compiling Bar main.swift"))
38-
XCTAssertMatch(output, .contains("Merging module Bar"))
39+
XCTAssertMatch(output, .or(.contains("Merging module Bar"),
40+
.contains("Emitting module Bar")))
3941
XCTAssertMatch(output, .contains("Linking Bar"))
4042
}
4143
}

Tests/FunctionalTests/TestDiscoveryTests.swift

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ class TestDiscoveryTests: XCTestCase {
1818
fixture(name: "Miscellaneous/TestDiscovery/Simple") { path in
1919
let (stdout, _) = try executeSwiftBuild(path)
2020
#if os(macOS)
21-
XCTAssertMatch(stdout, .contains("Merging module Simple"))
21+
XCTAssertMatch(stdout, .contains("module Simple"))
2222
#else
23-
XCTAssertMatch(stdout, .contains("Merging module Simple"))
23+
XCTAssertMatch(stdout, .contains("module Simple"))
2424
#endif
2525
}
2626
}
@@ -29,10 +29,10 @@ class TestDiscoveryTests: XCTestCase {
2929
fixture(name: "Miscellaneous/TestDiscovery/Simple") { path in
3030
let (stdout, stderr) = try executeSwiftTest(path)
3131
#if os(macOS)
32-
XCTAssertMatch(stdout, .contains("Merging module Simple"))
32+
XCTAssertMatch(stdout, .contains("module Simple"))
3333
XCTAssertMatch(stderr, .contains("Executed 2 tests"))
3434
#else
35-
XCTAssertMatch(stdout, .contains("Merging module Simple"))
35+
XCTAssertMatch(stdout, .contains("module Simple"))
3636
XCTAssertMatch(stdout, .contains("Executed 2 tests"))
3737
#endif
3838
}
@@ -42,10 +42,10 @@ class TestDiscoveryTests: XCTestCase {
4242
fixture(name: "Miscellaneous/TestDiscovery/hello world") { path in
4343
let (stdout, stderr) = try executeSwiftTest(path)
4444
#if os(macOS)
45-
XCTAssertMatch(stdout, .contains("Merging module hello_world"))
45+
XCTAssertMatch(stdout, .contains("module hello_world"))
4646
XCTAssertMatch(stderr, .contains("Executed 1 test"))
4747
#else
48-
XCTAssertMatch(stdout, .contains("Merging module hello_world"))
48+
XCTAssertMatch(stdout, .contains("module hello_world"))
4949
XCTAssertMatch(stdout, .contains("Executed 1 test"))
5050
#endif
5151
}
@@ -61,7 +61,7 @@ class TestDiscoveryTests: XCTestCase {
6161
let manifestPath = path.appending(components: "Tests", name)
6262
try localFileSystem.writeFileContents(manifestPath, bytes: ByteString("print(\"\(random)\")".utf8))
6363
let (stdout, _) = try executeSwiftTest(path)
64-
XCTAssertMatch(stdout, .contains("Merging module Simple"))
64+
XCTAssertMatch(stdout, .contains("module Simple"))
6565
XCTAssertNoMatch(stdout, .contains("Executed 1 test"))
6666
XCTAssertMatch(stdout, .contains(random))
6767
}
@@ -78,7 +78,7 @@ class TestDiscoveryTests: XCTestCase {
7878
let manifestPath = path.appending(components: "Tests", name)
7979
try localFileSystem.writeFileContents(manifestPath, bytes: ByteString("fatalError(\"should not be called\")".utf8))
8080
let (stdout, _) = try executeSwiftTest(path, extraArgs: ["--enable-test-discovery"])
81-
XCTAssertMatch(stdout, .contains("Merging module Simple"))
81+
XCTAssertMatch(stdout, .contains("module Simple"))
8282
XCTAssertNoMatch(stdout, .contains("Executed 1 test"))
8383
}
8484
#endif
@@ -90,7 +90,7 @@ class TestDiscoveryTests: XCTestCase {
9090
#else
9191
fixture(name: "Miscellaneous/TestDiscovery/Extensions") { path in
9292
let (stdout, _) = try executeSwiftTest(path, extraArgs: ["--enable-test-discovery"])
93-
XCTAssertMatch(stdout, .contains("Merging module Simple"))
93+
XCTAssertMatch(stdout, .contains("module Simple"))
9494
XCTAssertMatch(stdout, .contains("SimpleTests1.testExample1"))
9595
XCTAssertMatch(stdout, .contains("SimpleTests1.testExample1_a"))
9696
XCTAssertMatch(stdout, .contains("SimpleTests2.testExample2"))

0 commit comments

Comments
 (0)