GTest

public class GTest
extends GTestBase implements IDeviceTest

java.lang.Object
   ↳ com.android.tradefed.testtype.GTestBase
     ↳ com.android.tradefed.testtype.GTest


A Test that runs a native test package on given device.

Summary

Public constructors

GTest()

Public methods

ITestDevice getDevice()

Get the device under test.

void run(ITestInvocationListener listener)

void setDevice(ITestDevice device)

Inject the device under test.

Protected methods

void executeCommandByScript(ITestDevice testDevice, String cmd, IShellOutputReceiver resultParser)

Helper method to run a gtest command from a temporary script, in the case that the command is too long to be run directly by adb.

String getGTestCmdLine(String fullPath, String flags)

Helper method to build the gtest command to run.

String loadFilter(String binaryOnDevice)

Define get filter method.

boolean shouldSkipFile(String fullPath)

Helper method to determine if we should skip the execution of a given file.

Public constructors

GTest

public GTest ()

Public methods

getDevice

public ITestDevice getDevice ()

Get the device under test.

Returns
ITestDevice the ITestDevice

run

public void run (ITestInvocationListener listener)

Parameters
listener ITestInvocationListener

Throws
DeviceNotAvailableException

setDevice

public void setDevice (ITestDevice device)

Inject the device under test.

Parameters
device ITestDevice: the ITestDevice to use

Protected methods

executeCommandByScript

protected void executeCommandByScript (ITestDevice testDevice, 
                String cmd, 
                IShellOutputReceiver resultParser)

Helper method to run a gtest command from a temporary script, in the case that the command is too long to be run directly by adb.

Parameters
testDevice ITestDevice: the device on which to run the command

cmd String: the command string to run

resultParser IShellOutputReceiver: the output receiver for reading test results

Throws
DeviceNotAvailableException

getGTestCmdLine

protected String getGTestCmdLine (String fullPath, 
                String flags)

Helper method to build the gtest command to run.

Parameters
fullPath String: absolute file system path to gtest binary on device

flags String: gtest execution flags

Returns
String the shell command line to run for the gtest

loadFilter

protected String loadFilter (String binaryOnDevice)

Define get filter method.

Sub class must implement how to get it's own filter.

Parameters
binaryOnDevice String: the full path of the filter file.

Returns
String filter string.

Throws
DeviceNotAvailableException

shouldSkipFile

protected boolean shouldSkipFile (String fullPath)

Helper method to determine if we should skip the execution of a given file.

Parameters
fullPath String: the full path of the file in question

Returns
boolean true if we should skip the said file.

Throws
DeviceNotAvailableException