Fix parallelNoCache perf test

This change catches exceptions while parsing and ensures that we add
something to the queue being analyzed, else we block until timeout for
each failure for each iteration leading to test timeouts on devices with
APKs that won't parse (some for expected reasons).

Fixes: 179430570
Test: atest PackageParsingPerfTest
Change-Id: I5287c48a8fa54cd44cf8b7433f8bb2536a3743b3
This commit is contained in:
Patrick Baumann 2021-04-01 11:34:59 -07:00
parent d4f0220d29
commit cdce73aa65

View File

@ -159,7 +159,15 @@ class PackageParsingPerfTest {
PARALLEL_MAX_THREADS, "package-parsing-test",
Process.THREAD_PRIORITY_FOREGROUND)
fun submit(file: File) = service.submit { queue.put(parse(file)) }
fun submit(file: File) {
service.submit {
try {
queue.put(parse(file))
} catch (e: Exception) {
queue.put(e)
}
}
}
fun take() = queue.poll(QUEUE_POLL_TIMEOUT_SECONDS, TimeUnit.SECONDS)