diff options
author | Peng Xu | 2017-08-18 19:50:57 -0500 |
---|---|---|
committer | Peng Xu | 2017-09-19 14:08:48 -0500 |
commit | 2aef4b48f0be3db69e5cee9006bdf3cecc662e91 (patch) | |
tree | 389043b995ca3a550f223d217ce53b142cd0e36b /sensors | |
parent | 9dc12843882449e9e44aca5651cfa0a4e9c5b616 (diff) | |
download | platform-hardware-interfaces-2aef4b48f0be3db69e5cee9006bdf3cecc662e91.tar.gz platform-hardware-interfaces-2aef4b48f0be3db69e5cee9006bdf3cecc662e91.tar.xz platform-hardware-interfaces-2aef4b48f0be3db69e5cee9006bdf3cecc662e91.zip |
Sensor VTS testBatchingOperation flakiness fix
This CL is cherry-picked from internal branch oc-dev.
Bug: 64732324
Bug: 63529148
Test: testBatchingOperation passes consistently
Merged-In: Id4e8075e249f3658f5683d53d6dc8403ee32bc4a
Change-Id: Id4e8075e249f3658f5683d53d6dc8403ee32bc4a
Diffstat (limited to 'sensors')
-rw-r--r-- | sensors/1.0/vts/functional/VtsHalSensorsV1_0TargetTest.cpp | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/sensors/1.0/vts/functional/VtsHalSensorsV1_0TargetTest.cpp b/sensors/1.0/vts/functional/VtsHalSensorsV1_0TargetTest.cpp index 19265c29..d3323e1f 100644 --- a/sensors/1.0/vts/functional/VtsHalSensorsV1_0TargetTest.cpp +++ b/sensors/1.0/vts/functional/VtsHalSensorsV1_0TargetTest.cpp | |||
@@ -1221,16 +1221,17 @@ void SensorsHidlTest::testBatchingOperation(SensorType type) { | |||
1221 | usleep(batchingPeriodInNs / 1000 * 8 / 10); | 1221 | usleep(batchingPeriodInNs / 1000 * 8 / 10); |
1222 | 1222 | ||
1223 | SensorsHidlEnvironment::Instance()->setCollection(true); | 1223 | SensorsHidlEnvironment::Instance()->setCollection(true); |
1224 | // 0.8 + 0.3 times the batching period | 1224 | // clean existing collections |
1225 | // plus some time for the event to deliver | 1225 | collectEvents(0 /*timeLimitUs*/, 0/*nEventLimit*/, |
1226 | events = collectEvents( | 1226 | true /*clearBeforeStart*/, false /*change collection*/); |
1227 | batchingPeriodInNs / 1000 * 3 / 10, | ||
1228 | minFifoCount, true /*clearBeforeStart*/, false /*change collection*/); | ||
1229 | 1227 | ||
1228 | // 0.8 + 0.2 times the batching period | ||
1229 | usleep(batchingPeriodInNs / 1000 * 8 / 10); | ||
1230 | ASSERT_EQ(flush(handle), Result::OK); | 1230 | ASSERT_EQ(flush(handle), Result::OK); |
1231 | 1231 | ||
1232 | // plus some time for the event to deliver | ||
1232 | events = collectEvents(allowedBatchDeliverTimeNs / 1000, | 1233 | events = collectEvents(allowedBatchDeliverTimeNs / 1000, |
1233 | minFifoCount, true /*clearBeforeStart*/, false /*change collection*/); | 1234 | minFifoCount, false /*clearBeforeStart*/, false /*change collection*/); |
1234 | 1235 | ||
1235 | SensorsHidlEnvironment::Instance()->setCollection(false); | 1236 | SensorsHidlEnvironment::Instance()->setCollection(false); |
1236 | ASSERT_EQ(activate(handle, 0), Result::OK); | 1237 | ASSERT_EQ(activate(handle, 0), Result::OK); |
@@ -1243,7 +1244,7 @@ void SensorsHidlTest::testBatchingOperation(SensorType type) { | |||
1243 | } | 1244 | } |
1244 | 1245 | ||
1245 | // at least reach 90% of advertised capacity | 1246 | // at least reach 90% of advertised capacity |
1246 | ASSERT_GT(nEvent, (size_t)(batchingPeriodInNs / minSamplingPeriodInNs * 9 / 10)); | 1247 | ASSERT_GT(nEvent, (size_t)(minFifoCount * 9 / 10)); |
1247 | } | 1248 | } |
1248 | 1249 | ||
1249 | // Test if sensor hal can do accelerometer batching properly | 1250 | // Test if sensor hal can do accelerometer batching properly |