summaryrefslogtreecommitdiff
path: root/libnativeloader/native_loader_test.cpp
diff options
context:
space:
mode:
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();