Repository navigation
Commit 1f33e88
authored
Fix android_hardware_smoke_test retry mechanisms (flutter#195708)
Fixes flutter#194928
Fixes flutter#191348
Fixes flutter#193557
Related to flutter#193205
This makes `android_hardware_smoke_test` recover cleanly from transient
emulator `SurfaceFlinger` wedges and host-GPU-pipe startup crashes
instead of timing out or failing the shard after a passing retry. See
flutter#193557 (comment)
for my root-cause investigation and local emulator reproduction.
## What changed
`run_android_hardware_smoke_tests.dart` already retried failed `flutter
drive` runs once, while invoking `adb logcat -c` and `flutter drive`
through `runCommand`, which called `foundError` on any non-zero exit and
marked the shard failed even when attempt 2 passed. `runCommand` now
supports `checkExitCode: false` so retryable commands do not record a
shard error on attempt 1, and `startCommand` decodes output streams with
`Utf8Decoder(allowMalformed: true)` so raw bytes in native crash
tombstones do not throw `FormatException` when inspecting `adb logcat
-d`.
Retrying with `flutter drive --no-build` only restarted the app process
and left `SurfaceFlinger` wedged when an emulator QuickBoot snapshot
broke display composition. When attempt 1 fails with a blank screenshot
or fatal graphics error in `adb logcat -d`, the runner now resets
`sys.boot_completed` to `0`, restarts `surfaceflinger` and `zygote` via
`adb shell stop` and `adb shell start`, waits for
`sys.boot_completed=1`, and unlocks the screen before attempt 2. Normal
test assertion failures and golden mismatches still fail immediately on
attempt 1.
When the app crashed during native EGL or Vulkan startup right after
printing its Dart VM service URI, `flutter drive` looped against the
closed `adb forward` port until LUCI killed the shard on timeout.
`startCommand` and `runCommand` now accept a `stderrListener` alongside
`outputListener` so the runner can watch `stdout` and `stderr` for
slow-VM-connect warnings, check `adb shell pidof`, send `SIGKILL` to
`flutter drive` once the app process has exited, and trigger the
userspace-restart retry immediately.
In `FlutterActivityTest.kt`, querying `logcat -d --pid=$pid *:W`
stripped `Log.i` attempt markers, while both `FlutterActivityTest.kt`
and `run_android_hardware_smoke_tests.dart` treated routine `HWUI`
warnings as fatal errors. `FlutterActivityTest.kt` now passes `$TAG:I
*:W` to keep attempt markers visible in the dump. Both files now match
explicit fatal EGL, Vulkan, and host-pipe errors while ignoring benign
`HWUI` capability-probe logs.
## Pre-launch Checklist
- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [AI contribution guidelines] and understand my
responsibilities, or I am not using AI tools.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant in-code documentation (doc comments with
`///`).
- [x] If this PR introduces a new feature or capability, I created and
linked a website documentation issue or PR in [flutter/website] (or
verified none is needed).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.
<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[AI contribution guidelines]:
https://github.com/flutter/flutter/blob/main/CONTRIBUTING.ai.md
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[flutter/website]: https://github.com/flutter/website
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md1 parent 52bfbdd commit 1f33e88
7 files changed
Lines changed: 588 additions & 172 deletions
File tree
- dev
- bots
- suite_runners
- test
- integration_tests/android_hardware_smoke_test
- android/app/src/androidTest/java/com/example/android_hardware_smoke_test
- lib
- test_driver
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
82 | | - | |
83 | | - | |
84 | | - | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
85 | 86 | | |
86 | | - | |
87 | | - | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
88 | 94 | | |
89 | 95 | | |
90 | 96 | | |
| |||
93 | 99 | | |
94 | 100 | | |
95 | 101 | | |
| 102 | + | |
96 | 103 | | |
97 | 104 | | |
98 | 105 | | |
| |||
118 | 125 | | |
119 | 126 | | |
120 | 127 | | |
121 | | - | |
| 128 | + | |
122 | 129 | | |
123 | 130 | | |
124 | 131 | | |
| |||
136 | 143 | | |
137 | 144 | | |
138 | 145 | | |
139 | | - | |
| 146 | + | |
140 | 147 | | |
141 | 148 | | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
142 | 153 | | |
143 | 154 | | |
144 | 155 | | |
| |||
223 | 234 | | |
224 | 235 | | |
225 | 236 | | |
226 | | - | |
227 | | - | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
228 | 251 | | |
229 | 252 | | |
230 | | - | |
231 | | - | |
232 | | - | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
233 | 257 | | |
234 | 258 | | |
235 | 259 | | |
236 | | - | |
237 | | - | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
238 | 263 | | |
239 | 264 | | |
240 | 265 | | |
241 | 266 | | |
242 | 267 | | |
| 268 | + | |
243 | 269 | | |
244 | 270 | | |
245 | 271 | | |
246 | 272 | | |
247 | 273 | | |
248 | 274 | | |
| 275 | + | |
249 | 276 | | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
250 | 281 | | |
251 | 282 | | |
252 | 283 | | |
| |||
268 | 299 | | |
269 | 300 | | |
270 | 301 | | |
| 302 | + | |
271 | 303 | | |
272 | 304 | | |
273 | 305 | | |
| |||
277 | 309 | | |
278 | 310 | | |
279 | 311 | | |
280 | | - | |
281 | | - | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
282 | 315 | | |
283 | 316 | | |
284 | 317 | | |
| |||
327 | 360 | | |
328 | 361 | | |
329 | 362 | | |
330 | | - | |
331 | | - | |
332 | | - | |
333 | | - | |
334 | | - | |
| 363 | + | |
| 364 | + | |
335 | 365 | | |
336 | 366 | | |
337 | | - | |
338 | | - | |
339 | | - | |
340 | | - | |
341 | | - | |
342 | | - | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
343 | 370 | | |
344 | 371 | | |
0 commit comments