Merge "Add configs for new unit tests available in Android Pi" into pi-dev
diff --git a/src/com/android/tradefed/build/ITestzipBuildInfo.java b/src/com/android/tradefed/build/ITestzipBuildInfo.java
new file mode 100644
index 0000000..779f9d5
--- /dev/null
+++ b/src/com/android/tradefed/build/ITestzipBuildInfo.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.tradefed.build;
+
+import java.io.File;
+
+/**
+ * * A {@link IBuildInfo} that represents an Android application and its test zip.
+ */
+public interface ITestzipBuildInfo extends IBuildInfo {
+
+ /**
+ * Get the local path to the extracted tests.zip file contents.
+ */
+ public File getTestzipDir();
+
+ /**
+ * Set local path to the extracted tests.zip file contents.
+ *
+ * @param testsZipFile
+ */
+ public void setTestzipDir(File testsZipFile, String version);
+
+ /**
+ * Get the extracted tests.zip version.
+ */
+ public String getTestzipDirVersion();
+}
diff --git a/src/com/android/tradefed/build/TestzipBuildInfo.java b/src/com/android/tradefed/build/TestzipBuildInfo.java
new file mode 100644
index 0000000..38e8711
--- /dev/null
+++ b/src/com/android/tradefed/build/TestzipBuildInfo.java
@@ -0,0 +1,88 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.tradefed.build;
+
+import java.io.File;
+import java.io.IOException;
+
+/**
+ * A {@link IBuildInfo} that represents an Android application and its test package(s).
+ */
+public class TestzipBuildInfo extends BuildInfo implements ITestzipBuildInfo {
+
+ private static final long serialVersionUID = BuildSerializedVersion.VERSION;
+ private static final String TESTDIR_IMAGE_NAME = "testsdir";
+
+ /**
+ * Creates a {@link TestzipBuildInfo}.
+ *
+ * @param buildId the unique build id
+ * @param buildName the build name
+ */
+ public TestzipBuildInfo(String buildId, String buildName) {
+ super(buildId, buildName);
+ }
+
+ /**
+ * @see BuildInfo#BuildInfo(BuildInfo)
+ */
+ public TestzipBuildInfo(BuildInfo buildToCopy) {
+ super(buildToCopy);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public File getTestzipDir() {
+ return getFile(TESTDIR_IMAGE_NAME);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String getTestzipDirVersion() {
+ return getVersion(TESTDIR_IMAGE_NAME);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void setTestzipDir(File testsDir, String version) {
+ setFile(TESTDIR_IMAGE_NAME, testsDir, version);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public IBuildInfo clone() {
+ AppBuildInfo copy = new AppBuildInfo(getBuildId(), getBuildTargetName());
+ copy.addAllBuildAttributes(this);
+ try {
+ copy.addAllFiles(this);
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ copy.setBuildBranch(getBuildBranch());
+ copy.setBuildFlavor(getBuildFlavor());
+
+ return copy;
+ }
+}
diff --git a/src/com/android/tradefed/build/TestzipDeviceBuildInfo.java b/src/com/android/tradefed/build/TestzipDeviceBuildInfo.java
new file mode 100644
index 0000000..7fbc047
--- /dev/null
+++ b/src/com/android/tradefed/build/TestzipDeviceBuildInfo.java
@@ -0,0 +1,316 @@
+/*
+ * Copyright (C) 2011 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.tradefed.build;
+
+import java.io.File;
+
+/**
+ * A {@link IDeviceBuildInfo} that also contains a {@link ITestzipBuildInfo}.
+ */
+public class TestzipDeviceBuildInfo extends BuildInfo implements IDeviceBuildInfo, ITestzipBuildInfo {
+
+ private static final long serialVersionUID = BuildSerializedVersion.VERSION;
+ private IDeviceBuildInfo mDeviceBuild;
+ private ITestzipBuildInfo mTestzipBuildInfo;
+
+
+ @Override
+ public File getTestzipDir() {
+ return mTestzipBuildInfo.getTestzipDir();
+ }
+
+ @Override
+ public void setTestzipDir(File testsZipFile, String version) {
+ mTestzipBuildInfo.setTestzipDir(testsZipFile, version);
+ }
+
+ @Override
+ public String getTestzipDirVersion() {
+ return mTestzipBuildInfo.getTestzipDirVersion();
+ }
+
+ /**
+ * @see DeviceBuildInfo#DeviceBuildInfo(String, String)
+ */
+ public TestzipDeviceBuildInfo(String buildId, String buildName) {
+ super(buildId, buildName);
+ }
+
+ /**
+ * @return the {@link IDeviceBuildInfo} for the device.
+ */
+ public IDeviceBuildInfo getDeviceBuildInfo() {
+ return mDeviceBuild;
+ }
+
+ /**
+ * @return the {@link IDeviceBuildInfo} for the device.
+ */
+ public void setTestzipBuild(ITestzipBuildInfo testzipBuild) {
+ mTestzipBuildInfo = testzipBuild;
+ }
+
+ /**
+ * @return the {@link ITestzipBuildInfo} for the application.
+ */
+ public ITestzipBuildInfo getTestzipBuildInfo() {
+ return mTestzipBuildInfo;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String getDeviceBuildId() {
+ return mDeviceBuild.getDeviceBuildId();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String getDeviceBuildFlavor() {
+ return mDeviceBuild.getDeviceBuildFlavor();
+ }
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public File getDeviceImageFile() {
+ return mDeviceBuild.getDeviceImageFile();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String getDeviceImageVersion() {
+ return mDeviceBuild.getDeviceImageVersion();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void setDeviceImageFile(File deviceImageFile, String version) {
+ mDeviceBuild.setDeviceImageFile(deviceImageFile, version);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public File getUserDataImageFile() {
+ return mDeviceBuild.getUserDataImageFile();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String getUserDataImageVersion() {
+ return mDeviceBuild.getUserDataImageVersion();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void setUserDataImageFile(File userDataFile, String version) {
+ mDeviceBuild.setUserDataImageFile(userDataFile, version);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public File getTestsDir() {
+ return mTestzipBuildInfo.getTestzipDir();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String getTestsDirVersion() {
+ return mTestzipBuildInfo.getTestzipDirVersion();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void setTestsDir(File testsDir, String version) {
+ mTestzipBuildInfo.setTestzipDir(testsDir, version);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public File getBasebandImageFile() {
+ return mDeviceBuild.getBasebandImageFile();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String getBasebandVersion() {
+ return mDeviceBuild.getBasebandVersion();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void setBasebandImage(File basebandFile, String version) {
+ mDeviceBuild.setBasebandImage(basebandFile, version);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public File getBootloaderImageFile() {
+ return mDeviceBuild.getBootloaderImageFile();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String getBootloaderVersion() {
+ return mDeviceBuild.getBootloaderVersion();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void setBootloaderImageFile(File bootloaderImgFile, String version) {
+ mDeviceBuild.setBootloaderImageFile(bootloaderImgFile, version);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public File getOtaPackageFile() {
+ return mDeviceBuild.getOtaPackageFile();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String getOtaPackageVersion() {
+ return mDeviceBuild.getOtaPackageVersion();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void setOtaPackageFile(File otaFile, String version) {
+ mDeviceBuild.setOtaPackageFile(otaFile, version);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public File getMkbootimgFile() {
+ return mDeviceBuild.getMkbootimgFile();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String getMkbootimgVersion() {
+ return mDeviceBuild.getMkbootimgVersion();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void setMkbootimgFile(File mkbootimg, String version) {
+ mDeviceBuild.setMkbootimgFile(mkbootimg, version);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public File getRamdiskFile() {
+ return mDeviceBuild.getRamdiskFile();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String getRamdiskVersion() {
+ return mDeviceBuild.getRamdiskVersion();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void setRamdiskFile(File ramdisk, String version) {
+ mDeviceBuild.setRamdiskFile(ramdisk, version);
+ }
+
+ /**
+ * @param deviceBuild
+ */
+ public void setDeviceBuild(IDeviceBuildInfo deviceBuild) {
+ mDeviceBuild = deviceBuild;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void cleanUp() {
+ if (mDeviceBuild != null) {
+ mDeviceBuild.cleanUp();
+ }
+
+ if (mTestzipBuildInfo!= null) {
+ mTestzipBuildInfo.cleanUp();
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public IBuildInfo clone() {
+ TestzipDeviceBuildInfo copy = new TestzipDeviceBuildInfo(getBuildId(), getBuildTargetName());
+ copy.addAllBuildAttributes(this);
+ IDeviceBuildInfo deviceBuildClone = (IDeviceBuildInfo) mDeviceBuild.clone();
+ copy.setDeviceBuild(deviceBuildClone);
+ ITestzipBuildInfo testzipBuildClone = (ITestzipBuildInfo) mTestzipBuildInfo.clone();
+ copy.setTestsDir(testzipBuildClone.getTestzipDir(), testzipBuildClone.getTestzipDirVersion());
+ return copy;
+ }
+
+}