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

Commit 41eaab40 authored by Hsin-Yi Chen's avatar Hsin-Yi Chen
Browse files

Cast binder data type to uint64_t in high bits test

1. Cast fb->binder to uint64_t before shifting by 32 bits. It avoids
undefined result when binder is 32-bit.

2. Swap EXPECT_EQ arguments. The first one is expected value and the
second is actual value.

Bug: 64118463
Test: ./binderLibTest on x86 emulator
Change-Id: I4f736bd5b55db5af8598db0d5cd5fbd9ef323448
parent 715ac516
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -681,10 +681,10 @@ TEST_F(BinderLibTest, CheckHandleZeroBinderHighBitsZeroCookie) {

    const flat_binder_object *fb = reply.readObject(false);
    ASSERT_TRUE(fb != NULL);
    EXPECT_EQ(fb->hdr.type, BINDER_TYPE_HANDLE);
    EXPECT_EQ(ProcessState::self()->getStrongProxyForHandle(fb->handle), m_server);
    EXPECT_EQ(fb->cookie, (binder_uintptr_t)0);
    EXPECT_EQ(fb->binder >> 32, (binder_uintptr_t)0);
    EXPECT_EQ(BINDER_TYPE_HANDLE, fb->hdr.type);
    EXPECT_EQ(m_server, ProcessState::self()->getStrongProxyForHandle(fb->handle));
    EXPECT_EQ((binder_uintptr_t)0, fb->cookie);
    EXPECT_EQ((uint64_t)0, (uint64_t)fb->binder >> 32);
}

TEST_F(BinderLibTest, FreedBinder) {