ProtoResultParser

public class ProtoResultParser
extends Object

java.lang.Object
   ↳ com.android.tradefed.result.proto.ProtoResultParser


Parser for the Tradefed results proto format.

Summary

Public constructors

ProtoResultParser(ITestInvocationListener listener, IInvocationContext context, boolean reportInvocation)

Ctor.

ProtoResultParser(ITestInvocationListener listener, IInvocationContext context, boolean reportInvocation, String prefixForFile)

Ctor.

Public methods

void completeModuleEvents()

If needed to ensure consistent reporting, complete the events of the module, run and methods.

String getModuleInProgress()

Returns the id of the module in progress.

boolean hasInvocationFailed()

Returns whether or not the invocation failed has been reported.

boolean invocationEndedReached()

Returns whether or not the parsing reached an invocation ended.

void processFileProto(File protoFile)

In case of parsing proto files directly, handle direct parsing of them as a sequence.

void processFinalizedProto(TestRecordProto.TestRecord finalProto)

Main entry function that takes the finalized completed proto and replay its results.

ProtoResultParser.TestLevel processNewProto(TestRecordProto.TestRecord currentProto)

Main entry function where each proto is presented to get parsed into Tradefed events.

boolean setMergeInvocationContext(boolean enabled)

Enable or disable merging the serialized invocation context with the main context that this object is initialized with.

void setQuiet(boolean quiet)

Sets whether or not to print when events are received.

void setReportLogs(boolean reportLogs)

Sets whether or not we should report the logs.

void setSkipParsingAccounting(boolean skip)

Public constructors

ProtoResultParser

public ProtoResultParser (ITestInvocationListener listener, 
                IInvocationContext context, 
                boolean reportInvocation)

Ctor.

Parameters
listener ITestInvocationListener

context IInvocationContext

reportInvocation boolean

ProtoResultParser

public ProtoResultParser (ITestInvocationListener listener, 
                IInvocationContext context, 
                boolean reportInvocation, 
                String prefixForFile)

Ctor.

Parameters
listener ITestInvocationListener

context IInvocationContext

reportInvocation boolean

prefixForFile String

Public methods

completeModuleEvents

public void completeModuleEvents ()

If needed to ensure consistent reporting, complete the events of the module, run and methods.

getModuleInProgress

public String getModuleInProgress ()

Returns the id of the module in progress. Returns null if none in progress.

Returns
String

hasInvocationFailed

public boolean hasInvocationFailed ()

Returns whether or not the invocation failed has been reported.

Returns
boolean

invocationEndedReached

public boolean invocationEndedReached ()

Returns whether or not the parsing reached an invocation ended.

Returns
boolean

processFileProto

public void processFileProto (File protoFile)

In case of parsing proto files directly, handle direct parsing of them as a sequence. Associated with FileProtoResultReporter when reporting a sequence of files.

Parameters
protoFile File: The proto file to be parsed.

Throws
IOException

processFinalizedProto

public void processFinalizedProto (TestRecordProto.TestRecord finalProto)

Main entry function that takes the finalized completed proto and replay its results.

Parameters
finalProto TestRecordProto.TestRecord: The final TestRecord to be parsed.

processNewProto

public ProtoResultParser.TestLevel processNewProto (TestRecordProto.TestRecord currentProto)

Main entry function where each proto is presented to get parsed into Tradefed events.

Parameters
currentProto TestRecordProto.TestRecord: The current TestRecord to be parsed.

Returns
ProtoResultParser.TestLevel True if the proto processed was a module.

setMergeInvocationContext

public boolean setMergeInvocationContext (boolean enabled)

Enable or disable merging the serialized invocation context with the main context that this object is initialized with.

Note that disabling invocation-level reporting via the reportInvocation constructor parameter still merges context information and requires explicitly using this method to disable the behavior.

TODO(b/288001953): Revisit the proper API for accomplishing this.

Parameters
enabled boolean

Returns
boolean the previous state

setQuiet

public void setQuiet (boolean quiet)

Sets whether or not to print when events are received.

Parameters
quiet boolean

setReportLogs

public void setReportLogs (boolean reportLogs)

Sets whether or not we should report the logs.

Parameters
reportLogs boolean

setSkipParsingAccounting

public void setSkipParsingAccounting (boolean skip)

Parameters
skip boolean