From 81d73d78fc65362c005cc82b75d601e2fd10b688 Mon Sep 17 00:00:00 2001 From: Krzysztof KosiƄski Date: Mon, 2 Oct 2023 19:58:53 +0000 Subject: Isolate ValidNameNativeBridge_test. The test depends on static state that cannot be reset and is modified by other tests. Upstream googletest sorts the tests before running them, so it's no longer possible to control the order of tests via the order of the srcs attribute. Bug: 302771018 Test: art/libnativebridge/tests/runtests.sh Change-Id: If6b96049f6ed7a276ca1dcd0d7a70966d7ffecbf --- libnativebridge/tests/Android.bp | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) (limited to 'libnativebridge') diff --git a/libnativebridge/tests/Android.bp b/libnativebridge/tests/Android.bp index b416b0081e..f98fadc42d 100644 --- a/libnativebridge/tests/Android.bp +++ b/libnativebridge/tests/Android.bp @@ -186,9 +186,6 @@ cc_test { // loaded, to avoid the problems with test_per_src and pushing the extra // libnativebridge*-test-case.so files to device through tradefed. srcs: [ - // ValidNameNativeBridge_test.cpp needs to be first due to global state - // had_error that isn't reset between tests. - "ValidNameNativeBridge_test.cpp", "NeedsNativeBridge_test.cpp", "UnavailableNativeBridge_test.cpp", ], @@ -209,6 +206,35 @@ cc_test { ], } +// ValidNameNativeBridge_test.cpp needs to be in it own executable due +// to global state had_error that isn't reset between tests. +cc_test { + name: "art_libnativebridge_valid_name_cts_tests", + defaults: [ + "art_standalone_test_defaults", + "libnativebridge-tests-defaults", + ], + + srcs: [ + "ValidNameNativeBridge_test.cpp", + ], + static_libs: [ + "libdl_android", + "libnativebridge", + ], + shared_libs: [ + "liblog", + ], + header_libs: ["libbase_headers"], + + test_config_template: ":art-gtests-target-standalone-cts-template", + test_suites: [ + "cts", + "general-tests", + "mts-art", + ], +} + cc_test { name: "libnativebridge-lazy-tests", defaults: ["libnativebridge-tests-defaults"], -- cgit v1.2.3-59-g8ed1b