OSDN Git Service

Merge "Sensor VTS testBatchingOperation flakiness fix" into oc-dev
authorTreeHugger Robot <treehugger-gerrit@google.com>
Fri, 25 Aug 2017 22:12:24 +0000 (22:12 +0000)
committerAndroid (Google) Code Review <android-gerrit@google.com>
Fri, 25 Aug 2017 22:12:24 +0000 (22:12 +0000)
1  2 
sensors/1.0/vts/functional/VtsHalSensorsV1_0TargetTest.cpp

@@@ -1180,16 -1180,17 +1180,17 @@@ void SensorsHidlTest::testBatchingOpera
    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);
    }
  
    // 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
@@@ -1235,11 -1236,6 +1236,11 @@@ void SensorsHidlTest::testDirectReportO
  
    SensorInfo sensor = defaultSensorByType(type);
  
 +  if (!isValidType(sensor.type)) {
 +    // no default sensor of this type
 +    return;
 +  }
 +
    if (!isDirectReportRateSupported(sensor, rate)) {
      return;
    }