Skip to content

Commit 2bb3e5e

Browse files
authored
Add compiler diagnostics to a test that sometimes fails in CI due to what seem to be module rebuilding issues. The diagnostics are only shown if the test fails; they don't pollute the regular output. (#3424)
1 parent 41b97c8 commit 2bb3e5e

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

Tests/FunctionalTests/MiscellaneousTests.swift

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -518,29 +518,30 @@ class MiscellaneousTestCase: XCTestCase {
518518
}
519519

520520
func testEnableTestDiscoveryDeprecation() throws {
521+
let compilerDiagnosticFlags = ["-Xswiftc", "-Xfrontend", "-Xswiftc", "-Rmodule-interface-rebuild"]
521522
#if canImport(Darwin)
522523
// should emit when LinuxMain is present
523524
fixture(name: "Miscellaneous/TestDiscovery/Simple") { path in
524-
let (_, stderr) = try SwiftPMProduct.SwiftTest.execute(["--enable-test-discovery"], packagePath: path)
525+
let (_, stderr) = try SwiftPMProduct.SwiftTest.execute(["--enable-test-discovery"] + compilerDiagnosticFlags, packagePath: path)
525526
XCTAssertMatch(stderr, .contains("warning: '--enable-test-discovery' option is deprecated"))
526527
}
527528

528529
// should emit when LinuxMain is not present
529530
fixture(name: "Miscellaneous/TestDiscovery/Simple") { path in
530531
try localFileSystem.writeFileContents(path.appending(components: "Tests", SwiftTarget.testManifestNames.first!), bytes: "fatalError(\"boom\")")
531-
let (_, stderr) = try SwiftPMProduct.SwiftTest.execute(["--enable-test-discovery"], packagePath: path)
532+
let (_, stderr) = try SwiftPMProduct.SwiftTest.execute(["--enable-test-discovery"] + compilerDiagnosticFlags, packagePath: path)
532533
XCTAssertMatch(stderr, .contains("warning: '--enable-test-discovery' option is deprecated"))
533534
}
534535
#else
535536
// should emit when LinuxMain is present
536537
fixture(name: "Miscellaneous/TestDiscovery/Simple") { path in
537-
let (_, stderr) = try SwiftPMProduct.SwiftTest.execute(["--enable-test-discovery"], packagePath: path)
538+
let (_, stderr) = try SwiftPMProduct.SwiftTest.execute(["--enable-test-discovery"] + compilerDiagnosticFlags, packagePath: path)
538539
XCTAssertMatch(stderr, .contains("warning: '--enable-test-discovery' option is deprecated"))
539540
}
540541
// should not emit when LinuxMain is present
541542
fixture(name: "Miscellaneous/TestDiscovery/Simple") { path in
542543
try localFileSystem.writeFileContents(path.appending(components: "Tests", SwiftTarget.testManifestNames.first!), bytes: "fatalError(\"boom\")")
543-
let (_, stderr) = try SwiftPMProduct.SwiftTest.execute(["--enable-test-discovery"], packagePath: path)
544+
let (_, stderr) = try SwiftPMProduct.SwiftTest.execute(["--enable-test-discovery"] + compilerDiagnosticFlags, packagePath: path)
544545
XCTAssertNoMatch(stderr, .contains("warning: '--enable-test-discovery' option is deprecated"))
545546
}
546547
#endif

0 commit comments

Comments
 (0)