自 2025 年 3 月 27 日起,我們建議您使用 android-latest-release
而非 aosp-main
建構及貢獻 AOSP。詳情請參閱「Android 開放原始碼計畫變更」。
Trade Federation Console
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
Trade Federation 主控台是選用元件,可讓您檢查 Trade Federation 的狀態,以及它看到的內容,從裝置狀態到目前進行中的測試。
這是監控大量平行執行的測試,以及瞭解各項測試進度的絕佳工具。
前往控制台
建構 Tradefed 後,您就能透過路徑存取 tradefed.sh
啟動器指令碼,並根據預設前往主控台。
主控台會顯示 tf >
提示。
控制台可執行哪些操作?
控制台的 help
一律會列出最新資訊。其中幾項有趣的功能包括:
- 列出裝置和 Tradefed 看到的裝置狀態:
list devices
- 列出目前執行的叫用作業及其中繼資料:
list invocations
- 取得所有執行中叫用作業和 Tradefed 的記錄:
dump logs
您可以使用控制台查詢某些狀態,這些狀態不會在其他任何地方顯示,藉此對 Tradefed 和裝置中的情況進行偵錯。
如何停用控制台?
有時您不需要使用控制台,例如執行一次性指令時。從指令碼執行 Tradefed 或直接管道輸出時,必須停用控制台。在啟用控制台的情況下,透過指令碼執行 Tradefed 可能會導致非預期的行為。
如要避免主控台啟動,請使用 commandAndExit
引數執行 tradefed.sh
啟動器指令碼。
tradefed.sh run commandAndExit <usual command>
控制台自動完成功能
控制台會提供設定名稱的基本自動完成功能。
tf > run <hit TAB>
result in:
Display all 167 possibilities? (y or n)
按下 run
後按下 TAB 鍵,即可取得可用的完整設定清單。如果您已輸入部分名稱,控制台會列印所有可能的名稱。
tf >run tf/<HIT TAB>
tf/acceptance tf/fake tf/func
tf/stress tf/uiautomator tf/unit-runner
tf >run tf/
當您不記得確切的設定名稱時,這項功能就很實用。
這個頁面中的內容和程式碼範例均受《內容授權》中的授權所規範。Java 與 OpenJDK 是 Oracle 和/或其關係企業的商標或註冊商標。
上次更新時間:2025-07-27 (世界標準時間)。
[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["缺少我需要的資訊","missingTheInformationINeed","thumb-down"],["過於複雜/步驟過多","tooComplicatedTooManySteps","thumb-down"],["過時","outOfDate","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["示例/程式碼問題","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-07-27 (世界標準時間)。"],[],[],null,["# Trade Federation Console\n\nThe Trade Federation Console is an optional component that allows you to inspect\nthe state of Trade Federation and what it sees, from the device states to the\ncurrent tests in progress.\n\nIt is a great tool for monitoring a large number of tests running in parallel\nand understanding the progress of each test.\n\nReach the console\n-----------------\n\nOnce Tradefed is built, the `tradefed.sh` launcher script is accessible from\nyour path and by default will take you to the console.\n\nThe console presents itself with the `tf \u003e` prompt.\n\nWhat can the console do?\n------------------------\n\nThe `help` of the console will always list the most up-to-date information.\nA few interesting features of it are:\n\n- List the devices and how Tradefed sees their state: `list devices`\n- List the currently running invocations and their metadata: `list invocations`\n- Get the logs of all running invocations and Tradefed: `dump logs`\n\nThe console allows you to debug what is happening in Tradefed and the devices by\nquerying some states that are not shown together anywhere else.\n\nHow do I disable the console?\n-----------------------------\n\nSometimes the console isn't needed, such as when running a one-time command. The\nconsole must be disabled when running Tradefed from a script or when\npiping its output directly. Running Tradefed from a script with the console\nenabled can cause unexpected behavior.\n\nTo prevent the console from starting, run the `tradefed.sh` launcher script with\nthe `commandAndExit` argument. \n\n tradefed.sh run commandAndExit \u003cusual command\u003e\n\nConsole autocompletion\n----------------------\n\nThe console provides basic autocompletion of configuration names. \n\n tf \u003e run \u003chit TAB\u003e\n result in:\n Display all 167 possibilities? (y or n)\n\nBy hitting TAB after the `run` you can get the full list of configurations\navailable. And if you have a partial name already typed in, the console will\nprint all the possibilities. \n\n tf \u003erun tf/\u003cHIT TAB\u003e\n\n tf/acceptance tf/fake tf/func\n tf/stress tf/uiautomator tf/unit-runner\n tf \u003erun tf/\n\nThis is a useful when you don't remember an exact configuration name."]]