Google is committed to advancing racial equity for Black communities. See how.

SubprocessTestResultsParser

public class SubprocessTestResultsParser
extends Object

java.lang.Object
   ↳ com.android.tradefed.util.SubprocessTestResultsParser


Extends ERROR(/FileOutputStream) to parse the output before writing to the file so we can generate the test events on the launcher side.

Summary

Nested classes

class SubprocessTestResultsParser.StatusKeys

Relevant test status keys. 

Public constructors

SubprocessTestResultsParser(ITestInvocationListener listener, boolean streaming, IInvocationContext context)

Constructor for the result parser

SubprocessTestResultsParser(ITestInvocationListener listener, IInvocationContext context)

Constructor for the result parser

Public methods

void close()
TestDescription getCurrentTest()

Returns the test that is currently in progress.

int getSocketServerPort()

Returns the socket receiver that was open.

Long getStartTime()

Returns the start time associated with the invocation start event from the subprocess invocation.

boolean joinReceiver(long millis, boolean waitForConnection)

Wait for the event receiver to finish processing events.

boolean joinReceiver(long millis)

Wait for the event receiver to finish processing events.

void parseFile(File file)
void processNewLines(String[] lines)

call parse on each line of the array to extract the events if any.

boolean reportedInvocationFailed()

Returns whether or not an invocation failed was reported.

void setIgnoreTestLog(boolean ignoreTestLog)

Whether or not to ignore testLog events and only rely on logAssociation.

Public constructors

SubprocessTestResultsParser

public SubprocessTestResultsParser (ITestInvocationListener listener, 
                boolean streaming, 
                IInvocationContext context)

Constructor for the result parser

Parameters
listener ITestInvocationListener: ITestInvocationListener where to report the results

streaming boolean: if True, a socket receiver will be open to receive results.

context IInvocationContext: a IInvocationContext information about the invocation

SubprocessTestResultsParser

public SubprocessTestResultsParser (ITestInvocationListener listener, 
                IInvocationContext context)

Constructor for the result parser

Parameters
listener ITestInvocationListener: ITestInvocationListener where to report the results

context IInvocationContext: a IInvocationContext information about the invocation

Public methods

close

public void close ()

getCurrentTest

public TestDescription getCurrentTest ()

Returns the test that is currently in progress.

Returns
TestDescription

getSocketServerPort

public int getSocketServerPort ()

Returns the socket receiver that was open. -1 if none.

Returns
int

getStartTime

public Long getStartTime ()

Returns the start time associated with the invocation start event from the subprocess invocation.

Returns
Long

joinReceiver

public boolean joinReceiver (long millis, 
                boolean waitForConnection)

Wait for the event receiver to finish processing events.

Parameters
millis long: timeout in milliseconds.

waitForConnection boolean: False to skip waiting if a connection was never established.

Returns
boolean True if receiver thread terminate before timeout, False otherwise.

joinReceiver

public boolean joinReceiver (long millis)

Wait for the event receiver to finish processing events. Will wait even if a connection wasn't established, i.e. processing hasn't begun yet.

Parameters
millis long: timeout in milliseconds.

Returns
boolean True if receiver thread terminate before timeout, False otherwise.

parseFile

public void parseFile (File file)

Parameters
file File

processNewLines

public void processNewLines (String[] lines)

call parse on each line of the array to extract the events if any.

Parameters
lines String

reportedInvocationFailed

public boolean reportedInvocationFailed ()

Returns whether or not an invocation failed was reported.

Returns
boolean

setIgnoreTestLog

public void setIgnoreTestLog (boolean ignoreTestLog)

Whether or not to ignore testLog events and only rely on logAssociation.

Parameters
ignoreTestLog boolean