This repository has been archived by the owner on Nov 29, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Notes #1
Comments
|
/**
* A work action that runs UTP in an external java process.
*/
abstract class RunUtpWorkAction : WorkAction<RunUtpWorkParameters> {
private val logger = Logging.getLogger(RunUtpWorkAction::class.java)
@get:Inject
abstract val execOperations: ExecOperations
override fun execute() {
val javaProcessExecutor = GradleJavaProcessExecutor {
execOperations.javaexec(it)
}
val javaProcessInfo = ProcessInfoBuilder().apply {
setClasspath(parameters.launcherJar.asFile.get().absolutePath)
setMain(UtpDependency.LAUNCHER.mainClass)
addArgs(parameters.coreJar.asFile.get().absolutePath)
addArgs("--proto_config=${parameters.runnerConfig.asFile.get().absolutePath}")
addArgs("--proto_server_config=${parameters.serverConfig.asFile.get().absolutePath}")
addJvmArg("-Djava.util.logging.config.file=${
parameters.loggingProperties.asFile.get().absolutePath}")
}.createJavaProcess()
javaProcessExecutor.execute(
javaProcessInfo,
LoggedProcessOutputHandler(LoggerWrapper(logger))).apply {
rethrowFailure()
}
} |
// A UTP launcher jar file to run.
val launcherJar: RegularFileProperty
// A UTP core jar file.
val coreJar: RegularFileProperty
// A UTP runner config binary proto file to be passed into the launcher.
val runnerConfig: RegularFileProperty
// A UTP server config binary proto file to be passed into the launcher.
val serverConfig: RegularFileProperty
// A Java logging properties file to be loaded to run a UTP java process.
val loggingProperties: RegularFileProperty |
/*
* Runs Android Instrumentation tests using UTP (Unified Test Platform).
*/
class UtpTestRunner @JvmOverloads constructor(
splitSelectExec: File?,
processExecutor: ProcessExecutor,
private val workerExecutor: WorkerExecutor,
executor: ExecutorServiceAdapter,
private val utpDependencies: UtpDependencies,
private val versionedSdkLoader: SdkComponentsBuildService.VersionedSdkLoader,
private val retentionConfig: RetentionConfig,
private val useOrchestrator: Boolean,
private val uninstallIncompatibleApks: Boolean,
private val utpTestResultListener: UtpTestResultListener?,
private val configFactory: UtpConfigFactory = UtpConfigFactory(),
private val runUtpTestSuiteAndWaitFunc: (
List<UtpRunnerConfig>, String, String, File, ILogger
) -> List<Boolean> = { runnerConfigs, projectName, variantName, resultsDir, logger ->
runUtpTestSuiteAndWait(
runnerConfigs, workerExecutor, projectName, variantName, resultsDir, logger,
utpTestResultListener, utpDependencies)
}
) |
TestRunner createTestRunner(
WorkerExecutor workerExecutor,
ExecutorServiceAdapter executorServiceAdapter,
@Nullable UtpTestResultListener utpTestResultListener) {
GradleProcessExecutor gradleProcessExecutor =
new GradleProcessExecutor(getExecOperations()::exec);
if (getUnifiedTestPlatform().get()) {
boolean useOrchestrator =
(getExecutionEnum().get() == ANDROID_TEST_ORCHESTRATOR
|| getExecutionEnum().get() == ANDROIDX_TEST_ORCHESTRATOR);
return new UtpTestRunner(
getBuildTools().splitSelectExecutable().getOrNull(),
gradleProcessExecutor,
workerExecutor,
executorServiceAdapter,
getUtpDependencies(),
getSdkBuildService()
.get()
.sdkLoader(
getBuildTools().getCompileSdkVersion(),
getBuildTools().getBuildToolsRevision()),
getRetentionConfig().get(),
useOrchestrator,
getUninstallIncompatibleApks().get(),
utpTestResultListener);
} else {
switch (getExecutionEnum().get()) {
case ANDROID_TEST_ORCHESTRATOR:
case ANDROIDX_TEST_ORCHESTRATOR:
Preconditions.checkArgument(
!getShardBetweenDevices().get(),
"Sharding is not supported with Android Test Orchestrator.");
return new OnDeviceOrchestratorTestRunner(
getBuildTools().splitSelectExecutable().getOrNull(),
gradleProcessExecutor,
getExecutionEnum().get(),
executorServiceAdapter);
case HOST:
if (getShardBetweenDevices().get()) {
return new ShardedTestRunner(
getBuildTools().splitSelectExecutable().getOrNull(),
gradleProcessExecutor,
getNumShards().getOrNull(),
executorServiceAdapter);
} else {
return new SimpleTestRunner(
getBuildTools().splitSelectExecutable().getOrNull(),
gradleProcessExecutor,
executorServiceAdapter);
}
default:
throw new AssertionError("Unknown value " + getExecutionEnum().get());
}
}
}
} |
bootstraponline
pushed a commit
that referenced
this issue
Apr 21, 2022
This CL fixes two problems in the lint test infrastructure: (1) expectInlinedMessages wasn't working right, and was in fact not actually checking anything for tests with source transforming test modes enabled (which is the default). (2) Only two of the expect-methods on TestLintResult was looking rethrowing exceptions encountered during the lint analysis; this CL makes them all do that (3) When I fixed #1 above a couple of inline-message tests failed because they hadn't been kept up to date; for the range test, the error messages in the detector were updated and the tests need to be adjusted; for the allocation detector the fully qualified test mode check actually revealed a bug in the detector: exceptions thrown by fully qualified names would be flagged as an allocation. This CL fixes these. Test: Existing and updated unit tests Bug: None Change-Id: I43b1693b9e4fb287900e5703fb8bc94dfe7917e1
bootstraponline
pushed a commit
that referenced
this issue
Apr 21, 2022
The assumption here is that formc does not generate any new APIs that would be referenced by downstream Java/Kotlin code. Thus we do not need to include formc output in ijars. The benefit of this is that we can produce 'full_ijar' without needing to wait for the formc action to complete. By producing 'full_ijar' earlier, we can begin downstream module compilations sooner, thereby reducing the critical path slightly. Also, note that formc takes as input the "full" Java jar. So, by moving formc off the critical path, we no longer need to wait for the full Javac action either; instead we only need the hjar, which is produced very quickly by Turbine. Test scenario: add a new public Java method in android-common, then build //tools/adt/idea/android/... Results: Before this change: trial #1: 338 seconds trial #2: 323 seconds trial #3: 333 seconds After this change: trial #1: 316 seconds trial #2: 308 seconds trial #3: 305 seconds The improvement is relatively small in practice, it seems. But I did observe that compilation of downstream modules now starts in parallel with the "*.pjava.jar" and "*.java.jar" actions, which is good. Bug: relates to b/200690965 Test: Bazel build Change-Id: I3051c2328bebacf2f1c3de9af9950c4577388e0b
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
UTP shipping in Android Studio.
https://developer.android.com/studio/preview/features/
Android studio ships with
utp.jar
that defines 5 filesClone repo and checkout the
mirror-goog-studio-main
branch. Use bfg to remove files larger than the GitHub 100MB limit. Run bfg twice to remove all files.prebuilt jars
Mirror
The text was updated successfully, but these errors were encountered: