TestInvocation
public
class
TestInvocation
extends Object
implements
ITestInvocation
java.lang.Object | |
↳ | com.android.tradefed.invoker.TestInvocation |
Default implementation of ITestInvocation
.
IConfiguration
- retrieves build
- prepares target
- runs tests
- reports results
Summary
Constants | |
---|---|
long |
AVAILABILITY_CHECK_TIMEOUT
|
Fields | |
---|---|
public
static
final
String |
COMMAND_ARGS_KEY
Key of the command line args attributes |
public
static
final
String |
INVOCATION_EXTERNAL_DEPENDENCIES
|
public
static
final
String |
TRADEFED_CONFIG_NAME
|
public
static
final
String |
TRADEFED_END_HOST_LOG
|
public
static
final
String |
TRADEFED_INVOC_COMPLETE_HOST_LOG
|
public
static
final
String |
TRADEFED_LOG_NAME
|
Public constructors | |
---|---|
TestInvocation()
|
Public methods | |
---|---|
static
IBuildInfo
|
backFillBuildInfoForReporting(String commandLine)
Helper that use the command line to backfill a |
static
FailureDescription
|
createFailureFromException(Throwable exception, TestRecordProto.FailureStatus defaultStatus)
Create a |
IInvocationExecution
|
createInvocationExec(TestInvocation.RunMode mode)
Create the invocation path that should be followed. |
static
String
|
getDeviceLogName(TestInvocation.Stage stage)
|
static
String
|
getEmulatorLogName(TestInvocation.Stage stage)
|
ITestInvocation.ExitInformation
|
getExitInfo()
The exit information of the given invocation. |
void
|
invoke(IInvocationContext context, IConfiguration config, IRescheduler rescheduler, ITestInvocationListener... extraListeners)
Perform the test invocation. |
static
boolean
|
isSubprocess(IConfiguration config)
Returns true if the invocation is currently within a subprocess scope. |
void
|
notifyInvocationForceStopped(String message, ErrorIdentifier errorId)
Notify the |
void
|
notifyInvocationStopped(String message)
Notify the |
static
void
|
printStageDelimiter(TestInvocation.Stage phase, boolean end)
Prints a delimiter for a given Stage of the invocation. |
void
|
registerExecutionFiles(ExecutionFiles executionFiles)
|
void
|
setClearcutClient(ClearcutClient client)
Forward the clearcut client to report metrics. |
static
boolean
|
shouldSkipBugreportError(Throwable t)
Helper method that identifies errors when the bugreport should be skipped |
String
|
toString()
|
Protected methods | |
---|---|
void
|
addInvocationMetric(InvocationMetricLogger.InvocationMetricKey key, String value)
|
void
|
addInvocationMetric(InvocationMetricLogger.InvocationMetricKey key, long value)
|
void
|
applyAutomatedReporters(IConfiguration config)
|
void
|
setExitCode(CommandRunner.ExitCode code, Throwable stack)
Helper to set the exit code. |
Constants
AVAILABILITY_CHECK_TIMEOUT
public static final long AVAILABILITY_CHECK_TIMEOUT
Constant Value: 180000 (0x000000000002bf20)
Fields
COMMAND_ARGS_KEY
public static final String COMMAND_ARGS_KEY
Key of the command line args attributes
INVOCATION_EXTERNAL_DEPENDENCIES
public static final String INVOCATION_EXTERNAL_DEPENDENCIES
TRADEFED_CONFIG_NAME
public static final String TRADEFED_CONFIG_NAME
TRADEFED_END_HOST_LOG
public static final String TRADEFED_END_HOST_LOG
TRADEFED_INVOC_COMPLETE_HOST_LOG
public static final String TRADEFED_INVOC_COMPLETE_HOST_LOG
TRADEFED_LOG_NAME
public static final String TRADEFED_LOG_NAME
Public constructors
TestInvocation
public TestInvocation ()
Public methods
backFillBuildInfoForReporting
public static IBuildInfo backFillBuildInfoForReporting (String commandLine)
Helper that use the command line to backfill a IBuildInfo
for reporting in case of
download failure.
Parameters | |
---|---|
commandLine |
String |
Returns | |
---|---|
IBuildInfo |
createFailureFromException
public static FailureDescription createFailureFromException (Throwable exception, TestRecordProto.FailureStatus defaultStatus)
Create a FailureDescription
from an invocation exception.
Parameters | |
---|---|
exception |
Throwable : The exception to convert |
defaultStatus |
TestRecordProto.FailureStatus : The status to use by default if the exception is not a IHarnessException . |
Returns | |
---|---|
FailureDescription |
createInvocationExec
public IInvocationExecution createInvocationExec (TestInvocation.RunMode mode)
Create the invocation path that should be followed.
Parameters | |
---|---|
mode |
TestInvocation.RunMode : The mode we are currently running as. |
Returns | |
---|---|
IInvocationExecution |
The IInvocationExecution describing the invocation. |
getDeviceLogName
public static String getDeviceLogName (TestInvocation.Stage stage)
Parameters | |
---|---|
stage |
TestInvocation.Stage |
Returns | |
---|---|
String |
getEmulatorLogName
public static String getEmulatorLogName (TestInvocation.Stage stage)
Parameters | |
---|---|
stage |
TestInvocation.Stage |
Returns | |
---|---|
String |
getExitInfo
public ITestInvocation.ExitInformation getExitInfo ()
The exit information of the given invocation.
Returns | |
---|---|
ITestInvocation.ExitInformation |
invoke
public void invoke (IInvocationContext context, IConfiguration config, IRescheduler rescheduler, ITestInvocationListener... extraListeners)
Perform the test invocation.
Parameters | |
---|---|
context |
IInvocationContext : the IInvocationContext to perform tests. |
config |
IConfiguration : the IConfiguration of this test run. |
rescheduler |
IRescheduler : the IRescheduler , for rescheduling portions of the invocation for
execution on another resource(s) |
extraListeners |
ITestInvocationListener : ITestInvocationListener s to notify, in addition to those in
config |
Throws | |
---|---|
DeviceNotAvailableException |
isSubprocess
public static boolean isSubprocess (IConfiguration config)
Returns true if the invocation is currently within a subprocess scope.
Parameters | |
---|---|
config |
IConfiguration |
Returns | |
---|---|
boolean |
notifyInvocationForceStopped
public void notifyInvocationForceStopped (String message, ErrorIdentifier errorId)
Notify the TestInvocation
that TradeFed has been requested to stop.
Parameters | |
---|---|
message |
String : The message associated with stopping the invocation |
errorId |
ErrorIdentifier : Identifier associated with the forced stop |
notifyInvocationStopped
public void notifyInvocationStopped (String message)
Notify the TestInvocation
that TradeFed will eventually shutdown.
Parameters | |
---|---|
message |
String : The message associated with stopping the invocation |
printStageDelimiter
public static void printStageDelimiter (TestInvocation.Stage phase, boolean end)
Prints a delimiter for a given Stage of the invocation.
Parameters | |
---|---|
phase |
TestInvocation.Stage |
end |
boolean |
registerExecutionFiles
public void registerExecutionFiles (ExecutionFiles executionFiles)
Parameters | |
---|---|
executionFiles |
ExecutionFiles |
setClearcutClient
public void setClearcutClient (ClearcutClient client)
Forward the clearcut client to report metrics.
Parameters | |
---|---|
client |
ClearcutClient |
shouldSkipBugreportError
public static boolean shouldSkipBugreportError (Throwable t)
Helper method that identifies errors when the bugreport should be skipped
Parameters | |
---|---|
t |
Throwable |
Returns | |
---|---|
boolean |
toString
public String toString ()
Returns | |
---|---|
String |
Protected methods
addInvocationMetric
protected void addInvocationMetric (InvocationMetricLogger.InvocationMetricKey key, String value)
Parameters | |
---|---|
key |
InvocationMetricLogger.InvocationMetricKey |
value |
String |
addInvocationMetric
protected void addInvocationMetric (InvocationMetricLogger.InvocationMetricKey key, long value)
Parameters | |
---|---|
key |
InvocationMetricLogger.InvocationMetricKey |
value |
long |
applyAutomatedReporters
protected void applyAutomatedReporters (IConfiguration config)
Parameters | |
---|---|
config |
IConfiguration |
setExitCode
protected void setExitCode (CommandRunner.ExitCode code, Throwable stack)
Helper to set the exit code. Exposed for testing.
Parameters | |
---|---|
code |
CommandRunner.ExitCode |
stack |
Throwable |