LogSaverResultForwarder

public class LogSaverResultForwarder
extends ResultForwarder

java.lang.Object
   ↳ com.android.tradefed.result.ResultForwarder
     ↳ com.android.tradefed.result.LogSaverResultForwarder
Known Direct Subclasses
ShardMasterResultForwarder A ResultForwarder that combines the results of a sharded test invocations. 


A ResultForwarder for saving logs with the global file saver.

Summary

Fields

ILogSaver mLogSaver

Public constructors

LogSaverResultForwarder(ILogSaver logSaver, List<ITestInvocationListener> listeners)

Public methods

void invocationEnded(long elapsedTime)

Reports that the invocation has terminated, whether successfully or due to some error condition.

void invocationStarted(IInvocationContext context)

Reports the start of the test invocation.

void testLog(String dataName, LogDataType dataType, InputStreamSource dataStream)

Provides the associated log or debug data from the test invocation.

Also, save the log file with the global ILogSaver and call testLogSaved(String, LogDataType, InputStreamSource, LogFile) for those listeners implementing the ILogSaverListener interface.

Fields

mLogSaver

ILogSaver mLogSaver

Public constructors

LogSaverResultForwarder

LogSaverResultForwarder (ILogSaver logSaver, 
                List<ITestInvocationListener> listeners)

Parameters
logSaver ILogSaver
listeners List

Public methods

invocationEnded

void invocationEnded (long elapsedTime)

Reports that the invocation has terminated, whether successfully or due to some error condition.

Will be automatically called by the TradeFederation framework.

Parameters
elapsedTime long: the elapsed time of the invocation in ms

invocationStarted

void invocationStarted (IInvocationContext context)

Reports the start of the test invocation.

Will be automatically called by the TradeFederation framework. Reporters need to override this method to support multiple devices reporting.

Parameters
context IInvocationContext: information about the invocation

testLog

void testLog (String dataName, 
                LogDataType dataType, 
                InputStreamSource dataStream)

Provides the associated log or debug data from the test invocation.

Must be called before invocationFailed(Throwable) or invocationEnded(long)

The TradeFederation framework will automatically call this method, providing the host log and if applicable, the device logcat.

Also, save the log file with the global ILogSaver and call testLogSaved(String, LogDataType, InputStreamSource, LogFile) for those listeners implementing the ILogSaverListener interface.

Parameters
dataName String: a String descriptive name of the data. e.g. "device_logcat". Note dataName may not be unique per invocation. ie implementers must be able to handle multiple calls with same dataName
dataType LogDataType: the LogDataType of the data
dataStream InputStreamSource: the InputStreamSource of the data. Implementers should call createInputStream to start reading the data, and ensure to close the resulting InputStream when complete. Callers should ensure the source of the data remains present and accessible until the testLog method completes.