Ubuntu14.04编译TradeFederation

来源:互联网 发布:西安交大远程网络教育 编辑:程序博客网 时间:2024/06/06 20:20

  TradeFederation(后面简称TF)是android一个非常强大到测试框架,CTS,GTS,VTS上都用此框架进行各种测试,CTS测试case打包成jar,运行测试需要到配置文件以config(类似xml)形式一起放在本地PC,tradefederation利用java的反射机制执行case,并完成对结果到汇总。

  直接下载到源码包里面并不包含tradefederation代码,需要另外下载,而且编译过程中会有一些依赖库也不是android源码默认下载的,但是android官方已经提供,只是找到需要到依赖文件下载再重新编译就可以了。

1.TF官方介绍,以及build方法参考如下链接:

https://source.android.com/devices/tech/test_infra/tradefed/

TF源码:

https://android.googlesource.com/platform/tools/tradefederation/

2.参考官方提供到源码build说明,搭建好编译环境:

https://source.android.com/source/downloading

下载android源码(这里下载的分支为android-7.0.0_r33)

repo init -u https://android.googlesource.com/platform/manifest -b android-7.0.0_r33
3.源码下载完成后,在Ubuntu terminal里面进入源码下的tools目录,下载对应分支的TF

git clone https://android.googlesource.com/platform/tools/tradefederation -b android-7.0.0_r33
打开TF的Android.mk文件,需要依赖loganalysis。

LOCAL_JAVA_LIBRARIES := emmalib tools-common-prebuilt loganalysis

4.下载loganalysis到tools目录,与TF在同一个目录,loganalysis是TF的依赖库,如果没有编译汇报错(如最下方第八条);

git clone https://android.googlesource.com/platform/tools/loganalysis -b android-7.0.0_r33

5.下载jline到android源码的external目录,Android.mk文件中有说明jline是静态库文件:

LOCAL_STATIC_JAVA_LIBRARIES := junit kxml2-2.3.0 jline-1.0 tf-remote-client

git clone https://android.googlesource.com/platform/external/jline -b android-7.0.0_r33

6.参考官方提供的build说明进行build:

TF is a test harness used to drive Android automated testing. It runs on test hosts and monitors the connected devices, handling test scheduling & execution and device management.

Other test harnesses like Compatibility Test Suite (CTS) and Vendor Test Suite (VTS) use TF as a basis and extend it for their particular needs.

Building TF:

  • source build/envsetup.sh
  • tapas tradefed-all
  • make -j8
7.build完成

8.缺少loganalysis报错:

ninja: Entering directory `.'
ninja: error: 'out/host/linux-x86/framwork/loganalysis.jar', needed by 'out/host/common/obj/JAVA_LIBRARIES/tradefed_intermediates/classes-full-debug.jar', missing and no known rule to make it
make: *** [ninja_wrapper] Error 1


缺少jline报错:

ninja: Entering directory `.'
ninja: error: 'out/host/common/obj/JAVA_LIBRARIES/jline-1.0_intermediates/javalib.jar', needed by 'out/host/common/obj/JAVA_LIBRARIES/tradefed_intermediates/classes-full-debug.jar', missing and no known rule to make it
make: *** [ninja_wrapper] Error 1