mirror of
https://github.com/Evolution-X/hardware_interfaces
synced 2026-02-01 05:49:27 +00:00
Reland "Change HIDL fmq tests to use int32_t for payload"
9719e2d984
Bug: 142326204
Change-Id: I0914f7612bcd227f9a4cabbe2818de7d9999a3d3
This commit is contained in:
@@ -31,7 +31,7 @@ interface ITestMsgQ {
|
||||
*
|
||||
* @return ret True if the setup is successful.
|
||||
*/
|
||||
configureFmqSyncReadWrite(fmq_sync<uint16_t> mqDesc) generates(bool ret);
|
||||
configureFmqSyncReadWrite(fmq_sync<int32_t> 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<uint16_t> mqDesc);
|
||||
getFmqUnsyncWrite(bool configureFmq) generates(bool ret, fmq_unsync<int32_t> mqDesc);
|
||||
|
||||
/**
|
||||
* This method request the service to write into the synchronized read/write
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace implementation {
|
||||
|
||||
// Methods from ::android::hardware::tests::msgq::V1_0::ITestMsgQ follow.
|
||||
Return<bool> TestMsgQ::configureFmqSyncReadWrite(
|
||||
const android::hardware::MQDescriptorSync<uint16_t>& mqDesc) {
|
||||
const android::hardware::MQDescriptorSync<int32_t>& mqDesc) {
|
||||
mFmqSynchronized.reset(new (std::nothrow) MessageQueueSync(mqDesc));
|
||||
if ((mFmqSynchronized == nullptr) || (mFmqSynchronized->isValid() == false)) {
|
||||
return false;
|
||||
@@ -56,7 +56,7 @@ Return<void> TestMsgQ::getFmqUnsyncWrite(bool configureFmq, getFmqUnsyncWrite_cb
|
||||
}
|
||||
|
||||
Return<bool> TestMsgQ::requestWriteFmqSync(int32_t count) {
|
||||
std::vector<uint16_t> data(count);
|
||||
std::vector<int32_t> data(count);
|
||||
for (int i = 0; i < count; i++) {
|
||||
data[i] = i;
|
||||
}
|
||||
@@ -65,14 +65,14 @@ Return<bool> TestMsgQ::requestWriteFmqSync(int32_t count) {
|
||||
}
|
||||
|
||||
Return<bool> TestMsgQ::requestReadFmqSync(int32_t count) {
|
||||
std::vector<uint16_t> data(count);
|
||||
std::vector<int32_t> data(count);
|
||||
bool result = mFmqSynchronized->read(&data[0], count)
|
||||
&& verifyData(&data[0], count);
|
||||
return result;
|
||||
}
|
||||
|
||||
Return<bool> TestMsgQ::requestWriteFmqUnsync(int32_t count) {
|
||||
std::vector<uint16_t> data(count);
|
||||
std::vector<int32_t> data(count);
|
||||
for (int i = 0; i < count; i++) {
|
||||
data[i] = i;
|
||||
}
|
||||
@@ -81,14 +81,14 @@ Return<bool> TestMsgQ::requestWriteFmqUnsync(int32_t count) {
|
||||
}
|
||||
|
||||
Return<bool> TestMsgQ::requestReadFmqUnsync(int32_t count) {
|
||||
std::vector<uint16_t> data(count);
|
||||
std::vector<int32_t> data(count);
|
||||
bool result =
|
||||
mFmqUnsynchronized->read(&data[0], count) && verifyData(&data[0], count);
|
||||
return result;
|
||||
}
|
||||
|
||||
Return<void> TestMsgQ::requestBlockingRead(int32_t count) {
|
||||
std::vector<uint16_t> data(count);
|
||||
std::vector<int32_t> data(count);
|
||||
bool result = mFmqSynchronized->readBlocking(
|
||||
&data[0],
|
||||
count,
|
||||
@@ -103,7 +103,7 @@ Return<void> TestMsgQ::requestBlockingRead(int32_t count) {
|
||||
}
|
||||
|
||||
Return<void> TestMsgQ::requestBlockingReadDefaultEventFlagBits(int32_t count) {
|
||||
std::vector<uint16_t> data(count);
|
||||
std::vector<int32_t> data(count);
|
||||
bool result = mFmqSynchronized->readBlocking(
|
||||
&data[0],
|
||||
count);
|
||||
@@ -116,7 +116,7 @@ Return<void> TestMsgQ::requestBlockingReadDefaultEventFlagBits(int32_t count) {
|
||||
}
|
||||
|
||||
Return<void> TestMsgQ::requestBlockingReadRepeat(int32_t count, int32_t numIter) {
|
||||
std::vector<uint16_t> data(count);
|
||||
std::vector<int32_t> data(count);
|
||||
for (int i = 0; i < numIter; i++) {
|
||||
bool result = mFmqSynchronized->readBlocking(
|
||||
&data[0],
|
||||
|
||||
@@ -49,13 +49,13 @@ using android::hardware::MQDescriptorUnsync;
|
||||
using android::hardware::MessageQueue;
|
||||
|
||||
struct TestMsgQ : public ITestMsgQ {
|
||||
typedef MessageQueue<uint16_t, kSynchronizedReadWrite> MessageQueueSync;
|
||||
typedef MessageQueue<uint16_t, kUnsynchronizedWrite> MessageQueueUnsync;
|
||||
typedef MessageQueue<int32_t, kSynchronizedReadWrite> MessageQueueSync;
|
||||
typedef MessageQueue<int32_t, kUnsynchronizedWrite> MessageQueueUnsync;
|
||||
|
||||
TestMsgQ() : mFmqSynchronized(nullptr), mFmqUnsynchronized(nullptr) {}
|
||||
|
||||
// Methods from ::android::hardware::tests::msgq::V1_0::ITestMsgQ follow.
|
||||
Return<bool> configureFmqSyncReadWrite(const MQDescriptorSync<uint16_t>& mqDesc) override;
|
||||
Return<bool> configureFmqSyncReadWrite(const MQDescriptorSync<int32_t>& mqDesc) override;
|
||||
Return<void> getFmqUnsyncWrite(bool configureFmq, getFmqUnsyncWrite_cb _hidl_cb) override;
|
||||
Return<bool> requestWriteFmqSync(int32_t count) override;
|
||||
Return<bool> 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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user