From 2a3537d175c8d112011a91e9fceb510df7671a24 Mon Sep 17 00:00:00 2001 From: David Brazdil Date: Wed, 7 Sep 2022 13:23:47 +0100 Subject: [PATCH] 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 --- .../java/android/avf/test/AVFHostTestCase.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/benchmark_hostside/java/android/avf/test/AVFHostTestCase.java b/tests/benchmark_hostside/java/android/avf/test/AVFHostTestCase.java index 045be947..760c0722 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 com.android.tradefed.util.CommandResult; 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 @@ public final class AVFHostTestCase extends MicrodroidHostTestCaseBase { 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 @@ public final class AVFHostTestCase extends MicrodroidHostTestCaseBase { private void reportMetric(List data, String name, String unit) { Map stats = mMetricsProcessor.computeStats(data, name, unit); - TestMetrics metrics = new TestMetrics(); for (Map.Entry entry : stats.entrySet()) { - metrics.addTestMetric(entry.getKey(), Double.toString(entry.getValue())); + mMetrics.addTestMetric(entry.getKey(), entry.getValue().toString()); } }