summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTri Vo <trong@google.com>2019-03-21 10:43:57 -0700
committerandroid-build-merger <android-build-merger@google.com>2019-03-21 10:43:57 -0700
commit10a8b1d2d57b6bfdb2743c3f95dd66a155323c4f (patch)
treece4d44c423c5ccff5c4b7c7be100502b796ab9c4
parent0b2e22d1294b3aba5a149d5915b0f15ee5971c38 (diff)
parentc81b32a2a93b3f82c05c3256752125d0fabe9551 (diff)
downloadinterfaces-10a8b1d2d57b6bfdb2743c3f95dd66a155323c4f.tar.gz
SystemSuspendTest.CleanupOnAbort increase timeout am: 28d18ced6f am: f8f4527ef9
am: c81b32a2a9 Change-Id: Ibe2c194aa409bccf230b33752755d764a09c632c
-rw-r--r--suspend/1.0/default/SystemSuspendUnitTest.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/suspend/1.0/default/SystemSuspendUnitTest.cpp b/suspend/1.0/default/SystemSuspendUnitTest.cpp
index c5e07cd..3923812 100644
--- a/suspend/1.0/default/SystemSuspendUnitTest.cpp
+++ b/suspend/1.0/default/SystemSuspendUnitTest.cpp
@@ -65,11 +65,10 @@ namespace android {
static constexpr char kServiceName[] = "TestService";
static constexpr char kControlServiceName[] = "TestControlService";
-static bool isReadBlocked(int fd) {
+static bool isReadBlocked(int fd, int timeout_ms = 20) {
struct pollfd pfd {
.fd = fd, .events = POLLIN,
};
- int timeout_ms = 20;
return poll(&pfd, 1, timeout_ms) == 0;
}
@@ -168,7 +167,7 @@ class SystemSuspendTest : public ::testing::Test {
ASSERT_TRUE(WriteStringToFd(wakeupCount, wakeupCountFd));
}
- bool isSystemSuspendBlocked() { return isReadBlocked(stateFd); }
+ bool isSystemSuspendBlocked(int timeout_ms = 20) { return isReadBlocked(stateFd, timeout_ms); }
sp<IWakeLock> acquireWakeLock() {
return suspendService->acquireWakeLock(WakeLockType::PARTIAL, "TestLock");
@@ -288,7 +287,9 @@ TEST_F(SystemSuspendTest, CleanupOnAbort) {
::testing::KilledBySignal(SIGABRT), "");
ASSERT_TRUE(isSystemSuspendBlocked());
unblockSystemSuspendFromWakeupCount();
- ASSERT_FALSE(isSystemSuspendBlocked());
+ // Timing of the wake lock clean-up after process death is scheduler-dependent.
+ // Increase the timeout to avoid flakes.
+ ASSERT_FALSE(isSystemSuspendBlocked(200));
}
// Test that debug dump has correct information about WakeLocks.