Skip to content

Make it possible to configure Swift test options with CMake #34407

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 1 commit into from
Oct 27, 2020

Conversation

rmaz
Copy link
Contributor

@rmaz rmaz commented Oct 23, 2020

Currently it is only possible to specify Swift driver and frontend test options via environment variables. This makes it unwieldy to run the tests when cross compiling or compiling for different sysroots. This PR makes it possible to add Swift driver and frontend flags as part of CMake configuration using the existing names provided in the environment.

@gmittert
Copy link
Contributor

Looks good to me!
@swift-ci please test

@gmittert gmittert self-requested a review October 23, 2020 17:50
@gmittert
Copy link
Contributor

@swift-ci please smoke test

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 315d844266cf32cfff3d266c97934a64039cb7dd

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 315d844266cf32cfff3d266c97934a64039cb7dd

@gmittert
Copy link
Contributor

14:02:05   File "/home/buildnode/jenkins/workspace/swift-PR-Linux/branch-main/llvm-project/llvm/utils/lit/lit/TestingConfig.py", line 88, in load_from_path
14:02:05     exec(compile(data, path, 'exec'), cfg_globals, None)
14:02:05   File "/home/buildnode/jenkins/workspace/swift-PR-Linux/branch-main/swift/test/lit.cfg", line 1066
14:02:05     (xcrun_prefix, config.swiftc, target_options, config.swift_driver_test_options)))
14:02:05                                                                                     ^
14:02:05 SyntaxError: invalid syntax

CI failed due to a syntax error, could you fix that?

@gmittert
Copy link
Contributor

@swift-ci please smoke test

@@ -1,6 +1,6 @@
; REQUIRES: CODEGENERATOR=AArch64
; RUN: llvm-as %s -o %t.bc
; RUN: %swift -target arm64-apple-tvos9 -c -module-name someModule -embed-bitcode -disable-llvm-optzns -o %t2.o %t.bc -dump-clang-diagnostics 2> %t.diags.txt
; RUN: %swiftc_driver_plain -frontend -target arm64-apple-tvos9 -c -module-name someModule -embed-bitcode -disable-llvm-optzns -o %t2.o %t.bc -dump-clang-diagnostics 2> %t.diags.txt
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

%target-swift-frontend can replace %swiftc_driver_plain -frontend here. We'll take the last -target on the command line anyways.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason I went with %swiftc_driver_plain is because that avoids the addition of swift_driver_test_options or swift_frontend_test_options. We are using these configs to specify import paths required for cross compiling, and if the paths get passed to this test it will fail with something like:

swift/test/Frontend/embed-bitcode-tvos.ll:16:23: error: CHECK-IMPORTER-NOT: excluded string found in input
; CHECK-IMPORTER-NOT: argument unused
                      ^
<stdin>:2:10: note: found here
warning: argument unused during compilation: '-isystem /some/sysroot'
         ^~~~~~~~~~~~~~~

This matches the behavior of the embed-bitcode.ll test.

@gmittert
Copy link
Contributor

@swift-ci please smoke test

@gmittert
Copy link
Contributor

@swift-ci please smoke test

@gmittert gmittert merged commit c10064a into swiftlang:main Oct 27, 2020
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.

4 participants