ArtRunTest

public class ArtRunTest
extends Object implements IAbiReceiver, IConfigurationReceiver, IRemoteTest, ITestCollector, ITestFilterReceiver

java.lang.Object
   ↳ com.android.tradefed.testtype.ArtRunTest


A test runner to run ART run-tests.

Summary

Nested classes

class ArtRunTest.AdbShellCommandException

An exception class to report an error that occurred during the execution of an ADB shell command. 

Fields

public static final String CHECKER_PAR_FILENAME

Public constructors

ArtRunTest()

Public methods

void addAllExcludeFilters( filters)

Adds the ERROR(/Set) of filters of which tests to exclude.

void addAllIncludeFilters( filters)

Adds the ERROR(/Set) of filters of which tests to include.

void addExcludeFilter(String filter)

Adds a filter of which tests to exclude.

void addIncludeFilter(String filter)

Adds a filter of which tests to include.

void clearExcludeFilters()

Delete all the exclude filters currently tracked.

void clearIncludeFilters()

Delete all the include filters currently tracked.

IAbi getAbi()
getExcludeFilters()

Returns the current ERROR(/Set) of exclude filters.

getIncludeFilters()

Returns the current ERROR(/Set) of include filters.

void run(TestInformation testInfo, ITestInvocationListener listener)

Runs the tests, and reports result to the listener.

void setAbi(IAbi abi)

void setCollectTestsOnly(boolean shouldCollectTest)

Enables or disables test collection mode

void setConfiguration(IConfiguration configuration)

Injects the IConfiguration in use.

Protected methods

checkExitCode(Integer exitCode)

Check the exit code returned by a test command.

checkTestOutput(TestInformation testInfo, String actualOutputText, String outputShortName, String outputPrettyName)

Check an output produced by a test command.

File createTestLocalTempDirectory(TestInformation testInfo)

Create a local temporary directory within the test's dependencies folder, to collect test outputs pulled from the device-under-test.

executeCheckerTest(TestInformation testInfo, ITestInvocationListener listener)

Execute a Checker test and check its output.

void extractSourcesFromJar(File tmpCheckerLocalDir, File jar)

Extract src directory from given jar file to given directory.

File getCheckerBinaryPath(TestInformation testInfo)

Find the Checker binary (Python Archive).

runChecker(String[] checkerCommandLine)

Run a Checker command and check its result.

Fields

CHECKER_PAR_FILENAME

public static final String CHECKER_PAR_FILENAME

Public constructors

ArtRunTest

public ArtRunTest ()

Public methods

addAllExcludeFilters

public void addAllExcludeFilters ( filters)

Adds the ERROR(/Set) of filters of which tests to exclude.

Parameters
filters

addAllIncludeFilters

public void addAllIncludeFilters ( filters)

Adds the ERROR(/Set) of filters of which tests to include.

Parameters
filters

addExcludeFilter

public void addExcludeFilter (String filter)

Adds a filter of which tests to exclude.

Parameters
filter String

addIncludeFilter

public void addIncludeFilter (String filter)

Adds a filter of which tests to include.

Parameters
filter String

clearExcludeFilters

public void clearExcludeFilters ()

Delete all the exclude filters currently tracked.

clearIncludeFilters

public void clearIncludeFilters ()

Delete all the include filters currently tracked.

getAbi

public IAbi getAbi ()

Returns
IAbi

getExcludeFilters

public  getExcludeFilters ()

Returns the current ERROR(/Set) of exclude filters.

Returns

getIncludeFilters

public  getIncludeFilters ()

Returns the current ERROR(/Set) of include filters.

Returns

run

public void run (TestInformation testInfo, 
                ITestInvocationListener listener)

Runs the tests, and reports result to the listener.

Parameters
testInfo TestInformation: The TestInformation object containing useful information to run tests.

listener ITestInvocationListener: the ITestInvocationListener of test results

Throws
DeviceNotAvailableException

setAbi

public void setAbi (IAbi abi)

Parameters
abi IAbi

setCollectTestsOnly

public void setCollectTestsOnly (boolean shouldCollectTest)

Enables or disables test collection mode

setConfiguration

public void setConfiguration (IConfiguration configuration)

Injects the IConfiguration in use.

Parameters
configuration IConfiguration

Protected methods

checkExitCode

protected  checkExitCode (Integer exitCode)

Check the exit code returned by a test command.

Parameters
exitCode Integer: The exit code returned by the test command

Returns
An optional error message, empty if the test exit code indicated success

checkTestOutput

protected  checkTestOutput (TestInformation testInfo, 
                String actualOutputText, 
                String outputShortName, 
                String outputPrettyName)

Check an output produced by a test command.

Used to check the standard output and the standard error of a test.

Parameters
testInfo TestInformation: The TestInformation object associated to the executed test

actualOutputText String: The output produced by the test

outputShortName String: The short name of the output channel

outputPrettyName String: A prettier name for the output channel, used in error messages

Returns
An optional error message, empty if the checked output is valid

createTestLocalTempDirectory

protected File createTestLocalTempDirectory (TestInformation testInfo)

Create a local temporary directory within the test's dependencies folder, to collect test outputs pulled from the device-under-test.

Parameters
testInfo TestInformation: The TestInformation object associated to the executed test

Returns
File The ERROR(/File) object pointing to the created temporary directory.

Throws
If the creation of the temporary directory failed.

executeCheckerTest

protected  executeCheckerTest (TestInformation testInfo, 
                ITestInvocationListener listener)

Execute a Checker test and check its output.

Checker tests are additional tests included in some ART run-tests, written as annotations in the comments of a test's source files, and used to verify ART's compiler.

Parameters
testInfo TestInformation: The TestInformation object associated to the executed test

listener ITestInvocationListener: The ITestInvocationListener object associated to the executed test

Returns
An optional error message, empty if the Checker test succeeded

Throws
ArtRunTest.AdbShellCommandException
DeviceNotAvailableException

extractSourcesFromJar

protected void extractSourcesFromJar (File tmpCheckerLocalDir, 
                File jar)

Extract src directory from given jar file to given directory.

Parameters
tmpCheckerLocalDir File

jar File

getCheckerBinaryPath

protected File getCheckerBinaryPath (TestInformation testInfo)

Find the Checker binary (Python Archive).

Parameters
testInfo TestInformation

Returns
File

runChecker

protected  runChecker (String[] checkerCommandLine)

Run a Checker command and check its result.

Parameters
checkerCommandLine String: The Checker command line to execute

Returns
An optional error message, empty if the Checker invocation was successful