Fix VtsHalSensorsV2_0TargetTest am: 8659a96281
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/3115574 Change-Id: Ied0498a11b9f98994921c8dbe0953cfa8e42cbc0 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
commit
d8246d8300
1 changed files with 41 additions and 29 deletions
|
@ -604,7 +604,16 @@ void SensorsHidlTest::runFlushTest(const std::vector<SensorInfoType>& sensors, b
|
|||
EventCallback callback;
|
||||
getEnvironment()->registerCallback(&callback);
|
||||
|
||||
for (const SensorInfoType& sensor : sensors) {
|
||||
// 10 sensors per group
|
||||
constexpr size_t kSensorsPerGroup = 10;
|
||||
for (size_t sensorOffset = 0; sensorOffset < sensors.size();
|
||||
sensorOffset += kSensorsPerGroup) {
|
||||
std::vector<SensorInfoType> sensorGroup(
|
||||
sensors.begin() + sensorOffset,
|
||||
sensors.begin() +
|
||||
std::min(sensorOffset + kSensorsPerGroup, sensors.size()));
|
||||
|
||||
for (const SensorInfoType& sensor : sensorGroup) {
|
||||
// Configure and activate the sensor
|
||||
batch(sensor.sensorHandle, sensor.maxDelay, 0 /* maxReportLatencyNs */);
|
||||
activate(sensor.sensorHandle, activateSensor);
|
||||
|
@ -615,7 +624,8 @@ void SensorsHidlTest::runFlushTest(const std::vector<SensorInfoType>& sensors, b
|
|||
<< "Flush " << i << "/" << flushCalls << ": "
|
||||
<< " handle=0x" << std::hex << std::setw(8) << std::setfill('0')
|
||||
<< sensor.sensorHandle << std::dec
|
||||
<< " type=" << static_cast<int>(sensor.type) << " name=" << sensor.name);
|
||||
<< " type=" << static_cast<int>(sensor.type)
|
||||
<< " name=" << sensor.name);
|
||||
|
||||
Result flushResult = flush(sensor.sensorHandle);
|
||||
EXPECT_EQ(flushResult, expectedResponse);
|
||||
|
@ -623,23 +633,25 @@ void SensorsHidlTest::runFlushTest(const std::vector<SensorInfoType>& sensors, b
|
|||
}
|
||||
|
||||
// Wait up to one second for the flush events
|
||||
callback.waitForFlushEvents(sensors, flushCalls, milliseconds(1000) /* timeout */);
|
||||
callback.waitForFlushEvents(sensorGroup, flushCalls, milliseconds(1000) /* timeout */);
|
||||
|
||||
// Deactivate all sensors after waiting for flush events so pending flush events are not
|
||||
// abandoned by the HAL.
|
||||
for (const SensorInfoType& sensor : sensors) {
|
||||
for (const SensorInfoType& sensor : sensorGroup) {
|
||||
activate(sensor.sensorHandle, false);
|
||||
}
|
||||
getEnvironment()->unregisterCallback();
|
||||
|
||||
// Check that the correct number of flushes are present for each sensor
|
||||
for (const SensorInfoType& sensor : sensors) {
|
||||
for (const SensorInfoType& sensor : sensorGroup) {
|
||||
SCOPED_TRACE(::testing::Message()
|
||||
<< " handle=0x" << std::hex << std::setw(8) << std::setfill('0')
|
||||
<< sensor.sensorHandle << std::dec << " type=" << static_cast<int>(sensor.type)
|
||||
<< sensor.sensorHandle << std::dec
|
||||
<< " type=" << static_cast<int>(sensor.type)
|
||||
<< " name=" << sensor.name);
|
||||
ASSERT_EQ(callback.getFlushCount(sensor.sensorHandle), expectedFlushCount);
|
||||
}
|
||||
}
|
||||
getEnvironment()->unregisterCallback();
|
||||
}
|
||||
|
||||
TEST_P(SensorsHidlTest, FlushSensor) {
|
||||
|
|
Loading…
Reference in a new issue