diff options
author | Martin Stjernholm <mast@google.com> | 2023-12-20 17:32:04 +0000 |
---|---|---|
committer | Martin Stjernholm <mast@google.com> | 2023-12-20 18:28:07 +0000 |
commit | dfe9c4d7b203cf8e8981485e00eca05b103628a8 (patch) | |
tree | 6cfa0239bd5351487e5f1ec196999fcb8320466d | |
parent | 8fe0809df69d6bf0524bfb7553592addce2e27ba (diff) | |
download | art-dfe9c4d7b203cf8e8981485e00eca05b103628a8.tar.gz |
Do not add the ART APEX to LD_LIBRARY_PATH in the CTS tests, and link
statically what's needed instead.
Adding /apex/com.android.art/${LIB} to LD_LIBRARY_PATH conflates the
linker namespace separation and causes ART module libs to be loaded in
the default (= system) namespace. That causes linker errors when the
module is used on older system images where unstable shared libs are no
longer compatible.
Instead link all internal libs statically and only leave the ones with
exported APIs (which these CTS tests are intended to test).
Merged-In set to a CL in main to avoid merging there - gtests are
already linked statically there - it'll require a different fix.
Test: lunch aosp_x86_64
atest art_libnativebridge_cts_tests \
art_standalone_libdexfile_external_tests \
libnativeloader_test \
art_standalone_libartpalette_tests
using a cvd with a TM system image (had to apply
https://r.android.com/2654960 to make atest work in
android13-tests-dev)
Bug: 317042881
Change-Id: I538b00418f2e5563f6d88ae8a6aa99372e44bb78
Merged-In: I75a844f53663385ef98351f60d3adb900157f5e5
-rw-r--r-- | libartpalette/Android.bp | 5 | ||||
-rw-r--r-- | libdexfile/Android.bp | 7 | ||||
-rw-r--r-- | test/art-gtests-target-standalone-cts-template.xml | 2 |
3 files changed, 8 insertions, 6 deletions
diff --git a/libartpalette/Android.bp b/libartpalette/Android.bp index 3995d40e1e..2faa926551 100644 --- a/libartpalette/Android.bp +++ b/libartpalette/Android.bp @@ -114,9 +114,6 @@ art_cc_library { art_cc_defaults { name: "art_libartpalette_tests_defaults", srcs: ["apex/palette_test.cc"], - shared_libs: [ - "libartpalette", - ], target: { android: { static_libs: ["libmodules-utils-build"], @@ -133,6 +130,7 @@ art_cc_test { "art_libartpalette_tests_defaults", ], shared_libs: [ + "libartpalette", "libnativehelper", ], host_supported: true, @@ -147,6 +145,7 @@ art_cc_test { "art_libartpalette_tests_defaults", ], static_libs: [ + "libartpalette", "libc++fs", // libnativehelper_lazy has the glue we need to dlsym the platform-only // APIs we need, like JniInvocationInit. diff --git a/libdexfile/Android.bp b/libdexfile/Android.bp index f0e010664c..73f93a6782 100644 --- a/libdexfile/Android.bp +++ b/libdexfile/Android.bp @@ -385,7 +385,6 @@ art_cc_defaults { "external/dex_file_ext_test.cc", ], shared_libs: [ - "libartbase", "libdexfile", ], header_libs: [ @@ -402,6 +401,9 @@ art_cc_test { "art_test_defaults", "art_libdexfile_external_tests_defaults", ], + shared_libs: [ + "libartbase", + ], } // Standalone version of ART gtest `art_libdexfile_external_tests`, not bundled with the ART APEX on @@ -412,6 +414,9 @@ art_cc_test { "art_standalone_test_defaults", "art_libdexfile_external_tests_defaults", ], + static_libs: [ + "libartbase", + ], test_config_template: ":art-gtests-target-standalone-cts-template", test_suites: ["cts"], // For backed-by API coverage. diff --git a/test/art-gtests-target-standalone-cts-template.xml b/test/art-gtests-target-standalone-cts-template.xml index 3749c3e990..e862f171e2 100644 --- a/test/art-gtests-target-standalone-cts-template.xml +++ b/test/art-gtests-target-standalone-cts-template.xml @@ -30,8 +30,6 @@ <test class="com.android.tradefed.testtype.GTest" > <option name="native-test-device-path" value="/data/local/tmp/{MODULE}" /> <option name="module-name" value="{MODULE}" /> - <option name="ld-library-path-32" value="/apex/com.android.art/lib" /> - <option name="ld-library-path-64" value="/apex/com.android.art/lib64" /> </test> <!-- When this test is run in a Mainline context (e.g. with `mts-tradefed`), only enable it if |