Relax timing parameters for vibrator VTS

First we set the start timestamp before we call the compose method.
We'll increase the allowed latency to if the system is under heavy load
then there can be more latencies.

Bug: 184578694
Test: atest
Change-Id: I5c06017ab0242d32b281ff3a0d0dddcb2106de5d
This commit is contained in:
Vince Leung
2021-04-09 21:37:22 +00:00
parent f08107405a
commit 36f70d6ffc

View File

@@ -553,8 +553,6 @@ TEST_P(VibratorAidl, ComposeSizeBoundary) {
}
TEST_P(VibratorAidl, ComposeCallback) {
constexpr std::chrono::milliseconds allowedLatency{10};
if (capabilities & IVibrator::CAP_COMPOSE_EFFECTS) {
std::vector<CompositePrimitive> supported;
@@ -586,17 +584,16 @@ TEST_P(VibratorAidl, ComposeCallback) {
<< toString(primitive);
duration = std::chrono::milliseconds(durationMs);
start = high_resolution_clock::now();
EXPECT_EQ(Status::EX_NONE, vibrator->compose(composite, callback).exceptionCode())
<< toString(primitive);
start = high_resolution_clock::now();
EXPECT_EQ(completionFuture.wait_for(duration + allowedLatency), std::future_status::ready)
EXPECT_EQ(completionFuture.wait_for(duration * 2), std::future_status::ready)
<< toString(primitive);
end = high_resolution_clock::now();
elapsed = std::chrono::duration_cast<std::chrono::milliseconds>(end - start);
EXPECT_LE(elapsed.count(), (duration + allowedLatency).count()) << toString(primitive);
EXPECT_GE(elapsed.count(), (duration - allowedLatency).count()) << toString(primitive);
EXPECT_GE(elapsed.count(), duration.count()) << toString(primitive);
}
}
}