diff options
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2024-03-21 20:30:27 +0000 |
---|---|---|
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2024-03-21 20:30:27 +0000 |
commit | 26554b12a393121aa99813a24c1917987dda662c (patch) | |
tree | cbad5ba3a4565fd03dbac7d720683ef72b92bba6 | |
parent | bb8bdf1ffed6943de7823008dd9f10d6b5c962c0 (diff) | |
parent | 002aca7141e7baf488b02f330b307f059c47a84d (diff) | |
download | art-android14-tests-release.tar.gz |
Snap for 11608903 from 002aca7141e7baf488b02f330b307f059c47a84d to android14-tests-releaseandroid14-tests-release
Change-Id: I4ac4152ef570e064b0f4423f5cd33d6356fd2e47
-rw-r--r-- | libnativebridge/tests/Android.bp | 51 | ||||
-rw-r--r-- | libnativebridge/tests/libnativebridge_api_test.cpp (renamed from libnativebridge/tests/libnativebridge_lazy_test.cpp) | 15 |
2 files changed, 19 insertions, 47 deletions
diff --git a/libnativebridge/tests/Android.bp b/libnativebridge/tests/Android.bp index f1725fc278..008ef5ccdf 100644 --- a/libnativebridge/tests/Android.bp +++ b/libnativebridge/tests/Android.bp @@ -82,14 +82,13 @@ cc_test_library { defaults: ["libnativebridge-test-case-defaults"], } -cc_defaults { - name: "libnativebridge-tests-defaults", +cc_test { + name: "libnativebridge-tests", defaults: [ "art_defaults", "art_test_defaults", ], - // TODO(mast): Split up art_gtest_defaults so that it can be used for the - // following without pulling in lots of libs. + target: { linux: { cflags: [ @@ -100,11 +99,6 @@ cc_defaults { ], }, }, -} - -cc_test { - name: "libnativebridge-tests", - defaults: ["libnativebridge-tests-defaults"], // native_bridge.cc doesn't support reloading the native bridge after // unloading, so each test needs to be its own process. @@ -154,35 +148,14 @@ cc_test { header_libs: ["libbase_headers"], } -// Variant of libnativebridge-tests that is part of CTS to verify backed-by API -// coverage. +// Very basic tests in CTS to verify backed-by API coverage of the exported API +// in libnativebridge.map.txt. cc_test { name: "art_libnativebridge_cts_tests", - defaults: [ - "art_standalone_test_defaults", - "libnativebridge-tests-defaults", - ], - - // TODO(b/189484095): Pick only a subset of the tests in - // libnativebridge-tests that don't require the native bridge lib to be - // 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", - ], - static_libs: [ - "libdl_android", - "libnativebridge", - ], - shared_libs: [ - "liblog", - ], - header_libs: ["libbase_headers"], - + defaults: ["art_standalone_test_defaults"], + shared_libs: ["libnativebridge"], + static_libs: ["libbase"], + srcs: ["libnativebridge_api_test.cpp"], test_config_template: ":art-gtests-target-standalone-cts-template", test_suites: [ "cts", @@ -193,12 +166,10 @@ cc_test { cc_test { name: "libnativebridge-lazy-tests", - defaults: ["libnativebridge-tests-defaults"], - host_supported: false, - test_suites: ["device-tests"], + defaults: ["art_standalone_test_defaults"], static_libs: [ "libbase", "libnativebridge_lazy", ], - srcs: ["libnativebridge_lazy_test.cpp"], + srcs: ["libnativebridge_api_test.cpp"], } diff --git a/libnativebridge/tests/libnativebridge_lazy_test.cpp b/libnativebridge/tests/libnativebridge_api_test.cpp index e1d66f53df..037587cd81 100644 --- a/libnativebridge/tests/libnativebridge_lazy_test.cpp +++ b/libnativebridge/tests/libnativebridge_api_test.cpp @@ -21,33 +21,34 @@ namespace android { -class NativeBridgeLazyTest : public ::testing::Test {}; +class NativeBridgeApiTest : public ::testing::Test {}; +// Test the exported API in libnativebridge and libnativebridge_lazy. // The testing we can do here is limited since there's no exported API to // actually load the native bridge, but we only need to test the trivial // wrappers. -TEST_F(NativeBridgeLazyTest, NeedsNativeBridge) { +TEST_F(NativeBridgeApiTest, NeedsNativeBridge) { EXPECT_FALSE(NeedsNativeBridge(ABI_STRING)); } -TEST_F(NativeBridgeLazyTest, PreInitializeNativeBridge) { +TEST_F(NativeBridgeApiTest, PreInitializeNativeBridge) { EXPECT_FALSE(PreInitializeNativeBridge(nullptr, "")); } -TEST_F(NativeBridgeLazyTest, NativeBridgeAvailable) { +TEST_F(NativeBridgeApiTest, NativeBridgeAvailable) { EXPECT_FALSE(NativeBridgeAvailable()); } -TEST_F(NativeBridgeLazyTest, NativeBridgeInitialized) { +TEST_F(NativeBridgeApiTest, NativeBridgeInitialized) { EXPECT_FALSE(NativeBridgeInitialized()); } -TEST_F(NativeBridgeLazyTest, NativeBridgeGetTrampoline) { +TEST_F(NativeBridgeApiTest, NativeBridgeGetTrampoline) { EXPECT_EQ(nullptr, NativeBridgeGetTrampoline(nullptr, nullptr, nullptr, 0)); } -TEST_F(NativeBridgeLazyTest, NativeBridgeGetError) { +TEST_F(NativeBridgeApiTest, NativeBridgeGetError) { EXPECT_STREQ("native bridge is not initialized", NativeBridgeGetError()); } |