3

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?

4 Answers 4

8

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

1
  • 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
    – Sanyal
    Aug 29, 2018 at 6:59
1

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

0

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

0

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.