本页介绍了如何编写 shell 测试。如果测试可以用一个shell脚本来完成,你可以运行它ExecutableHostTest
。 ExecutableHostTest
支撑测试过滤和测试分片。
编写外壳测试
您的主 shell 脚本在主机上运行。要在设备上运行的其他脚本或二进制文件以及所需的数据文件必须首先推送到设备。这可以作为主要的脚本的一部分,或者用做PushFilePreparer
。
如果测试有应该与测试安装设备二进制模块,以指定它们data_device_bins
财产。
sh_test {
name: "module-name",
...
data_device_bins: ["target-name"],
}
壳体试验ziptool-tests
是这样的例子。
每个测试的测试结果基于主脚本的退出状态。如果测试可以超时per-binary-timeout
已经指定。
配置外壳测试
在Tradefed XML配置,外壳测试通过运行ExecutableHostTest
亚军。
<test class="com.android.tradefed.testtype.binary.ExecutableHostTest" >
<option name="binary" value="your-test-script.sh" />
<option name="relative-path-execution" value="true" />
<option name="per-binary-timeout" value="15m" />
</test>
设置主脚本测试作为价值binary
选项。看看其他ExecutableHostTest
选项。
如果脚本需要root权限,添加RootTargetPreparer
到配置。