From 6eba01f8f42914a6b19dfdecfdb8e64c707795f7 Mon Sep 17 00:00:00 2001 From: Yifan Hong Date: Fri, 21 Jun 2019 15:05:19 -0700 Subject: [PATCH] health storage hal vts test: add more tolerance. Test: run on blueline Bug: 135631007 Change-Id: Ie1770a4a152a045e5f40eaf9cd7b551fe391a0b1 Merged-In: Ie1770a4a152a045e5f40eaf9cd7b551fe391a0b1 (cherry picked from commit ae3d61c2c336a40cd6cdfd073ad112e5d70286c3) --- .../functional/VtsHalHealthStorageV1_0TargetTest.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/health/storage/1.0/vts/functional/VtsHalHealthStorageV1_0TargetTest.cpp b/health/storage/1.0/vts/functional/VtsHalHealthStorageV1_0TargetTest.cpp index 946e5f2470..2365124dcb 100644 --- a/health/storage/1.0/vts/functional/VtsHalHealthStorageV1_0TargetTest.cpp +++ b/health/storage/1.0/vts/functional/VtsHalHealthStorageV1_0TargetTest.cpp @@ -35,6 +35,9 @@ using ::std::literals::chrono_literals::operator""ms; // Dev GC timeout. This is the timeout used by vold. const uint64_t kDevGcTimeoutSec = 120; const std::chrono::seconds kDevGcTimeout{kDevGcTimeoutSec}; +// Dev GC timeout tolerance. The HAL may not immediately return after the +// timeout, so include an acceptable tolerance. +const std::chrono::seconds kDevGcTolerance{3}; // Time accounted for RPC calls. const std::chrono::milliseconds kRpcTime{1000}; @@ -156,8 +159,9 @@ TEST_F(HealthStorageHidlTest, GcNullCallback) { ASSERT_OK(ret); // Hold test process because HAL can be single-threaded and doing GC. - ASSERT_TRUE(ping(kDevGcTimeout + kRpcTime)) - << "Service must be available after " << toString(kDevGcTimeout + kRpcTime); + ASSERT_TRUE(ping(kDevGcTimeout + kDevGcTolerance + kRpcTime)) + << "Service must be available after " + << toString(kDevGcTimeout + kDevGcTolerance + kRpcTime); } /** @@ -167,7 +171,7 @@ TEST_F(HealthStorageHidlTest, GcNonNullCallback) { sp cb = new GcCallback(); auto ret = fs->garbageCollect(kDevGcTimeoutSec, cb); ASSERT_OK(ret); - cb->waitForResult(kDevGcTimeout + kRpcTime, Result::SUCCESS); + cb->waitForResult(kDevGcTimeout + kDevGcTolerance + kRpcTime, Result::SUCCESS); } } // namespace V1_0