Nandi
Nandi

Reputation: 71

How to input commands to CTS-Tradefed?

I'm currently trying to automate few steps in android ICS CTS.

  1. When we execute ./cts-tradefed we get cts-tf > prompt.
  2. then I am able to enter run cts --plan CTS
  3. then exit command to exit from prompt.

Here I want to write all the above 3 steps in one shell script. But unable to do it with below script. Tried in many way but could not achieve it. Please help.

Want to execute:

1. ./cts-tradefed

2. run cts --plan CTS exit

3. ./cts-tradefed

4. run cts --plan CTS

5. exit

Help in any shell, python or perl languages appreciated.

Upvotes: 3

Views: 7214

Answers (3)

cfig
cfig

Reputation: 31

With Android CTS 7.0, you can simply run this command line, it's most convenient for automation: (Assume "cts-tradefed" is in your PATH.)

$ cts-tradefed run commandAndExit cts 

Help from 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

Upvotes: 3

chetal
chetal

Reputation: 51

Excerpt from help of CTS-tradefed (version 6.0_r0)

exit: gracefully exit the cts console, waiting till all invocations are complete

We can leverage above argument to serve the purpose as follows:

echo exit | cts-tradefed <arguments to cts>

Upvotes: 4

sayuan
sayuan

Reputation: 41

I am not sure which version of CTS you are using, so I assume the version is 4.0.3_r3.

You could execute the command ./cts-tradefed run cts --plan CTS in one line. However, the prompt still exist after finish the command.

According to this issue, I think there are no simple ways to solve it.

Therefore, I just apply the patch in the above link, and execute the following command:

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

Upvotes: 3

Related Questions