diff options
author | Ronald Braunstein <rbraunstein@google.com> | 2024-04-30 14:02:59 +0000 |
---|---|---|
committer | Ronald Braunstein <rbraunstein@google.com> | 2024-04-30 18:44:49 +0000 |
commit | b4a4ef9d23f442ff8ed4e762dcaac744eb482873 (patch) | |
tree | 96b0a496b7ec21ef5f13c99cf05ffc6af11379b8 | |
parent | 0dd436cd0a165aa5fe5c317c803b494f91a8844a (diff) | |
download | soong-b4a4ef9d23f442ff8ed4e762dcaac744eb482873.tar.gz |
Remove incorrect strict test for test-suites for test_module_config
I misunderstood our desire to eventually migrate all
`test_module_config` modules -> "general-tests" for the requirement that
it must be used now.
While working on converting these modules to use symlinks rather than
copies of data files, I noticed a problem if the derived test was in
"general-tests", but the base test was in "device-tests". The symlink
would not have a base to point to in general-tests.zip.
Allow the derived tests to be in other suites for now.
Test: go test ./tradefed_modules/
Test: m blueprint_tests
Change-Id: I9524d6c3964db6de38fc3c4cb4c5bc493dadc0db
-rw-r--r-- | tradefed_modules/test_module_config.go | 28 | ||||
-rw-r--r-- | tradefed_modules/test_module_config_test.go | 24 |
2 files changed, 5 insertions, 47 deletions
diff --git a/tradefed_modules/test_module_config.go b/tradefed_modules/test_module_config.go index 9127f67a9..b2d563129 100644 --- a/tradefed_modules/test_module_config.go +++ b/tradefed_modules/test_module_config.go @@ -160,35 +160,17 @@ func (m *testModuleConfigModule) GenerateAndroidBuildActions(ctx android.ModuleC } -// Any test suites in base should not be repeated in the derived class, except "general-tests". -// We may restrict derived tests to only be "general-tests" as it doesn't make sense to add a slice -// of a test to compatibility suite. +// Ensure at least one test_suite is listed. Ideally it should be general-tests +// or device-tests, whichever is listed in base and prefer general-tests if both are listed. +// However this is not enforced yet. // -// Returns ErrorMessage, false on problems -// Returns _, true if okay. +// Returns true if okay and reports errors via ModuleErrorf. func (m *testModuleConfigModule) validateTestSuites(ctx android.ModuleContext) bool { if len(m.tradefedProperties.Test_suites) == 0 { - ctx.ModuleErrorf("At least one test-suite must be set or this won't run. Use \"general-tests\"") + ctx.ModuleErrorf("At least one test-suite must be set or this won't run. Use \"general-tests\" or \"device-tests\"") return false } - derivedSuites := make(map[string]bool) - // See if any suites in base is also in derived (other than general-tests) - for _, s := range m.tradefedProperties.Test_suites { - if s != "general-tests" { - derivedSuites[s] = true - } - } - if len(derivedSuites) == 0 { - return true - } - for _, baseSuite := range m.provider.TestSuites { - if derivedSuites[baseSuite] { - ctx.ModuleErrorf("TestSuite %s exists in the base, do not add it here", baseSuite) - return false - } - } - return true } diff --git a/tradefed_modules/test_module_config_test.go b/tradefed_modules/test_module_config_test.go index 6997228ce..b2049b1af 100644 --- a/tradefed_modules/test_module_config_test.go +++ b/tradefed_modules/test_module_config_test.go @@ -325,30 +325,6 @@ func TestModuleConfigHostNeedsATestSuite(t *testing.T) { RunTestWithBp(t, badBp) } -func TestModuleConfigHostDuplicateTestSuitesGiveErrors(t *testing.T) { - badBp := ` - java_test_host { - name: "base", - srcs: ["a.java"], - test_suites: ["general-tests", "some-compat"], - } - - test_module_config_host { - name: "derived_test", - base: "base", - exclude_filters: ["android.test.example.devcodelab.DevCodelabTest#testHelloFail"], - include_annotations: ["android.platform.test.annotations.LargeTest"], - test_suites: ["general-tests", "some-compat"], - }` - - android.GroupFixturePreparers( - java.PrepareForTestWithJavaDefaultModules, - android.FixtureRegisterWithContext(RegisterTestModuleConfigBuildComponents), - ).ExtendWithErrorHandler( - android.FixtureExpectsAtLeastOneErrorMatchingPattern("TestSuite some-compat exists in the base")). - RunTestWithBp(t, badBp) -} - func TestTestOnlyProvider(t *testing.T) { t.Parallel() ctx := android.GroupFixturePreparers( |