From 37f1892d61daf50de166906b7a828586e334a0fc Mon Sep 17 00:00:00 2001 From: Steven Moreland Date: Wed, 10 Jul 2019 11:12:42 -0700 Subject: binderDriverInterfaceTest: fix failure After servicemanager was re-written in C++, it started returning a 4-byte payload for ping. Whereas before, in the C implementation, a zero byte payload was returned. Allowing multiple values in this test to stop presubmit failures. As a follow-up, I will try to determine if we can switch libbinder to a 0-byte ping (and revert this CL). Alternatively, once SM is in all branches, if we want this behavior, we can restrict this test to 4-bytes OR we can remove this expected value from this test altogether. This test is allowing both values and being fixed in this strange way because an investigation will follow, and our branching structure (and vendor prebuilts) make it hard to revert the offending change. Fixes: 136633463 Bug: 137203409 Test: binderDriverInterfaceTest passes (on devices with and w/o and updated SM) Change-Id: I43a5d10c59ae71933db40d932716cd979f802cc5 --- libs/binder/tests/binderDriverInterfaceTest.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'libs') diff --git a/libs/binder/tests/binderDriverInterfaceTest.cpp b/libs/binder/tests/binderDriverInterfaceTest.cpp index 77ebac8f5a..6508bb1283 100644 --- a/libs/binder/tests/binderDriverInterfaceTest.cpp +++ b/libs/binder/tests/binderDriverInterfaceTest.cpp @@ -286,7 +286,13 @@ TEST_F(BinderDriverInterfaceTest, Transaction) { EXPECT_EQ(0u, br.arg2.cookie); EXPECT_EQ(0u, br.arg2.code); EXPECT_EQ(0u, br.arg2.flags); - EXPECT_EQ(0u, br.arg2.data_size); + + // ping returns a 4 byte header in libbinder, but the original + // C implementation of servicemanager returns a 0 byte header + if (br.arg2.data_size != 0 && br.arg2.data_size != 4) { + ADD_FAILURE() << br.arg2.data_size << " is expected to be 0 or 4"; + } + EXPECT_EQ(0u, br.arg2.offsets_size); SCOPED_TRACE("3rd WriteRead"); -- cgit v1.2.3-59-g8ed1b