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

Commit 87b2ab28 authored by Aditya Choudhary's avatar Aditya Choudhary
Browse files

Add test spec provider to test modules.

Provider added for the following test modules in this change: art_cc_test, cc_benchmark, cc_fuzz, cc_test, cc_test_host, rust_test,and rust_test_host.

Bug: 296873595
Test: Manual test
Change-Id: I815680529bcbecacb3a2bdb8f3746053afdee48c
parent b91108c9
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ bootstrap_go_package {
        "soong-multitree",
        "soong-snapshot",
        "soong-sysprop-bp2build",
        "soong-testing",
        "soong-tradefed",
    ],
    srcs: [
+8 −3
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ import (
	"strconv"
	"strings"

	"android/soong/testing"
	"android/soong/ui/metrics/bp2build_metrics_proto"

	"github.com/google/blueprint"
@@ -865,6 +866,7 @@ type Module struct {
	hod        android.HostOrDeviceSupported
	multilib   android.Multilib
	bazelable  bool
	testModule bool

	// Allowable SdkMemberTypes of this module type.
	sdkMemberTypes []android.SdkMemberType
@@ -2329,6 +2331,9 @@ func (c *Module) GenerateAndroidBuildActions(actx android.ModuleContext) {
			}
		}
	}
	if c.testModule {
		ctx.SetProvider(testing.TestModuleProviderKey, testing.TestModuleProviderData{})
	}

	c.maybeInstall(ctx, apexInfo)
}
+1 −0
Original line number Diff line number Diff line
@@ -96,6 +96,7 @@ func fuzzMutatorDeps(mctx android.TopDownMutatorContext) {
// your device, or $ANDROID_PRODUCT_OUT/data/fuzz in your build tree.
func LibFuzzFactory() android.Module {
	module := NewFuzzer(android.HostAndDeviceSupported)
	module.testModule = true
	return module.Init()
}

+3 −0
Original line number Diff line number Diff line
@@ -141,6 +141,7 @@ func init() {
func TestFactory() android.Module {
	module := NewTest(android.HostAndDeviceSupported, true)
	module.bazelHandler = &ccTestBazelHandler{module: module}
	module.testModule = true
	return module.Init()
}

@@ -158,12 +159,14 @@ func TestLibraryFactory() android.Module {
// binary.
func BenchmarkFactory() android.Module {
	module := NewBenchmark(android.HostAndDeviceSupported)
	module.testModule = true
	return module.Init()
}

// cc_test_host compiles a test host binary.
func TestHostFactory() android.Module {
	module := NewTest(android.HostSupported, true)
	module.testModule = true
	return module.Init()
}

+1 −0
Original line number Diff line number Diff line
@@ -12,6 +12,7 @@ bootstrap_go_package {
        "soong-cc",
        "soong-rust-config",
        "soong-snapshot",
        "soong-testing",
    ],
    srcs: [
        "afdo.go",
Loading