ArtRunTest

public class ArtRunTest
extends Object implements IAbiReceiver, IConfigurationReceiver, IRemoteTest, ITestCollector, ITestFilterReceiver

java.lang.Object
   ↳ com.android.tradefed.testtype.ArtRunTest


執行 ART 執行階段測試的測試執行工具。

摘要

巢狀類別

class ArtRunTest.AdbShellCommandException

這個例外狀況類別會回報執行 ADB Shell 指令時發生的錯誤。 

常數

String CHECKER_PAR_FILENAME

欄位

public static final Boolean RUN_CHECKER

公用建構函式

ArtRunTest()

公用方法

void addAllExcludeFilters(Set<String> filters)

新增要排除的測試篩選器 Set

void addAllIncludeFilters(Set<String> filters)

新增要納入測試的篩選器 Set

void addExcludeFilter(String filter)

新增要排除的測試篩選器。

void addIncludeFilter(String filter)

新增要納入的測試篩選器。

void clearExcludeFilters()

刪除目前追蹤的所有排除篩選器。

void clearIncludeFilters()

刪除目前追蹤的所有納入篩選器。

IAbi getAbi()
Set<String> getExcludeFilters()

傳回排除篩選器的目前 Set

Set<String> getIncludeFilters()

傳回包含篩選器的目前 Set

void run(TestInformation testInfo, ITestInvocationListener listener)

Runs the tests, and reports result to the listener.

void setAbi(IAbi abi)

void setCollectTestsOnly(boolean shouldCollectTest)

啟用或停用測試收集模式

void setConfiguration(IConfiguration configuration)

注入使用的 IConfiguration

受保護的方法

Optional<String> checkExitCode(Integer exitCode)

檢查測試指令傳回的結束程式碼。

Optional<String> checkTestOutput(TestInformation testInfo, String actualOutputText, String outputShortName, String outputPrettyName)

檢查測試指令產生的輸出內容。

File createTestLocalTempDirectory(TestInformation testInfo)

在測試的依附元件資料夾中建立本機暫時目錄,收集從受測裝置擷取的測試輸出內容。

Optional<String> executeCheckerTest(TestInformation testInfo, ITestInvocationListener listener)

執行 Checker 測試並檢查輸出內容。

void extractSourcesFromJar(File tmpCheckerLocalDir, File jar)

將指定 jar 檔案中的 src 目錄解壓縮至指定目錄。

File getCheckerBinaryPath(TestInformation testInfo)

找出 Checker 二進位檔 (Python 封存檔)。

Optional<String> runChecker(String[] checkerCommandLine)

執行 Checker 指令並檢查結果。

常數

CHECKER_PAR_FILENAME

public static final String CHECKER_PAR_FILENAME

常數值: "art-run-test-checker"

欄位

RUN_CHECKER

public static final Boolean RUN_CHECKER

公用建構函式

ArtRunTest

public ArtRunTest ()

公用方法

addAllExcludeFilters

public void addAllExcludeFilters (Set<String> filters)

新增要排除的測試篩選器 Set

參數
filters Set

addAllIncludeFilters

public void addAllIncludeFilters (Set<String> filters)

新增要納入測試的篩選器Set

參數
filters Set

addExcludeFilter

public void addExcludeFilter (String filter)

新增要排除的測試篩選器。

參數
filter String

addIncludeFilter

public void addIncludeFilter (String filter)

新增要納入的測試篩選條件。

參數
filter String

clearExcludeFilters

public void clearExcludeFilters ()

刪除目前追蹤的所有排除篩選器。

clearIncludeFilters

public void clearIncludeFilters ()

刪除目前追蹤的所有包含篩選器。

getAbi

public IAbi getAbi ()

傳回
IAbi

getExcludeFilters

public Set<String> getExcludeFilters ()

傳回排除篩選器的目前 Set

傳回
Set<String>

getIncludeFilters

public Set<String> getIncludeFilters ()

傳回包含篩選器的目前 Set

傳回
Set<String>

得分

public void run (TestInformation testInfo, 
                ITestInvocationListener listener)

執行測試,並向接聽程式回報結果。

參數
testInfo TestInformation:包含執行測試實用資訊的 TestInformation 物件。

listener ITestInvocationListener:測試結果的 ITestInvocationListener

擲回
DeviceNotAvailableException

setAbi

public void setAbi (IAbi abi)

參數
abi IAbi

setCollectTestsOnly

public void setCollectTestsOnly (boolean shouldCollectTest)

啟用或停用測試收集模式

setConfiguration

public void setConfiguration (IConfiguration configuration)

注入使用的 IConfiguration

參數
configuration IConfiguration

受保護的方法

checkExitCode

protected Optional<String> checkExitCode (Integer exitCode)

檢查測試指令傳回的結束程式碼。

參數
exitCode Integer:測試指令傳回的結束代碼

傳回
Optional<String> 選用錯誤訊息,如果測試結束代碼表示成功,則為空白

checkTestOutput

protected Optional<String> checkTestOutput (TestInformation testInfo, 
                String actualOutputText, 
                String outputShortName, 
                String outputPrettyName)

檢查測試指令產生的輸出內容。

用於檢查測試的標準輸出和標準錯誤。

參數
testInfo TestInformation:與執行的測試相關聯的 TestInformation 物件

actualOutputText String:測試產生的輸出內容

outputShortName String:輸出管道的簡稱

outputPrettyName String:輸出管道的名稱,用於錯誤訊息中

傳回
Optional<String> 選用錯誤訊息,如果檢查的輸出內容有效,則為空白

createTestLocalTempDirectory

protected File createTestLocalTempDirectory (TestInformation testInfo)

在測試的依附元件資料夾中建立本機暫時目錄,收集從受測裝置擷取的測試輸出內容。

參數
testInfo TestInformation:與執行的測試相關聯的 TestInformation 物件

傳回
File 指向所建立臨時目錄的 File 物件。

擲回
IOException 如果無法建立臨時目錄。

executeCheckerTest

protected Optional<String> executeCheckerTest (TestInformation testInfo, 
                ITestInvocationListener listener)

執行 Checker 測試並檢查輸出內容。

檢查程式測試是某些 ART 執行測試中包含的額外測試,以註解形式寫入測試來源檔案的註解中,用於驗證 ART 的編譯器。

參數
testInfo TestInformation:與執行的測試相關聯的 TestInformation 物件

listener ITestInvocationListener:與執行的測試相關聯的 ITestInvocationListener 物件

傳回
Optional<String> 選用錯誤訊息,如果檢查程式測試成功,則為空白

擲回
ArtRunTest.AdbShellCommandException
DeviceNotAvailableException
IOException

extractSourcesFromJar

protected void extractSourcesFromJar (File tmpCheckerLocalDir, 
                File jar)

將指定 jar 檔案中的 src 目錄解壓縮至指定目錄。

參數
tmpCheckerLocalDir File

jar File

擲回
IOException

getCheckerBinaryPath

protected File getCheckerBinaryPath (TestInformation testInfo)

找出 Checker 二進位檔 (Python 封存檔)。

參數
testInfo TestInformation

傳回
File

runChecker

protected Optional<String> runChecker (String[] checkerCommandLine)

執行 Checker 指令並檢查結果。

參數
checkerCommandLine String:要執行的 Checker 指令列

傳回
Optional<String> 選用錯誤訊息,如果 Checker 呼叫成功,則為空白