【问题标题】:How to input commands to CTS-Tradefed?如何向 CTS-Tradefed 输入指令?
【发布时间】:2012-10-17 08:36:24
【问题描述】:

我目前正在尝试自动化 android ICS CTS 中的几个步骤。

  1. 当我们执行./cts-tradefed 我们得到cts-tf > 提示。
  2. 然后我可以进入运行cts --plan CTS
  3. 然后 exit 命令退出提示符。

在这里,我想在一个 shell 脚本中编写以上 3 个步骤。但无法用下面的脚本做到这一点。尝试了多种方式,但无法实现。请帮忙。

想要执行:

1. ./cts-tradefed

2.运行cts --plan CTS exit

3. ./cts-tradefed

4. run cts --plan CTS

5. exit

对任何 shell、python 或 perl 语言的帮助表示赞赏。

【问题讨论】:

    标签: android python shell android-testing


    【解决方案1】:

    摘自 CTS-tradefed(版本 6.0_r0)的帮助

    exit:优雅退出 cts 控制台,等待所有调用完成

    我们可以利用上述论点来达到以下目的:

    echo exit | cts-tradefed <arguments to cts>
    

    【讨论】:

    • 使用这个小脚本在 bash shell 上获得一个循环。 while [ 1 ]; do echo exit | ./android-cts/tools/cts-tradefed run cts -c android.media.cts.DecoderTest -m testEOSBehaviorH264; sleep 1; done
    【解决方案2】:

    我不确定您使用的是哪个版本的 CTS,所以我假设版本是 4.0.3_r3

    您可以在一行中执行命令./cts-tradefed run cts --plan CTS。 但是,执行完命令后提示仍然存在。

    根据this issue, 我认为没有简单的方法可以解决它。

    因此,我只是应用了上面链接中的补丁,然后执行以下命令:

    echo | ./cts-tradefed run cts --plan CTS

    【讨论】:

      【解决方案3】:

      使用 Android CTS 7.0,您可以简单地运行这个命令行,它最方便自动化: (假设“cts-tradefed”在您的 PATH 中。)

      $ cts-tradefed run commandAndExit cts 
      

      来自 cts-tradefed 的帮助:

      r(?:un)? help:
          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
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2015-07-29
        • 2018-03-31
        • 2017-01-14
        • 1970-01-01
        • 2019-09-26
        • 2017-09-19
        相关资源
        最近更新 更多