Reputation: 51
I am trying to execute android CTS via this command:
./cts-tradefed run cts --shards ${no_of_devices}
When I execute a plain shell command from terminal it detects all the connected devices and executes test suite in parallel using all connected devices to execute tests. While when I try to call this shell command from Java code(locally) or CI server; it detects all devices but executes tests on (no_of_devices -1). The device that gets ignored is always the first device in the list. Confirmed that device itself is not a problem because if same device is not the first one in the list of devices, that device will be used for executing the tests.
My shell script looks like:
!#/bin/bash
./cts-tradefed run cts --shards 2 #say if I have two devices connected
The java code I use to execute the shell script is this:
public class Main {
public static void main(String[] args) {
ProcessBuilder pb = new ProcessBuilder("temp/run-cts-with-sharding.sh");
try {
Process p = pb.start();
Thread.sleep(2000);
BufferedReader reader = new BufferedReader(
new InputStreamReader(p.getInputStream()));
String line;
while ((line = reader.readLine()) != null) {
System.out.println(line);
}
} catch(Exception e) {
System.out.println("Exception on pb.start(): " + e);
}
}
}
Upvotes: 3
Views: 268