summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTri Vo <trong@google.com>2019-03-21 10:31:50 -0700
committerandroid-build-merger <android-build-merger@google.com>2019-03-21 10:31:50 -0700
commitf8f4527ef9583947a69ad875e63148d73e23aabe (patch)
tree2dd9e4f3df59eec15a5acdf849ee085fdebf7a32
parent1a40c5cbbecbe8a04f84c8fc1351ed58fb0f76b8 (diff)
parent28d18ced6faeaf49958f00e6f0cc9499860d1436 (diff)
downloadinterfaces-f8f4527ef9583947a69ad875e63148d73e23aabe.tar.gz
SystemSuspendTest.CleanupOnAbort increase timeout
am: 28d18ced6f Change-Id: Ibc716da5ae4e2a99f346637a6a1d64dddd921c13
-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.