TradefedSandbox
public
class
TradefedSandbox
extends Object
implements
ISandbox
java.lang.Object | |
↳ | com.android.tradefed.sandbox.TradefedSandbox |
可运行 Trade Federation 调用的沙盒容器。TODO:允许将选项传递给沙盒。
摘要
字段 | |
---|---|
public
static
final
String |
EXTRA_TARGET_LAB
|
public
static
final
String |
GENERAL_TESTS_ZIP
|
public
static
final
String |
SANDBOX_ENABLED
|
公共构造函数 | |
---|---|
TradefedSandbox()
|
公共方法 | |
---|---|
String
|
createClasspath(File workingDir)
根据环境和 |
IConfiguration
|
createThinLauncherConfig(String[] args, IKeyStoreClient keyStoreClient, IRunUtil runUtil, File globalConfig)
与主运行作业断开连接的特殊模式:如果父级中似乎不存在配置,我们会回退到精简启动器,在其中尝试使用当前已知的信息设置沙盒,并填充工作目录,以便在版本化目录中完全创建配置。 |
File
|
getTradefedSandboxEnvironment(IInvocationContext context, IConfiguration nonVersionedConfig, ITestLogger logger, String[] args)
|
static
|
matchSandboxExtraBuildTargetByConfigName(String configName)
给定测试配置名称,与沙盒的额外 build 目标中的额外 build 目标进行匹配。 |
Exception
|
prepareEnvironment(IInvocationContext context, IConfiguration config, ITestInvocationListener listener)
准备环境,以便沙盒正常运行。 |
CommandResult
|
run(TestInformation info, IConfiguration config, ITestLogger logger)
使用设置的环境运行沙盒。 |
void
|
tearDown()
清理可能已更改的所有状态、文件或环境。 |
受保护的方法 | |
---|---|
File
|
dumpGlobalConfig(IConfiguration config,
转储从某些对象过滤出的全局配置。 |
String
|
getJava()
|
Exception
|
prepareConfiguration(IInvocationContext context, IConfiguration config, ITestInvocationListener listener)
准备将传递给子进程并驱动容器执行的 |
File
|
prepareContext(IInvocationContext context, IConfiguration config)
准备并序列化 |
字段
EXTRA_TARGET_LAB
public static final String EXTRA_TARGET_LAB
GENERAL_TESTS_ZIP
public static final String GENERAL_TESTS_ZIP
SANDBOX_ENABLED
public static final String SANDBOX_ENABLED
公共构造函数
TradefedSandbox
public TradefedSandbox ()
公共方法
createClasspath
public String createClasspath (File workingDir)
根据环境和 ISandbox.getTradefedSandboxEnvironment(com.android.tradefed.invoker.IInvocationContext, com.android.tradefed.config.IConfiguration, String[])
返回的工作目录创建类路径。
参数 | |
---|---|
workingDir |
File :沙盒的当前工作目录。 |
返回 | |
---|---|
String |
要使用的类路径。 |
抛出 | |
---|---|
ConfigurationException |
createThinLauncherConfig
public IConfiguration createThinLauncherConfig (String[] args, IKeyStoreClient keyStoreClient, IRunUtil runUtil, File globalConfig)
与主运行作业断开连接的特殊模式:如果父级中似乎不存在配置,我们会回退到精简启动器,在其中尝试使用当前已知的信息设置沙盒,并填充工作目录,以便在版本化目录中完全创建配置。
参数 | |
---|---|
args |
String :原始命令行参数。 |
keyStoreClient |
IKeyStoreClient :用于创建配置的当前密钥库客户端。 |
runUtil |
IRunUtil :用于运行主机命令的当前 IRunUtil 。 |
globalConfig |
File :用于运行 TF 子进程的全局配置。 |
返回 | |
---|---|
IConfiguration |
指向 NON_VERSIONED 对象的 TF 配置 XML 的文件。如果无法创建任何精简启动器配置,则返回 null。 |
getTradefedSandboxEnvironment
public File getTradefedSandboxEnvironment (IInvocationContext context, IConfiguration nonVersionedConfig, ITestLogger logger, String[] args)
参数 | |
---|---|
context |
IInvocationContext |
nonVersionedConfig |
IConfiguration |
logger |
ITestLogger |
args |
String |
返回 | |
---|---|
File |
matchSandboxExtraBuildTargetByConfigName
public staticmatchSandboxExtraBuildTargetByConfigName (String configName)
给定测试配置名称,与沙盒的额外 build 目标中的额外 build 目标进行匹配。
参数 | |
---|---|
configName |
String |
返回 | |
---|---|
|
prepareEnvironment
public Exception prepareEnvironment (IInvocationContext context, IConfiguration config, ITestInvocationListener listener)
准备环境,以便沙盒正常运行。
参数 | |
---|---|
context |
IInvocationContext :当前调用 IInvocationContext 。 |
config |
IConfiguration :要运行的命令的 IConfiguration 。 |
listener |
ITestInvocationListener :应将最终结果管道传输到的当前调用 ITestInvocationListener 。 |
返回 | |
---|---|
Exception |
包含失败信息的 Exception ;如果成功,则为 null。 |
得分
public CommandResult run (TestInformation info, IConfiguration config, ITestLogger logger)
使用设置的环境运行沙盒。
参数 | |
---|---|
info |
TestInformation :用于描述调用的 TestInformation |
config |
IConfiguration :要运行的命令的 IConfiguration 。 |
logger |
ITestLogger :用于记录日志文件的 ITestLogger 。 |
返回 | |
---|---|
CommandResult |
包含沙盒运行状态和日志的 CommandResult 。 |
tearDown
public void tearDown ()
清理可能已更改的所有状态、文件或环境。
受保护的方法
dumpGlobalConfig
protected File dumpGlobalConfig (IConfiguration config,exclusionPatterns)
转储从某些对象过滤出的全局配置。
参数 | |
---|---|
config |
IConfiguration |
exclusionPatterns |
|
返回 | |
---|---|
File |
抛出 | |
---|---|
ConfigurationException |
getJava
protected String getJava ()
返回 | |
---|---|
String |
prepareConfiguration
protected Exception prepareConfiguration (IInvocationContext context, IConfiguration config, ITestInvocationListener listener)
准备将传递给子进程并驱动容器执行的 IConfiguration
。
参数 | |
---|---|
context |
IInvocationContext :当前的 IInvocationContext 。 |
config |
IConfiguration :要准备的 IConfiguration 。 |
listener |
ITestInvocationListener :当前调用 ITestInvocationListener 。 |
返回 | |
---|---|
Exception |
如果出现任何问题,则为异常;否则为 null。 |
prepareContext
protected File prepareContext (IInvocationContext context, IConfiguration config)
准备并序列化 IInvocationContext
。
参数 | |
---|---|
context |
IInvocationContext :要准备的 IInvocationContext 。 |
config |
IConfiguration :沙盒的 IConfiguration 。 |
返回 | |
---|---|
File |
序列化的 IInvocationContext 。 |
抛出 | |
---|---|
|
IOException |