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/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
+ },
+}