-
Notifications
You must be signed in to change notification settings - Fork 10.4k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
[android] Enable several C++ Interop and other tests #74883
Conversation
@@ -4,7 +4,6 @@ | |||
// RUN: %FileCheck %s < %t/ir.ll | |||
|
|||
// UNSUPPORTED: OS=windows-msvc | |||
// XFAIL: OS=linux-android, OS=linux-androideabi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I disabled this last year, 12f20ec, because it was failing with the clang 14 in NDK 25 at that time, but it builds fine with clang 17 in NDK 26 now.
@@ -1,8 +1,6 @@ | |||
// UNSUPPORTED: OS=windows-msvc | |||
// static library is not well supported yet on Windows | |||
|
|||
// XFAIL: OS=linux-android, OS=linux-androideabi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similarly, I disabled this last year because it didn't work with clang 14 in NDK 25, but it works with clang 17 in NDK 26 now.
test/lit.cfg
Outdated
@@ -615,7 +615,7 @@ else: | |||
config.swift_driver_test_options, | |||
) | |||
) | |||
toolchain_lib_dir = make_path(config.swift_lib_dir, 'swift', host_os) | |||
toolchain_lib_dir = make_path(config.swift_lib_dir, 'swift', 'android' if kIsAndroid else host_os) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This path was just added late last year and broke building several macro tests natively on Android that have started using it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, the host_os
should be android if we are building for android right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
host_os
is parsed from the host triple, which on Android is linux
. That heuristic works on most platforms, but not for an Android host.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, that is annoying. Thanks for the explanation!
test/lit.cfg
Outdated
@@ -2428,8 +2428,12 @@ elif not kIsWindows and not run_os == 'wasi': | |||
lit_config.note('Testing with the just-built libraries') | |||
|
|||
lit_config.note('Library load path: {0}'.format(os.path.pathsep.join(target_stdlib_path))) | |||
env_path = "/usr/bin/env " | |||
# Android doesn't have /usr/bin/, so just grab whatever `env` is in the PATH. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It does have /bin/env which is pretty standard, why not use that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll try running the tests with that instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
@@ -1403,7 +1403,7 @@ def create_argument_parser(): | |||
|
|||
option('--android-arch', store, | |||
choices=['armv7', 'aarch64', 'x86_64'], | |||
default='armv7', | |||
default='aarch64', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems unrelated? It's a welcome change, just seems not related to the test enablement.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unrelated to the title, yes, but these are all Android changes, and I specifically mention these non-test changes in the commit message.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, but it still helps to keep changes focused :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, this should probably be a separate patch, since it isn't just a test-only change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, this should probably be a separate patch, since it isn't just a test-only change.
It never says it's a test-only change, the label used is [android]
and the commit message lists the non-test changes.
If you would like, I can split this into separate commits, but I see no reason to go farther.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PR title doesn't mention any non-test changes, which makes it confusing. I initially assumed that this is a test-only change.
I think the arch change should be its own commit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I will split this commit up.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
@swift-ci please smoke test |
Sigh, I had simply hacked in I'll clean that up and run the validation suite natively on Android on the entirety of this pull before asking for another CI run. |
Alright, fixed the This is ready for review and another CI run. |
# Manually set the host OS on Android, because the host OS from the triple says | ||
# `linux`. | ||
if kIsAndroid: | ||
host_os = 'android' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than overriding this just for the new toolchain_lib_dir
below, I overrode host_os
itself on Android, as it is only used for that and target-same-as-host
just below, which is only checked by a single macOS-only test, so changing this for Android hosts should be fine.
@@ -768,7 +768,7 @@ class BuildScriptImplOption(_BaseOption): | |||
ChoicesOption('--swift-analyze-code-coverage', | |||
choices=['false', 'not-merged', 'merged']), | |||
ChoicesOption('--android-arch', | |||
choices=['armv7', 'aarch64']), | |||
choices=['armv7', 'aarch64', 'x86_64']), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This never triggered before because this just checks if it's a subset, so updating to all three arches supported now.
@kateinoigakukun, need a CI run here. @egorzhdan, maybe you can review. |
@rauhul, need a CI run here. |
Also, fix lit.cfg for running the test suite natively in Android and mark one SILOptimizer executable_test as such.
…s by far the most commonly used now
@bnbarham, ready for a CI run here. |
@swift-ci please test |
Alright, passed CI, just need @egorzhdan or some one to review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
C++ interop changes LGTM
@etcwilde, if you would review the few remaining Android changes, we can get this in. |
@bnbarham, ready for merge. |
@hyp, would you merge? |
Sorry, missed initial ping. Merged! |
Also, update NDK and Ubuntu versions to the latest in the Android doc, enable inline bridging when building the compiler for Android, and update the default arch set by
build-script
to AArch64, as that is by far the most commonly used now.These C++ Interop tests were all disabled over the years because of build errors with the Android NDK, but @hyp's recent pull #72161 adding a modularized Bionic module map fixed them and the inline bridging issue in the compiler itself. Alex, let me know if these tests all pass for you too.
@drodriguez, perhaps you'd like to take a look at this pull too.