Accept EAGAIN on a binder transaction.
A recent change to the binder kernel driver delays the
delivery of BR_TRANSACTION_COMPLETE until a reply comes
in. The binderDriverInterfaceTest uses the non-blocking
interface, and assumes BR_TRANSACTION_COMPLETE comes in
on the first read. I don't think we depend on this
assumption in any of our real code, so change the test.
Bug: 69442864
Test: binderDriverInterfaceTest passes
Change-Id: Iafca061c1bb7badd6cb61b3e876d9c3bbfa18542
Merged-In: Iafca061c1bb7badd6cb61b3e876d9c3bbfa18542
(cherry picked from 2b39df7b8964739f7eb793c13392b73752c08460)
diff --git a/libs/binder/tests/binderDriverInterfaceTest.cpp b/libs/binder/tests/binderDriverInterfaceTest.cpp
index ff5912f..9b289c0 100644
--- a/libs/binder/tests/binderDriverInterfaceTest.cpp
+++ b/libs/binder/tests/binderDriverInterfaceTest.cpp
@@ -77,6 +77,16 @@
virtual void TearDown() {
}
protected:
+ /* The ioctl must either return 0, or if it doesn't errno should be accepted_errno */
+ void binderTestIoctlSuccessOrError(int cmd, void *arg, int accepted_errno) {
+ int ret;
+
+ ret = ioctl(m_binderFd, cmd, arg);
+ if (ret != 0) {
+ EXPECT_EQ(errno, accepted_errno);
+ }
+ }
+
void binderTestIoctlRetErr2(int cmd, void *arg, int expect_ret, int expect_errno, int accept_errno) {
int ret;
@@ -250,7 +260,7 @@
{
SCOPED_TRACE("1st WriteRead");
- binderTestIoctl(BINDER_WRITE_READ, &bwr);
+ binderTestIoctlSuccessOrError(BINDER_WRITE_READ, &bwr, EAGAIN);
}
EXPECT_EQ(sizeof(bc1), bwr.write_consumed);
if (bwr.read_consumed < offsetof(typeof(br), pad)) {