Skip to content
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

[android] build and run LIT-based tests on x64 #229

Open
weliveindetail opened this issue Jan 17, 2025 · 4 comments
Open

[android] build and run LIT-based tests on x64 #229

weliveindetail opened this issue Jan 17, 2025 · 4 comments
Assignees

Comments

@weliveindetail
Copy link
Collaborator

weliveindetail commented Jan 17, 2025

The Swift SDK contains components that use the LLVM Integrated Tester, e.g. swift-corelibs-xctest

Tests in swift-corelibs-xctest are implemented in Swift, so we have to make the Swift Runtime available on the emulator. The lit.cfg in swift-corelibs-xctest seems to allow us to inject SWIFT_EXEC, SWIFT_FLAGS and FOUNDATION_BUILT_PRODUCTS_DIR as environment variables. There are special cases for Windows already, we might have to add some upstream for Android.

LIT tests have end-to-end character: Test conditions and behavior is described in text files that are parsed from Python. RUN lines invoke executables and pass arguments, so the command-line is the interface to the code under test here.

@weliveindetail
Copy link
Collaborator Author

There might be infrastructure in LIT that allows to offload test execution. This bot cross-compiles upstream LLVM for Android and (apparently) runs tests on attached devices: https://lab.llvm.org/buildbot/#/builders/186

@compnerd
Copy link
Collaborator

Yes, there is existing tooling that needs to be understood that allows sharding and remote execution under an emulator that we should try to reuse if possible.

@weliveindetail
Copy link
Collaborator Author

For the moment I found a few related mechanisms, but none of them exactly matches what we are looking for:

  • COMPILER_RT_EMULATOR is a feature of compiler-rt that seems very close, but I'd have to implement it for the projects we want to support.
  • TEST_SUITE_RUN_UNDER is a feature of LNT, the nightly test suite. We don't use that.
  • There are scattered bits of Apple-specific code that add support for iOS simulators.

@weliveindetail
Copy link
Collaborator Author

The Swift test suite itself ships a number of adb utility scripts that are wired up in the main LIT file via the target_run configuration (which is used for Apple simulators as well):
https://github.com/swiftlang/swift/blob/eb6339dd3ec241cb56965a18a7c171ddd6bd2809/test/lit.cfg#L1947

It looks like we can us this approach for all Swift tests (except swift_interpreter, which is discarded explicitly). In a first step we could try and use it for the existing compiler-rt components. If that works, we may find a way to extend it to the out-of-tree Swift Runtime libraries.

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

No branches or pull requests

2 participants