如何在 Windows 上使用命令行启动 CTS?

发布于 2024-12-26 07:25:12 字数 339 浏览 0 评论 0原文

对于Android 2.3,我使用此命令行进入CTS控制台:

java -Xmx512M -cp %CTS_ROOT%\tools\ddmlib-prebuilt.jar;%CTS_ROOT%\tools\cts.jar;%CTS_ROOT%\tools\junit.jar; %CTS_ROOT%\tools\hosttestlib.jar com.android.cts.TestHost %CTS_ROOT%\repository/host_config.xml

是否有类似的方式运行 Android 4.0 CTS 像这样没有 cygwin 之类的东西?

For Android 2.3, I use this command line to enter CTS console:

java -Xmx512M -cp
%CTS_ROOT%\tools\ddmlib-prebuilt.jar;%CTS_ROOT%\tools\cts.jar;%CTS_ROOT%\tools\junit.jar;
%CTS_ROOT%\tools\hosttestlib.jar com.android.cts.TestHost
%CTS_ROOT%\repository/host_config.xml

Is there a similar way of running Android 4.0 CTS like this without cygwin-like thing?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

心安伴我暖 2025-01-02 07:25:12

对于在 Windows 上运行 Android 4.0+ CTS,

这是我的解决方案:(我假设所有路径(adb)/类路径(Java)设置正确)

1.下载并解压 CTS 文件(例如,我将所有解压文件放入 D:\ cts ,该文件夹将类似于 D:\cts\android-cts)

http://source.android.com/compatibility/downloads.html

2.制作cts_windows.bat文件并放入工具中文件夹。
(在我的例子中是 D:\cts\android-cts\tools\cts_windows.bat)

使用下面的代码编辑 cts_windows.bat 文件(记住使用您自己的 -DCTS_ROOT 路径):

java -cp ddmlib-prebuilt.jar;tradefed-prebuilt.jar;hosttestlib.jar;cts-tradefed.jar -DCTS_ROOT=D:\cts com.android.cts.tradefed.command.CtsConsole
  1. 执行 cts_windows。 bat 文件,它将进入像“cts-tf>”这样的 shell
    然后您可以使用“ run cts --plan CTS ”命令运行 cts 。

有关更多说明,请阅读手册:
http://source.android.com/compatibility/android-cts-manual-r4.pdf< /a>

For run Android 4.0+ CTS on Windows

here is my solution:(I assume all path(adb)/classpath(Java) is set correct)

1.download and unzip CTS file(for example,I put all unzipped files into D:\cts , the folder will look like D:\cts\android-cts)

http://source.android.com/compatibility/downloads.html

2.make cts_windows.bat file and put into tools folder.
(that is D:\cts\android-cts\tools\cts_windows.bat in my case)

edit cts_windows.bat file with code below (remember to use your own -DCTS_ROOT path):

java -cp ddmlib-prebuilt.jar;tradefed-prebuilt.jar;hosttestlib.jar;cts-tradefed.jar -DCTS_ROOT=D:\cts com.android.cts.tradefed.command.CtsConsole
  1. execute cts_windows.bat file and it will into a shell like "cts-tf>"
    then you can run cts using " run cts --plan CTS " command.

for more instructions, read manual at
http://source.android.com/compatibility/android-cts-manual-r4.pdf

静谧幽蓝 2025-01-02 07:25:12

对于 4.1 CTS Suite,我执行了不同的任务来解决我的问题。

对于运行 Cygwin 的 Windows 用户:

  1. 修改第 81 行的 JAR_PATH 设置,将冒号替换为分号。
    还要在赋值周围添加引号。它应该类似于下面的命令:

    JAR_PATH=${JAR_PATH}:${JAR_DIR}/${JAR}
    JAR_PATH="${JAR_PATH};${JAR_DIR}/${JAR}"

  2. 确保在同一目录中运行 cts-tradefed 脚本!
    第 73 行假设如果未定义 CTS_ROOT,则用户与 cts-tradefed 位于同一目录中。
    但是指令告诉人们从 cts-android 所在的目录运行脚本。

    好:./cts-tradefed
    错误:./android-cts/tools/tradefed

For the 4.1 CTS Suite I performed different tasks that resolved my issue.

For windows users running Cygwin:

  1. Modify JAR_PATH setup on line 81, replace the colon with a semi-colon.
    Also add quotes around the assignment. It should look like the command below:

    Bad: JAR_PATH=${JAR_PATH}:${JAR_DIR}/${JAR}
    Good: JAR_PATH="${JAR_PATH};${JAR_DIR}/${JAR}"

  2. Be sure to run the cts-tradefed script inside the same directory!
    Line 73 assumes if CTS_ROOT is not defined then the user is in the same directory as cts-tradefed.
    But the instructions tell the person to run the script from the directory cts-android is in.

    Good: ./cts-tradefed
    Bad: ./android-cts/tools/tradefed

楠木可依 2025-01-02 07:25:12

我能够在 Windows 上运行 CTS,通过传递正确的 CTS 根目录可以解决上述异常。

默认情况下,CTS 将 android-cts 视为根目录,因此我们应该将文件夹维护为“D:\Android\android-cts”

通过 -DCTS_ROOT=D:\Android

所以“ 引起:java.io.FileNotFoundException:CTS 安装文件夹 D :\cts\android-cts " 将得到解决。

java -cp ddmlib-prebuilt.jar;tradefed-prebuilt.jar;hosttestlib.jar;cts-tradefed.jar
-DCTS_ROOT=D:\Android com.android.cts.tradefed.command.CtsConsole

使用上述脚本,我能够在我的用户设备上运行 CTS。

谢谢。,
加内什·库马尔·拉马莫西

Am able to run CTS on Windows, The above Exception is resolved by passing the proper CTS root directory.

By default CTS refers android-cts as root directory, So we should maintain folder as "D:\Android\android-cts"

Pass -DCTS_ROOT=D:\Android

So " Caused by: java.io.FileNotFoundException: CTS install folder D:\cts\android-cts " will be resolved.

java -cp ddmlib-prebuilt.jar;tradefed-prebuilt.jar;hosttestlib.jar;cts-tradefed.jar
-DCTS_ROOT=D:\Android com.android.cts.tradefed.command.CtsConsole

With above script am able to RUN CTS on my user device.

Thanks.,
Ganesh Kumar Ramamoorthy

泪冰清 2025-01-02 07:25:12

我不建议在 Windows 上运行 CTS。

在 Android 4+ 之前,使用此处建议的解决方法(使用批处理文件)确实有效,但当我尝试它时,出现了很多失败,许多测试甚至根本没有执行。
另外,根据 Google CTS 文档,它应该仅在 Linux 或 MAC 上运行,因此如何保证故障是由于被测设备(真正的故障)或因为您在不受支持的环境中运行而导致的?

然而,从Android 6+开始,在Windows中使用批处理文件对我来说不起作用,CTS将寻找仅存在于Linux机器中的bash,并在开始之前退出执行。

当尝试在 Linux 上运行时,它运行得非常漂亮。

I wouldn't recommend to run CTS on Windows.

Until Android 4+, the use of workaround suggested here (use batch file) did worked but when I've tried it, there were many failures and many tests even not executed at all.
Also, according to Google CTS documentation, it should run on Linux or MAC only so how you can guarantee that failures are because of the device under test (real failure), or because you're running it in not supported environment?

Nevertheless, as of Android 6+, the use of batch file in Windows didn't worked for me, CTS will look for bash which exists only in Linux machine and will quit the execution before it starts.

When try to run in on Linux it runs beautifully.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文