ArtRun測試
public class ArtRunTest
extends Object
implements IRemoteTest , IAbiReceiver , ITestFilterReceiver , ITestCollector
java.lang.Object | |
↳ | com.android.tradefed.testtype.ArtRunTest |
運行 ART 運行測試的測試運行器。
概括
嵌套類 | |
---|---|
class | ArtRunTest.AdbShellCommandException 一個異常類,用於報告在執行 ADB shell 命令期間發生的錯誤。 |
領域 | |
---|---|
public static final String | CHECKER_PAR_FILENAME
|
公共構造函數 | |
---|---|
ArtRunTest () |
公共方法 | |
---|---|
void | addAllExcludeFilters ( filters) addAllExcludeFilters ( filters) 添加要排除的測試的過濾器的 |
void | addAllIncludeFilters ( filters) addAllIncludeFilters ( filters) 添加要包含哪些測試的過濾器的 |
void | addExcludeFilter (String filter) 添加要排除哪些測試的過濾器。 |
void | addIncludeFilter (String filter) 添加要包含哪些測試的過濾器。 |
void | clearExcludeFilters () 刪除當前跟踪的所有排除過濾器。 |
void | clearIncludeFilters () 刪除當前跟踪的所有包含過濾器。 |
IAbi | getAbi () |
getExcludeFilters () 返回排除過濾器的當前 | |
getIncludeFilters () 返回包含過濾器的當前 | |
void | run ( TestInformation testInfo, ITestInvocationListener listener) 運行測試,並將結果報告給偵聽器。 |
void | setAbi ( IAbi abi) |
void | setCollectTestsOnly (boolean shouldCollectTest) 啟用或禁用測試收集模式 |
受保護的方法 | |
---|---|
checkExitCode (Integer exitCode) 檢查測試命令返回的退出代碼。 | |
checkTestOutput ( TestInformation testInfo, String actualOutputText, String outputShortName, String outputPrettyName) 檢查測試命令產生的輸出。 | |
File | createTestLocalTempDirectory ( TestInformation testInfo) 在測試的依賴項文件夾中創建一個本地臨時目錄,以收集從被測設備中提取的測試輸出。 |
executeCheckerTest ( TestInformation testInfo, ITestInvocationListener listener) 執行 Checker 測試並檢查其輸出。 | |
void | extractSourcesFromJar (File tmpCheckerLocalDir, File jar) 從給定的 jar 文件中提取 src 目錄到給定的目錄。 |
File | getCheckerBinaryPath ( TestInformation testInfo) 找到 Checker 二進製文件(Python 存檔)。 |
runChecker (String[] checkerCommandLine) 運行 Checker 命令並檢查其結果。 |
領域
CHECKER_PAR_FILENAME
public static final String CHECKER_PAR_FILENAME
公共構造函數
ArtRun測試
public ArtRunTest ()
公共方法
添加排除過濾器
public void addExcludeFilter (String filter)
添加要排除哪些測試的過濾器。
參數 | |
---|---|
filter | String |
添加包含過濾器
public void addIncludeFilter (String filter)
添加要包含哪些測試的過濾器。
參數 | |
---|---|
filter | String |
清除排除過濾器
public void clearExcludeFilters ()
刪除當前跟踪的所有排除過濾器。
清除包含過濾器
public void clearIncludeFilters ()
刪除當前跟踪的所有包含過濾器。
跑步
public void run (TestInformation testInfo, ITestInvocationListener listener)
運行測試,並將結果報告給偵聽器。
參數 | |
---|---|
testInfo | TestInformation :包含運行測試的有用信息的TestInformation 對象。 |
listener | ITestInvocationListener : 測試結果的ITestInvocationListener |
投擲 | |
---|---|
DeviceNotAvailableException |
setCollectTestsOnly
public void setCollectTestsOnly (boolean shouldCollectTest)
啟用或禁用測試收集模式
受保護的方法
檢查出口代碼
protectedcheckExitCode (Integer exitCode)
檢查測試命令返回的退出代碼。
參數 | |
---|---|
exitCode | Integer : 測試命令返回的退出碼 |
退貨 | |
---|---|
可選的錯誤消息,如果測試退出代碼指示成功則為空 |
檢查測試輸出
protectedcheckTestOutput (TestInformation testInfo, String actualOutputText, String outputShortName, String outputPrettyName)
檢查測試命令產生的輸出。
用於檢查測試的標準輸出和標準錯誤。
參數 | |
---|---|
testInfo | TestInformation :與執行的測試關聯的TestInformation 對象 |
actualOutputText | String :測試產生的輸出 |
outputShortName | String : 輸出通道的簡稱 |
outputPrettyName | String :輸出通道的更漂亮的名稱,用於錯誤消息 |
退貨 | |
---|---|
可選的錯誤消息,如果檢查的輸出有效則為空 |
創建測試本地臨時目錄
protected File createTestLocalTempDirectory (TestInformation testInfo)
在測試的依賴項文件夾中創建一個本地臨時目錄,以收集從被測設備中提取的測試輸出。
參數 | |
---|---|
testInfo | TestInformation :與執行的測試關聯的TestInformation 對象 |
退貨 | |
---|---|
File | 指向創建的臨時目錄的ERROR(/File) 對象。 |
投擲 | |
---|---|
| 如果創建臨時目錄失敗。 |
執行檢查器測試
protectedexecuteCheckerTest (TestInformation testInfo, ITestInvocationListener listener)
執行 Checker 測試並檢查其輸出。
Checker 測試是一些 ART 運行測試中包含的附加測試,在測試源文件的註釋中作為註釋編寫,用於驗證 ART 的編譯器。
參數 | |
---|---|
testInfo | TestInformation :與執行的測試關聯的TestInformation 對象 |
listener | ITestInvocationListener :與執行的測試關聯的ITestInvocationListener 對象 |
退貨 | |
---|---|
可選的錯誤消息,如果 Checker 測試成功則為空 |
投擲 | |
---|---|
ArtRunTest.AdbShellCommandException | |
DeviceNotAvailableException |
extractSourcesFromJar 文件
protected void extractSourcesFromJar (File tmpCheckerLocalDir, File jar)
從給定的 jar 文件中提取 src 目錄到給定的目錄。
參數 | |
---|---|
tmpCheckerLocalDir | File |
jar | File |
getCheckerBinaryPath
protected File getCheckerBinaryPath (TestInformation testInfo)
找到 Checker 二進製文件(Python 存檔)。
參數 | |
---|---|
testInfo | TestInformation |
退貨 | |
---|---|
File |
運行檢查器
protectedrunChecker (String[] checkerCommandLine)
運行 Checker 命令並檢查其結果。
參數 | |
---|---|
checkerCommandLine | String :要執行的 Checker 命令行 |
退貨 | |
---|---|
可選的錯誤消息,如果 Checker 調用成功則為空 |
這個頁面中的內容和程式碼範例均受《內容授權》中的授權所規範。Java 與 OpenJDK 是 Oracle 和/或其關係企業的商標或註冊商標。
上次更新時間:2023-03-30 (世界標準時間)。