Loading apex/apex.go +4 −27 Original line number Diff line number Diff line Loading @@ -2095,20 +2095,10 @@ func (a *apexBundle) depVisitor(vctx *visitorContext, ctx android.ModuleContext, } case testTag: if ccTest, ok := child.(*cc.Module); ok { if ccTest.IsTestPerSrcAllTestsVariation() { // Multiple-output test module (where `test_per_src: true`). // // `ccTest` is the "" ("all tests") variation of a `test_per_src` module. // We do not add this variation to `filesInfo`, as it has no output; // however, we do add the other variations of this module as indirect // dependencies (see below). } else { // Single-output test module (where `test_per_src: false`). af := apexFileForExecutable(ctx, ccTest) af.class = nativeTest vctx.filesInfo = append(vctx.filesInfo, af) addAconfigFiles(vctx, ctx, child) } return true // track transitive dependencies } else { ctx.PropertyErrorf("tests", "%q is not a cc module", depName) Loading Loading @@ -2197,19 +2187,6 @@ func (a *apexBundle) depVisitor(vctx *visitorContext, ctx android.ModuleContext, addAconfigFiles(vctx, ctx, child) return true // track transitive dependencies } } else if cc.IsTestPerSrcDepTag(depTag) { if ch, ok := child.(*cc.Module); ok { af := apexFileForExecutable(ctx, ch) // Handle modules created as `test_per_src` variations of a single test module: // use the name of the generated test binary (`fileToCopy`) instead of the name // of the original test module (`depName`, shared by all `test_per_src` // variations of that module). af.androidMkModuleName = filepath.Base(af.builtFile.String()) // these are not considered transitive dep af.transitiveDep = false vctx.filesInfo = append(vctx.filesInfo, af) return true // track transitive dependencies } } else if cc.IsHeaderDepTag(depTag) { // nothing } else if java.IsJniDepTag(depTag) { Loading apex/apex_test.go +0 −28 Original line number Diff line number Diff line Loading @@ -5728,7 +5728,6 @@ func TestApexWithTests(t *testing.T) { updatable: false, tests: [ "mytest", "mytests", ], } Loading Loading @@ -5771,25 +5770,6 @@ func TestApexWithTests(t *testing.T) { "testdata/baz" ], } cc_test { name: "mytests", gtest: false, srcs: [ "mytest1.cpp", "mytest2.cpp", "mytest3.cpp", ], test_per_src: true, relative_install_path: "test", system_shared_libs: [], static_executable: true, stl: "none", data: [ ":fg", ":fg2", ], } `) apexRule := ctx.ModuleForTests("myapex", "android_common_myapex").Rule("apexRule") Loading @@ -5803,11 +5783,6 @@ func TestApexWithTests(t *testing.T) { ensureContains(t, copyCmds, "image.apex/bin/test/baz") ensureContains(t, copyCmds, "image.apex/bin/test/bar/baz") // Ensure that test deps built with `test_per_src` are copied into apex. ensureContains(t, copyCmds, "image.apex/bin/test/mytest1") ensureContains(t, copyCmds, "image.apex/bin/test/mytest2") ensureContains(t, copyCmds, "image.apex/bin/test/mytest3") // Ensure the module is correctly translated. bundle := ctx.ModuleForTests("myapex", "android_common_myapex").Module().(*apexBundle) data := android.AndroidMkDataForTest(t, ctx, bundle) Loading @@ -5817,9 +5792,6 @@ func TestApexWithTests(t *testing.T) { data.Custom(&builder, name, prefix, "", data) androidMk := builder.String() ensureContains(t, androidMk, "LOCAL_MODULE := mytest.myapex\n") ensureContains(t, androidMk, "LOCAL_MODULE := mytest1.myapex\n") ensureContains(t, androidMk, "LOCAL_MODULE := mytest2.myapex\n") ensureContains(t, androidMk, "LOCAL_MODULE := mytest3.myapex\n") ensureContains(t, androidMk, "LOCAL_MODULE := myapex\n") } Loading cc/androidmk.go +0 −3 Original line number Diff line number Diff line Loading @@ -351,9 +351,6 @@ func (test *testBinary) AndroidMkEntries(ctx AndroidMkContext, entries *android. ctx.subAndroidMk(entries, test.testDecorator) entries.Class = "NATIVE_TESTS" if Bool(test.Properties.Test_per_src) { entries.SubName = "_" + String(test.binaryDecorator.Properties.Stem) } entries.ExtraEntries = append(entries.ExtraEntries, func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) { if test.testConfig != nil { entries.SetString("LOCAL_FULL_TEST_CONFIG", test.testConfig.String()) Loading cc/cc.go +1 −25 Original line number Diff line number Diff line Loading @@ -51,7 +51,6 @@ func RegisterCCBuildComponents(ctx android.RegistrationContext) { ctx.BottomUp("sdk", sdkMutator).Parallel() ctx.BottomUp("llndk", llndkMutator).Parallel() ctx.BottomUp("link", LinkageMutator).Parallel() ctx.BottomUp("test_per_src", TestPerSrcMutator).Parallel() ctx.BottomUp("version", versionMutator).Parallel() ctx.BottomUp("begin", BeginMutator).Parallel() }) Loading Loading @@ -799,7 +798,6 @@ var ( dataLibDepTag = dependencyTag{name: "data lib"} dataBinDepTag = dependencyTag{name: "data bin"} runtimeDepTag = installDependencyTag{name: "runtime lib"} testPerSrcDepTag = dependencyTag{name: "test_per_src"} stubImplDepTag = dependencyTag{name: "stub_impl"} JniFuzzLibTag = dependencyTag{name: "jni_fuzz_lib_tag"} FdoProfileTag = dependencyTag{name: "fdo_profile"} Loading @@ -826,11 +824,6 @@ func IsRuntimeDepTag(depTag blueprint.DependencyTag) bool { return depTag == runtimeDepTag } func IsTestPerSrcDepTag(depTag blueprint.DependencyTag) bool { ccDepTag, ok := depTag.(dependencyTag) return ok && ccDepTag == testPerSrcDepTag } // Module contains the properties and members used by all C/C++ module types, and implements // the blueprint.Module interface. It delegates to compiler, linker, and installer interfaces // to construct the output file. Behavior can be customized with a Customizer, or "decorator", Loading Loading @@ -1786,11 +1779,6 @@ func (c *Module) Symlinks() []string { return nil } func (c *Module) IsTestPerSrcAllTestsVariation() bool { test, ok := c.linker.(testPerSrc) return ok && test.isAllTestsVariation() } func (c *Module) DataPaths() []android.DataPath { if p, ok := c.installer.(interface { dataPaths() []android.DataPath Loading Loading @@ -1943,16 +1931,6 @@ func (c *Module) GenerateAndroidBuildActions(actx android.ModuleContext) { TopLevelTarget: c.testModule, }) // Handle the case of a test module split by `test_per_src` mutator. // // The `test_per_src` mutator adds an extra variation named "", depending on all the other // `test_per_src` variations of the test module. Set `outputFile` to an empty path for this // module and return early, as this module does not produce an output file per se. if c.IsTestPerSrcAllTestsVariation() { c.outputFile = android.OptionalPath{} return } c.Properties.SubName = GetSubnameProperty(actx, c) apexInfo, _ := android.ModuleProvider(actx, android.ApexInfoProvider) if !apexInfo.IsForPlatform() { Loading Loading @@ -3758,14 +3736,12 @@ func GetMakeLinkType(actx android.ModuleContext, c LinkableInterface) string { } // Overrides ApexModule.IsInstallabeToApex() // Only shared/runtime libraries and "test_per_src" tests are installable to APEX. // Only shared/runtime libraries . func (c *Module) IsInstallableToApex() bool { if lib := c.library; lib != nil { // Stub libs and prebuilt libs in a versioned SDK are not // installable to APEX even though they are shared libs. return lib.shared() && !lib.buildStubs() } else if _, ok := c.linker.(testPerSrc); ok { return true } return false } Loading cc/cc_test_only_property_test.go +0 −32 Original line number Diff line number Diff line Loading @@ -78,38 +78,6 @@ func TestTestOnlyProvider(t *testing.T) { } } func TestTestOnlyValueWithTestPerSrcProp(t *testing.T) { t.Parallel() ctx := android.GroupFixturePreparers( prepareForCcTest, ).RunTestWithBp(t, ` // These should be test-only cc_test { name: "cc-test", gtest: false, test_per_src: true, srcs: ["foo_test.cpp"], test_options: { unit_test: false, }, } `) // Ensure all variation of test-per-src tests are marked test-only. ctx.VisitAllModules(func(m blueprint.Module) { testOnly := false if provider, ok := android.OtherModuleProvider(ctx.TestContext.OtherModuleProviderAdaptor(), m, android.TestOnlyProviderKey); ok { if provider.TestOnly { testOnly = true } } if module, ok := m.(*Module); ok { if testModule, ok := module.installer.(*testBinary); ok { if !testOnly && *testModule.Properties.Test_per_src { t.Errorf("%v is not test-only but should be", m) } } } }) } func TestTestOnlyInTeamsProto(t *testing.T) { t.Parallel() ctx := android.GroupFixturePreparers( Loading Loading
apex/apex.go +4 −27 Original line number Diff line number Diff line Loading @@ -2095,20 +2095,10 @@ func (a *apexBundle) depVisitor(vctx *visitorContext, ctx android.ModuleContext, } case testTag: if ccTest, ok := child.(*cc.Module); ok { if ccTest.IsTestPerSrcAllTestsVariation() { // Multiple-output test module (where `test_per_src: true`). // // `ccTest` is the "" ("all tests") variation of a `test_per_src` module. // We do not add this variation to `filesInfo`, as it has no output; // however, we do add the other variations of this module as indirect // dependencies (see below). } else { // Single-output test module (where `test_per_src: false`). af := apexFileForExecutable(ctx, ccTest) af.class = nativeTest vctx.filesInfo = append(vctx.filesInfo, af) addAconfigFiles(vctx, ctx, child) } return true // track transitive dependencies } else { ctx.PropertyErrorf("tests", "%q is not a cc module", depName) Loading Loading @@ -2197,19 +2187,6 @@ func (a *apexBundle) depVisitor(vctx *visitorContext, ctx android.ModuleContext, addAconfigFiles(vctx, ctx, child) return true // track transitive dependencies } } else if cc.IsTestPerSrcDepTag(depTag) { if ch, ok := child.(*cc.Module); ok { af := apexFileForExecutable(ctx, ch) // Handle modules created as `test_per_src` variations of a single test module: // use the name of the generated test binary (`fileToCopy`) instead of the name // of the original test module (`depName`, shared by all `test_per_src` // variations of that module). af.androidMkModuleName = filepath.Base(af.builtFile.String()) // these are not considered transitive dep af.transitiveDep = false vctx.filesInfo = append(vctx.filesInfo, af) return true // track transitive dependencies } } else if cc.IsHeaderDepTag(depTag) { // nothing } else if java.IsJniDepTag(depTag) { Loading
apex/apex_test.go +0 −28 Original line number Diff line number Diff line Loading @@ -5728,7 +5728,6 @@ func TestApexWithTests(t *testing.T) { updatable: false, tests: [ "mytest", "mytests", ], } Loading Loading @@ -5771,25 +5770,6 @@ func TestApexWithTests(t *testing.T) { "testdata/baz" ], } cc_test { name: "mytests", gtest: false, srcs: [ "mytest1.cpp", "mytest2.cpp", "mytest3.cpp", ], test_per_src: true, relative_install_path: "test", system_shared_libs: [], static_executable: true, stl: "none", data: [ ":fg", ":fg2", ], } `) apexRule := ctx.ModuleForTests("myapex", "android_common_myapex").Rule("apexRule") Loading @@ -5803,11 +5783,6 @@ func TestApexWithTests(t *testing.T) { ensureContains(t, copyCmds, "image.apex/bin/test/baz") ensureContains(t, copyCmds, "image.apex/bin/test/bar/baz") // Ensure that test deps built with `test_per_src` are copied into apex. ensureContains(t, copyCmds, "image.apex/bin/test/mytest1") ensureContains(t, copyCmds, "image.apex/bin/test/mytest2") ensureContains(t, copyCmds, "image.apex/bin/test/mytest3") // Ensure the module is correctly translated. bundle := ctx.ModuleForTests("myapex", "android_common_myapex").Module().(*apexBundle) data := android.AndroidMkDataForTest(t, ctx, bundle) Loading @@ -5817,9 +5792,6 @@ func TestApexWithTests(t *testing.T) { data.Custom(&builder, name, prefix, "", data) androidMk := builder.String() ensureContains(t, androidMk, "LOCAL_MODULE := mytest.myapex\n") ensureContains(t, androidMk, "LOCAL_MODULE := mytest1.myapex\n") ensureContains(t, androidMk, "LOCAL_MODULE := mytest2.myapex\n") ensureContains(t, androidMk, "LOCAL_MODULE := mytest3.myapex\n") ensureContains(t, androidMk, "LOCAL_MODULE := myapex\n") } Loading
cc/androidmk.go +0 −3 Original line number Diff line number Diff line Loading @@ -351,9 +351,6 @@ func (test *testBinary) AndroidMkEntries(ctx AndroidMkContext, entries *android. ctx.subAndroidMk(entries, test.testDecorator) entries.Class = "NATIVE_TESTS" if Bool(test.Properties.Test_per_src) { entries.SubName = "_" + String(test.binaryDecorator.Properties.Stem) } entries.ExtraEntries = append(entries.ExtraEntries, func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) { if test.testConfig != nil { entries.SetString("LOCAL_FULL_TEST_CONFIG", test.testConfig.String()) Loading
cc/cc.go +1 −25 Original line number Diff line number Diff line Loading @@ -51,7 +51,6 @@ func RegisterCCBuildComponents(ctx android.RegistrationContext) { ctx.BottomUp("sdk", sdkMutator).Parallel() ctx.BottomUp("llndk", llndkMutator).Parallel() ctx.BottomUp("link", LinkageMutator).Parallel() ctx.BottomUp("test_per_src", TestPerSrcMutator).Parallel() ctx.BottomUp("version", versionMutator).Parallel() ctx.BottomUp("begin", BeginMutator).Parallel() }) Loading Loading @@ -799,7 +798,6 @@ var ( dataLibDepTag = dependencyTag{name: "data lib"} dataBinDepTag = dependencyTag{name: "data bin"} runtimeDepTag = installDependencyTag{name: "runtime lib"} testPerSrcDepTag = dependencyTag{name: "test_per_src"} stubImplDepTag = dependencyTag{name: "stub_impl"} JniFuzzLibTag = dependencyTag{name: "jni_fuzz_lib_tag"} FdoProfileTag = dependencyTag{name: "fdo_profile"} Loading @@ -826,11 +824,6 @@ func IsRuntimeDepTag(depTag blueprint.DependencyTag) bool { return depTag == runtimeDepTag } func IsTestPerSrcDepTag(depTag blueprint.DependencyTag) bool { ccDepTag, ok := depTag.(dependencyTag) return ok && ccDepTag == testPerSrcDepTag } // Module contains the properties and members used by all C/C++ module types, and implements // the blueprint.Module interface. It delegates to compiler, linker, and installer interfaces // to construct the output file. Behavior can be customized with a Customizer, or "decorator", Loading Loading @@ -1786,11 +1779,6 @@ func (c *Module) Symlinks() []string { return nil } func (c *Module) IsTestPerSrcAllTestsVariation() bool { test, ok := c.linker.(testPerSrc) return ok && test.isAllTestsVariation() } func (c *Module) DataPaths() []android.DataPath { if p, ok := c.installer.(interface { dataPaths() []android.DataPath Loading Loading @@ -1943,16 +1931,6 @@ func (c *Module) GenerateAndroidBuildActions(actx android.ModuleContext) { TopLevelTarget: c.testModule, }) // Handle the case of a test module split by `test_per_src` mutator. // // The `test_per_src` mutator adds an extra variation named "", depending on all the other // `test_per_src` variations of the test module. Set `outputFile` to an empty path for this // module and return early, as this module does not produce an output file per se. if c.IsTestPerSrcAllTestsVariation() { c.outputFile = android.OptionalPath{} return } c.Properties.SubName = GetSubnameProperty(actx, c) apexInfo, _ := android.ModuleProvider(actx, android.ApexInfoProvider) if !apexInfo.IsForPlatform() { Loading Loading @@ -3758,14 +3736,12 @@ func GetMakeLinkType(actx android.ModuleContext, c LinkableInterface) string { } // Overrides ApexModule.IsInstallabeToApex() // Only shared/runtime libraries and "test_per_src" tests are installable to APEX. // Only shared/runtime libraries . func (c *Module) IsInstallableToApex() bool { if lib := c.library; lib != nil { // Stub libs and prebuilt libs in a versioned SDK are not // installable to APEX even though they are shared libs. return lib.shared() && !lib.buildStubs() } else if _, ok := c.linker.(testPerSrc); ok { return true } return false } Loading
cc/cc_test_only_property_test.go +0 −32 Original line number Diff line number Diff line Loading @@ -78,38 +78,6 @@ func TestTestOnlyProvider(t *testing.T) { } } func TestTestOnlyValueWithTestPerSrcProp(t *testing.T) { t.Parallel() ctx := android.GroupFixturePreparers( prepareForCcTest, ).RunTestWithBp(t, ` // These should be test-only cc_test { name: "cc-test", gtest: false, test_per_src: true, srcs: ["foo_test.cpp"], test_options: { unit_test: false, }, } `) // Ensure all variation of test-per-src tests are marked test-only. ctx.VisitAllModules(func(m blueprint.Module) { testOnly := false if provider, ok := android.OtherModuleProvider(ctx.TestContext.OtherModuleProviderAdaptor(), m, android.TestOnlyProviderKey); ok { if provider.TestOnly { testOnly = true } } if module, ok := m.(*Module); ok { if testModule, ok := module.installer.(*testBinary); ok { if !testOnly && *testModule.Properties.Test_per_src { t.Errorf("%v is not test-only but should be", m) } } } }) } func TestTestOnlyInTeamsProto(t *testing.T) { t.Parallel() ctx := android.GroupFixturePreparers( Loading