2

我即将为我们的 AOSP 设置 VTS 和 CTS 测试。两个测试套件都使用 Trade Federation 测试框架。令我困惑的是如何运行不同的测试计划。

根据 VTS 的文档 ( https://source.android.com/compatibility/vts/systems ),必须决定运行哪个测试计划。然后使用运行命令对其进行测试。

例如,如果我想运行默认的 VTS 测试计划,我会使用它。

me@computer> vts-tradefed
vts-tf > run vts

这将对连接的设备启动一些测试。

接下来,在启动 CTS 测试时,我希望调用相应的函数,或者看起来是什么。通过以下说明,我希望使用名为“cts”的测试计划运行 CTS 测试。

me@computer> cts-tradefed
cts-tf > run cts

这似乎工作正常,测试似乎开始了。但后来我在 CTS 的手册 ( https://source.android.com/compatibility/cts/run ) 中读到 cts 应执行为run cts --plan <test-plan>. 他们给出了run cts --plan CTS下面的例子来运行默认的 cts 计划。

通过附加以下命令启动默认测试计划(包含所有测试包): run cts --plan CTS 。这将启动兼容性所需的所有 CTS 测试。

对于 CTS v1(Android 6.0 及更早版本),输入 list plan 以查看存储库中的测试计划列表,或输入 list packages 以查看存储库中的测试包列表。对于 CTS v2(Android 7.0 及更高版本),输入 list modules 以查看测试模块列表。

或者,使用以下命令从命令行运行您选择的 CTS 计划:cts-tradefed run cts --plan

在测试时,它似乎也可以工作。两个想法让我想知道。首先,示例中的测试计划用大写字母表示,即“CTS”而不是“cts”。其次,运行命令在这里的工作方式似乎完全不同。对我来说,run-command 是一个内置的 tradefed 命令是有道理的,它的参数应该是测试计划的名称。tradefed 本身也证实了这一点。

VTS 帮助:

vts-tf > help run
r(?:un)? help:
    command <config> [options]        Run the specified command
    <config> [options]                Shortcut for the above: run specified command
    cmdfile <cmdfile.txt>             Run the specified commandfile
    commandAndExit <config> [options] Run the specified command, and run 'exit -c' immediately afterward
    cmdfileAndExit <cmdfile.txt>      Run the specified commandfile, and run 'exit -c' immediately afterward

    ----- Vendor Test Suite specific options ----- 
    <plan> --module/-m <module>       Run a test module
    <plan> --module/-m <module> --test/-t <test_name>    Run a specific test from the module. Test name can be <package>.<class>, <package>.<class>#<method> or <native_binary_name>
        Available Options:
            --serial/-s <device_id>: The device to run the test on
            --abi/-a <abi>         : The ABI to run the test against
            --logcat-on-failure    : Capture logcat when a test fails
            --bugreport-on-failure : Capture a bugreport when a test fails
            --screenshot-on-failure: Capture a screenshot when a test fails
            --shard-count <shards>: Shards a run into the given number of independent chunks, to run on multiple devices in parallel.
     ----- In order to retry a previous run -----
    retry --retry <session id to retry> [--retry-type <FAILED | NOT_EXECUTED>]
        Without --retry-type, retry will run both FAIL and NOT_EXECUTED tests

CTS 帮助:

cts-tf > help run
r(?:un)? help:
    command <config> [options]        Run the specified command
    <config> [options]                Shortcut for the above: run specified command
    cmdfile <cmdfile.txt>             Run the specified commandfile
    commandAndExit <config> [options] Run the specified command, and run 'exit -c' immediately afterward
    cmdfileAndExit <cmdfile.txt>      Run the specified commandfile, and run 'exit -c' immediately afterward

    ----- Compatibility Test Suite specific options ----- 
    <plan> --module/-m <module>       Run a test module
    <plan> --module/-m <module> --test/-t <test_name>    Run a specific test from the module. Test name can be <package>.<class>, <package>.<class>#<method> or <native_binary_name>
        Available Options:
            --serial/-s <device_id>: The device to run the test on
            --abi/-a <abi>         : The ABI to run the test against
            --logcat-on-failure    : Capture logcat when a test fails
            --bugreport-on-failure : Capture a bugreport when a test fails
            --screenshot-on-failure: Capture a screenshot when a test fails
            --shard-count <shards>: Shards a run into the given number of independent chunks, to run on multiple devices in parallel.
     ----- In order to retry a previous run -----
    retry --retry <session id to retry> [--retry-type <FAILED | NOT_EXECUTED>]
        Without --retry-type, retry will run both FAIL and NOT_EXECUTED tests

解释几乎相同。run cts因此,与并分别运行实际上是有意义的run vts。这只是一个愚蠢的问题,我完全错了吗?由于这些测试对我们的兼容性很重要,我希望确保它们以正确的方式运行。

4

1 回答 1

2

要运行计划(cts 或 vts),您可以根据您的选择性需要使用不同的命令:

运行完整的 vts 或 cts 测试: run <plan>例如run cts / run vts

在计划中运行特定模块: run <plan> -m <module>例如运行 cts -m CtsMyDisplayTestCases(模块名称应与您的 Android.mk 中的 LOCAL_PACAKGE_NAME 中提到的相同)

在计划中运行包含特定模块的多个测试的特定测试类: run <plan> -m <module> -t <packageName.className>例如运行 cts -m CtsMyDisplayTestCases -t android.display.cts.ScreenTests(此命令将运行测试类“ScreenTests”中存在的所有测试,包名相同已在 AndroidManifest.xml 中修复)

在计划中特定模块的测试类中运行特定测试用例: run <plan> -m <module> -t <packageName.className#testName>例如运行 cts -m CtsMyDisplayTestCases -t android.display.cts.ScreenTests#testDisplayName(此命令将运行测试类“ScreenTests”中存在的 testDisplayName 测试用例,包名与 AndroidManifest.xml 中固定的相同)

您还可以查看 AOSP/cts/ 目录以了解命名约定和工作的基本概念。

于 2018-12-05T06:15:10.833 回答