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

Commit 45681ecf authored by Hsin-Yi Chen's avatar Hsin-Yi Chen Committed by Keun Soo Yim
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
Merged-In: I4f736bd5b55db5af8598db0d5cd5fbd9ef323448
Change-Id: I4f736bd5b55db5af8598db0d5cd5fbd9ef323448
(cherry picked from commit 7e04edd5)
(cherry picked from commit 3b7d54dd791dfb58b6e42429311dd7ec9a4f1bb6)
parent ba54d5ba
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->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->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) {