Stay organized with collections Save and categorize content based on your preferences.

IsolatedHostTest

public class IsolatedHostTest
extends Object implements IRemoteTest, IBuildReceiver, ITestAnnotationFilterReceiver, ITestFilterReceiver, ITestCollector

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


Implements a TradeFed runner that uses a subprocess to execute the tests in a low-dependency environment instead of executing them on the main process.

This runner assumes that all of the jars configured are in the same test directory and launches the subprocess in that directory. Since it must choose a working directory for the subprocess, and many tests benefit from that directory being the test directory, this was the best compromise available.

Summary

Public constructors

IsolatedHostTest()

Public methods

void addAllExcludeAnnotation( notAnnotations)

Adds a ERROR(/Set) of annotations to exclude if a tests if marked with it.

void addAllExcludeFilters( filters)

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

void addAllIncludeAnnotation( annotations)

Adds a ERROR(/Set) of annotations to include if a tests if marked with it.

void addAllIncludeFilters( filters)

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

void addExcludeAnnotation(String notAnnotation)

Adds an annotation to exclude if a tests if marked with it.

void addExcludeFilter(String filter)

Adds a filter of which tests to exclude.

void addIncludeAnnotation(String annotation)

Adds an annotation to include if a tests if marked with it.

void addIncludeFilter(String filter)

Adds a filter of which tests to include.

void clearExcludeAnnotations()

Delete all the exclude annotations currently tracked.

void clearExcludeFilters()

Delete all the exclude filters currently tracked.

void clearIncludeAnnotations()

Delete all the include annotations currently tracked.

void clearIncludeFilters()

Delete all the include filters currently tracked.

compileCommandArgs(String classpath)

Assembles the command arguments to execute the subprocess runner.

getExcludeAnnotations()

Returns the current ERROR(/Set) of annotations to exclude.

getExcludeFilters()

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

getIncludeAnnotations()

Returns the current ERROR(/Set) of annotations to include.

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 setBuild(IBuildInfo build)

void setCollectTestsOnly(boolean shouldCollectTest)

Enables or disables test collection mode

Protected methods

String compileLdLibraryPath()

Return LD_LIBRARY_PATH for tests that require native library.

File getJarFile(String jarName, TestInformation testInfo)

Copied over from HostTest to mimic its unit test harnessing.

void setServer(ServerSocket server)

Public constructors

IsolatedHostTest

public IsolatedHostTest ()

Public methods

addAllExcludeAnnotation

public void addAllExcludeAnnotation ( notAnnotations)

Adds a ERROR(/Set) of annotations to exclude if a tests if marked with it.

Parameters
notAnnotations

addAllExcludeFilters

public void addAllExcludeFilters ( filters)

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

Parameters
filters

addAllIncludeAnnotation

public void addAllIncludeAnnotation ( annotations)

Adds a ERROR(/Set) of annotations to include if a tests if marked with it.

Parameters
annotations

addAllIncludeFilters

public void addAllIncludeFilters ( filters)

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

Parameters
filters

addExcludeAnnotation

public void addExcludeAnnotation (String notAnnotation)

Adds an annotation to exclude if a tests if marked with it.

Parameters
notAnnotation String

addExcludeFilter

public void addExcludeFilter (String filter)

Adds a filter of which tests to exclude.

Parameters
filter String

addIncludeAnnotation

public void addIncludeAnnotation (String annotation)

Adds an annotation to include if a tests if marked with it.

Parameters
annotation String

addIncludeFilter

public void addIncludeFilter (String filter)

Adds a filter of which tests to include.

Parameters
filter String

clearExcludeAnnotations

public void clearExcludeAnnotations ()

Delete all the exclude annotations currently tracked.

clearExcludeFilters

public void clearExcludeFilters ()

Delete all the exclude filters currently tracked.

clearIncludeAnnotations

public void clearIncludeAnnotations ()

Delete all the include annotations currently tracked.

clearIncludeFilters

public void clearIncludeFilters ()

Delete all the include filters currently tracked.

compileCommandArgs

public  compileCommandArgs (String classpath)

Assembles the command arguments to execute the subprocess runner.

Parameters
classpath String

Returns

getExcludeAnnotations

public  getExcludeAnnotations ()

Returns the current ERROR(/Set) of annotations to exclude.

Returns

getExcludeFilters

public  getExcludeFilters ()

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

Returns

getIncludeAnnotations

public  getIncludeAnnotations ()

Returns the current ERROR(/Set) of annotations to include.

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

setBuild

public void setBuild (IBuildInfo build)

Parameters
build IBuildInfo

setCollectTestsOnly

public void setCollectTestsOnly (boolean shouldCollectTest)

Enables or disables test collection mode

Protected methods

compileLdLibraryPath

protected String compileLdLibraryPath ()

Return LD_LIBRARY_PATH for tests that require native library.

Returns
String a string specifying the colon separated library path.

getJarFile

protected File getJarFile (String jarName, 
                TestInformation testInfo)

Copied over from HostTest to mimic its unit test harnessing.

Inspect several location where the artifact are usually located for different use cases to find our jar.

Parameters
jarName String

testInfo TestInformation

Returns
File

setServer

protected void setServer (ServerSocket server)

Parameters
server ServerSocket