diff options
author | jdesprez <jdesprez@google.com> | 2017-09-08 15:30:06 -0700 |
---|---|---|
committer | jdesprez <jdesprez@google.com> | 2017-10-13 14:25:08 -0700 |
commit | 267ab895f7f6371b073329f4e3f3acf8e5b3c55c (patch) | |
tree | 5c345456c340ec5aeb917be6d55949ef740d4b23 /src/com/android/tradefed/invoker | |
parent | 82e24a3a7cc971098b5af3614ce8ba7e83e4e6ef (diff) | |
download | tradefederation-267ab895f7f6371b073329f4e3f3acf8e5b3c55c.tar.gz |
Create interface and base metric collectors
This allows to collect metrics and have them available on
the result_reporters associated with the test run for now.
More work can go in the TestDataInfo to hold and carry
more data more efficiently, this is a first version.
Test: unit tests
Bug: 36351803
Change-Id: I30778e26cec540d002192fd9e62c7c2fe80ad6ce
Diffstat (limited to 'src/com/android/tradefed/invoker')
-rw-r--r-- | src/com/android/tradefed/invoker/TestInvocation.java | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/com/android/tradefed/invoker/TestInvocation.java b/src/com/android/tradefed/invoker/TestInvocation.java index dd9a4fb3c..13cdae075 100644 --- a/src/com/android/tradefed/invoker/TestInvocation.java +++ b/src/com/android/tradefed/invoker/TestInvocation.java @@ -32,6 +32,7 @@ import com.android.tradefed.device.ITestDevice; import com.android.tradefed.device.ITestDevice.RecoveryMode; import com.android.tradefed.device.StubDevice; import com.android.tradefed.device.TestDeviceState; +import com.android.tradefed.device.metric.IMetricCollector; import com.android.tradefed.invoker.shard.IShardHelper; import com.android.tradefed.invoker.shard.ShardBuildCloner; import com.android.tradefed.log.ILeveledLogOutput; @@ -762,8 +763,15 @@ public class TestInvocation implements ITestInvocation { * @param listener the {@link ITestInvocationListener} of test results * @throws DeviceNotAvailableException */ - private void runTests(IInvocationContext context, IConfiguration config, - ITestInvocationListener listener) throws DeviceNotAvailableException { + @VisibleForTesting + void runTests( + IInvocationContext context, IConfiguration config, ITestInvocationListener listener) + throws DeviceNotAvailableException { + // Wrap collectors in each other and collection will be sequential + for (IMetricCollector collector : config.getMetricCollectors()) { + listener = collector.init(context, listener); + } + for (IRemoteTest test : config.getTests()) { // For compatibility of those receivers, they are assumed to be single device alloc. if (test instanceof IDeviceTest) { |