Add test to open and close with no mmap
Add a test to check that alloc->buffers
is properly initialized when calling
close after open with no mmap.
Bug: 36007193
Test: run binderDriverInterfaceTest
Change-Id: I94af8499e65714b1b09ac063459eacf05504262a
Signed-off-by: Sherry Yang <sherryy@android.com>
diff --git a/libs/binder/tests/binderDriverInterfaceTest.cpp b/libs/binder/tests/binderDriverInterfaceTest.cpp
index ff5912f..b14631d 100644
--- a/libs/binder/tests/binderDriverInterfaceTest.cpp
+++ b/libs/binder/tests/binderDriverInterfaceTest.cpp
@@ -139,6 +139,12 @@
ASSERT_EQ(BINDER_CURRENT_PROTOCOL_VERSION, version.protocol_version);
}
+TEST_F(BinderDriverInterfaceTest, OpenNoMmap) {
+ int binderFd = open(BINDER_DEV_NAME, O_RDWR | O_NONBLOCK | O_CLOEXEC);
+ ASSERT_GE(binderFd, 0);
+ close(binderFd);
+}
+
TEST_F(BinderDriverInterfaceTest, WriteReadNull) {
binderTestIoctlErr1(BINDER_WRITE_READ, NULL, EFAULT);
}