GcovCodeCoverageCollector

public final class GcovCodeCoverageCollector
extends BaseDeviceMetricCollector implements IConfigurationReceiver

java.lang.Object
   ↳ com.android.tradefed.device.metric.BaseDeviceMetricCollector
     ↳ com.android.tradefed.device.metric.GcovCodeCoverageCollector


A BaseDeviceMetricCollector that will pull gcov coverage measurements off of the device and log them as test artifacts.

Summary

Public constructors

GcovCodeCoverageCollector()

Public methods

void extraInit(IInvocationContext context, ITestInvocationListener listener)
void logCoverageMeasurements(ITestDevice device, String runName)

Pulls native coverage measurements from the device and logs them.

void onTestRunEnd(DeviceMetricData runData, runMetrics)

Callback when a test run is ended.

void setCollectOnTestEnd(boolean collect)

Sets whether to collect coverage on testRunEnded.

void setConfiguration(IConfiguration config)

Injects the IConfiguration in use.

Public constructors

GcovCodeCoverageCollector

public GcovCodeCoverageCollector ()

Public methods

extraInit

public void extraInit (IInvocationContext context, 
                ITestInvocationListener listener)

Throws
DeviceNotAvailableException

logCoverageMeasurements

public void logCoverageMeasurements (ITestDevice device, 
                String runName)

Pulls native coverage measurements from the device and logs them.

Parameters
device ITestDevice

runName String

Throws
DeviceNotAvailableException

onTestRunEnd

public void onTestRunEnd (DeviceMetricData runData, 
                 runMetrics)

Callback when a test run is ended. This should be the time for clean up.

Parameters
runData DeviceMetricData: the DeviceMetricData holding the data for the run. Will be the same object as during BaseDeviceMetricCollector.onTestRunStart(com.android.tradefed.device.metric.DeviceMetricData).

runMetrics : the current map of metrics passed to ERROR(/#testRunEnded(long,Map)).

Throws
DeviceNotAvailableException

setCollectOnTestEnd

public void setCollectOnTestEnd (boolean collect)

Sets whether to collect coverage on testRunEnded.

Set this to false during re-runs, otherwise each individual test re-run will collect coverage rather than having a single merged coverage result.

Parameters
collect boolean

setConfiguration

public void setConfiguration (IConfiguration config)

Injects the IConfiguration in use.

Parameters
config IConfiguration