Fix metric reporting from AVFHostTestCase
Metrics are not being picked up by the CI from this test. TestMetric
object must be a @Rule.
Test: atest AVFHostTestCases
Change-Id: I02d82160196f01301e46cf4852cc5daef6cbb203
diff --git a/tests/benchmark_hostside/java/android/avf/test/AVFHostTestCase.java b/tests/benchmark_hostside/java/android/avf/test/AVFHostTestCase.java
index 045be94..760c072 100644
--- a/tests/benchmark_hostside/java/android/avf/test/AVFHostTestCase.java
+++ b/tests/benchmark_hostside/java/android/avf/test/AVFHostTestCase.java
@@ -34,6 +34,7 @@
import org.junit.After;
import org.junit.Before;
+import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -66,6 +67,7 @@
private static final String METRIC_PREFIX = "avf_perf/hostside/";
private final MetricsProcessor mMetricsProcessor = new MetricsProcessor(METRIC_PREFIX);
+ @Rule public TestMetrics mMetrics = new TestMetrics();
@Before
public void setUp() throws Exception {
@@ -166,9 +168,8 @@
private void reportMetric(List<Double> data, String name, String unit) {
Map<String, Double> stats = mMetricsProcessor.computeStats(data, name, unit);
- TestMetrics metrics = new TestMetrics();
for (Map.Entry<String, Double> entry : stats.entrySet()) {
- metrics.addTestMetric(entry.getKey(), Double.toString(entry.getValue()));
+ mMetrics.addTestMetric(entry.getKey(), entry.getValue().toString());
}
}