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. |
Constants | |
|---|---|
String |
CHECKER_PAR_FILENAME
|
Fields | |
|---|---|
public
static
final
Boolean |
RUN_CHECKER
|
Public constructors | |
|---|---|
ArtRunTest()
|
|
Public methods | |
|---|---|
void
|
addAllExcludeFilters(Set<String> filters)
Adds the |
void
|
addAllIncludeFilters(Set<String> filters)
Adds the |
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()
|
Set<String>
|
getExcludeFilters()
Returns the current |
Set<String>
|
getIncludeFilters()
Returns the current |
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 |
Protected methods | |
|---|---|
Optional<String>
|
checkExitCode(Integer exitCode)
Check the exit code returned by a test command. |
Optional<String>
|
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. |
Optional<String>
|
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). |
Optional<String>
|
runChecker(String[] checkerCommandLine)
Run a Checker command and check its result. |
Constants
CHECKER_PAR_FILENAME
public static final String CHECKER_PAR_FILENAME
Constant Value: "art-run-test-checker"
Fields
RUN_CHECKER
public static final Boolean RUN_CHECKER
Public constructors
ArtRunTest
public ArtRunTest ()
Public methods
addAllExcludeFilters
public void addAllExcludeFilters (Set<String> filters)
Adds the Set of filters of which tests to exclude.
| Parameters | |
|---|---|
filters |
Set |
addAllIncludeFilters
public void addAllIncludeFilters (Set<String> filters)
Adds the Set of filters of which tests to include.
| Parameters | |
|---|---|
filters |
Set |
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.
getExcludeFilters
public Set<String> getExcludeFilters ()
Returns the current Set of exclude filters.
| Returns | |
|---|---|
Set<String> |
|
getIncludeFilters
public Set<String> getIncludeFilters ()
Returns the current Set of include filters.
| Returns | |
|---|---|
Set<String> |
|
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 |
|
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 Optional<String> checkExitCode (Integer exitCode)
Check the exit code returned by a test command.
| Parameters | |
|---|---|
exitCode |
Integer: The exit code returned by the test command |
| Returns | |
|---|---|
Optional<String> |
An optional error message, empty if the test exit code indicated success |
checkTestOutput
protected Optional<String> 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 | |
|---|---|
Optional<String> |
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 File object pointing to the created temporary directory. |
| Throws | |
|---|---|
IOException |
If the creation of the temporary directory failed. |
executeCheckerTest
protected Optional<String> 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 | |
|---|---|
Optional<String> |
An optional error message, empty if the Checker test succeeded |
| Throws | |
|---|---|
ArtRunTest.AdbShellCommandException |
|
DeviceNotAvailableException |
|
IOException |
|
extractSourcesFromJar
protected void extractSourcesFromJar (File tmpCheckerLocalDir,
File jar)Extract src directory from given jar file to given directory.
| Parameters | |
|---|---|
tmpCheckerLocalDir |
File |
jar |
File |
| Throws | |
|---|---|
IOException |
|
getCheckerBinaryPath
protected File getCheckerBinaryPath (TestInformation testInfo)
Find the Checker binary (Python Archive).
| Parameters | |
|---|---|
testInfo |
TestInformation |
| Returns | |
|---|---|
File |
|
runChecker
protected Optional<String> runChecker (String[] checkerCommandLine)
Run a Checker command and check its result.
| Parameters | |
|---|---|
checkerCommandLine |
String: The Checker command line to execute |
| Returns | |
|---|---|
Optional<String> |
An optional error message, empty if the Checker invocation was successful |
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2026-06-22 UTC.