Create base conformance framework test

Test: atest sdkextensions_conformance_framework_tests
Bug: 254647310

Change-Id: I2eb5da132bc7d66909f641b2e1c479f69aa22ae0
This commit is contained in:
Andrei Onea
2022-10-26 15:24:56 +00:00
parent 816b8b6b99
commit 9f4e40c814
4 changed files with 239 additions and 0 deletions

View File

@@ -28,4 +28,8 @@ java_library_host {
"compat-classpaths-testing",
"classpath_classes_proto_java"
],
visibility: [
"//packages/modules/common:__subpackages__",
"//packages/modules/SdkExtensions",
],
}

View File

@@ -27,6 +27,7 @@ import com.android.modules.proto.ClasspathClasses.ClasspathClassesDump;
import com.android.modules.proto.ClasspathClasses.ClasspathEntry;
import com.android.modules.proto.ClasspathClasses.Jar;
import com.android.tradefed.config.Option;
import com.android.tradefed.device.DeviceNotAvailableException;
import com.android.tradefed.device.INativeDevice;
import com.android.tradefed.device.ITestDevice;
@@ -77,6 +78,13 @@ public class ClasspathFetcher extends BaseTargetPreparer {
// TODO(andreionea): also fetch classes for standalone system server jars, apk-in-apex and
// shared libraries. They require more mocking on the test side.
public static final String APEX_PKG_TAG = "apex-package";
// Special case for fetching only non-updatable platform.
public static final String PLATFORM_PACKAGE = "platform";
@Option(name = "apex-package",
description = "The package name of the apex under test.")
private String mApexPackage;
private boolean mFetchedArtifacts = false;
@@ -84,6 +92,9 @@ public class ClasspathFetcher extends BaseTargetPreparer {
public void setUp(TestInformation testInfo)
throws TargetSetupError, DeviceNotAvailableException {
Objects.requireNonNull(testInfo.getDevice());
if (mApexPackage != null) {
testInfo.properties().put(APEX_PKG_TAG, mApexPackage);
}
// The artifacts have been fetched already, no need to do anything else.
if (testInfo.properties().containsKey(DEVICE_JAR_ARTIFACTS_TAG)) {
return;