Fix FMQ benchmark test.
Wait for the service to come up before running the test.
This should not be done for "real" HALs; test HALs needs
waitForHwService because they are not declared in manifest.
Test: Run test without service, test hangs (before this change,
test will fail); then starting the service will
resume the test, and it passes.
Test: Run with service, test passes
Bug: 63974414
Change-Id: Ie3758bf563a9e52ba4c7cb198dcace283cceeeff
Merged-In: Ie3758bf563a9e52ba4c7cb198dcace283cceeeff
diff --git a/benchmarks/msgq_benchmark_client.cpp b/benchmarks/msgq_benchmark_client.cpp
index e67f1cf..6abbe3b 100644
--- a/benchmarks/msgq_benchmark_client.cpp
+++ b/benchmarks/msgq_benchmark_client.cpp
@@ -23,6 +23,7 @@
#include <android/hardware/tests/msgq/1.0/IBenchmarkMsgQ.h>
#include <fmq/MessageQueue.h>
+#include <hidl/ServiceManagement.h>
// libutils:
using android::OK;
@@ -39,6 +40,7 @@
using android::hardware::kSynchronizedReadWrite;
using android::hardware::MQDescriptorSync;
using android::hardware::MessageQueue;
+using android::hardware::details::waitForHwService;
/*
* All the benchmark cases will be performed on an FMQ of size kQueueSize.
@@ -69,6 +71,9 @@
}
virtual void SetUp() {
+ // waitForHwService is required because IBenchmarkMsgQ is not in manifest.xml.
+ // "Real" HALs shouldn't be doing this.
+ waitForHwService(IBenchmarkMsgQ::descriptor, "default");
service = IBenchmarkMsgQ::getService();
ASSERT_NE(service, nullptr);
ASSERT_TRUE(service->isRemote());