summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTreehugger Robot <treehugger-gerrit@google.com>2017-11-09 19:14:02 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2017-11-09 19:14:02 +0000
commit863c52448ee3d218b03c585c4f1ee2fee2080a19 (patch)
tree88e0b6c46537e7c607f861dd21b4782b355a91d4
parentc5103e68aebc932a39557c9ed31baef93d487799 (diff)
parent25e47b174791295416f5db516862a5b00204080a (diff)
downloadplatform_hardware_interfaces-863c52448ee3d218b03c585c4f1ee2fee2080a19.tar.gz
platform_hardware_interfaces-863c52448ee3d218b03c585c4f1ee2fee2080a19.tar.bz2
platform_hardware_interfaces-863c52448ee3d218b03c585c4f1ee2fee2080a19.zip
Merge "Fix flakiness of sensor VTS test cases" into oreo-devoreo-dev
-rw-r--r--sensors/1.0/vts/functional/VtsHalSensorsV1_0TargetTest.cpp17
1 files changed, 9 insertions, 8 deletions
diff --git a/sensors/1.0/vts/functional/VtsHalSensorsV1_0TargetTest.cpp b/sensors/1.0/vts/functional/VtsHalSensorsV1_0TargetTest.cpp
index 2cf4ef9cd4..51d7645de3 100644
--- a/sensors/1.0/vts/functional/VtsHalSensorsV1_0TargetTest.cpp
+++ b/sensors/1.0/vts/functional/VtsHalSensorsV1_0TargetTest.cpp
@@ -1180,16 +1180,17 @@ void SensorsHidlTest::testBatchingOperation(SensorType type) {
usleep(batchingPeriodInNs / 1000 * 8 / 10);
SensorsHidlEnvironment::Instance()->setCollection(true);
- // 0.8 + 0.3 times the batching period
- // plus some time for the event to deliver
- events = collectEvents(
- batchingPeriodInNs / 1000 * 3 / 10,
- minFifoCount, true /*clearBeforeStart*/, false /*change collection*/);
+ // clean existing collections
+ collectEvents(0 /*timeLimitUs*/, 0/*nEventLimit*/,
+ true /*clearBeforeStart*/, false /*change collection*/);
+ // 0.8 + 0.2 times the batching period
+ usleep(batchingPeriodInNs / 1000 * 8 / 10);
ASSERT_EQ(flush(handle), Result::OK);
+ // plus some time for the event to deliver
events = collectEvents(allowedBatchDeliverTimeNs / 1000,
- minFifoCount, true /*clearBeforeStart*/, false /*change collection*/);
+ minFifoCount, false /*clearBeforeStart*/, false /*change collection*/);
SensorsHidlEnvironment::Instance()->setCollection(false);
ASSERT_EQ(activate(handle, 0), Result::OK);
@@ -1202,7 +1203,7 @@ void SensorsHidlTest::testBatchingOperation(SensorType type) {
}
// at least reach 90% of advertised capacity
- ASSERT_GT(nEvent, (size_t)(batchingPeriodInNs / minSamplingPeriodInNs * 9 / 10));
+ ASSERT_GT(nEvent, (size_t)(minFifoCount * 9 / 10));
}
// Test if sensor hal can do accelerometer batching properly
@@ -1223,7 +1224,7 @@ TEST_F(SensorsHidlTest, MagnetometerBatchingOperation) {
void SensorsHidlTest::testDirectReportOperation(
SensorType type, SharedMemType memType, RateLevel rate, const SensorEventsChecker &checker) {
constexpr size_t kEventSize = static_cast<size_t>(SensorsEventFormatOffset::TOTAL_LENGTH);
- constexpr size_t kNEvent = 500;
+ constexpr size_t kNEvent = 4096;
constexpr size_t kMemSize = kEventSize * kNEvent;
constexpr float kNormalNominal = 50;