android編譯cts
㈠ android cts如何到另一台電腦繼續測試
Android 4.0 CTS 測試方法
這段時間公司做CTS測試,下面是一些總結,以android4.0.3為例,希望對大家有所幫助!
一 CTS測試簡介
The Android compatibility program makes it easy for mobile device manufacturers to develop compatible Android devices
CTS具體的介紹,大家可以參考google的官方網站,大家可以詳細的了解CTS測試的目的和環境,我們一般的疑惑都能在該網站上找到答案。
1.1為什麼需要兼容性測試(以下稱CTS)?
1.1.1、讓APP提供更好的用戶體驗。用戶可以選擇更多的適合自己設備的APP。讓APP更穩定。
1.1.2、讓開發者設計更高質量的APP。
1.1.3、通過CTS的設備可以運行Android market。
1.2怎麼樣才能讓我的設備變成兼容的。
1.2.1、與Android Compatibility Definition文檔(以下簡稱ACD)匹配
先看一下與你的系統版本相匹配的ACD,文檔中描述了你需要具備的軟體和硬體參數。
1.2.2、通過CTS測試
CTS是開源的測試框架,使用它來測試你的設備是否具備兼容性。
1.2.3、提交報告
你可以把測試結果發送給[email protected]。當你提交了一個CTS報告時,你還可以要求訪問Android Market。
如果是google的合作夥伴,需要將CTS測試報告、機器、以及軟體一共寄給google進行測試,取得google的approval以後,手機才能上市,這是後話,相信好多人都是用不到的。
1.3 CTS測試原理
CTS主要包含兩個組件:
運行在PC上的測試框架組件。主要用來管理測試用例(test case)的執行。
運行在設備或模擬器上的測試用例。這些用例用java寫成的APK文件。
1.4工作流程
1)可以從源碼編譯CTS,也可以從網站下載編譯好的CTS
2)安裝配置CTS。
3)把設備連接到PC上。
4)運行CTS。CTS會把相應的測試用例(也就是一個APK文件)傳送到設備上並通過instrumentation運行,然後記錄運行結果,最後刪除測試用例。
所有的測試用例執行完畢後,可以參照測試結果重新調整或優化系統。然後繼續運行CTS測試。
1.5、測試通過以後,你可以把CTS生成的結果(就是result下面那個以測一、取得Compatibility Test Suite的兩種方法:
(1)可以從 下載最新版本的Compatibility Test Suit;
(2)也可以通過編譯Android源代碼的方式獲得。在android源代碼目錄下輸入make cts命令來編譯CTS,之後會在out/host/linux-x86/cts/下生成android-cts文件夾。這個文件夾就是Compatibility Test Suit。
注意:但是源碼中的代碼可能不是最新的,所以建議沖網站上下載最新的,需要用git在google的網站上下載,網上有好多例子,這里就不再重復了。
二 測試用例的范圍
1、Signature
對每個Android產品,都有一些XML文件來描述所有的公開API。CTS包含了一個工具來檢測這些API簽名中包含的API是否都在系統中被支持。
2、Platform
測試SDK文檔中描述的平台API,比如core libraries,Android Application Framework等。要求這些API可以提供:
正確的類、屬性、方法簽名、方法行為、錯誤參數處理方式
3、Dalvik VM
專門針對Dalvik Vm的測試。
4、Platform Data Model
平台通過ContentProvider提供給開發者使用的數據,比如:Contacts,Browser,Settings等。
5、Platform Intents
平台提供的用於核心功能的Intent。
6、Platform permission
平台提供的一些重要APP許可權
7、Platform Resources
simple values,drawables,nine-patch,animations,layouts,styles and themes,loading alternate resources等
三 如何搭配環境
目前cts沒有提供windows版本,只能在Linux下測試。
1 PC機配置環境
PC端網上有好多資料可以供參考,這里就省略了。
2 手機設置
1) 進入settings->Privacy->Factorydata reset,對平台進行reset一次
2) 平台插入一張空的TF卡
3) 平台安裝兩個APK:.apk,CtsDeviceAdmin.apk
4) 進入settings打開Wi-Fi並連接AP (AP需要連外網)
5) 進入settings->Security->Screenlock設為None
6) 進入settings->Security->EnableUnknown sources
7) 進入settings->Security->Deviceadministrators->Enable兩個選項
8) 進入Language&input->language設為English(UnitedStates)
9) 進入settings->Display->Sleep設為30minutes或None
10) 進入settings->Accessibility->EnableDelegating Accessibility Service
11) 進入settings->Developeroptions->Enable USB debugging、Stay awake、Allowmock locations
12) PC上「android-cts-media-1.0」,在android-cts-media-1.0文件下輸入./__media.sh運行腳本,將media文件進平台。成功後會在平台的內存中看到test文件夾。(此條適用於CTS4.0 R2和R3,R1上無需使用)
四 測試方法
1.平台用USB線連接LinuxPC (連通後平台左上方會顯示usb和debug icon)
2.打開終端
3.輸入sudosu -
輸入root密碼
4.輸入cd ../..
輸入 cd /home/linux/cts/android-cts-4.0.3_r1-linux_x86-arm/android-cts/tools (這個是cts-tradefed文件所在路徑,各位需要輸入實際路徑)
輸入 ./cts-tradefed
終端顯示 01-16 15:44:05 I/DeviceManager: Detected newdevice 0123456789ABCDEF(如果沒有這行,說明設備沒有和PC聯通)
Android CTS 4.0.3_r1
cts-tf >
5.輸入run cts --plan CTS
終端顯示 cts-tf > run cts --plan CTS
cts-tf> 01-16 15:45:34 I/TestInvocation: Starting invocation for 'cts' on build'4.0.3_r1' on device 0123456789ABCDEF
01-16 15:45:35I/0123456789ABCDEF: Created result dir 2012.01.16_15.45.34
開始測試CTS
五 關於CTS4.0測試報告
1.CTS測試報告是自動生成一個xml報表,並自動填寫的,不需要測試人員干預
2.當一個CTS測試任務開始時,會在android-cts-4.0.3_r1-linux_x86-arm/android-cts/repository/results中,為這個任務建立一個存放測試報告的文件夾,文件名以任務開始的日期和時間命名。
例如:2012.01.12_13.00.03
3.CTS4.0生成測試報告的速度比CTS2.3/2.2要慢不少,特別是在測試過程中中斷測試,CTS4.0需要70秒才會開始生成報告。如果你在此過程中按ctrl+c終止CTS進程,測試報告就無法生成,以後也無法繼續測試未完成的計劃。
下方是中途斷開後生成報告的例子:
01-1813:50:19I/0123456789ABCDEF: android.accounts.cts.AccountManagerTest#testHasFeature FAIL
Testfailed to run to completion. Reason: 'Test run failed to complete. Expected 1tests, received 0'. Check device logcat for details
01-1813:51:29I/0123456789ABCDEF: android.accounts package complete: Passed 20, Failed 2, NotExecuted 6
01-1813:51:29 I/0123456789ABCDEF: -----------------------------------------
01-1813:51:29 I/0123456789ABCDEF: Test package android.admin started
01-1813:51:29 I/0123456789ABCDEF: -----------------------------------------
……
01-1813:51:30 I/0123456789ABCDEF: -----------------------------------------
01-1813:51:30 I/0123456789ABCDEF: Test package android.widget started
01-1813:51:30 I/0123456789ABCDEF: -----------------------------------------
01-1813:51:30 I/0123456789ABCDEF: Saved log device_logcat_8558243668624894128.zip
01-1813:51:30 I/0123456789ABCDEF: Saved log host_log_6087775957743010530.zip
㈡ 如何進行android兼容性測試cts
二、運行CTS的方法,步驟如下:
(1)進入目錄android-cts,該目錄是通過上面那兩種方法獲得的。在android-cts目錄下會有3個文件夾,其中一個是tools。
(2)進入tools目錄,輸入./startcts來啟動CTS。
(3)如果運行成功會出現Android CTS version 2.3_r1的字樣(我的android的版本是2.3的)。如果有連接設備到PC上還會出現Device(設備ID)connected的字樣。這里設備可以是連接PC的android的機器,也可以是模擬器。
三、CTS測試的方法:
(1)在cts_host>下敲入help,會顯示cts下的許多命令。ls –plan命令顯示google自帶的測試方案,如:Java、Signature、Android、CTS、VM、RefApp、Performance、AppSecurity。其中Performance這個方案是google暫不要求的。Java、Signature、Android、VM、RefApp、Appsecurity方案都是CTS方案的子集。
(2)用命令ls -d來查看已連接的設備,CTS測試之前我們必須保證至少有一個設備連接上。
(3)輸入命令start –plan CTS來執行CTS測試方案,該方案有兩萬多條測試項目,需要很長時間,因此除了第一次測試之外,不建議這么做。我做的都是針對某些包的測試。如果連接了多個設備的話需加上-d參數,後面跟上設備id來告訴CTS需要測試的設備。
(4)對單獨一個包進行測試的方法:start –plan CTS –p 包名;推薦用這種方法來進行針對性的測試。需要知道有哪些包名,可以輸入命令:ls –plan CTS
(5)也可以針對單獨一個case進行測試:start –plan CTS –test 類名#方法名
四、查看測試的結果:
測試生成的log在\android-cts\repository目錄下以log+測試時間.txt命名。測試報告在android-cts\repository\results目錄下,也是以測試時間命名。
五、注意事項:
(1)測試前需要安裝一個apk:adb install -r android-cts/repository/testcases/.apk 然後在設置裡面
㈢ android 源碼 怎麼只編譯 systemui
Google提供的Android包含了原始Android的目標機代碼,主機編譯工具、模擬環境,下載的代碼包經過解壓後(這里是Android2.2的源碼包),源代碼的第一層目錄結構如下: -- Makefile -- bionic (bionic C庫) -- bootable (啟動引導相關代碼) -- build (存放系統編譯規則及generic等基礎開發包配置) -- cts (Android兼容性測試套件標准) -- dalvik (dalvik JAVA虛擬機) -- development (應用程序開發相關) -- external (android使用的一些開源的模組) -- frameworks (核心框架——java及C++語言) -- hardware (主要保護硬解適配層HAL代碼) -- libcore -- ndk -- device -- out (編譯完成後的代碼輸出與此目錄) -- packages (應用程序包) -- prebuilt (x86和arm架構下預編譯的一些資源) -- sdk (sdk及模擬器) -- system (文件系統庫、應用及組件——c語言) `-- vendor (廠商定製代碼) bionic 目錄 -- libc (C庫) -- arch-arm (ARM架構,包含系統調用匯編實現) -- arch-x86 (x86架構,包含系統調用匯編實現) -- bionic (由C實現的功能,架構無關) -- docs (文檔) -- include (頭文件) -- inet -- kernel (Linux內核中的一些頭文件) -- netbsd (?netbsd系統相關,具體作用不明) -- private (?一些私有的頭文件) -- stdio (stdio實現) -- stdlib (stdlib實現) -- string (string函數實現) -- tools (幾個工具) -- tzcode (時區相關代碼) -- unistd (unistd實現) `-- zoneinfo (時區信息) -- libdl (libdl實現,dl是動態鏈接,提供訪問動態鏈接庫的功能) -- libm (libm數學庫的實現,) -- alpha (apaha架構) -- amd64 (amd64架構) -- arm (arm架構) -- bsdsrc (?bsd的源碼) -- i386 (i386架構) -- i387 (i387架構?) -- ia64 (ia64架構) -- include (頭文件) -- man (數學函數,後綴名為.3,一些為freeBSD的庫文件) -- powerpc (powerpc架構) -- sparc64 (sparc64架構) `-- src (源代碼) -- libstdc++ (libstdc++ C++實現庫) -- include (頭文件) `-- src (源碼) -- libthread_db (多線程程序的調試器庫) `-- include (頭文件) `-- linker (動態鏈接器) `-- arch (支持arm和x86兩種架構) bootable 目錄 -- bootloader (適合各種bootloader的通用代碼) `-- legacy (估計不能直接使用,可以參考) -- arch_armv6 (V6架構,幾個簡單的匯編文件) -- arch_msm7k (高通7k處理器架構的幾個基本驅動) -- include (通用頭文件和高通7k架構頭文件) -- libboot (啟動庫,都寫得很簡單) -- libc (一些常用的c函數) -- nandwrite (nandwirte函數實現) `-- usbloader (usbloader實現) -- diskinstaller (android鏡像打包器,x86可生產iso) `-- recovery (系統恢復相關) -- edify (升級腳本使用的edify腳本語言) -- etc (init.rc恢復腳本) -- minui (一個簡單的UI) -- minzip (一個簡單的壓縮工具) -- mttils (mtd工具) -- res (資源) `-- images (一些圖片) -- tools (工具) `-- ota (OTA Over The Air Updates升級工具) `-- updater (升級器) build目錄 -- core (核心編譯規則) -- history (歷史記錄) -- libs `-- host (主機端庫,有android 「cp」功能替換) -- target (目標機編譯對象) -- board (開發平台) -- emulator (模擬器) -- generic (通用) -- idea6410 (自己添加的) `-- sim (最簡單) `-- proct (開發平台對應的編譯規則) `-- security (密鑰相關) `-- tools (編譯中主機使用的工具及腳本) -- acp (Android "acp" Command) -- apicheck (api檢查工具) -- applypatch (補丁工具) -- apriori (預鏈接工具) -- atree (tree工具) -- bin2asm (bin轉換為asm工具) -- check_prereq (檢查編譯時間戳工具) -- dexpreopt (模擬器相關工具,具體功能不明) -- droiddoc (?作用不明,java語言,網上有人說和JDK5有關) -- fs_config (This program takes a list of files and directories) -- fs_get_stats (獲取文件系統狀態) -- iself (判斷是否ELF格式) -- isprelinked (判斷是否prelinked) -- kcm (按鍵相關) -- lsd (List symbol dependencies) -- releasetools (生成鏡像的工具及腳本) -- rgb2565 (rgb轉換為565) -- signapk (apk簽名工具) -- soslim (strip工具) `-- zipalign (zip archive alignment tool) dalvik目錄 dalvik虛擬機 . -- dalvikvm (main.c的目錄) -- dexmp (dex反匯編) -- dexlist (List all methods in all concrete classes in a DEX file.) -- dexopt (預驗證與優化) -- docs (文檔) -- dvz (和zygote相關的一個命令) -- dx (dx工具,將多個java轉換為dex) -- hit (?java語言寫成) -- libcore (核心庫) -- libcore-disabled (?禁用的庫) -- libdex (dex的庫) -- libnativehelper (Support functions for Android's class libraries) -- tests (測試代碼) -- tools (工具) `-- vm (虛擬機實現) development 目錄 (開發者需要的一些常式及工具) -- apps (一些核心應用程序) -- BluetoothDebug (藍牙調試程序) -- CustomLocale (自定義區域設置) -- Development (開發) -- Fallback (和語言相關的一個程序) -- FontLab (字型檔) -- GestureBuilder (手勢動作) -- NinePatchLab (?) -- OBJViewer (OBJ查看器) -- SdkSetup (SDK安裝器) -- SpareParts (高級設置) -- Term (遠程登錄) `-- launchperf (?) -- build (編譯腳本模板) -- cmds (有個monkey工具) -- data (配置數據) -- docs (文檔) -- host (主機端USB驅動等) -- ide (集成開發環境) -- ndk (本地開發套件——c語言開發套件) -- pdk (Plug Development Kit) -- samples (演示程序) -- AliasActivity () -- ApiDemos (API演示程序) -- BluetoothChat (藍牙聊天) -- BrowserPlugin (瀏覽器插件) -- BusinessCard (商業卡) -- Compass (指南針) -- ContactManager (聯系人管理器) -- CubeLiveWall** (動態壁紙的一個簡單常式) -- FixedGridLayout (像是布局) -- GlobalTime (全球時間) -- HelloActivity (Hello) -- Home (Home) -- JetBoy (jetBoy游戲) -- LunarLander (貌似又是一個游戲) -- MailSync (郵件同步) -- MultiResolution (多解析度) -- MySampleRss (RSS) -- NotePad (記事本) -- RSSReader (RSS閱讀器) -- SearchableDictionary (目錄搜索) -- **JNI (JNI常式) -- SkeletonApp (空殼APP) -- Snake (snake程序) -- SoftKeyboard (軟鍵盤) -- Wiktionary (?維基) `-- Wiktionary**(?維基常式) -- scripts (腳本) -- sdk (sdk配置) -- simulator (?模擬器) -- testrunner (?測試用) `-- tools (一些工具)
㈣ android產品上市必須通過CTS認證測試嗎
是的,一定要通過CTS認證測試
Android的CTS測試,英文為Compatibility Test Suite,意為兼容性測試。只有通過CTS測試的設備才有可能獲得Android的商標和享受Android Market的許可權。以下分享我對Android CTS的認識。
一、取得Compatibility Test Suite的兩種方法:
(1)可以從http://source.android.com/compatibility/downloads.html下載最新版本的Compatibility Test Suit;
(2)也可以通過編譯Android源代碼的方式獲得。在android源代碼目錄下輸入make cts命令來編譯CTS,之後會在out/host/linux-x86/cts/下生成android-cts文件夾。這個文件夾就是Compatibility Test Suit。
==========================================
1、Error occurred ring initialization of VM
Could not reserve enough space for object heap
從字面上看是在初始化java Vm的時候不能獲取足夠的堆空間,於是修改了build/core/definition.mk文件中的編譯core.jar和framework.jar時需要的-JXmx為1024m,此參數代表編譯上述兩個包時需要的最大內存,此初始值為2048M,由於我的PC電腦總的內存才2G,系統運行會占據一部分內存,故編譯android的時候肯定不會分配2G內存,
解決:
把build/core/definitions.mk 文件
第1528行:$(if $(findstring windows,$(HOST_OS)),,-JXms16M -JXmx2048M) \
改成: $(if $(findstring windows,$(HOST_OS)),,-JXms16M -JXmx1024M) \
http://blog.csdn.net/leerobin83/article/details/7873229
==========================================
二、運行CTS的方法,步驟如下:
(1)進入目錄android-cts,該目錄是通過上面那兩種方法獲得的。在android-cts目錄下會有3個文件夾,其中一個是tools。
(2)進入tools目錄,輸入./startcts來啟動CTS。
(3)如果運行成功會出現Android CTS version 2.3_r1的字樣(我的android的版本是2.3的)。如果有連接設備到PC上還會出現Device(設備ID)connected的字樣。這里設備可以是連接PC的android的機器,也可以是模擬器。
三、CTS測試的方法:
(1)在cts_host>下敲入help,會顯示cts下的許多命令。ls –plan命令顯示google自帶的測試方案,如:Java、Signature、Android、CTS、VM、RefApp、Performance、AppSecurity。其中Performance這個方案是google暫不要求的。Java、Signature、Android、VM、RefApp、Appsecurity方案都是CTS方案的子集。
(2)用命令ls -d來查看已連接的設備,CTS測試之前我們必須保證至少有一個設備連接上。
(3)輸入命令start –plan CTS來執行CTS測試方案,該方案有兩萬多條測試項目,需要很長時間,因此除了第一次測試之外,不建議這么做。我做的都是針對某些包的測試。如果連接了多個設備的話需加上-d參數,後面跟上設備id來告訴CTS需要測試的設備。
(4)對單獨一個包進行測試的方法:start –plan CTS –p 包名;推薦用這種方法來進行針對性的測試。需要知道有哪些包名,可以輸入命令:ls –plan CTS
(5)也可以針對單獨一個case進行測試:start –plan CTS –test 類名#方法名
四、查看測試的結果:
測試生成的log在\android-cts\repository目錄下以log+測試時間.txt命名。測試報告在android-cts\repository\results目錄下,也是以測試時間命名。
五、注意事項:
(1)測試前需要安裝一個apk:adb install -r android-cts/repository/testcases/.apk 然後在設置裡面的輔助功能中會多一個Delegating Accessibility Service選項,將這個選項勾起。
(2)在android設備設置中:顯示->屏幕超時->選取30分鍾
(3)在android設備設置中:應用程序->開發->勾選保持喚醒狀態。
(4)保證測試前,android設備在主界面狀態。
(5)將android設備的語言設置為英文
㈤ 如何編譯出ctsverifier.apk
Android 4.0 CTS 測試方法 這段時間公司做CTS測試,下面是一些總結,以android4.0.3為例,希望對大家有所幫助! 一 CTS測試簡介 The Android compatibility program makes it easy for mobile device manufacturers to develop compatible Andro.
㈥ 編譯android2.2時出現內存溢出!main javac dalvik-cts-builtil build step failed
因為沒有指針操作,java裡面的溢出一般是數組訪問越界。
沒有代碼,沒法幫你找。
最好在每次用index訪問數組時,判斷一下index不要大於數組的size-1
㈦ 如何判斷 cts android
CTS是什麼?
資料:CDD、CTS官網、android-cts-manual-r4;
CTS是什麼我就不多費話了,看上面官方的說法就行了。不過有一點需要明確,你的設備只有滿足CDD的規定並且通過CTS,才有可能獲得Android的商標和享受Android Market的許可權。這里有可能指的是需要你自己去向google申請的,不是說兼容了,這些東西就自然而然有了。
怎麼用:
資料: android-cts-manual-r4、宋立新_Android CTS測試研究;
安裝與配置:
下載或自己編譯;修改startcts中SDK_ROOT;在板子或emulator上裝一個apk;設置setting;
各種命令的用法:
注意:start --plan –p以及start --plan –t的用法,-t要指定一個具體的測試方法
方法1:一般使用的方法
$ ./startcts 注意如果用手機設備調試,用root許可權執行
cts_host > ls --plan 列出所有plan
out/host/linux-x86/cts/android-cts/repository/plans中有plan的具體內容
cts_host > start --plan VM 運行某個plan
測試結果在out/host/linux-x86/cts/android-cts/repository/results目錄下,用瀏覽器看時間目錄下的xml文件即可
注意在改動cts後,還要make cts重新編譯,若只在cts目錄中編譯不能生效
cts_host > ls -p 看當前可用的用例包
cts_host > start --plan Android -p android.app 只運行某個用例包,節約時間
cts_host > start --plan Android -p android.app -t android.app.cts.AlertDialogTest#testAlertDialog
只運行某個用例包中的某個用例
方法2:遇到問題時方便調試的方法
$ adb install out/target/proct/xxxx/data/app/SginatureTest.apk 安裝某個用例包
$ adb shell pm list instrumentation pm用於管理package,看當前機器安裝了什麼用例
$ adb shell am instrument -w android.tests.sigtest/.InstrumentationRunner am用於管理activity 運行某一用例
$ adb shell am instrument -e class android.app.cts.AlertDialogTest#testAlertDialog -w com.android.cts.app/android.test/InstrumentationCtsTestRunner 單獨運行一個小case
如果在一個時間很長的plan(如Android)中,某處錯了,而錯誤信息又不全,需要單獨跑一個小case,用-e指明class明就可以節約很多時間
用完後結果的分析:
結果在repository/results中,放在一個文件夾里,名字是你測試開始的時間。
分析的方法有兩種:
1、可以直接從Failure Details找原因;(個人感覺應該難度較大)
2、結合源代碼以及Failure Details的信息找原因
第二種方法牽扯到找測試源代碼的問題,這就要對CTS源碼目錄以及相應生成物的命名有一定的了解。
了解CTS這個工程:
資料:宋立新同學的Android CTS測試研究二、android build system、CTS源碼、makefile以及shell基本知識
了解Linux工程最好的入手點,就是從它的編譯系統入手。
這個涉及到Linux的makefile以及android的編譯系統的基本知識,具體內容還是挺多的,不過看懂了android編譯系統,以後看其他Android工程應該都會得心應手。
在android CTS上增加自己的test package
資料:CTS命令的用法、Erin Yueh的兩篇文章
有兩種方法:
1、完美利用自帶命令(已驗證)
2、用Erin Yueh的方法
用這個方法的前提也是要徹底弄懂CTS的內部結構,不然也只能照貓畫虎
如何寫test case
資料:JUnit、SDK/docs下面的五篇文章、android open source官網/porting/Instrumentation Testing
這又是另外一門學問了
這個test case 可以涉及各個層次,Android 平台相關的測試的寫法可以參考官方的那五篇文章,如何運行可參考上面資料三,其他的可能會涉及到JUnit以及其他一些知識,目前還沒實地考察。
接下來要弄明白的
1、android的編譯系統(學習下makefile以及shell基本知識)
2、CTS這個工程(看看測試包XML生成器的假設成不成立,能不能提取出來)
3、眾多層次test case 的寫法
㈧ android的cts測試到底有多細
1.下載完整的cts測試工具包,方式有兩種:
a.在現有代碼上編譯,代碼版本與目標機器版本一致;
b.在Google官網下載:http://source.android.com/compatibility/downloads.html,Compatibility
Test Suite (CTS)即可。
2.下載media測試內容,還是上邊的官網,在網頁最下邊:
CTS Media Files
These media files are required for the CTS media stress tests.
CTS Media 1.0
3.連接手機與電腦(至少一台手機)
4.測試前准備
android-cts/repository/testcases中的.apk和CtsDeviceAdmin.apk
安裝完成以上apk後,在手機端操作:
a.設置->輔助程序->Delegating Accessibility Service,打開;
b.設置->安全->設備管理器->CTS相關的兩個選項都激活;
c.打開USB調試模式;
d.保持屏幕喚醒;
e.允許模仿位置;
f.切換至英文模式US。
5.進入cts控制台
執行android-cts/tools/cts-tradefed
dev@linux -dev:~/android/CTS/android-cts/tools$ ./cts-tradefed
09-0509:20:52 I/: Detectednew device c8090fe4
09-0509:20:52 I/: Detectednew device5348300e
Android CTS 4.2_r1
我現在連接著兩台設備,都檢測到了。
6.開始進行CTS測試
首先,在控制台中輸入help看這個控制台都能幹什麼。
cts-tf > help
CTS-tradefed host version 4.2_r1
CTS-tradefed is the test harness for running the Android Compatibility
Suite, built on top of the tradefed framework.
Available commands and options
Host:
help: show this message
help all: show the complete tradefed help
exit: gracefully exit the cts console, waiting till all invocations are
complete
Run:
run cts --plan test_plan_name: run a test plan
run cts --package/-p: run a CTS test package
run cts --class/-c [--method/-m]: run a specific test class
and/ormethod
run cts --continue-session session_ID: run all not executed tests from a
previous CTS session
run cts [options] --serial/s device_ID: run CTS on specified device
run cts [options] --shards number_of_shards: shard a CTS run into given
number of independent chunks, to run on multiple devices inparallel
run cts --help/--help-all: get more help on running CTS
List:
l/list d/devices: list connected devices and their state
l/list packages: list CTS test packages
l/list p/plans: list CTS test plans
l/list i/invocations: list invocations aka CTS test runs currentlyin
progress
l/list c/commands: list commands: aka CTS test run commands currently in
the queue waiting to be allocated devices
l/list r/results: list CTS results currently present in the repository
Add:
add derivedplan --plan plane_name --session/-s session_id-r
[pass/fail/notExecuted/timeout]: derive a plan from the given session
Dump:
d/mp l/logs: mp the tradefed logsfor all running invocations
Options:
--disable-reboot: Do not reboot device after running some amount of
tests.
run cts --plan + 運行某個plan,查看當前支持的plan,運行l
p,實際上所有的plan存放在android-cts/repository/plans;
run cts --package/-p 運行某一個測試包;
run cts --class/-c [--method/-m] 運行某一個測試類或測試方法;
run cts --continue-session session_ID 繼續運行之前沒有完成的CTS測試,要知道它的session_ID;
run cts [options] --serial/s device_ID 在某個串號的設備上進行CTS測試,對應多個機器的時候,通過adb
devices能夠查看當前連接的所有設備的串號;
run cts [options] --shards number_of_shards 在多個設備上同時運行CTS測試,如run cts --plan
CTS --shards 2,在兩個設備上同時運行;
run cts --help/--help-all 展示更多幫助
查看列表:
查看行為是l/list,接不同的參數顯示對應信息。
d/devices 當前連接的設備,效果同adb devices,不過信息更詳細,還有設備電量信息;
packages 當前CTS plan的所有測試包;
p/plan 當前所支持的CTS plan有哪些;
i/invocations 當前CTS的運行狀態;
c/commands 展示出用戶輸入過的命令;
r/results 展示以往的測試結果
Session Pass Fail Not Executed Start time Plan name Device serial(s)
0 17720 239 12 2013.08.24_18.23.23 CTS c8090fe4
1 17907 64 0 2013.09.04_17.51.15 CTS FUSC85YLYPAMRC69
需要特別關注的幾點注意事項:
首先,手機的功能一定要完整,WIFI BT 3G CAMERA等;
手機要切換至英文語言;
連接到可用WIFI;
有SIM卡,並能夠打電話發簡訊;
對於屏幕密度,目前CTS中最高支持320,但實際上Google已經添加了對480,也就是1080p的支持;
會檢測Fingerprint,注意廠家名;
要保證能夠訪問到www.google.com;
實戰演戲:
連接兩台手機後,進入cts控制台:
run cts --plan CTS --shards 2
兩台手機上會同時跑起CTS測試,大概5小時候測試完成,生成測試報告,保存在results下。
㈨ android 7.0 cts 要求必須硬體加密嗎
1.下載完整的cts測試工具包,方式有兩種:
a.在現有代碼上編譯,代碼版本與目標機器版本一致;
b.在Google官網下載:http://source.android.com/compatibility/downloads.html,Compatibility
Test Suite (CTS)即可。
2.下載media測試內容,還是上邊的官網,在網頁最下邊:
CTS Media Files
These media files are required for the CTS media stress tests.
CTS Media 1.0
3.連接手機與電腦(至少一台手機)
4.測試前准備
android-cts/repository/testcases中的.apk和CtsDeviceAdmin.apk
安裝完成以上apk後,在手機端操作:
a.設置->輔助程序->Delegating Accessibility Service,打開;
㈩ 如何通過Android CTS測試
解決方法: 1. 生成加密key文件: 將/android_src/development/tools/生成的key COPY到android\build\target\proct\security\ 2. 編譯android源碼 重新編譯android源碼,此時out/.../system/app下就是重新編譯的APK 重新構建NFS掛載使用的根文件系統再次測試 3. 單個APK的簽名 重新測試時發現com.android.pts.browser包還是PASS不了,查看out/.../system/app/下的APK文件,發現在步驟2中, out/.../system/app/PtsDeviceBrowserLauncher.apk沒有重新生成,還是原來的。 不知道為啥沒有重新生成? 我的解決方法是對此APK單獨簽名,將signapk.jar 及自簽名密匙,platform.pk8 platform.x509.pem COPY到下面路徑並 cd /out/target/proct/xxxx/obj/APPS/PtsDeviceBrowserLauncher_intermediates 文件位置:可以在platform/build/target/proct/security/中找到platform.pk8 platform.x509.pem等簽名文件,對應不同的許可權。 signapk.jar:由/platform/build/tools/signapk/編譯產出,可以在/out/host/linux-x86/framework/中找到。 然後運行下面命令 : # java -jar signapk.jar platform.x509.pem platform.pk8 package.apk.unsigned PtsDeviceBrowserLauncher.apk package.apk.unsigned 表示未簽名的該APK文件, 重新簽名後為PtsDeviceBrowserLauncher.apk //簽過名的APK重新簽名可能會出錯,最好找到未簽名的APK 其他參考: 簽名: java -jar signapk.jar platform.x509.pem platform.pk8 MyDemo.apk MyDemo_signed.apk 得到具有對應許可權的APK 優化APK: zipalign -v 4 MyDemo_signed.apk MyDemo_new.apk 查循APK是否優化過: zipalign -c -v 4 MyDemo.apk