diff options
author | Tri Vo <trong@google.com> | 2019-03-21 10:31:50 -0700 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2019-03-21 10:31:50 -0700 |
commit | f8f4527ef9583947a69ad875e63148d73e23aabe (patch) | |
tree | 2dd9e4f3df59eec15a5acdf849ee085fdebf7a32 | |
parent | 1a40c5cbbecbe8a04f84c8fc1351ed58fb0f76b8 (diff) | |
parent | 28d18ced6faeaf49958f00e6f0cc9499860d1436 (diff) | |
download | interfaces-f8f4527ef9583947a69ad875e63148d73e23aabe.tar.gz |
SystemSuspendTest.CleanupOnAbort increase timeout
am: 28d18ced6f
Change-Id: Ibc716da5ae4e2a99f346637a6a1d64dddd921c13
-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. |