Fix broken input tests
InputPublisherAndConsumer_test currently segfaults due to
null pointer dereference. This is because 0 is passed instead
of a valid pointer to an allocated int32_t. Also, enforce strict
compiler warnings, include signed comparisons.
Bug: 62033391
Test: m -j libinput_tests_InputEvent_test
libinput_tests_InputChannel_test
libinput_tests_InputPublisherAndConsumer_test
libinput_tests_InputTransport_test libinput_tests_VelocityTracker_test
&& adb push out/target/product/taimen/data/nativetest/libinput_tests/
/data/nativetest/
then run the above tests individually, for example
/data/nativetest/libinput_tests # ./InputPublisherAndConsumer_test
and others in a similar manner
Change-Id: Ia030cdbfa22d2bf7bdf6274a337b059ca3f9a6c3
diff --git a/libs/input/tests/InputPublisherAndConsumer_test.cpp b/libs/input/tests/InputPublisherAndConsumer_test.cpp
index a136738..34c52d0 100644
--- a/libs/input/tests/InputPublisherAndConsumer_test.cpp
+++ b/libs/input/tests/InputPublisherAndConsumer_test.cpp
@@ -89,8 +89,9 @@
uint32_t consumeSeq;
InputEvent* event;
+ int32_t displayId;
status = mConsumer->consume(&mEventFactory, true /*consumeBatches*/, -1, &consumeSeq, &event,
- 0);
+ &displayId);
ASSERT_EQ(OK, status)
<< "consumer consume should return OK";
@@ -133,7 +134,7 @@
const uint32_t seq = 15;
const int32_t deviceId = 1;
const int32_t source = AINPUT_SOURCE_TOUCHSCREEN;
- const int32_t displayId = 0;
+ int32_t displayId = 0;
const int32_t action = AMOTION_EVENT_ACTION_MOVE;
const int32_t actionButton = 0;
const int32_t flags = AMOTION_EVENT_FLAG_WINDOW_IS_OBSCURED;
@@ -176,7 +177,7 @@
uint32_t consumeSeq;
InputEvent* event;
status = mConsumer->consume(&mEventFactory, true /*consumeBatches*/, -1, &consumeSeq, &event,
- 0);
+ &displayId);
ASSERT_EQ(OK, status)
<< "consumer consume should return OK";