From e447335f81a3c3d954667fccc64e09e4f0d4796b Mon Sep 17 00:00:00 2001 From: Jiyong Park Date: Thu, 25 Jul 2019 22:54:27 +0900 Subject: [PATCH] Fix libnativeloader_test Just before the test is enabled, the neuralnetwork namespace was added by https://android-review.googlesource.com/c/platform/system/core/+/1014637. This is breaking the libnativeloader_test. Fix the test by adding the code for the new namespace. Bug: 138304345 Test: libnativeloader_test on aosp_cf_x86_phone Change-Id: Ifa762e395a3b9b5debdbcfcbcb395eeda3a1b2a4 --- libnativeloader/native_loader_test.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/libnativeloader/native_loader_test.cpp b/libnativeloader/native_loader_test.cpp index 614188b27..3232e4ccb 100644 --- a/libnativeloader/native_loader_test.cpp +++ b/libnativeloader/native_loader_test.cpp @@ -85,6 +85,7 @@ static std::unordered_map namespac {"runtime", TO_MOCK_NAMESPACE(TO_ANDROID_NAMESPACE("runtime"))}, {"sphal", TO_MOCK_NAMESPACE(TO_ANDROID_NAMESPACE("sphal"))}, {"vndk", TO_MOCK_NAMESPACE(TO_ANDROID_NAMESPACE("vndk"))}, + {"neuralnetworks", TO_MOCK_NAMESPACE(TO_ANDROID_NAMESPACE("neuralnetworks"))}, }; // The actual gmock object @@ -339,11 +340,13 @@ class NativeLoaderTest_Create : public NativeLoaderTest { bool expected_link_with_sphal_ns = !vendor_public_libraries().empty(); bool expected_link_with_vndk_ns = false; bool expected_link_with_default_ns = false; + bool expected_link_with_neuralnetworks_ns = true; std::string expected_shared_libs_to_platform_ns = default_public_libraries(); std::string expected_shared_libs_to_runtime_ns = runtime_public_libraries(); std::string expected_shared_libs_to_sphal_ns = vendor_public_libraries(); std::string expected_shared_libs_to_vndk_ns = vndksp_libraries(); std::string expected_shared_libs_to_default_ns = default_public_libraries(); + std::string expected_shared_libs_to_neuralnetworks_ns = neuralnetworks_public_libraries(); void SetExpectations() { NativeLoaderTest::SetExpectations(); @@ -394,6 +397,11 @@ class NativeLoaderTest_Create : public NativeLoaderTest { StrEq(expected_shared_libs_to_default_ns))) .WillOnce(Return(true)); } + if (expected_link_with_neuralnetworks_ns) { + EXPECT_CALL(*mock, mock_link_namespaces(Eq(IsBridged()), _, NsEq("neuralnetworks"), + StrEq(expected_shared_libs_to_neuralnetworks_ns))) + .WillOnce(Return(true)); + } } void RunTest() {