How to launch CTS using command line on Windows?

17,616

Solution 1

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

Solution 2

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

Share:
17,616
stillwater
Author by

stillwater

Updated on July 24, 2022

Comments

  • stillwater
    stillwater almost 2 years

    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?

  • Sanyal
    Sanyal over 5 years
    The same does not work for Android 8.:[Worked for android Version 6] Error: Could not find or load main class com.android.cts.tradefed.command.CtsConsole Caused by: java.lang. ClassNotFoundException : com.android.cts.tradefed.command.CtsConsole. Please help