summaryrefslogtreecommitdiff
path: root/android/path_properties_test.go
diff options
context:
space:
mode:
author Colin Cross <ccross@android.com> 2019-03-18 12:24:29 -0700
committer Colin Cross <ccross@android.com> 2019-03-18 12:49:14 -0700
commita3a97415d38b0435ef7e2c0314aa6124bd7c6c75 (patch)
tree85d1522bf71ced439668d81f11dc8cbb5e3b8dff /android/path_properties_test.go
parentcd2e52870a89494eb0105d77e2977ac259de4a0a (diff)
Don't add dependencies on modules referenced in unused arch variants
When extracting dependencies from properties tagged with `android:"path"`, only look at the general property structs and not the arch-specific ones. The necessary arch-specific values will be appended into the general property structs. Fixes: 128377112 Test: path_properties_test.go Change-Id: I35e35555d5b15473229a7458fcfc2c7dacaec889
Diffstat (limited to 'android/path_properties_test.go')
-rw-r--r--android/path_properties_test.go27
1 files changed, 22 insertions, 5 deletions
diff --git a/android/path_properties_test.go b/android/path_properties_test.go
index 6471a3cf5..ecc2d2122 100644
--- a/android/path_properties_test.go
+++ b/android/path_properties_test.go
@@ -25,7 +25,7 @@ type pathDepsMutatorTestModule struct {
ModuleBase
props struct {
Foo string `android:"path"`
- Bar []string `android:"path"`
+ Bar []string `android:"path,arch_variant"`
Baz *string `android:"path"`
Qux string
}
@@ -36,7 +36,7 @@ type pathDepsMutatorTestModule struct {
func pathDepsMutatorTestModuleFactory() Module {
module := &pathDepsMutatorTestModule{}
module.AddProperties(&module.props)
- InitAndroidModule(module)
+ InitAndroidArchModule(module, DeviceSupported, MultilibBoth)
return module
}
@@ -64,6 +64,23 @@ func TestPathDepsMutator(t *testing.T) {
}`,
deps: []string{"a", "b", "c"},
},
+ {
+ name: "arch variant",
+ bp: `
+ test {
+ name: "foo",
+ arch: {
+ arm64: {
+ bar: [":a"],
+ },
+ arm: {
+ bar: [":b"],
+ },
+ },
+ bar: [":c"],
+ }`,
+ deps: []string{"c", "a"},
+ },
}
buildDir, err := ioutil.TempDir("", "soong_path_properties_test")
@@ -74,8 +91,8 @@ func TestPathDepsMutator(t *testing.T) {
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
- config := TestConfig(buildDir, nil)
- ctx := NewTestContext()
+ config := TestArchConfig(buildDir, nil)
+ ctx := NewTestArchContext()
ctx.RegisterModuleType("test", ModuleFactoryAdaptor(pathDepsMutatorTestModuleFactory))
ctx.RegisterModuleType("filegroup", ModuleFactoryAdaptor(FileGroupFactory))
@@ -110,7 +127,7 @@ func TestPathDepsMutator(t *testing.T) {
_, errs = ctx.PrepareBuildActions(config)
FailIfErrored(t, errs)
- m := ctx.ModuleForTests("foo", "").Module().(*pathDepsMutatorTestModule)
+ m := ctx.ModuleForTests("foo", "android_arm64_armv8-a").Module().(*pathDepsMutatorTestModule)
if g, w := m.sourceDeps, test.deps; !reflect.DeepEqual(g, w) {
t.Errorf("want deps %q, got %q", w, g)