Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 57011173 authored by Aditya Choudhary's avatar Aditya Choudhary
Browse files

Add proto for Test ownership metadata.

This Cl adds a new rule to Soong to generate test spec metadata. Also, this CL adds a provider in various test module to provide test spec related data to the Soong rule.
Will add providers and test code to other Module in the future changes.
Provider added for the following test modules in this change: android_robolectric_test, android_test, bootclasspath_fragment_test, java_test, java_test_host, python_test, python_test_host, sh_test,and sh_test_host.

Bug: 296873595

Change-Id: I5f89f72d5874bb7838ae357efdb8c6ca208e18a7

Ignore-AOSP-First: CPing test_spec rule to udc-mainline-prod to support migration of test targets. Cherry pick of:aosp/2774872

Change-Id: I23c09ed262915a5f68d6e7a4f21683e0389cd5f6
Merged-In: I5f89f72d5874bb7838ae357efdb8c6ca208e18a7
parent 64038069
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -15,6 +15,7 @@ bootstrap_go_package {
        "soong-dexpreopt",
        "soong-genrule",
        "soong-java-config",
        "soong-testing",
        "soong-provenance",
        "soong-python",
        "soong-remoteexec",
+2 −0
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import (
	"path/filepath"
	"strings"

	"android/soong/testing"
	"github.com/google/blueprint"
	"github.com/google/blueprint/proptools"

@@ -1124,6 +1125,7 @@ func (a *AndroidTest) GenerateAndroidBuildActions(ctx android.ModuleContext) {
	a.testConfig = a.FixTestConfig(ctx, testConfig)
	a.extraTestConfigs = android.PathsForModuleSrc(ctx, a.testProperties.Test_options.Extra_test_configs)
	a.data = android.PathsForModuleSrc(ctx, a.testProperties.Data)
	ctx.SetProvider(testing.TestModuleProviderKey, testing.TestModuleProviderData{})
}

func (a *AndroidTest) FixTestConfig(ctx android.ModuleContext, testConfig android.Path) android.Path {
+2 −0
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ import (

	"android/soong/android"
	"android/soong/dexpreopt"
	"android/soong/testing"

	"github.com/google/blueprint/proptools"

@@ -564,6 +565,7 @@ func (b *BootclasspathFragmentModule) GenerateAndroidBuildActions(ctx android.Mo
	if ctx.Module() != ctx.FinalModule() {
		b.HideFromMake()
	}
	ctx.SetProvider(testing.TestModuleProviderKey, testing.TestModuleProviderData{})
}

// shouldCopyBootFilesToPredefinedLocations determines whether the current module should copy boot
+3 −1
Original line number Diff line number Diff line
@@ -26,7 +26,7 @@ import (
	"android/soong/bazel"
	"android/soong/bazel/cquery"
	"android/soong/remoteexec"

	"android/soong/testing"
	"github.com/google/blueprint"
	"github.com/google/blueprint/proptools"

@@ -1199,10 +1199,12 @@ func (j *TestHost) GenerateAndroidBuildActions(ctx android.ModuleContext) {
	}

	j.Test.generateAndroidBuildActionsWithConfig(ctx, configs)
	ctx.SetProvider(testing.TestModuleProviderKey, testing.TestModuleProviderData{})
}

func (j *Test) GenerateAndroidBuildActions(ctx android.ModuleContext) {
	j.generateAndroidBuildActionsWithConfig(ctx, nil)
	ctx.SetProvider(testing.TestModuleProviderKey, testing.TestModuleProviderData{})
}

func (j *Test) generateAndroidBuildActionsWithConfig(ctx android.ModuleContext, configs []tradefed.Config) {
+2 −0
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ import (

	"android/soong/android"
	"android/soong/java/config"
	"android/soong/testing"
	"android/soong/tradefed"

	"github.com/google/blueprint/proptools"
@@ -235,6 +236,7 @@ func (r *robolectricTest) GenerateAndroidBuildActions(ctx android.ModuleContext)
	}

	r.installFile = ctx.InstallFile(installPath, ctx.ModuleName()+".jar", r.combinedJar, installDeps...)
	ctx.SetProvider(testing.TestModuleProviderKey, testing.TestModuleProviderData{})
}

func generateRoboTestConfig(ctx android.ModuleContext, outputFile android.WritablePath,
Loading