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

Commit 9b59352a 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
parent bf3e32d8
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
@@ -22,6 +22,7 @@ import (
	"path/filepath"
	"strings"

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

@@ -1193,6 +1194,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"

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

// getProfileProviderApex returns the name of the apex that provides a boot image profile, or an
+3 −0
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@ import (
	"android/soong/bazel"
	"android/soong/bazel/cquery"
	"android/soong/remoteexec"
	"android/soong/testing"
	"android/soong/ui/metrics/bp2build_metrics_proto"

	"github.com/google/blueprint"
@@ -1228,10 +1229,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"
@@ -253,6 +254,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