diff options
author | Tri Vo <trong@google.com> | 2019-03-21 10:43:57 -0700 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2019-03-21 10:43:57 -0700 |
commit | 10a8b1d2d57b6bfdb2743c3f95dd66a155323c4f (patch) | |
tree | ce4d44c423c5ccff5c4b7c7be100502b796ab9c4 | |
parent | 0b2e22d1294b3aba5a149d5915b0f15ee5971c38 (diff) | |
parent | c81b32a2a93b3f82c05c3256752125d0fabe9551 (diff) | |
download | interfaces-10a8b1d2d57b6bfdb2743c3f95dd66a155323c4f.tar.gz |
SystemSuspendTest.CleanupOnAbort increase timeout am: 28d18ced6f am: f8f4527ef9
am: c81b32a2a9
Change-Id: Ibe2c194aa409bccf230b33752755d764a09c632c
-rw-r--r-- | suspend/1.0/default/SystemSuspendUnitTest.cpp | 9 |
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. |