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

Commit 464e6c71 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Add test suite handling to central androidmk code"

parents 882c0425 57f5b33a
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -177,6 +177,18 @@ func (a *AndroidMkEntries) AddStrings(name string, value ...string) {
	a.EntryMap[name] = append(a.EntryMap[name], value...)
}

// AddCompatibilityTestSuites adds the supplied test suites to the EntryMap, with special handling
// for partial MTS test suites.
func (a *AndroidMkEntries) AddCompatibilityTestSuites(suites ...string) {
	// MTS supports a full test suite and partial per-module MTS test suites, with naming mts-${MODULE}.
	// To reduce repetition, if we find a partial MTS test suite without an full MTS test suite,
	// we add the full test suite to our list.
	if PrefixInList(suites, "mts-") && !InList("mts", suites) {
		suites = append(suites, "mts")
	}
	a.AddStrings("LOCAL_COMPATIBILITY_SUITE", suites...)
}

// The contributions to the dist.
type distContributions struct {
	// List of goals and the dist copy instructions.
+1 −1
Original line number Diff line number Diff line
@@ -44,7 +44,7 @@ func (me *CSuiteConfig) AndroidMkEntries() []AndroidMkEntries {
			if me.properties.Test_config != nil {
				entries.SetString("LOCAL_TEST_CONFIG", *me.properties.Test_config)
			}
			entries.AddStrings("LOCAL_COMPATIBILITY_SUITE", "csuite")
			entries.AddCompatibilityTestSuites("csuite")
		},
	}
	return []AndroidMkEntries{androidMkEntries}
+2 −4
Original line number Diff line number Diff line
@@ -334,8 +334,7 @@ func (benchmark *benchmarkDecorator) AndroidMkEntries(ctx AndroidMkContext, entr
	entries.Class = "NATIVE_TESTS"
	entries.ExtraEntries = append(entries.ExtraEntries, func(entries *android.AndroidMkEntries) {
		if len(benchmark.Properties.Test_suites) > 0 {
			entries.SetString("LOCAL_COMPATIBILITY_SUITE",
				strings.Join(benchmark.Properties.Test_suites, " "))
			entries.AddCompatibilityTestSuites(benchmark.Properties.Test_suites...)
		}
		if benchmark.testConfig != nil {
			entries.SetString("LOCAL_FULL_TEST_CONFIG", benchmark.testConfig.String())
@@ -360,8 +359,7 @@ func (test *testBinary) AndroidMkEntries(ctx AndroidMkContext, entries *android.
	}
	entries.ExtraEntries = append(entries.ExtraEntries, func(entries *android.AndroidMkEntries) {
		if len(test.Properties.Test_suites) > 0 {
			entries.SetString("LOCAL_COMPATIBILITY_SUITE",
				strings.Join(test.Properties.Test_suites, " "))
			entries.AddCompatibilityTestSuites(test.Properties.Test_suites...)
		}
		if test.testConfig != nil {
			entries.SetString("LOCAL_FULL_TEST_CONFIG", test.testConfig.String())
+2 −2
Original line number Diff line number Diff line
@@ -139,9 +139,9 @@ func (library *Library) AndroidMkEntries() []android.AndroidMkEntries {
func testSuiteComponent(entries *android.AndroidMkEntries, test_suites []string) {
	entries.SetString("LOCAL_MODULE_TAGS", "tests")
	if len(test_suites) > 0 {
		entries.AddStrings("LOCAL_COMPATIBILITY_SUITE", test_suites...)
		entries.AddCompatibilityTestSuites(test_suites...)
	} else {
		entries.SetString("LOCAL_COMPATIBILITY_SUITE", "null-suite")
		entries.AddCompatibilityTestSuites("null-suite")
	}
}

+2 −2
Original line number Diff line number Diff line
@@ -49,7 +49,7 @@ func (p *binaryDecorator) AndroidMk(base *Module, entries *android.AndroidMkEntr
	entries.Class = "EXECUTABLES"

	entries.ExtraEntries = append(entries.ExtraEntries, func(entries *android.AndroidMkEntries) {
		entries.AddStrings("LOCAL_COMPATIBILITY_SUITE", p.binaryProperties.Test_suites...)
		entries.AddCompatibilityTestSuites(p.binaryProperties.Test_suites...)
	})
	base.subAndroidMk(entries, p.pythonInstaller)
}
@@ -58,7 +58,7 @@ func (p *testDecorator) AndroidMk(base *Module, entries *android.AndroidMkEntrie
	entries.Class = "NATIVE_TESTS"

	entries.ExtraEntries = append(entries.ExtraEntries, func(entries *android.AndroidMkEntries) {
		entries.AddStrings("LOCAL_COMPATIBILITY_SUITE", p.binaryDecorator.binaryProperties.Test_suites...)
		entries.AddCompatibilityTestSuites(p.binaryDecorator.binaryProperties.Test_suites...)
		if p.testConfig != nil {
			entries.SetString("LOCAL_FULL_TEST_CONFIG", p.testConfig.String())
		}
Loading