summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorHans Chen2018-07-14 19:23:45 -0500
committerHans Chen2018-07-17 12:56:03 -0500
commit58d52f70b30d4c6d9b55fe03981f8a5292947eeb (patch)
tree2759b50a9e988e5490775b7228cc9169aa991aba /tests
parent76b383d5c2f5ec50f7102aca6700ced8bcb05601 (diff)
downloadplatform-hardware-interfaces-58d52f70b30d4c6d9b55fe03981f8a5292947eeb.tar.gz
platform-hardware-interfaces-58d52f70b30d4c6d9b55fe03981f8a5292947eeb.tar.xz
platform-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 350e26d9..112270a9 100644
--- a/tests/msgq/1.0/ITestMsgQ.hal
+++ b/tests/msgq/1.0/ITestMsgQ.hal
@@ -24,14 +24,14 @@ interface ITestMsgQ {
24 24
25 /** 25 /**
26 * This method requests the service to set up a synchronous read/write 26 * This method requests the service to set up a synchronous read/write
27 * wait-free FMQ with the client as reader. 27 * wait-free FMQ using the input descriptor with the client as reader.
28 *
29 * @param mqDesc This structure describes the FMQ that was set up by the
30 * client. Server uses this descriptor to set up a FMQ object at its end.
28 * 31 *
29 * @return ret True if the setup is successful. 32 * @return ret True if the setup is successful.
30 * @return mqDesc This structure describes the FMQ that was
31 * set up by the service. Client can use it to set up the FMQ at its end.
32 */ 33 */
33 configureFmqSyncReadWrite() 34 configureFmqSyncReadWrite(fmq_sync<uint16_t> mqDesc) generates(bool ret);
34 generates(bool ret, fmq_sync<uint16_t> mqDesc);
35 35
36 /** 36 /**
37 * This method requests the service to return an MQDescriptor to 37 * 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 6fd4fc6b..ba665c92 100644
--- a/tests/msgq/1.0/default/TestMsgQ.cpp
+++ b/tests/msgq/1.0/default/TestMsgQ.cpp
@@ -24,24 +24,21 @@ namespace V1_0 {
24namespace implementation { 24namespace implementation {
25 25
26// Methods from ::android::hardware::tests::msgq::V1_0::ITestMsgQ follow. 26// Methods from ::android::hardware::tests::msgq::V1_0::ITestMsgQ follow.
27Return<void> TestMsgQ::configureFmqSyncReadWrite(configureFmqSyncReadWrite_cb _hidl_cb) { 27Return<bool> TestMsgQ::configureFmqSyncReadWrite(
28 static constexpr size_t kNumElementsInQueue = 1024; 28 const android::hardware::MQDescriptorSync<uint16_t>& mqDesc) {
29 mFmqSynchronized.reset(new (std::nothrow) MessageQueueSync( 29 mFmqSynchronized.reset(new (std::nothrow) MessageQueueSync(mqDesc));
30 kNumElementsInQueue, true /* configureEventFlagWord */));
31 if ((mFmqSynchronized == nullptr) || (mFmqSynchronized->isValid() == false)) { 30 if ((mFmqSynchronized == nullptr) || (mFmqSynchronized->isValid() == false)) {
32 _hidl_cb(false /* ret */, MessageQueueSync::Descriptor()); 31 return false;
33 } else {
34 /*
35 * Initialize the EventFlag word with bit FMQ_NOT_FULL.
36 */
37 auto evFlagWordPtr = mFmqSynchronized->getEventFlagWord();
38 if (evFlagWordPtr != nullptr) {
39 std::atomic_init(evFlagWordPtr,
40 static_cast<uint32_t>(ITestMsgQ::EventFlagBits::FMQ_NOT_FULL));
41 }
42 _hidl_cb(true /* ret */, *mFmqSynchronized->getDesc());
43 } 32 }
44 return Void(); 33 /*
34 * Initialize the EventFlag word with bit FMQ_NOT_FULL.
35 */
36 auto evFlagWordPtr = mFmqSynchronized->getEventFlagWord();
37 if (evFlagWordPtr != nullptr) {
38 std::atomic_init(evFlagWordPtr,
39 static_cast<uint32_t>(ITestMsgQ::EventFlagBits::FMQ_NOT_FULL));
40 }
41 return true;
45} 42}
46 43
47Return<void> TestMsgQ::getFmqUnsyncWrite(bool configureFmq, getFmqUnsyncWrite_cb _hidl_cb) { 44Return<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 86e4ac40..f9fcddd4 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 {
55 TestMsgQ() : mFmqSynchronized(nullptr), mFmqUnsynchronized(nullptr) {} 55 TestMsgQ() : mFmqSynchronized(nullptr), mFmqUnsynchronized(nullptr) {}
56 56
57 // Methods from ::android::hardware::tests::msgq::V1_0::ITestMsgQ follow. 57 // Methods from ::android::hardware::tests::msgq::V1_0::ITestMsgQ follow.
58 Return<void> configureFmqSyncReadWrite(configureFmqSyncReadWrite_cb _hidl_cb) override; 58 Return<bool> configureFmqSyncReadWrite(const MQDescriptorSync<uint16_t>& mqDesc) override;
59 Return<void> getFmqUnsyncWrite(bool configureFmq, getFmqUnsyncWrite_cb _hidl_cb) override; 59 Return<void> getFmqUnsyncWrite(bool configureFmq, getFmqUnsyncWrite_cb _hidl_cb) override;
60 Return<bool> requestWriteFmqSync(int32_t count) override; 60 Return<bool> requestWriteFmqSync(int32_t count) override;
61 Return<bool> requestReadFmqSync(int32_t count) override; 61 Return<bool> requestReadFmqSync(int32_t count) override;