GTest

public class GTest
extends GTestBase implements IDeviceTest

java.lang.Object
   ↳ com.android.tradefed.testtype.GTestBase
     ↳ com.android.tradefed.testtype.GTest


指定のデバイスでネイティブ テスト パッケージを実行するテスト。

概要

パブリック コンストラクタ

GTest()

パブリック メソッド

ITestDevice getDevice()

テスト対象デバイスを入手します。

boolean isRebootBeforeTestEnabled()
void run(TestInformation testInfo, ITestInvocationListener listener)

void setDevice(ITestDevice device)

テスト対象デバイスを挿入します。

void setNativeTestDevicePath(String path)

保護されたメソッド

String createFlagFile(String filter)

--gtest_flagfile で使用されるフィルタを含むファイルを作成して、引数のサイズに関する OS の制限を回避します。

void executeCommandByScript(ITestDevice testDevice, String cmd, IShellOutputReceiver resultParser)

コマンドが長すぎて adb で直接実行できない場合に、一時スクリプトから gtest コマンドを実行するヘルパー メソッド。

String getGTestCmdLine(String fullPath, String flags)

実行する gtest コマンドをビルドするヘルパー メソッド。

String loadFilter(String binaryOnDevice)

フィルタ取得メソッドを定義します。

boolean shouldRunFile(String fullPath)

特定のファイルを実行する必要があるかどうかを判断するヘルパー メソッド。

パブリック コンストラクタ

GTest

public GTest ()

パブリック メソッド

getDevice

public ITestDevice getDevice ()

テスト対象デバイスを入手します。

戻り値
ITestDevice ITestDevice

isRebootBeforeTestEnabled

public boolean isRebootBeforeTestEnabled ()

戻り値
boolean

ホームラン

public void run (TestInformation testInfo, 
                ITestInvocationListener listener)

パラメータ
testInfo TestInformation

listener ITestInvocationListener

例外
DeviceNotAvailableException

setDevice

public void setDevice (ITestDevice device)

テスト対象デバイスを挿入します。

パラメータ
device ITestDevice: 使用する ITestDevice

setNativeTestDevicePath

public void setNativeTestDevicePath (String path)

パラメータ
path String

保護されたメソッド

createFlagFile

protected String createFlagFile (String filter)

--gtest_flagfile で使用されるフィルタを含むファイルを作成して、引数のサイズに関する OS の制限を回避します。

パラメータ
filter String: フィルタ文字列

戻り値
String フィルタを含むファイルのパス。

例外
DeviceNotAvailableException

executeCommandByScript

protected void executeCommandByScript (ITestDevice testDevice, 
                String cmd, 
                IShellOutputReceiver resultParser)

コマンドが長すぎて adb で直接実行できない場合に、一時スクリプトから gtest コマンドを実行するヘルパー メソッド。

パラメータ
testDevice ITestDevice: コマンドを実行するデバイス

cmd String: 実行するコマンド文字列

resultParser IShellOutputReceiver: テスト結果を読み取る出力レシーバ

例外
DeviceNotAvailableException

getGTestCmdLine

protected String getGTestCmdLine (String fullPath, 
                String flags)

実行する gtest コマンドをビルドするヘルパー メソッド。

パラメータ
fullPath String: デバイス上の gtest バイナリへの絶対ファイル システム パス

flags String: gtest 実行フラグ

戻り値
String gtest 用に実行するシェルコマンドライン

loadFilter

protected String loadFilter (String binaryOnDevice)

取得フィルタ メソッドを定義します。

サブクラスは、独自のフィルタを取得する方法を実装する必要があります。

パラメータ
binaryOnDevice String: フィルタ ファイルのフルパス。

戻り値
String フィルタ文字列。

例外
DeviceNotAvailableException

shouldRunFile

protected boolean shouldRunFile (String fullPath)

特定のファイルを実行するかどうかを判断するヘルパー メソッド。

パラメータ
fullPath String: 問題のファイルのフルパス

戻り値
boolean 該当するファイルを実行する場合は true。