summaryrefslogtreecommitdiff
path: root/libnativeloader/native_loader_test.cpp
diff options
context:
space:
mode:
author Samip Garg <samgarg@google.com> 2023-01-11 15:14:47 +0000
committer Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> 2023-01-11 15:14:47 +0000
commit99887e28700d01386c65bb527dee42c365f22cbd (patch)
tree52ce1dd5ec0086e976412c2868019d22cd20522b /libnativeloader/native_loader_test.cpp
parent57ed482d340e78b9a6c96b7407963615a6703978 (diff)
parent474f318add83fbfa746b96904368da6e6c0a65dc (diff)
Snap tm-dev to android13-tests-dev am: 474f318add
Original change: https://googleplex-android-review.googlesource.com/c/platform/art/+/20514366 Change-Id: Ia20409501bb1dba383f6cbf1fdcc2f75dd687b4e Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
Diffstat (limited to 'libnativeloader/native_loader_test.cpp')
-rw-r--r--libnativeloader/native_loader_test.cpp24
1 files changed, 20 insertions, 4 deletions
diff --git a/libnativeloader/native_loader_test.cpp b/libnativeloader/native_loader_test.cpp
index 9648713e70..1dc778abcd 100644
--- a/libnativeloader/native_loader_test.cpp
+++ b/libnativeloader/native_loader_test.cpp
@@ -31,6 +31,7 @@ namespace android {
namespace nativeloader {
using ::testing::Eq;
+using ::testing::MatchesRegex;
using ::testing::NotNull;
using ::testing::StrEq;
using internal::ConfigEntry;
@@ -224,7 +225,7 @@ class NativeLoaderTest_Create : public NativeLoaderTest {
EXPECT_CALL(*mock, NativeBridgeInitialized()).Times(testing::AnyNumber());
EXPECT_CALL(*mock, mock_create_namespace(
- Eq(IsBridged()), StrEq(expected_namespace_name), nullptr,
+ Eq(IsBridged()), MatchesRegex(expected_namespace_name), nullptr,
StrEq(expected_library_path), expected_namespace_flags,
StrEq(expected_permitted_path), NsEq(expected_parent_namespace.c_str())))
.WillOnce(Return(TO_MOCK_NAMESPACE(TO_ANDROID_NAMESPACE(dex_path.c_str()))));
@@ -344,7 +345,7 @@ TEST_P(NativeLoaderTest_Create, UnbundledVendorApp) {
expected_permitted_path = expected_permitted_path + ":/vendor/" LIB_DIR;
expected_shared_libs_to_platform_ns =
default_public_libraries() + ":" + llndk_libraries_vendor();
- expected_link_with_vndk_ns = true;
+ expected_link_with_vndk_ns = !get_vndk_version(/*is_product_vndk=*/false).empty();
SetExpectations();
RunTest();
}
@@ -375,13 +376,28 @@ TEST_P(NativeLoaderTest_Create, UnbundledProductApp) {
is_shared = false;
if (is_product_vndk_version_defined()) {
- expected_namespace_name = "vendor-classloader-namespace";
+ expected_namespace_name = "(vendor|product)-classloader-namespace";
expected_library_path = expected_library_path + ":/product/" LIB_DIR ":/system/product/" LIB_DIR;
expected_permitted_path =
expected_permitted_path + ":/product/" LIB_DIR ":/system/product/" LIB_DIR;
+ expected_link_with_vndk_product_ns = true;
+
+ // The handling of extended libraries for product apps changed in the
+ // M-2022-10 release of the ART module (https://r.android.com/2194871).
+ // Since this test is in CTS for T, we need to accept both new and old
+ // behaviour, i.e. with and without the extended public libraries appended
+ // at the end. Skip the EXPECT_CALL in
+ // NativeLoaderTest_Create::SetExpectations and create a more lenient
+ // variant of it here.
+ expected_link_with_platform_ns = false;
expected_shared_libs_to_platform_ns =
default_public_libraries() + ":" + llndk_libraries_product();
- expected_link_with_vndk_product_ns = true;
+ EXPECT_CALL(*mock,
+ mock_link_namespaces(Eq(IsBridged()),
+ _,
+ NsEq("system"),
+ ::testing::StartsWith(expected_shared_libs_to_platform_ns)))
+ .WillOnce(Return(true));
}
SetExpectations();
RunTest();