Don't set LD_LIBRARY_PATH to the ART module for any tests. am: 56ab4a6915 am: 940428ea11

Original change: https://android-review.googlesource.com/c/platform/art/+/2967365

Change-Id: Ibb9dc71bbad2abb4d7bee38626d1486a9dd500a8
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/artd/Android.bp b/artd/Android.bp
index 8b74981..50f5428 100644
--- a/artd/Android.bp
+++ b/artd/Android.bp
@@ -35,11 +35,8 @@
         "profman_headers",
     ],
     shared_libs: [
-        "libartservice",
-        "libarttools", // Contains "libc++fs".
         "libbase",
         "libbinder_ndk",
-        "libdexfile",
         "libselinux",
     ],
     static_libs: [
@@ -57,6 +54,9 @@
     shared_libs: [
         "libart",
         "libartbase",
+        "libartservice",
+        "libarttools", // Contains "libc++fs".
+        "libdexfile",
     ],
     apex_available: [
         "com.android.art",
@@ -93,6 +93,11 @@
         "art_gtest_defaults",
         "art_artd_tests_defaults",
     ],
+    shared_libs: [
+        "libartservice",
+        "libarttools",
+        "libdexfile",
+    ],
 }
 
 // Standalone version of ART gtest `art_artd_tests`, not bundled with the ART
@@ -103,6 +108,11 @@
         "art_standalone_gtest_defaults",
         "art_artd_tests_defaults",
     ],
+    static_libs: [
+        "libartservice",
+        "libarttools",
+        "libdexfile",
+    ],
     test_config_template: "art_standalone_artd_tests.xml",
 }
 
@@ -124,6 +134,9 @@
     shared_libs: [
         "libart",
         "libartbase",
+        "libartservice",
+        "libarttools",
+        "libdexfile",
         "liblog",
     ],
     fuzz_config: {
diff --git a/artd/art_standalone_artd_tests.xml b/artd/art_standalone_artd_tests.xml
index 27e7001..a5c6c99 100644
--- a/artd/art_standalone_artd_tests.xml
+++ b/artd/art_standalone_artd_tests.xml
@@ -33,8 +33,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
diff --git a/compiler/art_standalone_compiler_tests.xml b/compiler/art_standalone_compiler_tests.xml
index 8e8636c..c2065dd 100644
--- a/compiler/art_standalone_compiler_tests.xml
+++ b/compiler/art_standalone_compiler_tests.xml
@@ -47,8 +47,6 @@
     <test class="com.android.tradefed.testtype.GTest" >
         <option name="native-test-device-path" value="/data/local/tmp/art_standalone_compiler_tests" />
         <option name="module-name" value="art_standalone_compiler_tests" />
-        <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
diff --git a/dex2oat/art_standalone_dex2oat_cts_tests.xml b/dex2oat/art_standalone_dex2oat_cts_tests.xml
index 254f11d..b6f4a3d 100644
--- a/dex2oat/art_standalone_dex2oat_cts_tests.xml
+++ b/dex2oat/art_standalone_dex2oat_cts_tests.xml
@@ -54,8 +54,6 @@
     <test class="com.android.tradefed.testtype.GTest" >
         <option name="native-test-device-path" value="/data/local/tmp/art_standalone_dex2oat_cts_tests" />
         <option name="module-name" value="art_standalone_dex2oat_cts_tests" />
-        <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
diff --git a/dex2oat/art_standalone_dex2oat_tests.xml b/dex2oat/art_standalone_dex2oat_tests.xml
index 7b53f1f..d0c3f40 100644
--- a/dex2oat/art_standalone_dex2oat_tests.xml
+++ b/dex2oat/art_standalone_dex2oat_tests.xml
@@ -73,8 +73,6 @@
         <option name="test-case-timeout" value="5m" />
         <option name="native-test-device-path" value="/data/local/tmp/art_standalone_dex2oat_tests" />
         <option name="module-name" value="art_standalone_dex2oat_tests" />
-        <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
diff --git a/dexoptanalyzer/art_standalone_dexoptanalyzer_tests.xml b/dexoptanalyzer/art_standalone_dexoptanalyzer_tests.xml
index c04deaa..07e5ed6 100644
--- a/dexoptanalyzer/art_standalone_dexoptanalyzer_tests.xml
+++ b/dexoptanalyzer/art_standalone_dexoptanalyzer_tests.xml
@@ -54,8 +54,6 @@
     <test class="com.android.tradefed.testtype.GTest" >
         <option name="native-test-device-path" value="/data/local/tmp/art_standalone_dexoptanalyzer_tests" />
         <option name="module-name" value="art_standalone_dexoptanalyzer_tests" />
-        <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
diff --git a/libartservice/service/Android.bp b/libartservice/service/Android.bp
index efd0f10..652d49d 100644
--- a/libartservice/service/Android.bp
+++ b/libartservice/service/Android.bp
@@ -32,7 +32,6 @@
     ],
     export_include_dirs: ["native"],
     shared_libs: [
-        "libarttools", // Contains "libc++fs".
         "libbase",
         "libnativehelper",
     ],
@@ -48,6 +47,7 @@
     shared_libs: [
         "libart",
         "libartbase",
+        "libarttools", // Contains "libc++fs".
     ],
 }
 
@@ -64,6 +64,7 @@
     shared_libs: [
         "libartd",
         "libartbased",
+        "libarttools", // Contains "libc++fs".
     ],
 }
 
@@ -198,6 +199,9 @@
         "art_gtest_defaults",
         "art_libartservice_tests_defaults",
     ],
+    shared_libs: [
+        "libarttools",
+    ],
 }
 
 // Standalone version of ART gtest `art_libartservice_tests`, not bundled with the ART APEX on
@@ -208,6 +212,9 @@
         "art_standalone_gtest_defaults",
         "art_libartservice_tests_defaults",
     ],
+    static_libs: [
+        "libarttools",
+    ],
 }
 
 android_test {
diff --git a/libarttools/Android.bp b/libarttools/Android.bp
index 5997e5d..2c036fb 100644
--- a/libarttools/Android.bp
+++ b/libarttools/Android.bp
@@ -59,7 +59,6 @@
         "tools_test.cc",
     ],
     shared_libs: [
-        "libarttools",
         "libbase",
     ],
     static_libs: [
@@ -80,6 +79,9 @@
         "art_gtest_defaults",
         "art_libarttools_tests_defaults",
     ],
+    shared_libs: [
+        "libarttools",
+    ],
 }
 
 // Standalone version of ART gtest `art_libarttools_tests`, not bundled with the ART APEX on
@@ -90,6 +92,9 @@
         "art_standalone_gtest_defaults",
         "art_libarttools_tests_defaults",
     ],
+    static_libs: [
+        "libarttools",
+    ],
 }
 
 cc_binary {
diff --git a/libdexfile/Android.bp b/libdexfile/Android.bp
index ad528c1..b51456c 100644
--- a/libdexfile/Android.bp
+++ b/libdexfile/Android.bp
@@ -385,7 +385,6 @@
         "external/dex_file_ext_test.cc",
     ],
     shared_libs: [
-        "libartbase",
         "libdexfile",
     ],
     header_libs: [
@@ -467,7 +466,6 @@
         "external/dex_file_supp_test.cc",
     ],
     shared_libs: [
-        "libartbase",
         "libbase",
         "libdexfile",
         "liblog",
diff --git a/libdexfile/art_standalone_libdexfile_tests.xml b/libdexfile/art_standalone_libdexfile_tests.xml
index ca30d74..4f18d8a 100644
--- a/libdexfile/art_standalone_libdexfile_tests.xml
+++ b/libdexfile/art_standalone_libdexfile_tests.xml
@@ -37,8 +37,6 @@
     <test class="com.android.tradefed.testtype.GTest" >
         <option name="native-test-device-path" value="/data/local/tmp/art_standalone_libdexfile_tests" />
         <option name="module-name" value="art_standalone_libdexfile_tests" />
-        <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
diff --git a/libprofile/art_standalone_libprofile_tests.xml b/libprofile/art_standalone_libprofile_tests.xml
index fc4ebdc..8a4cf8d 100644
--- a/libprofile/art_standalone_libprofile_tests.xml
+++ b/libprofile/art_standalone_libprofile_tests.xml
@@ -33,8 +33,6 @@
     <test class="com.android.tradefed.testtype.GTest" >
         <option name="native-test-device-path" value="/data/local/tmp/art_standalone_libprofile_tests" />
         <option name="module-name" value="art_standalone_libprofile_tests" />
-        <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
diff --git a/oatdump/art_standalone_oatdump_tests.xml b/oatdump/art_standalone_oatdump_tests.xml
index bb5cc0a..15dba47 100644
--- a/oatdump/art_standalone_oatdump_tests.xml
+++ b/oatdump/art_standalone_oatdump_tests.xml
@@ -45,8 +45,6 @@
     <test class="com.android.tradefed.testtype.GTest" >
         <option name="native-test-device-path" value="/data/local/tmp/art_standalone_oatdump_tests" />
         <option name="module-name" value="art_standalone_oatdump_tests" />
-        <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
diff --git a/odrefresh/Android.bp b/odrefresh/Android.bp
index 7b9aad7..8b6ea8d 100644
--- a/odrefresh/Android.bp
+++ b/odrefresh/Android.bp
@@ -41,7 +41,6 @@
         "art-odrefresh-operator-srcs",
     ],
     shared_libs: [
-        "libarttools", // Contains "libc++fs".
         "libbase",
         "liblog",
         "libselinux",
@@ -65,6 +64,7 @@
     ],
     srcs: ["odrefresh_main.cc"],
     shared_libs: [
+        "libarttools", // Contains "libc++fs".
         "libdexfile",
     ],
     target: {
@@ -210,6 +210,9 @@
         "art_odrefresh_tests_defaults",
     ],
     host_supported: false,
+    shared_libs: [
+        "libarttools",
+    ],
     // The test config template is needed even though it's not used by the test
     // runner. Otherwise, Soong will generate a test config, which is adding
     // `art-host-test` as a test tag, while this test does not support running
@@ -225,6 +228,9 @@
         "art_standalone_gtest_defaults",
         "art_odrefresh_tests_defaults",
     ],
+    static_libs: [
+        "libarttools",
+    ],
 }
 
 genrule {
diff --git a/profman/art_standalone_profman_tests.xml b/profman/art_standalone_profman_tests.xml
index 94a54a7..875f263 100644
--- a/profman/art_standalone_profman_tests.xml
+++ b/profman/art_standalone_profman_tests.xml
@@ -46,8 +46,6 @@
     <test class="com.android.tradefed.testtype.GTest" >
         <option name="native-test-device-path" value="/data/local/tmp/art_standalone_profman_tests" />
         <option name="module-name" value="art_standalone_profman_tests" />
-        <option name="ld-library-path-32" value="/apex/com.android.art/lib" />
-        <option name="ld-library-path-64" value="/apex/com.android.art/lib64" />
 
         <!-- The following tests from `art_standalone_profman_tests` are currently failing when
              run as 32-bit on a 64-bit device, because they try to execute other system (64-bit)
diff --git a/runtime/art_standalone_runtime_tests.xml b/runtime/art_standalone_runtime_tests.xml
index 76c1e54..d0e959c 100644
--- a/runtime/art_standalone_runtime_tests.xml
+++ b/runtime/art_standalone_runtime_tests.xml
@@ -81,8 +81,6 @@
     <test class="com.android.tradefed.testtype.GTest" >
         <option name="native-test-device-path" value="/data/local/tmp/art_standalone_runtime_tests" />
         <option name="module-name" value="art_standalone_runtime_tests" />
-        <option name="ld-library-path-32" value="/apex/com.android.art/lib" />
-        <option name="ld-library-path-64" value="/apex/com.android.art/lib64" />
 
         <!-- The following tests from `art_standalone_runtime_tests` are currently failing
              (observed on `aosp_cf_x86_64_phone-userdebug`).
diff --git a/test/art-gtests-target-standalone-cts-template.xml b/test/art-gtests-target-standalone-cts-template.xml
index a5ac30b..42ad284 100644
--- a/test/art-gtests-target-standalone-cts-template.xml
+++ b/test/art-gtests-target-standalone-cts-template.xml
@@ -32,8 +32,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
diff --git a/test/art-gtests-target-standalone-template.xml b/test/art-gtests-target-standalone-template.xml
index d898112..1c21620 100644
--- a/test/art-gtests-target-standalone-template.xml
+++ b/test/art-gtests-target-standalone-template.xml
@@ -27,8 +27,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
diff --git a/test/art-gtests-target-standalone-with-boot-image-template.xml b/test/art-gtests-target-standalone-with-boot-image-template.xml
index 9d2a4c4..7f44ba6 100644
--- a/test/art-gtests-target-standalone-with-boot-image-template.xml
+++ b/test/art-gtests-target-standalone-with-boot-image-template.xml
@@ -40,8 +40,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
diff --git a/test/dexpreopt/art_standalone_dexpreopt_tests.xml b/test/dexpreopt/art_standalone_dexpreopt_tests.xml
index 67faa76..cf459e6 100644
--- a/test/dexpreopt/art_standalone_dexpreopt_tests.xml
+++ b/test/dexpreopt/art_standalone_dexpreopt_tests.xml
@@ -35,8 +35,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>
 
     <!-- Only run tests if the device under test is SDK version 31 (Android 12) or above. -->