From 5b028bab2a530a703a99d905776d275f9020cafe Mon Sep 17 00:00:00 2001 From: Yo Chiang Date: Fri, 10 Jul 2020 19:34:53 +0800 Subject: [PATCH] Move SingletonTest back to libutils_test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use the new "data_libs:" to specify test library dependency. This is like "data:" and it treats compiled libraries as test data files. The result is libutils_test_singleton{1,2} is picked up by libutils_test and installed next to the test binary. Mark the test libs libutils_test_singleton{1,2} as uninstallable. This prevents installing libutils_test_singleton{1,2} directly and only permits installing via "data_libs:". ``` $ m libutils_test testcases └── libutils_test ├── arm │   ├── libutils_test │   ├── libutils_test_singleton1.so │   └── libutils_test_singleton2.so ├── arm64 │   ├── libutils_test │   ├── libutils_test_singleton1.so │   └── libutils_test_singleton2.so └── libutils_test.config ``` Bug: 124838889 Test: atest libutils_test Change-Id: I432135e128fc9eedb1b8c18a331957e271d8b0f0 --- libutils/Android.bp | 29 ++++++++--------------------- 1 file changed, 8 insertions(+), 21 deletions(-) diff --git a/libutils/Android.bp b/libutils/Android.bp index 9bd15c68e..022dedf05 100644 --- a/libutils/Android.bp +++ b/libutils/Android.bp @@ -248,6 +248,7 @@ cc_test { "LruCache_test.cpp", "Mutex_test.cpp", "SharedBuffer_test.cpp", + "Singleton_test.cpp", "String8_test.cpp", "String16_test.cpp", "StrongPointer_test.cpp", @@ -284,6 +285,11 @@ cc_test { }, }, + data_libs: [ + "libutils_test_singleton1", + "libutils_test_singleton2", + ], + cflags: [ "-Wall", "-Wextra", @@ -294,29 +300,10 @@ cc_test { test_suites: ["device-tests"], } -// TODO: the test infrastructure isn't yet capable of running this, -// so it's broken out into its own test so that the main libutils_tests -// can be in presubmit even if this can't. - -cc_test { - name: "libutils_singleton_test", - srcs: ["Singleton_test.cpp"], - cflags: [ - "-Wall", - "-Werror", - ], - shared_libs: ["libbase"], - - required: [ - ":libutils_test_singleton1", - ":libutils_test_singleton2", - ], -} - cc_test_library { name: "libutils_test_singleton1", host_supported: true, - relative_install_path: "libutils_test", + installable: false, srcs: ["Singleton_test1.cpp"], cflags: [ "-Wall", @@ -327,7 +314,7 @@ cc_test_library { cc_test_library { name: "libutils_test_singleton2", host_supported: true, - relative_install_path: "libutils_test", + installable: false, srcs: ["Singleton_test2.cpp"], cflags: [ "-Wall",