Merge changes Id705d625,Id924fdd2 into main
* changes:
Fix flaky TestWakeupClientServiceImplUnitTest.
Fix Vts VUR test case.
diff --git a/automotive/remoteaccess/test_grpc_server/impl/src/TestWakeupClientServiceImpl.cpp b/automotive/remoteaccess/test_grpc_server/impl/src/TestWakeupClientServiceImpl.cpp
index 5d33fcb..515dc98 100644
--- a/automotive/remoteaccess/test_grpc_server/impl/src/TestWakeupClientServiceImpl.cpp
+++ b/automotive/remoteaccess/test_grpc_server/impl/src/TestWakeupClientServiceImpl.cpp
@@ -169,7 +169,8 @@
Looper::setForThread(mLooper);
while (true) {
- mLooper->pollAll(/*timeoutMillis=*/-1);
+ // Don't use pollAll since it might swallow wake.
+ mLooper->pollOnce(/*timeoutMillis=*/-1);
if (mServerStopped) {
return;
}
diff --git a/automotive/remoteaccess/test_grpc_server/impl/test/TestWakeupClientServiceImplUnitTest.cpp b/automotive/remoteaccess/test_grpc_server/impl/test/TestWakeupClientServiceImplUnitTest.cpp
index dd08e32..a7927f5 100644
--- a/automotive/remoteaccess/test_grpc_server/impl/test/TestWakeupClientServiceImplUnitTest.cpp
+++ b/automotive/remoteaccess/test_grpc_server/impl/test/TestWakeupClientServiceImplUnitTest.cpp
@@ -53,6 +53,9 @@
public:
virtual void SetUp() override {
int selectedPort = 0;
+ mServerStarted = false;
+ mService.reset();
+ mServer.reset();
mServerThread = std::thread([this, &selectedPort] {
mService = std::make_unique<MyTestWakeupClientServiceImpl>();
ServerBuilder builder;
diff --git a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp
index 30661a2..608a328 100644
--- a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp
+++ b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp
@@ -603,6 +603,7 @@
<< "skip testing";
}
+ // Subscribe to PERF_VEHICLE_SPEED using the max sample rate.
auto client = mVhalClient->getSubscriptionClient(mCallback);
ASSERT_NE(client, nullptr) << "Failed to get subscription client";
SubscribeOptionsBuilder builder(propId);
@@ -616,18 +617,17 @@
", error: %s",
propId, result.error().message().c_str());
- ASSERT_TRUE(mCallback->waitForExpectedEvents(propId, 1, std::chrono::seconds(2)))
- << "Must get at least 1 events within 2 seconds after subscription for rate: "
- << maxSampleRate;
-
// Sleep for 1 seconds to wait for more possible events to arrive.
std::this_thread::sleep_for(std::chrono::seconds(1));
client->unsubscribe({propId});
auto events = mCallback->getEvents(propId);
- if (events.size() == 1) {
- // We only received one event, the value is not changing so nothing to check here.
+ if (events.size() <= 1) {
+ // We received 0 or 1 event, the value is not changing so nothing to check here.
+ // If all VHAL clients are subscribing to PERF_VEHICLE_SPEED with VUR on, then we
+ // will receive 0 event. If there are other VHAL clients subscribing to PERF_VEHICLE_SPEED
+ // with VUR off, then we will receive 1 event which is the initial value.
return;
}