to top
public class

TestFilePushSetup

extends Object
implements ITargetPreparer @OptionClass(alias = "tests-zip-file")
java.lang.Object
   ↳ com.android.tradefed.targetprep.TestFilePushSetup

Class Overview

A ITargetPreparer that pushes one or more files/dirs from a getTestsDir() folder onto device.

This preparer will look in alternate directories if the tests zip does not exist or does not contain the required apk. The search will go in order from the last alternative dir specified to the first.

Summary

Fields
private AltDirBehavior mAltDirBehavior @Option(name = "alt-dir-behavior", description = "The order of alternate directory to be used when searching for files to push")
private List<File> mAltDirs @Option(name = "alt-dir", description = "Alternate directory to look for the apk if the apk is not in the tests zip file. For each alternate dir, will look in // and //DATA. Can be repeated. Look for apks in last alt-dir first.")
private Collection<String> mTestPaths @Option(name = "test-file-name", description = "the relative path of a test zip file/directory to install on device. Can be repeated.", importance = com.android.tradefed.config.Option.Importance.IF_UNSET)
private boolean mThrowIfNoFile @Option(name = "throw-if-not-found", description = "Throw exception if the specified file is not found.")
Public Constructors
TestFilePushSetup()
Public Methods
void setAltDir(File altDir)
Set an alternate directory.
void setAltDirBehavior(AltDirBehavior behavior)
Set the alternative directory search beahvior
void setUp(ITestDevice device, IBuildInfo buildInfo)
Perform the target setup for testing.
Protected Methods
File getLocalPathForFilename(IBuildInfo buildInfo, String fileName)
Resolve the host side path based on testing artifact information inside build info.
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.android.tradefed.targetprep.ITargetPreparer

Fields

private AltDirBehavior mAltDirBehavior

private List<File> mAltDirs

private Collection<String> mTestPaths

private boolean mThrowIfNoFile

Public Constructors

public TestFilePushSetup ()

Public Methods

public void setAltDir (File altDir)

Set an alternate directory.

Parameters
altDir File

public void setAltDirBehavior (AltDirBehavior behavior)

Set the alternative directory search beahvior

public void setUp (ITestDevice device, IBuildInfo buildInfo)

Perform the target setup for testing.

Parameters
device ITestDevice: the ITestDevice to prepare.
buildInfo IBuildInfo: data about the build under test.
Throws
TargetSetupError
BuildError
DeviceNotAvailableException

Protected Methods

protected File getLocalPathForFilename (IBuildInfo buildInfo, String fileName)

Resolve the host side path based on testing artifact information inside build info.

Parameters
buildInfo IBuildInfo: build artifact information
fileName String: filename of artifacts to push
Returns
File a File representing the physical file/path on host
Throws
TargetSetupError