在Androidgts-tradefedxts-tradefed中,perl或Python脚本中的“shards”选项不适用于2个或更多设备。
Python代码

import subprocess

p = subprocess.Popen('./gts-tradefed run gts --shards 2', stdout=subprocess.PIPE,stderr=subprocess.PIPE,stdin=subprocess.PIPE)
out, err = p.communicate()
print out

命令输出:
Android GTS 3.0_r5 build:3028956
Non-interactive mode: Running initial command then exiting.
Using commandline arguments as starting command: [run, xts, --plan, XTS, --shards, 2]
08-16 16:07:44 I/DeviceManager: Detected new device 100fb56f
08-16 16:07:44 I/DeviceManager: Detected new device 20bf34cc
08-16 16:07:44 I/unknown_device: Created result dir 2016.08.16_16.07.44
Saved log to /tmp/tradefed_global_log_6249175650313503897.txt
08-16 16:07:45 I/CommandScheduler: All done

如果在"run gts --shards 2"中输入命令gts-tradefed将按预期工作。
请建议如何调用"./gts-tradefed run gts --shards 2"并从Python或perl脚本执行它。

最佳答案

我不确定要不要试试

subprocess.check_output('./gts-tradefed run gts --shards 2',shell=True)
(or) subprocess.call('./gts-tradefed run gts --shards 2',shell=True)

10-06 03:44