Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e447335f authored by Jiyong Park's avatar Jiyong Park
Browse files

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
parent becbf6cb
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -85,6 +85,7 @@ static std::unordered_map<std::string, Platform::mock_namespace_handle> 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() {