InvocationExecution

public class InvocationExecution
extends Object implements IInvocationExecution

java.lang.Object
   ↳ com.android.tradefed.invoker.InvocationExecution


המחלקות שמתארות את כל שלבי ההפעלה: הורדת build, הכנת היעד, הרצת בדיקות וניקוי. אפשר להרחיב את ההגדרה כדי לשנות את התנהגות ברירת המחדל של חלק מהשלבים. סדר השלבים נקבע על ידי TestInvocation.

סיכום

ערכים קבועים

String ADB_VERSION_KEY

String JAVA_CLASSPATH_KEY

String JAVA_VERSION_KEY

‫Constructors ציבוריים

InvocationExecution()

‫methods ציבוריים

void cleanUpBuilds(IInvocationContext context, IConfiguration config)

מריצים את שלב הניקוי build_provider.

void doCleanUp(IInvocationContext context, IConfiguration config, Throwable exception)

מבצעים את שלב הניקוי של target_preparer ו-multi_target_preparer.

void doSetup(TestInformation testInfo, IConfiguration config, ITestLogger listener)

מריצים את שלב ההגדרה של target_preparer ו-multi_target_preparer.

void doTeardown(TestInformation testInfo, IConfiguration config, ITestLogger logger, Throwable exception)

מבצעים את שלב הניקוי של target_preparer ו-multi_target_preparer.

boolean fetchBuild(TestInformation testInfo, IConfiguration config, IRescheduler rescheduler, ITestInvocationListener listener)

מריצים את השלב build_provider של הקריאה.

void reportLogs(ITestDevice device, ITestLogger listener, TestInvocation.Stage stage)

לדווח על חלק מיומני המכשיר בשלב אחר של ההפעלה.

void runDevicePostInvocationTearDown(IInvocationContext context, IConfiguration config, Throwable exception)

מפעילים את ITestDevice.postInvocationTearDown(Throwable) לכל מכשיר שכלול בהפעלה.

void runDevicePreInvocationSetup(IInvocationContext context, IConfiguration config, ITestLogger logger)

מפעילים את ERROR(ITestDevice.preInvocationSetup(IBuildInfo)/com.android.tradefed.device.ITestDevice#preInvocationSetup(com.android.tradefed.build.IBuildInfo) ITestDevice.preInvocationSetup(IBuildInfo)) לכל מכשיר שכלול בהפעלה.

void runTests(TestInformation info, IConfiguration config, ITestInvocationListener listener)

מריצים את הבדיקה.

boolean shardConfig(IConfiguration config, TestInformation testInfo, IRescheduler rescheduler, ITestLogger logger)

מנסים לפצל את ההגדרה להגדרות משנה, כדי לתזמן מחדש את ההרצה בכמה משאבים במקביל.

שיטות מוגנות

void collectAutoInfo(IConfiguration config, TestInformation info)

איסוף אוטומטי של מידע מסוים במכשיר הראשי שנבדק.

IShardHelper createShardHelper()

יוצר את IShardHelper שבו רוצים להשתמש ומחזיר אותו.

void customizeDevicePreInvocation(IConfiguration config, IInvocationContext context)

אפשרות להתאים אישית חלק מהמכשיר לפני preInvocationSetup.

String getAdbVersion()

הפונקציה מחזירה את גרסת ה-adb שנמצאת בשימוש עבור הקריאה.

List<ITargetPreparer> getLabPreparersToRun(IConfiguration config, String deviceName)

אחזור רשימה של מכיני מעבדה להפעלה במכשיר הזה.

List<ITargetPreparer> getTargetPreparersToRun(IConfiguration config, String deviceName)

אחזור רשימה של מכיני יעדים להפעלה במכשיר הזה.

void linkExternalDirs(IBuildInfo info, TestInformation testInfo)
void logHostAdb(IConfiguration config, ITestLogger logger)

אוספים את היומנים מ-$TMPDIR/adb.$UID.log.

Throwable runPreparersTearDown(TestInformation testInfo, ITestDevice device, String deviceName, int deviceIndex, ITestLogger logger, Throwable exception, List<ITargetPreparer> preparersToRun, Map<String, Set<ITargetPreparer>> trackPreparersMap)
void setTestTag(IBuildInfo info, IConfiguration config)

הגדרת תג הבדיקה בפרטי הגרסה.

ערכים קבועים

ADB_VERSION_KEY

public static final String ADB_VERSION_KEY

ערך קבוע: "adb_version"

JAVA_CLASSPATH_KEY

public static final String JAVA_CLASSPATH_KEY

ערך קבוע: "java_classpath"

JAVA_VERSION_KEY

public static final String JAVA_VERSION_KEY

ערך קבוע: "java_version"

‫constructors ציבוריים

InvocationExecution

public InvocationExecution ()

‫methods ציבוריים

cleanUpBuilds

public void cleanUpBuilds (IInvocationContext context, 
                IConfiguration config)

מריצים את שלב הניקוי build_provider. משויך לאחזור של הגרסה.

פרמטרים
context ‫IInvocationContext: ה-IInvocationContext של ההפעלה.

config ‫IConfiguration: IConfiguration של הרצת הבדיקה הזו.

doCleanUp

public void doCleanUp (IInvocationContext context, 
                IConfiguration config, 
                Throwable exception)

מבצעים את שלב הניקוי של target_preparer ו-multi_target_preparer. המכשירים מנקים את עצמם.

פרמטרים
context ‫IInvocationContext: ה-IInvocationContext של ההפעלה.

config ‫IConfiguration: IConfiguration של הרצת הבדיקה הזו.

exception ‫Throwable: החריגה המקורית שהופעלה על ידי הרצת הבדיקה.

doSetup

public void doSetup (TestInformation testInfo, 
                IConfiguration config, 
                ITestLogger listener)

מריצים את שלב ההגדרה של target_preparer ו-multi_target_preparer. מגדיר את כל המכשירים שנדרשים להרצת הבדיקה.

פרמטרים
testInfo ‫TestInformation: ה-TestInformation של ההפעלה.

config ‫IConfiguration: IConfiguration של הרצת הבדיקה הזו.

listener ‫ITestLogger: ITestLogger כדי לדווח על יומני כשל בהגדרה.

הקפצת הודעות שגיאה (throw)
BuildError
DeviceNotAvailableException
TargetSetupError

doTeardown

public void doTeardown (TestInformation testInfo, 
                IConfiguration config, 
                ITestLogger logger, 
                Throwable exception)

מבצעים את שלב הניקוי של target_preparer ו-multi_target_preparer. האם המכשירים מפורקים ומשויכים להגדרה.

פרמטרים
testInfo ‫TestInformation: ה-TestInformation של ההפעלה.

config ‫IConfiguration: IConfiguration של הרצת הבדיקה הזו.

logger ‫ITestLogger: ITestLogger לדיווח על יומנים.

exception ‫Throwable: החריגה המקורית שהופעלה על ידי הרצת הבדיקה.

הקפצת הודעות שגיאה (throw)
Throwable

fetchBuild

public boolean fetchBuild (TestInformation testInfo, 
                IConfiguration config, 
                IRescheduler rescheduler, 
                ITestInvocationListener listener)

מריצים את השלב build_provider של הקריאה.

פרמטרים
testInfo ‫TestInformation: ה-TestInformation של ההפעלה.

config ‫IConfiguration: IConfiguration של הרצת הבדיקה הזו.

rescheduler ‫IRescheduler: IRescheduler, לתזמון מחדש של חלקים מההפעלה לביצוע במשאבים אחרים

listener ‫ITestInvocationListener: ITestInvocation לדיווח על כשלים בהורדת גרסת Build.

החזרות
boolean ‫True אם הורדנו את הגרסה בהצלחה, אחרת False.

הקפצת הודעות שגיאה (throw)
BuildRetrievalError
DeviceNotAvailableException

reportLogs

public void reportLogs (ITestDevice device, 
                ITestLogger listener, 
                TestInvocation.Stage stage)

לדווח על חלק מיומני המכשיר בשלב אחר של ההפעלה. לדוגמה: logcat.

פרמטרים
device ‫ITestDevice: המכשיר שממנו ידווחו היומנים.

listener ‫ITestLogger: כלי הרישום של היומנים.

stage ‫TestInvocation.Stage: השלב של הקריאה שאנחנו נמצאים בו.

runDevicePostInvocationTearDown

public void runDevicePostInvocationTearDown (IInvocationContext context, 
                IConfiguration config, 
                Throwable exception)

מפעילים את ITestDevice.postInvocationTearDown(Throwable) לכל מכשיר שכלול בהפעלה.

פרמטרים
context ‫IInvocationContext: ה-IInvocationContext של ההפעלה.

config ‫IConfiguration: IConfiguration של הרצת הבדיקה הזו.

exception ‫Throwable: החריגה המקורית שהופעלה על ידי הבדיקה, אם יש כזו.

runDevicePreInvocationSetup

public void runDevicePreInvocationSetup (IInvocationContext context, 
                IConfiguration config, 
                ITestLogger logger)

מפעילים את ERROR(ITestDevice.preInvocationSetup(IBuildInfo)/com.android.tradefed.device.ITestDevice#preInvocationSetup(com.android.tradefed.build.IBuildInfo) ITestDevice.preInvocationSetup(IBuildInfo)) לכל מכשיר שכלול בהפעלה.

פרמטרים
context ‫IInvocationContext: ה-IInvocationContext של ההפעלה.

config ‫IConfiguration: IConfiguration של הרצת הבדיקה הזו.

logger ‫ITestLogger: ITestLogger לדיווח על יומנים.

הקפצת הודעות שגיאה (throw)
DeviceNotAvailableException
TargetSetupError

runTests

public void runTests (TestInformation info, 
                IConfiguration config, 
                ITestInvocationListener listener)

מריצים את הבדיקה.

פרמטרים
info ‫TestInformation: TestInformation להרצת בדיקות.

config ‫IConfiguration: ה-IConfiguration שרוצים להריץ

listener ‫ITestInvocationListener: ITestInvocationListener תוצאות הבדיקה

הקפצת הודעות שגיאה (throw)
Throwable

shardConfig

public boolean shardConfig (IConfiguration config, 
                TestInformation testInfo, 
                IRescheduler rescheduler, 
                ITestLogger logger)

מנסים לפצל את ההגדרה להגדרות משנה, כדי לתזמן מחדש את ההרצה בכמה משאבים במקביל.

אם מספר הרסיסים גדול מ-1, המערכת פשוט תיצור הגדרות לכל רסיס על ידי הגדרת אינדקסים של רסיסים ותזמון מחדש שלהם. אם לא מוגדר מספר שברים,ברירת המחדל היא IShardHelper.shardConfig.

פרמטרים
config ‫IConfiguration: IConfiguration הנוכחי.

testInfo ‫TestInformation: TestInformation שמכיל את פרטי הבדיקות.

rescheduler ‫IRescheduler: IRescheduler.

logger ‫ITestLogger: ITestLogger שמשמש לרישום בקובץ יומן במהלך חלוקה למקטעים.

החזרות
boolean true אם הבדיקה פוצלה. אחרת, מחזירה את הערך false

שיטות מוגנות

collectAutoInfo

protected void collectAutoInfo (IConfiguration config, 
                TestInformation info)

איסוף אוטומטי של מידע מסוים במכשיר הראשי שנבדק.

פרמטרים
config IConfiguration

info TestInformation

הקפצת הודעות שגיאה (throw)
DeviceNotAvailableException

createShardHelper

protected IShardHelper createShardHelper ()

יוצר את IShardHelper שבו רוצים להשתמש ומחזיר אותו.

החזרות
IShardHelper

customizeDevicePreInvocation

protected void customizeDevicePreInvocation (IConfiguration config, 
                IInvocationContext context)

אפשרות להתאים אישית חלק מהמכשיר לפני preInvocationSetup.

פרמטרים
config ‫IConfiguration: ההגדרה של הקריאה.

context ‫IInvocationContext: ההקשר הנוכחי של הקריאה.

getAdbVersion

protected String getAdbVersion ()

הפונקציה מחזירה את גרסת ה-adb שנמצאת בשימוש עבור הקריאה.

החזרות
String

getLabPreparersToRun

protected List<ITargetPreparer> getLabPreparersToRun (IConfiguration config, 
                String deviceName)

אחזור רשימה של מכיני מעבדה להפעלה במכשיר הזה.

מוחלף בכיתות של ארגז חול כדי להגביל את ההרצה של קבצים להכנת שיעור Lab בתוך ארגז החול (sandbox) של הצאצא

פרמטרים
config IConfiguration

deviceName String

החזרות
List<ITargetPreparer>

getTargetPreparersToRun

protected List<ITargetPreparer> getTargetPreparersToRun (IConfiguration config, 
                String deviceName)

אחזור רשימה של מכיני יעדים להפעלה במכשיר הזה.

מוחלף בכיתות של ארגז חול כדי להגביל את ההרצה של קבצים להכנת שיעור Lab בתוך ארגז החול (sandbox) של הצאצא

פרמטרים
config IConfiguration

deviceName String

החזרות
List<ITargetPreparer>

linkExternalDirs

protected void linkExternalDirs (IBuildInfo info, 
                TestInformation testInfo)

פרמטרים
info IBuildInfo

testInfo TestInformation

logHostAdb

protected void logHostAdb (IConfiguration config, 
                ITestLogger logger)

אוספים את היומנים מ-$TMPDIR/adb.$UID.log.

פרמטרים
config IConfiguration

logger ITestLogger

runPreparersTearDown

protected Throwable runPreparersTearDown (TestInformation testInfo, 
                ITestDevice device, 
                String deviceName, 
                int deviceIndex, 
                ITestLogger logger, 
                Throwable exception, 
                List<ITargetPreparer> preparersToRun, 
                Map<String, Set<ITargetPreparer>> trackPreparersMap)

פרמטרים
testInfo TestInformation

device ITestDevice

deviceName String

deviceIndex int

logger ITestLogger

exception Throwable

preparersToRun List

trackPreparersMap Map

החזרות
Throwable

setTestTag

protected void setTestTag (IBuildInfo info, 
                IConfiguration config)

הגדרת תג הבדיקה בפרטי הגרסה.

פרמטרים
info IBuildInfo

config IConfiguration