多设备执行CTS, 期间遇到的一个问题, 有用过shards的大神一起研究研究,和管道也相关。

广印大叔 2016-03-04 09:54:57
首先入门级别,不用shards的时候都没问题,用shards的时候不能用管道了, 为啥?
这样做没问题 os.system('tmp/android-cts/tools/cts-tradefed run cts --plan CTS')
这样做没问题 os.system('tmp/android-cts/tools/cts-tradefed run cts --plan CTS')
这样做没问题 os.system('tmp/android-cts/tools/cts-tradefed run cts --plan CTS --shards 2')
这样做有问题 os.system('tmp/android-cts/tools/cts-tradefed run cts --plan CTS --shards 2') | tee result.txt

我现在是通过python做CTS的自动化,用的是subprocess.Popen, 因为用os.system我不能实时读取输出。
    popen = subprocess.Popen(command_list, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
for line in iter(popen.stdout.readline, b''):
clean_line = line.decode("utf-8").strip()
if verbose:
print(prefix + "------< " + clean_line)
sys.stdout.flush()
yield clean_line

传递进去的参数带shards就不能执行了,也没报错,就是一闪而过。

tmp/android-cts/tools/cts-tradefed run cts --plan CTS-hardware --shards 2 --disable-reboot | tee TTT
Android CTS 5.1_r5
Non-interactive mode: Running initial command then exiting.
Using commandline arguments as starting command: [run, cts, --plan, CTS-hardware, --shards, 2, --disable-reboot]
03-04 21:45:41 I/DeviceManager: Detected new device JIDEBJFORCTS0001
03-04 21:45:41 I/DeviceManager: Detected new device 20080411
03-04 21:45:41 I/unknown_device: Created result dir 2016.03.04_21.45.41
Saved log to /tmp/tradefed_global_log_2759563044977409240.txt
03-04 21:45:42 I/CommandScheduler: All done
...全文
332 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
  • 打赏
  • 举报
回复
引用 2 楼 renguangyin1980 的回复:
'tmp/android-cts/tools/cts-tradefed run cts --plan CTS --shards 2 > result.txt' 这样做也是不行 其实和 tee 是一样的 主要是tee不会block屏幕上的输出 我最终的解决方法就是 subprocess.Popen(query, stdout=sys.stdout.isatty(), stderr=subprocess.STDOUT) 然后循环等待testReport.xml的生成
大神,能否详细说明下,小白表示没有看懂啊
广印大叔 2016-03-07
  • 打赏
  • 举报
回复
'tmp/android-cts/tools/cts-tradefed run cts --plan CTS --shards 2 > result.txt' 这样做也是不行 其实和 tee 是一样的 主要是tee不会block屏幕上的输出 我最终的解决方法就是 subprocess.Popen(query, stdout=sys.stdout.isatty(), stderr=subprocess.STDOUT) 然后循环等待testReport.xml的生成
梦里茶 2016-03-04
  • 打赏
  • 举报
回复
os.system('tmp/android-cts/tools/cts-tradefed run cts --plan CTS --shards 2 > result.txt') 这样如何?

80,351

社区成员

发帖
与我相关
我的任务
社区描述
移动平台 Android
androidandroid-studioandroidx 技术论坛(原bbs)
社区管理员
  • Android
  • yechaoa
  • 失落夏天
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧