servicemanager: enable bctest with debug logs
Enable bctest binder test and put ioctl pass/failure logs for lava.
Change-Id: I33eb6b87d3f9efcef7334dbb0a649ce23b8b0a21
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
diff --git a/cmds/servicemanager/Android.mk b/cmds/servicemanager/Android.mk
index 8840867..46a053d 100644
--- a/cmds/servicemanager/Android.mk
+++ b/cmds/servicemanager/Android.mk
@@ -1,9 +1,11 @@
LOCAL_PATH:= $(call my-dir)
-#include $(CLEAR_VARS)
-#LOCAL_SRC_FILES := bctest.c binder.c
-#LOCAL_MODULE := bctest
-#include $(BUILD_EXECUTABLE)
+include $(CLEAR_VARS)
+LOCAL_SHARED_LIBRARIES := liblog
+LOCAL_CFLAGS := -DBCTEST_DEBUG=1
+LOCAL_SRC_FILES := bctest.c binder.c
+LOCAL_MODULE := bctest
+include $(BUILD_EXECUTABLE)
include $(CLEAR_VARS)
LOCAL_SHARED_LIBRARIES := liblog
diff --git a/cmds/servicemanager/binder.c b/cmds/servicemanager/binder.c
index 1985756..c45ef6d 100644
--- a/cmds/servicemanager/binder.c
+++ b/cmds/servicemanager/binder.c
@@ -136,7 +136,16 @@
int binder_become_context_manager(struct binder_state *bs)
{
- return ioctl(bs->fd, BINDER_SET_CONTEXT_MGR, 0);
+ int ret;
+ ret = ioctl(bs->fd, BINDER_SET_CONTEXT_MGR, 0);
+ if (ret < 0) {
+ fprintf(stderr,"binder_set_context_manager: ioctl FAIL (%s)\n", strerror(errno));
+#if BCTEST_DEBUG
+ } else {
+ fprintf(stderr,"binder_set_context_manager: ioctl PASS\n");
+#endif
+ }
+ return ret;
}
int binder_write(struct binder_state *bs, void *data, unsigned len)
@@ -151,8 +160,12 @@
bwr.read_buffer = 0;
res = ioctl(bs->fd, BINDER_WRITE_READ, &bwr);
if (res < 0) {
- fprintf(stderr,"binder_write: ioctl failed (%s)\n",
+ fprintf(stderr,"binder_write: ioctl FAIL (%s)\n",
strerror(errno));
+#if BCTEST_DEBUG
+ } else {
+ fprintf(stderr,"binder_write: ioctl PASS\n");
+#endif
}
return res;
}
@@ -339,8 +352,12 @@
res = ioctl(bs->fd, BINDER_WRITE_READ, &bwr);
if (res < 0) {
- fprintf(stderr,"binder: ioctl failed (%s)\n", strerror(errno));
+ fprintf(stderr,"binder: ioctl FAIL (%s)\n", strerror(errno));
goto fail;
+#if BCTEST_DEBUG
+ } else {
+ fprintf(stderr,"binder: ioctl PASS\n");
+#endif
}
res = binder_parse(bs, reply, readbuf, bwr.read_consumed, 0);
@@ -376,7 +393,14 @@
if (res < 0) {
ALOGE("binder_loop: ioctl failed (%s)\n", strerror(errno));
+#if BCTEST_DEBUG
+ fprintf(stderr,"binder_loop: ioctl FAIL (%s)\n", strerror(errno));
+#endif
break;
+#if BCTEST_DEBUG
+ } else {
+ fprintf(stderr,"binder_loop: ioctl PASS\n");
+#endif
}
res = binder_parse(bs, 0, readbuf, bwr.read_consumed, func);