Fixed
Status Update
Comments
al...@google.com <al...@google.com>
ap...@google.com <ap...@google.com> #2
Project: platform/frameworks/support
Branch: androidx-main
commit 99e66e131ccc6016089e80d23d1ce5ff8c7f5d5d
Author: Allison Thompson <allisonmt@google.com>
Date: Mon Mar 28 14:27:50 2022
Allows tests to be skipped on unsupported devices.
Bug: b/227229375
Relnote: Previously an UnsupportedOperationException was thrown in the benchmark if run on an unsupported device. Now UOE only occurs if the metric is used on the unsupported device (ie: PowerMetric.configure).
Test: ./gradlew benchmark:benchmark-macro:cC
Change-Id: I5cf2004861662d9a751847ed4457178d36b8980f
M benchmark/benchmark-macro/src/main/java/androidx/benchmark/macro/Metric.kt
M benchmark/integration-tests/macrobenchmark/src/androidTest/java/androidx/benchmark/integration/macrobenchmark/TrivialPowerBenchmark.kt
A benchmark/benchmark-macro/src/main/java/androidx/benchmark/macro/PowerRail.kt
A benchmark/benchmark-macro/src/androidTest/java/androidx/benchmark/macro/PowerRailTest.kt
M benchmark/benchmark-macro/api/restricted_current.txt
https://android-review.googlesource.com/2046788
Branch: androidx-main
commit 99e66e131ccc6016089e80d23d1ce5ff8c7f5d5d
Author: Allison Thompson <allisonmt@google.com>
Date: Mon Mar 28 14:27:50 2022
Allows tests to be skipped on unsupported devices.
Bug:
Relnote: Previously an UnsupportedOperationException was thrown in the benchmark if run on an unsupported device. Now UOE only occurs if the metric is used on the unsupported device (ie: PowerMetric.configure).
Test: ./gradlew benchmark:benchmark-macro:cC
Change-Id: I5cf2004861662d9a751847ed4457178d36b8980f
M benchmark/benchmark-macro/src/main/java/androidx/benchmark/macro/Metric.kt
M benchmark/integration-tests/macrobenchmark/src/androidTest/java/androidx/benchmark/integration/macrobenchmark/TrivialPowerBenchmark.kt
A benchmark/benchmark-macro/src/main/java/androidx/benchmark/macro/PowerRail.kt
A benchmark/benchmark-macro/src/androidTest/java/androidx/benchmark/macro/PowerRailTest.kt
M benchmark/benchmark-macro/api/restricted_current.txt
Description
Sample failure:https://android-build.googleplex.com/builds/tests/view?invocationId=I94500010032007415&redirect=https%3A%2F%2Fsponge2.corp.google.com%2Ff4bf3852-6d0c-4a6b-9419-71122febc2ff&testResultId=TR07327948635652186
These tests should pass false to assumeTrue() on unsupported devices, instead of throwing an UnsupportedOperationException. The exception should be used if someone tries to run the benchmark on an unsupported device (e.g. in PowerMetric.configure / start).
If you pass false to assumeTrue(), it throws a special exception that registers the test as a skipped test instead of a failure (in that dashboard, white instead of red).