Convert bionic dlext test zips to Android.bp

Use cc_genrules to create the dlext test zips needed by the bionic
tests.  The genrules aren't visible to Make, and so don't work with
the `required` property.  Move all of the dependencies to `data_bins`,
`data_libs` or `data` for helper binaries, shared libraries or
genrule zip files respectively.  The `data*` properties copy the
files into the same directory as a test, respecting the
`bionic-loader-test-libs` relative path specified by each, but
does not put each helper binary in its own subdirectory, so update
the paths in each of the tests.

Bug: 200872604
Test: atest CtsBionicTestCases
Test: atest bionic-unit-tests
Test: cts-tradefed run commandAndExit cts -m CtsBionicTestCases
Test: adb push $OUT/data/nativetest/bionic-unit-tests /data/nativetest/ && adb shell /data/nativetest/bionic-unit-tests/bionic-unit-tests
Change-Id: Ic4257cb4104ff558326df2363730acd20464b051
diff --git a/tests/Android.bp b/tests/Android.bp
index 3637404..f79dc3e 100644
--- a/tests/Android.bp
+++ b/tests/Android.bp
@@ -787,13 +787,14 @@
     name: "libBionicCtsGtestMain",
     defaults: ["bionic_tests_defaults"],
     srcs: [
-        "gtest_globals_cts.cpp",
+        "gtest_globals.cpp",
         "gtest_main.cpp",
     ],
     shared: {
         enabled: false,
     },
     whole_static_libs: [
+        "libbase",
         "libgtest_isolated",
     ],
 }
@@ -870,13 +871,13 @@
                 "libLLVMSupport",
             ],
             ldflags: [
-                "-Wl,--rpath,${ORIGIN}/../bionic-loader-test-libs",
+                "-Wl,--rpath,${ORIGIN}/bionic-loader-test-libs",
                 "-Wl,--enable-new-dtags",
             ],
         },
     },
 
-    required: [
+    data_bins: [
         "cfi_test_helper",
         "cfi_test_helper2",
         "elftls_dlopen_ie_error_helper",
@@ -895,6 +896,14 @@
         "ld_preload_test_helper",
         "ld_preload_test_helper_lib1",
         "ld_preload_test_helper_lib2",
+        "ns_hidden_child_helper",
+        "preinit_getauxval_test_helper",
+        "preinit_syscall_test_helper",
+        "thread_exit_cb_helper",
+        "tls_properties_helper",
+    ],
+
+    data_libs: [
         "libatest_simple_zip",
         "libcfi-test",
         "libcfi-test-bad",
@@ -906,9 +915,7 @@
         "libdlext_test_fd",
         "libdlext_test_norelro",
         "libdlext_test_recursive",
-        "libdlext_test_runpath_zip_zipaligned",
         "libdlext_test_zip",
-        "libdlext_test_zip_zipaligned",
         "libgnu-hash-table-library",
         "libns_hidden_child_app",
         "libns_hidden_child_global",
@@ -1028,11 +1035,6 @@
         "libtest_with_dependency_loop_b",
         "libtest_with_dependency_loop_c",
         "libtestshared",
-        "ns_hidden_child_helper",
-        "preinit_getauxval_test_helper",
-        "preinit_syscall_test_helper",
-        "thread_exit_cb_helper",
-        "tls_properties_helper",
     ],
 }
 
@@ -1041,6 +1043,10 @@
     defaults: [
         "bionic_unit_tests_defaults",
     ],
+    data: [
+        ":libdlext_test_runpath_zip_zipaligned",
+        ":libdlext_test_zip_zipaligned",
+    ],
 }
 
 cc_test {
diff --git a/tests/cfi_test.cpp b/tests/cfi_test.cpp
index 9a6ed9a..dd65a81 100644
--- a/tests/cfi_test.cpp
+++ b/tests/cfi_test.cpp
@@ -146,7 +146,7 @@
 // cfi_test_helper exports __cfi_check, which triggers CFI initialization at startup.
 TEST(cfi_test, early_init) {
 #if defined(__BIONIC__)
-  std::string helper = GetTestlibRoot() + "/cfi_test_helper/cfi_test_helper";
+  std::string helper = GetTestlibRoot() + "/cfi_test_helper";
   chmod(helper.c_str(), 0755); // TODO: "x" lost in CTS, b/34945607
   ExecTestHelper eth;
   eth.SetArgs({ helper.c_str(), nullptr });
@@ -158,7 +158,7 @@
 // at startup.
 TEST(cfi_test, early_init2) {
 #if defined(__BIONIC__)
-  std::string helper = GetTestlibRoot() + "/cfi_test_helper2/cfi_test_helper2";
+  std::string helper = GetTestlibRoot() + "/cfi_test_helper2";
   chmod(helper.c_str(), 0755); // TODO: "x" lost in CTS, b/34945607
   ExecTestHelper eth;
   eth.SetArgs({ helper.c_str(), nullptr });
diff --git a/tests/dl_test.cpp b/tests/dl_test.cpp
index 47bf133..ad16501 100644
--- a/tests/dl_test.cpp
+++ b/tests/dl_test.cpp
@@ -125,8 +125,7 @@
 TEST(dl, exec_linker_load_file) {
 #if defined(__BIONIC__)
   const char* path_to_linker = PathToLinker();
-  std::string helper = GetTestlibRoot() +
-      "/exec_linker_helper/exec_linker_helper";
+  std::string helper = GetTestlibRoot() + "/exec_linker_helper";
   std::string expected_output =
       "ctor: argc=1 argv[0]=" + helper + "\n" +
       "main: argc=1 argv[0]=" + helper + "\n" +
@@ -167,8 +166,7 @@
 TEST(dl, preinit_system_calls) {
 #if defined(__BIONIC__)
   SKIP_WITH_HWASAN << "hwasan not initialized in preinit_array, b/124007027";
-  std::string helper = GetTestlibRoot() +
-      "/preinit_syscall_test_helper/preinit_syscall_test_helper";
+  std::string helper = GetTestlibRoot() + "/preinit_syscall_test_helper";
   chmod(helper.c_str(), 0755); // TODO: "x" lost in CTS, b/34945607
   ExecTestHelper eth;
   eth.SetArgs({ helper.c_str(), nullptr });
@@ -179,8 +177,7 @@
 TEST(dl, preinit_getauxval) {
 #if defined(__BIONIC__)
   SKIP_WITH_HWASAN << "hwasan not initialized in preinit_array, b/124007027";
-  std::string helper = GetTestlibRoot() +
-      "/preinit_getauxval_test_helper/preinit_getauxval_test_helper";
+  std::string helper = GetTestlibRoot() + "/preinit_getauxval_test_helper";
   chmod(helper.c_str(), 0755); // TODO: "x" lost in CTS, b/34945607
   ExecTestHelper eth;
   eth.SetArgs({ helper.c_str(), nullptr });
@@ -194,8 +191,7 @@
 
 TEST(dl, exec_without_ld_preload) {
 #if defined(__BIONIC__)
-  std::string helper = GetTestlibRoot() +
-      "/ld_preload_test_helper/ld_preload_test_helper";
+  std::string helper = GetTestlibRoot() + "/ld_preload_test_helper";
   chmod(helper.c_str(), 0755);
   ExecTestHelper eth;
   eth.SetArgs({ helper.c_str(), nullptr });
@@ -205,8 +201,7 @@
 
 TEST(dl, exec_with_ld_preload) {
 #if defined(__BIONIC__)
-  std::string helper = GetTestlibRoot() +
-      "/ld_preload_test_helper/ld_preload_test_helper";
+  std::string helper = GetTestlibRoot() + "/ld_preload_test_helper";
   std::string env = std::string("LD_PRELOAD=") + GetTestlibRoot() + "/ld_preload_test_helper_lib2.so";
   chmod(helper.c_str(), 0755);
   ExecTestHelper eth;
@@ -232,12 +227,10 @@
 // The two libs are in ns2/ subdir.
 TEST(dl, exec_without_ld_config_file) {
 #if defined(__BIONIC__)
-  std::string error_message =
-      "CANNOT LINK EXECUTABLE \"" + GetTestlibRoot() +
-      "/ld_config_test_helper/ld_config_test_helper\": library \"ld_config_test_helper_lib1.so\" "
-      "not found: needed by main executable\n";
-  std::string helper = GetTestlibRoot() +
-      "/ld_config_test_helper/ld_config_test_helper";
+  std::string error_message = "CANNOT LINK EXECUTABLE \"" + GetTestlibRoot() +
+                              "/ld_config_test_helper\": library \"ld_config_test_helper_lib1.so\" "
+                              "not found: needed by main executable\n";
+  std::string helper = GetTestlibRoot() + "/ld_config_test_helper";
   chmod(helper.c_str(), 0755);
   ExecTestHelper eth;
   eth.SetArgs({ helper.c_str(), nullptr });
@@ -252,13 +245,16 @@
   android_get_LD_LIBRARY_PATH(default_search_paths, sizeof(default_search_paths));
 
   std::ofstream fout(config_file, std::ios::out);
-  fout << "dir.test = " << GetTestlibRoot() << "/ld_config_test_helper/" << std::endl
+  fout << "dir.test = " << GetTestlibRoot() << "/" << std::endl
        << "[test]" << std::endl
        << "additional.namespaces = ns2" << std::endl
        << "namespace.default.search.paths = " << GetTestlibRoot() << std::endl
        << "namespace.default.links = ns2" << std::endl
-       << "namespace.default.link.ns2.shared_libs = libc.so:libm.so:libdl.so:ld_config_test_helper_lib1.so" << std::endl
-       << "namespace.ns2.search.paths = " << default_search_paths << ":" << GetTestlibRoot() << "/ns2" << std::endl;
+       << "namespace.default.link.ns2.shared_libs = "
+          "libc.so:libm.so:libdl.so:ld_config_test_helper_lib1.so"
+       << std::endl
+       << "namespace.ns2.search.paths = " << default_search_paths << ":" << GetTestlibRoot()
+       << "/ns2" << std::endl;
   fout.close();
 }
 #endif
@@ -288,8 +284,7 @@
   if (is_user_build()) {
     GTEST_SKIP() << "LD_CONFIG_FILE is not supported on user build";
   }
-  std::string helper = GetTestlibRoot() +
-      "/ld_config_test_helper/ld_config_test_helper";
+  std::string helper = GetTestlibRoot() + "/ld_config_test_helper";
   TemporaryFile config_file;
   create_ld_config_file(config_file.path);
   std::string env = std::string("LD_CONFIG_FILE=") + config_file.path;
@@ -325,8 +320,7 @@
   if (is_user_build()) {
     GTEST_SKIP() << "LD_CONFIG_FILE is not supported on user build";
   }
-  std::string helper = GetTestlibRoot() +
-      "/ld_config_test_helper/ld_config_test_helper";
+  std::string helper = GetTestlibRoot() + "/ld_config_test_helper";
   TemporaryFile config_file;
   create_ld_config_file(config_file.path);
   std::string env = std::string("LD_CONFIG_FILE=") + config_file.path;
@@ -363,11 +357,11 @@
     GTEST_SKIP() << "test requires user build";
   }
 
-  std::string error_message = std::string("CANNOT LINK EXECUTABLE ") +
-      "\"" + GetTestlibRoot() + "/ld_config_test_helper/ld_config_test_helper\": " +
+  std::string error_message =
+      std::string("CANNOT LINK EXECUTABLE ") + "\"" + GetTestlibRoot() +
+      "/ld_config_test_helper\": " +
       "library \"ld_config_test_helper_lib1.so\" not found: needed by main executable\n";
-  std::string helper = GetTestlibRoot() +
-      "/ld_config_test_helper/ld_config_test_helper";
+  std::string helper = GetTestlibRoot() + "/ld_config_test_helper";
   TemporaryFile config_file;
   create_ld_config_file(config_file.path);
   std::string env = std::string("LD_CONFIG_FILE=") + config_file.path;
diff --git a/tests/dlext_test.cpp b/tests/dlext_test.cpp
index e3caf0e..4cb08b9 100644
--- a/tests/dlext_test.cpp
+++ b/tests/dlext_test.cpp
@@ -2076,7 +2076,7 @@
 TEST(dlext, ns_hidden_child) {
   ExecTestHelper eth;
 
-  std::string helper = GetTestlibRoot() + "/ns_hidden_child_helper/ns_hidden_child_helper";
+  std::string helper = GetTestlibRoot() + "/ns_hidden_child_helper";
   chmod(helper.c_str(), 0755); // TODO: "x" lost in CTS, b/34945607
   std::string app_ns_dir = GetTestlibRoot() + "/ns_hidden_child_app";
   eth.SetArgs({ helper.c_str(), app_ns_dir.c_str(), nullptr });
diff --git a/tests/elftls_dl_test.cpp b/tests/elftls_dl_test.cpp
index aa975de..82ccf82 100644
--- a/tests/elftls_dl_test.cpp
+++ b/tests/elftls_dl_test.cpp
@@ -68,8 +68,7 @@
 }
 
 TEST(elftls_dl, dlopen_ie_error) {
-  std::string helper = GetTestlibRoot() +
-      "/elftls_dlopen_ie_error_helper/elftls_dlopen_ie_error_helper";
+  std::string helper = GetTestlibRoot() + "/elftls_dlopen_ie_error_helper";
   std::string src_path = GetTestlibRoot() + "/libtest_elftls_shared_var_ie.so";
   std::string dst_path = GetTestlibRoot() + "/libtest_elftls_shared_var.so";
 #if defined(__BIONIC__)
diff --git a/tests/gtest_globals.cpp b/tests/gtest_globals.cpp
index 5b5ede8..11b2dff 100644
--- a/tests/gtest_globals.cpp
+++ b/tests/gtest_globals.cpp
@@ -25,8 +25,8 @@
 
 std::string GetTestlibRoot() {
   // Typically the executable is /data/nativetest[64]/bionic-unit-tests/bionic-unit-tests, and the
-  // test libraries are in /data/nativetest[64]/bionic-loader-test-libs.
-  std::string path = android::base::GetExecutableDirectory() + "/..";
+  // test libraries are in /data/nativetest[64]/bionic-unit-tests/bionic-loader-test-libs.
+  std::string path = android::base::GetExecutableDirectory();
 
   std::string out_path;
   if (!android::base::Realpath(path.c_str(), &out_path)) {
diff --git a/tests/gtest_globals_cts.cpp b/tests/gtest_globals_cts.cpp
deleted file mode 100644
index 78bb3ca..0000000
--- a/tests/gtest_globals_cts.cpp
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Copyright (C) 2016 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "gtest_globals.h"
-
-std::string GetTestlibRoot() {
-  return "/data/local/tmp/lib/bionic-loader-test-libs";
-}
diff --git a/tests/libs/Android.bp b/tests/libs/Android.bp
index fabcd04..cef95cd 100644
--- a/tests/libs/Android.bp
+++ b/tests/libs/Android.bp
@@ -1667,3 +1667,71 @@
      memtag_heap: false,
    },
 }
+
+cc_genrule {
+    name: "libdlext_test_zip_zipaligned",
+     out: ["bionic-loader-test-libs/libdlext_test_zip/libdlext_test_zip_zipaligned.zip"],
+    tools: [
+        "soong_zip",
+        "bionic_tests_zipalign",
+    ],
+    srcs: [
+        ":libdlext_test_zip",
+        ":libatest_simple_zip",
+        ":exec_linker_helper",
+        ":exec_linker_helper_lib",
+    ],
+    cmd: "mkdir -p $(genDir)/zipdir/libdir &&" +
+        " cp $(in) $(genDir)/zipdir/libdir/ &&" +
+        " touch $(genDir)/zipdir/empty_file.txt &&" +
+        " $(location soong_zip) -o $(out).unaligned -L 0 -C $(genDir)/zipdir -D $(genDir)/zipdir &&" +
+        " $(location bionic_tests_zipalign) 4096 $(out).unaligned $(out)",
+
+    bazel_module: {
+        // Depends on soong_zip, which is not available yet.
+        bp2build_available: false
+    },
+}
+
+cc_genrule {
+    name: "libdlext_test_runpath_zip_zipaligned",
+    out: ["bionic-loader-test-libs/libdlext_test_runpath_zip/libdlext_test_runpath_zip_zipaligned.zip"],
+    tools: [
+        "soong_zip",
+        "bionic_tests_zipalign",
+    ],
+    srcs: [
+        ":libtest_dt_runpath_d_zip",
+        ":libtest_dt_runpath_a",
+        ":libtest_dt_runpath_b",
+        ":libtest_dt_runpath_c",
+        ":libtest_dt_runpath_x",
+        ":libtest_dt_runpath_y",
+    ],
+    cmd: "mkdir -p $(genDir)/zipdir/libdir &&" +
+        " if [[ \"$$CC_MULTILIB\" = lib32 ]]; then" +
+        "  PRIVATE_LIB_OR_LIB64=lib;" +
+        " else" +
+        "  PRIVATE_LIB_OR_LIB64=lib64;" +
+        " fi &&" +
+        " if [[ -n \"$$CC_NATIVE_BRIDGE\" ]]; then" +
+        "  PRIVATE_LIB_OR_LIB64=$$PRIVATE_LIB_OR_LIB64/$$CC_NATIVE_BRIDGE;" +
+        " fi &&" +
+        " mkdir -p $(genDir)/zipdir/libdir/dt_runpath_a &&" +
+        " mkdir -p $(genDir)/zipdir/libdir/dt_runpath_b_c_x &&" +
+        " mkdir -p $(genDir)/zipdir/libdir/dt_runpath_y/$$PRIVATE_LIB_OR_LIB64 &&" +
+        " cp $(location :libtest_dt_runpath_d_zip) $(genDir)/zipdir/libdir &&" +
+        " cp $(location :libtest_dt_runpath_a) $(genDir)/zipdir/libdir/dt_runpath_a &&" +
+        " cp $(location :libtest_dt_runpath_b) $(genDir)/zipdir/libdir/dt_runpath_b_c_x &&" +
+        " cp $(location :libtest_dt_runpath_c) $(genDir)/zipdir/libdir/dt_runpath_b_c_x &&" +
+        " cp $(location :libtest_dt_runpath_x) $(genDir)/zipdir/libdir/dt_runpath_b_c_x &&" +
+        " cp $(location :libtest_dt_runpath_y) $(genDir)/zipdir/libdir/dt_runpath_y/$$PRIVATE_LIB_OR_LIB64 &&" +
+        " touch $(genDir)/zipdir/empty_file.txt &&" +
+        " $(location soong_zip) -o $(out).unaligned -L 0 -C $(genDir)/zipdir -D $(genDir)/zipdir &&" +
+        " $(location bionic_tests_zipalign) 4096 $(out).unaligned $(out)",
+
+    bazel_module: {
+        // Depends on soong_zip, which is not available yet.
+        bp2build_available: false
+    },
+}
diff --git a/tests/libs/Android.build.dlext_testzip.mk b/tests/libs/Android.build.dlext_testzip.mk
deleted file mode 100644
index 66ed343..0000000
--- a/tests/libs/Android.build.dlext_testzip.mk
+++ /dev/null
@@ -1,102 +0,0 @@
-#
-# Copyright (C) 2014 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-# -----------------------------------------------------------------------------
-# Library used by dlext tests - zipped and aligned
-# -----------------------------------------------------------------------------
-
-BIONIC_TESTS_ZIPALIGN := $(HOST_OUT_EXECUTABLES)/bionic_tests_zipalign
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_CLASS := NATIVE_TESTS
-LOCAL_MODULE := libdlext_test_zip_zipaligned
-LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-BSD
-LOCAL_LICENSE_CONDITIONS := notice
-LOCAL_NOTICE_FILE := $(LOCAL_PATH)/../NOTICE
-LOCAL_MODULE_SUFFIX := .zip
-LOCAL_MODULE_PATH := $($(bionic_2nd_arch_prefix)TARGET_OUT_DATA_NATIVE_TESTS)/bionic-loader-test-libs/libdlext_test_zip
-LOCAL_2ND_ARCH_VAR_PREFIX := $(bionic_2nd_arch_prefix)
-
-include $(BUILD_SYSTEM)/base_rules.mk
-
-my_shared_libs := \
-  $(call intermediates-dir-for,SHARED_LIBRARIES,libdlext_test_zip,,,$(bionic_2nd_arch_prefix))/libdlext_test_zip.so \
-  $(call intermediates-dir-for,SHARED_LIBRARIES,libatest_simple_zip,,,$(bionic_2nd_arch_prefix))/libatest_simple_zip.so \
-  $(call intermediates-dir-for,NATIVE_TESTS,exec_linker_helper,,,$(bionic_2nd_arch_prefix))/exec_linker_helper \
-  $(call intermediates-dir-for,SHARED_LIBRARIES,exec_linker_helper_lib,,,$(bionic_2nd_arch_prefix))/exec_linker_helper_lib.so
-
-$(LOCAL_BUILT_MODULE): PRIVATE_SHARED_LIBS := $(my_shared_libs)
-$(LOCAL_BUILT_MODULE): $(my_shared_libs) $(BIONIC_TESTS_ZIPALIGN)
-	@echo "Aligning zip: $@"
-	$(hide) rm -rf $@.unaligned $@ $(dir $@)/zipdir && mkdir -p $(dir $@)/zipdir/libdir
-	$(hide) cp $(PRIVATE_SHARED_LIBS) $(dir $@)/zipdir/libdir
-	$(hide) touch $(dir $@)/zipdir/empty_file.txt
-	$(hide) (cd $(dir $@)/zipdir && zip -qrD0 ../$(notdir $@).unaligned .)
-	$(hide) $(BIONIC_TESTS_ZIPALIGN) 4096 $@.unaligned $@
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_CLASS := NATIVE_TESTS
-LOCAL_MODULE := libdlext_test_runpath_zip_zipaligned
-LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-BSD
-LOCAL_LICENSE_CONDITIONS := notice
-LOCAL_NOTICE_FILE := $(LOCAL_PATH)/../NOTICE
-LOCAL_MODULE_SUFFIX := .zip
-LOCAL_MODULE_PATH := $($(bionic_2nd_arch_prefix)TARGET_OUT_DATA_NATIVE_TESTS)/bionic-loader-test-libs/libdlext_test_runpath_zip
-LOCAL_2ND_ARCH_VAR_PREFIX := $(bionic_2nd_arch_prefix)
-
-include $(BUILD_SYSTEM)/base_rules.mk
-lib_d := $(call intermediates-dir-for,SHARED_LIBRARIES,libtest_dt_runpath_d_zip,,,$(bionic_2nd_arch_prefix))/libtest_dt_runpath_d_zip.so
-lib_a := $(call intermediates-dir-for,SHARED_LIBRARIES,libtest_dt_runpath_a,,,$(bionic_2nd_arch_prefix))/libtest_dt_runpath_a.so
-lib_b := $(call intermediates-dir-for,SHARED_LIBRARIES,libtest_dt_runpath_b,,,$(bionic_2nd_arch_prefix))/libtest_dt_runpath_b.so
-lib_c := $(call intermediates-dir-for,SHARED_LIBRARIES,libtest_dt_runpath_c,,,$(bionic_2nd_arch_prefix))/libtest_dt_runpath_c.so
-lib_x := $(call intermediates-dir-for,SHARED_LIBRARIES,libtest_dt_runpath_x,,,$(bionic_2nd_arch_prefix))/libtest_dt_runpath_x.so
-lib_y := $(call intermediates-dir-for,SHARED_LIBRARIES,libtest_dt_runpath_y,,,$(bionic_2nd_arch_prefix))/libtest_dt_runpath_y.so
-
-$(LOCAL_BUILT_MODULE) : PRIVATE_LIB_D := $(lib_d)
-$(LOCAL_BUILT_MODULE) : PRIVATE_LIB_A := $(lib_a)
-$(LOCAL_BUILT_MODULE) : PRIVATE_LIB_B := $(lib_b)
-$(LOCAL_BUILT_MODULE) : PRIVATE_LIB_C := $(lib_c)
-$(LOCAL_BUILT_MODULE) : PRIVATE_LIB_X := $(lib_x)
-$(LOCAL_BUILT_MODULE) : PRIVATE_LIB_Y := $(lib_y)
-ifeq ($(TARGET_IS_64_BIT),true)
-  ifeq ($(TARGET_TRANSLATE_2ND_ARCH),true)
-    $(LOCAL_BUILT_MODULE) : PRIVATE_LIB_OR_LIB64 := $(if $(LOCAL_2ND_ARCH_VAR_PREFIX),lib/$(TARGET_2ND_ARCH),lib64)
-  else
-    $(LOCAL_BUILT_MODULE) : PRIVATE_LIB_OR_LIB64 := $(if $(LOCAL_2ND_ARCH_VAR_PREFIX),lib,lib64)
-  endif
-else
-  ifeq ($(TARGET_TRANSLATE_2ND_ARCH),true)
-    $(LOCAL_BUILT_MODULE) : PRIVATE_LIB_OR_LIB64 := $(if $(LOCAL_2ND_ARCH_VAR_PREFIX),lib/$(TARGET_2ND_ARCH),lib)
-  else
-    $(LOCAL_BUILT_MODULE) : PRIVATE_LIB_OR_LIB64 := lib
-  endif
-endif
-$(LOCAL_BUILT_MODULE) : $(lib_d) $(lib_a) $(lib_b) $(lib_c) $(lib_x) $(lib_y) $(BIONIC_TESTS_ZIPALIGN)
-	@echo "Aligning zip: $@"
-	$(hide) rm -rf $@.unaligned $@ $(dir $@)/zipdir && mkdir -p $(dir $@)/zipdir/libdir && \
-    mkdir -p $(dir $@)/zipdir/libdir/dt_runpath_a && mkdir -p $(dir $@)/zipdir/libdir/dt_runpath_b_c_x && \
-    mkdir -p $(dir $@)/zipdir/libdir/dt_runpath_y/$(PRIVATE_LIB_OR_LIB64)
-	$(hide) cp $(PRIVATE_LIB_D) $(dir $@)/zipdir/libdir
-	$(hide) cp $(PRIVATE_LIB_A) $(dir $@)/zipdir/libdir/dt_runpath_a
-	$(hide) cp $(PRIVATE_LIB_B) $(dir $@)/zipdir/libdir/dt_runpath_b_c_x
-	$(hide) cp $(PRIVATE_LIB_C) $(dir $@)/zipdir/libdir/dt_runpath_b_c_x
-	$(hide) cp $(PRIVATE_LIB_X) $(dir $@)/zipdir/libdir/dt_runpath_b_c_x
-	$(hide) cp $(PRIVATE_LIB_Y) $(dir $@)/zipdir/libdir/dt_runpath_y/$(PRIVATE_LIB_OR_LIB64)
-	$(hide) touch $(dir $@)/zipdir/empty_file.txt
-	$(hide) (cd $(dir $@)/zipdir && zip -qrD0 ../$(notdir $@).unaligned .)
-	$(hide) $(BIONIC_TESTS_ZIPALIGN) 4096 $@.unaligned $@
diff --git a/tests/libs/Android.mk b/tests/libs/Android.mk
deleted file mode 100644
index 08416ac..0000000
--- a/tests/libs/Android.mk
+++ /dev/null
@@ -1,28 +0,0 @@
-#
-# Copyright (C) 2012 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-LOCAL_PATH := $(call my-dir)
-
-# -----------------------------------------------------------------------------
-# Library used by dlext tests - zipped and aligned
-# -----------------------------------------------------------------------------
-include $(CLEAR_VARS)
-bionic_2nd_arch_prefix :=
-include $(LOCAL_PATH)/Android.build.dlext_testzip.mk
-ifneq ($(TARGET_2ND_ARCH),)
-  bionic_2nd_arch_prefix := $(TARGET_2ND_ARCH_VAR_PREFIX)
-  include $(LOCAL_PATH)/Android.build.dlext_testzip.mk
-endif