From 0a10d6918c6279bacd01aa66350bb8d7b99d21ee Mon Sep 17 00:00:00 2001 From: Devin Moore Date: Wed, 16 Sep 2020 11:13:25 -0700 Subject: [PATCH] Change HIDL fmq tests to use int32_t for payload This is in preperation for more AIDL fmq testing. The types need to be the same and AIDL does not support unit16_t. Test: atest fmq_test fmq_unit_tests Bug: 142326204 Change-Id: Ice9c28c3d0df064ea43c31950b3438d2e0d19063 --- tests/msgq/1.0/ITestMsgQ.hal | 4 ++-- tests/msgq/1.0/default/TestMsgQ.cpp | 16 ++++++++-------- tests/msgq/1.0/default/TestMsgQ.h | 8 ++++---- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/tests/msgq/1.0/ITestMsgQ.hal b/tests/msgq/1.0/ITestMsgQ.hal index 112270a9e8..bd10237c90 100644 --- a/tests/msgq/1.0/ITestMsgQ.hal +++ b/tests/msgq/1.0/ITestMsgQ.hal @@ -31,7 +31,7 @@ interface ITestMsgQ { * * @return ret True if the setup is successful. */ - configureFmqSyncReadWrite(fmq_sync mqDesc) generates(bool ret); + configureFmqSyncReadWrite(fmq_sync mqDesc) generates(bool ret); /** * This method requests the service to return an MQDescriptor to @@ -46,7 +46,7 @@ interface ITestMsgQ { * @return mqDesc This structure describes the unsynchronized FMQ that was * set up by the service. Client can use it to set up the FMQ at its end. */ - getFmqUnsyncWrite(bool configureFmq) generates(bool ret, fmq_unsync mqDesc); + getFmqUnsyncWrite(bool configureFmq) generates(bool ret, fmq_unsync mqDesc); /** * This method request the service to write into the synchronized read/write diff --git a/tests/msgq/1.0/default/TestMsgQ.cpp b/tests/msgq/1.0/default/TestMsgQ.cpp index ba665c9204..44737378b3 100644 --- a/tests/msgq/1.0/default/TestMsgQ.cpp +++ b/tests/msgq/1.0/default/TestMsgQ.cpp @@ -25,7 +25,7 @@ namespace implementation { // Methods from ::android::hardware::tests::msgq::V1_0::ITestMsgQ follow. Return TestMsgQ::configureFmqSyncReadWrite( - const android::hardware::MQDescriptorSync& mqDesc) { + const android::hardware::MQDescriptorSync& mqDesc) { mFmqSynchronized.reset(new (std::nothrow) MessageQueueSync(mqDesc)); if ((mFmqSynchronized == nullptr) || (mFmqSynchronized->isValid() == false)) { return false; @@ -56,7 +56,7 @@ Return TestMsgQ::getFmqUnsyncWrite(bool configureFmq, getFmqUnsyncWrite_cb } Return TestMsgQ::requestWriteFmqSync(int32_t count) { - std::vector data(count); + std::vector data(count); for (int i = 0; i < count; i++) { data[i] = i; } @@ -65,14 +65,14 @@ Return TestMsgQ::requestWriteFmqSync(int32_t count) { } Return TestMsgQ::requestReadFmqSync(int32_t count) { - std::vector data(count); + std::vector data(count); bool result = mFmqSynchronized->read(&data[0], count) && verifyData(&data[0], count); return result; } Return TestMsgQ::requestWriteFmqUnsync(int32_t count) { - std::vector data(count); + std::vector data(count); for (int i = 0; i < count; i++) { data[i] = i; } @@ -81,14 +81,14 @@ Return TestMsgQ::requestWriteFmqUnsync(int32_t count) { } Return TestMsgQ::requestReadFmqUnsync(int32_t count) { - std::vector data(count); + std::vector data(count); bool result = mFmqUnsynchronized->read(&data[0], count) && verifyData(&data[0], count); return result; } Return TestMsgQ::requestBlockingRead(int32_t count) { - std::vector data(count); + std::vector data(count); bool result = mFmqSynchronized->readBlocking( &data[0], count, @@ -103,7 +103,7 @@ Return TestMsgQ::requestBlockingRead(int32_t count) { } Return TestMsgQ::requestBlockingReadDefaultEventFlagBits(int32_t count) { - std::vector data(count); + std::vector data(count); bool result = mFmqSynchronized->readBlocking( &data[0], count); @@ -116,7 +116,7 @@ Return TestMsgQ::requestBlockingReadDefaultEventFlagBits(int32_t count) { } Return TestMsgQ::requestBlockingReadRepeat(int32_t count, int32_t numIter) { - std::vector data(count); + std::vector data(count); for (int i = 0; i < numIter; i++) { bool result = mFmqSynchronized->readBlocking( &data[0], diff --git a/tests/msgq/1.0/default/TestMsgQ.h b/tests/msgq/1.0/default/TestMsgQ.h index f9fcddd4bc..8a204b725d 100644 --- a/tests/msgq/1.0/default/TestMsgQ.h +++ b/tests/msgq/1.0/default/TestMsgQ.h @@ -49,13 +49,13 @@ using android::hardware::MQDescriptorUnsync; using android::hardware::MessageQueue; struct TestMsgQ : public ITestMsgQ { - typedef MessageQueue MessageQueueSync; - typedef MessageQueue MessageQueueUnsync; + typedef MessageQueue MessageQueueSync; + typedef MessageQueue MessageQueueUnsync; TestMsgQ() : mFmqSynchronized(nullptr), mFmqUnsynchronized(nullptr) {} // Methods from ::android::hardware::tests::msgq::V1_0::ITestMsgQ follow. - Return configureFmqSyncReadWrite(const MQDescriptorSync& mqDesc) override; + Return configureFmqSyncReadWrite(const MQDescriptorSync& mqDesc) override; Return getFmqUnsyncWrite(bool configureFmq, getFmqUnsyncWrite_cb _hidl_cb) override; Return requestWriteFmqSync(int32_t count) override; Return requestReadFmqSync(int32_t count) override; @@ -73,7 +73,7 @@ private: /* * Utility function to verify data read from the fast message queue. */ - bool verifyData(uint16_t* data, int count) { + bool verifyData(int32_t* data, int count) { for (int i = 0; i < count; i++) { if (data[i] != i) return false; }