system/hardware/interfaces
Revision | f8f4527ef9583947a69ad875e63148d73e23aabe (tree) |
---|---|
Zeit | 2019-03-22 02:31:50 |
Autor | Tri Vo <trong@goog...> |
Commiter | android-build-merger |
SystemSuspendTest.CleanupOnAbort increase timeout
am: 28d18ced6f
Change-Id: Ibc716da5ae4e2a99f346637a6a1d64dddd921c13
@@ -65,11 +65,10 @@ namespace android { | ||
65 | 65 | static constexpr char kServiceName[] = "TestService"; |
66 | 66 | static constexpr char kControlServiceName[] = "TestControlService"; |
67 | 67 | |
68 | -static bool isReadBlocked(int fd) { | |
68 | +static bool isReadBlocked(int fd, int timeout_ms = 20) { | |
69 | 69 | struct pollfd pfd { |
70 | 70 | .fd = fd, .events = POLLIN, |
71 | 71 | }; |
72 | - int timeout_ms = 20; | |
73 | 72 | return poll(&pfd, 1, timeout_ms) == 0; |
74 | 73 | } |
75 | 74 |
@@ -168,7 +167,7 @@ class SystemSuspendTest : public ::testing::Test { | ||
168 | 167 | ASSERT_TRUE(WriteStringToFd(wakeupCount, wakeupCountFd)); |
169 | 168 | } |
170 | 169 | |
171 | - bool isSystemSuspendBlocked() { return isReadBlocked(stateFd); } | |
170 | + bool isSystemSuspendBlocked(int timeout_ms = 20) { return isReadBlocked(stateFd, timeout_ms); } | |
172 | 171 | |
173 | 172 | sp<IWakeLock> acquireWakeLock() { |
174 | 173 | return suspendService->acquireWakeLock(WakeLockType::PARTIAL, "TestLock"); |
@@ -288,7 +287,9 @@ TEST_F(SystemSuspendTest, CleanupOnAbort) { | ||
288 | 287 | ::testing::KilledBySignal(SIGABRT), ""); |
289 | 288 | ASSERT_TRUE(isSystemSuspendBlocked()); |
290 | 289 | unblockSystemSuspendFromWakeupCount(); |
291 | - ASSERT_FALSE(isSystemSuspendBlocked()); | |
290 | + // Timing of the wake lock clean-up after process death is scheduler-dependent. | |
291 | + // Increase the timeout to avoid flakes. | |
292 | + ASSERT_FALSE(isSystemSuspendBlocked(200)); | |
292 | 293 | } |
293 | 294 | |
294 | 295 | // Test that debug dump has correct information about WakeLocks. |