Skip to content

Attempt to unbreak the build by building SwiftDriver module with -enable-testing in CMake. #363

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 4 commits into from
Nov 17, 2020

Conversation

artemcm
Copy link
Contributor

@artemcm artemcm commented Nov 14, 2020

Pass -enable-testing to SwiftDriver CMake build to allow the tests to be built on Linux in the presence of @testable.
Linux build bots are otherwise failing with:

/home/buildnode/jenkins/workspace/swift-PR-Linux@2/branch-main/swift-driver/Tests/SwiftDriverTests/IncrementalCompilationTests.swift:15:18: error: module 'SwiftDriver' was not compiled for testing

Tests relying on SwiftDriver were disabled in #364. This PR restores these tests.

@cltnschlosser
Copy link
Contributor

cltnschlosser commented Nov 14, 2020

Do we build in release configuration? (https://bugs.swift.org/browse/SR-1354)

I ran into this just now too when running the integration tests with spm (This fixed there, diff is broken to fix markdown):

diff --git a/README.md b/README.md
index b17beb4..442acaf 100644
--- a/README.md
+++ b/README.md
@@ -88,7 +88,7 @@ on the command line:

 $ SWIFT_DRIVER_ENABLE_INTEGRATION_TESTS=1 \
   SWIFT_DRIVER_LIT_DIR=/path/to/build/Ninja-ReleaseAssert/swift-.../test-... \
-  swift test -c release --parallel
+  swift test -c release -Xswiftc -enable-testing --parallel

 
 #### Testing against `swift` compiler trunk

@artemcm
Copy link
Contributor Author

artemcm commented Nov 14, 2020

I think in this case the problem is a little bit different, here the CMake build (not part of the test stage, but rather part of the build stage in build-script), on Linux, is building files that belong to the test targets. And that breaks if the imported module has not been built with -enable-testing

@cltnschlosser
Copy link
Contributor

Ah, does it need to build the tests?

So with this change we build with testability when doing things like building a toolchain? If yes, do we have a long term plan for getting rid of @testable?

@artemcm
Copy link
Contributor Author

artemcm commented Nov 14, 2020

Yeah that's a good question, and I definitely don't think this is anything workable long-term. This has been a bit of a perfect storm where our use of SPI caused build breaks with newest development compilers, and it was easier to remove that than debug the compiler, to unblock the build. Then we replaced it with Testable which had the effect this PR is trying to fix.

Long term, we should absolutely move away from Testable and do this properly, probably with library evolution and spi combination. This change is a very temporary workaround to get folks' PR tests working.

@DougGregor
Copy link
Member

@swift-ci please test

@DougGregor
Copy link
Member

Ah, macOS PR testing seems to have failed with this:

/Users/buildnode/jenkins/workspace/swift-PR-osx-smoke-test/branch-main/swift-driver/Tests/SwiftDriverTests/IncrementalCompilationTests.swift:15:18: error: module 'SwiftDriver' was not compiled for testing
21:39:25 @testable import SwiftDriver
21:39:25 ~~~~~~~~~~       ^
21:39:25 error: fatalError
21:39:25 xcrun --sdk macosx --show-sdk-path

@DougGregor
Copy link
Member

Folks, we can't have PR testing broken. I'm going to land #364 to disable the code with @testable import in it and we can sort this out on Monday.

@DougGregor
Copy link
Member

Make sure to revert #364 before tackling this.

@artemcm
Copy link
Contributor Author

artemcm commented Nov 17, 2020

@swift-ci please test

1 similar comment
@artemcm
Copy link
Contributor Author

artemcm commented Nov 17, 2020

@swift-ci please test

@artemcm artemcm merged commit de4c66b into swiftlang:main Nov 17, 2020
@artemcm artemcm deleted the TestableCMakeFlag branch January 20, 2021 19:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants