summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorHans Chen <junyec@google.com>2018-07-14 17:23:45 -0700
committerHans Chen <junyec@google.com>2018-07-17 10:56:03 -0700
commit58d52f70b30d4c6d9b55fe03981f8a5292947eeb (patch)
tree2759b50a9e988e5490775b7228cc9169aa991aba /tests
parent76b383d5c2f5ec50f7102aca6700ced8bcb05601 (diff)
downloadandroid_hardware_interfaces-58d52f70b30d4c6d9b55fe03981f8a5292947eeb.tar.gz
android_hardware_interfaces-58d52f70b30d4c6d9b55fe03981f8a5292947eeb.tar.bz2
android_hardware_interfaces-58d52f70b30d4c6d9b55fe03981f8a5292947eeb.zip
Modified ITestMsgQ hal service interface
Test: make vts -j; fmq_test Changes: * Modified method that configures the synchronized queue. Now this method takes in a descriptor of an existing queue and creates a queue on the HAL server side. Change-Id: I395d6311f3580af6a87556849b3e921fa9eaf097
Diffstat (limited to 'tests')
-rw-r--r--tests/msgq/1.0/ITestMsgQ.hal10
-rw-r--r--tests/msgq/1.0/default/TestMsgQ.cpp29
-rw-r--r--tests/msgq/1.0/default/TestMsgQ.h2
3 files changed, 19 insertions, 22 deletions
diff --git a/tests/msgq/1.0/ITestMsgQ.hal b/tests/msgq/1.0/ITestMsgQ.hal
index 350e26d96..112270a9e 100644
--- a/tests/msgq/1.0/ITestMsgQ.hal
+++ b/tests/msgq/1.0/ITestMsgQ.hal
@@ -24,14 +24,14 @@ interface ITestMsgQ {
/**
* This method requests the service to set up a synchronous read/write
- * wait-free FMQ with the client as reader.
+ * wait-free FMQ using the input descriptor with the client as reader.
+ *
+ * @param mqDesc This structure describes the FMQ that was set up by the
+ * client. Server uses this descriptor to set up a FMQ object at its end.
*
* @return ret True if the setup is successful.
- * @return mqDesc This structure describes the FMQ that was
- * set up by the service. Client can use it to set up the FMQ at its end.
*/
- configureFmqSyncReadWrite()
- generates(bool ret, fmq_sync<uint16_t> mqDesc);
+ configureFmqSyncReadWrite(fmq_sync<uint16_t> mqDesc) generates(bool ret);
/**
* This method requests the service to return an MQDescriptor to
diff --git a/tests/msgq/1.0/default/TestMsgQ.cpp b/tests/msgq/1.0/default/TestMsgQ.cpp
index 6fd4fc6bb..ba665c920 100644
--- a/tests/msgq/1.0/default/TestMsgQ.cpp
+++ b/tests/msgq/1.0/default/TestMsgQ.cpp
@@ -24,24 +24,21 @@ namespace V1_0 {
namespace implementation {
// Methods from ::android::hardware::tests::msgq::V1_0::ITestMsgQ follow.
-Return<void> TestMsgQ::configureFmqSyncReadWrite(configureFmqSyncReadWrite_cb _hidl_cb) {
- static constexpr size_t kNumElementsInQueue = 1024;
- mFmqSynchronized.reset(new (std::nothrow) MessageQueueSync(
- kNumElementsInQueue, true /* configureEventFlagWord */));
+Return<bool> TestMsgQ::configureFmqSyncReadWrite(
+ const android::hardware::MQDescriptorSync<uint16_t>& mqDesc) {
+ mFmqSynchronized.reset(new (std::nothrow) MessageQueueSync(mqDesc));
if ((mFmqSynchronized == nullptr) || (mFmqSynchronized->isValid() == false)) {
- _hidl_cb(false /* ret */, MessageQueueSync::Descriptor());
- } else {
- /*
- * Initialize the EventFlag word with bit FMQ_NOT_FULL.
- */
- auto evFlagWordPtr = mFmqSynchronized->getEventFlagWord();
- if (evFlagWordPtr != nullptr) {
- std::atomic_init(evFlagWordPtr,
- static_cast<uint32_t>(ITestMsgQ::EventFlagBits::FMQ_NOT_FULL));
- }
- _hidl_cb(true /* ret */, *mFmqSynchronized->getDesc());
+ return false;
}
- return Void();
+ /*
+ * Initialize the EventFlag word with bit FMQ_NOT_FULL.
+ */
+ auto evFlagWordPtr = mFmqSynchronized->getEventFlagWord();
+ if (evFlagWordPtr != nullptr) {
+ std::atomic_init(evFlagWordPtr,
+ static_cast<uint32_t>(ITestMsgQ::EventFlagBits::FMQ_NOT_FULL));
+ }
+ return true;
}
Return<void> TestMsgQ::getFmqUnsyncWrite(bool configureFmq, getFmqUnsyncWrite_cb _hidl_cb) {
diff --git a/tests/msgq/1.0/default/TestMsgQ.h b/tests/msgq/1.0/default/TestMsgQ.h
index 86e4ac402..f9fcddd4b 100644
--- a/tests/msgq/1.0/default/TestMsgQ.h
+++ b/tests/msgq/1.0/default/TestMsgQ.h
@@ -55,7 +55,7 @@ struct TestMsgQ : public ITestMsgQ {
TestMsgQ() : mFmqSynchronized(nullptr), mFmqUnsynchronized(nullptr) {}
// Methods from ::android::hardware::tests::msgq::V1_0::ITestMsgQ follow.
- Return<void> configureFmqSyncReadWrite(configureFmqSyncReadWrite_cb _hidl_cb) override;
+ Return<bool> configureFmqSyncReadWrite(const MQDescriptorSync<uint16_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;