Merge "Swallow parsing errors in parsing perf tests" into sc-dev

This commit is contained in:
Patrick Baumann
2021-03-02 21:29:46 +00:00
committed by Android (Google) Code Review

View File

@@ -97,11 +97,21 @@ class PackageParsingPerfTest {
private val state: BenchmarkState get() = perfStatusReporter.benchmarkState
private val apks: List<File> get() = params.apks
private fun safeParse(parser: ParallelParser<*>, file: File) {
try {
parser.parse(file)
} catch (e: Exception) {
// ignore
}
}
@Test
fun sequentialNoCache() {
params.cacheDirToParser(null).use { parser ->
while (state.keepRunning()) {
apks.forEach { parser.parse(it) }
apks.forEach {
safeParse(parser, it)
}
}
}
}
@@ -110,10 +120,10 @@ class PackageParsingPerfTest {
fun sequentialCached() {
params.cacheDirToParser(testFolder.newFolder()).use { parser ->
// Fill the cache
apks.forEach { parser.parse(it) }
apks.forEach { safeParse(parser, it) }
while (state.keepRunning()) {
apks.forEach { parser.parse(it) }
apks.forEach { safeParse(parser, it) }
}
}
}
@@ -132,7 +142,7 @@ class PackageParsingPerfTest {
fun parallelCached() {
params.cacheDirToParser(testFolder.newFolder()).use { parser ->
// Fill the cache
apks.forEach { parser.parse(it) }
apks.forEach { safeParse(parser, it) }
while (state.keepRunning()) {
apks.forEach { parser.submit(it) }