summaryrefslogtreecommitdiff
path: root/android/module_test.go
diff options
context:
space:
mode:
author Liz Kammer <eakammer@google.com> 2022-03-22 11:27:26 -0400
committer Liz Kammer <eakammer@google.com> 2022-03-25 18:30:49 -0400
commit898e076d6f3cb289c5fb8fa712fc819250773a99 (patch)
tree473299c26269825b42a598b3ce4838f58b5b99de /android/module_test.go
parent057beb21468ec738d6d9325a46d6e8ca77fef00b (diff)
Add values to json module graph
Increases size of json module graph but it still remains smaller than action information. Test: m json-module-graph Change-Id: I215e92afb0f5d3d688e5e590517392d0cc534455
Diffstat (limited to 'android/module_test.go')
-rw-r--r--android/module_test.go89
1 files changed, 62 insertions, 27 deletions
diff --git a/android/module_test.go b/android/module_test.go
index 1dcddf71b..77ef14673 100644
--- a/android/module_test.go
+++ b/android/module_test.go
@@ -563,6 +563,12 @@ type PropsTestModuleEmbedded struct {
Embedded_prop *string
}
+type StructInSlice struct {
+ G string
+ H bool
+ I []string
+}
+
type propsTestModule struct {
ModuleBase
DefaultableModuleBase
@@ -579,6 +585,8 @@ type propsTestModule struct {
E *string
}
F *string `blueprint:"mutated"`
+
+ Slice_of_struct []StructInSlice
}
}
@@ -621,7 +629,7 @@ func TestUsedProperties(t *testing.T) {
}
`,
expectedProps: []propInfo{
- propInfo{"Name", "string"},
+ propInfo{Name: "Name", Type: "string", Value: "foo"},
},
},
{
@@ -634,10 +642,10 @@ func TestUsedProperties(t *testing.T) {
}
`,
expectedProps: []propInfo{
- propInfo{"A", "string"},
- propInfo{"B", "bool"},
- propInfo{"D", "int64"},
- propInfo{"Name", "string"},
+ propInfo{Name: "A", Type: "string", Value: "abc"},
+ propInfo{Name: "B", Type: "bool", Value: "true"},
+ propInfo{Name: "D", Type: "int64", Value: "123"},
+ propInfo{Name: "Name", Type: "string", Value: "foo"},
},
},
{
@@ -650,10 +658,10 @@ func TestUsedProperties(t *testing.T) {
`,
expectedProps: []propInfo{
// for non-pointer cannot distinguish between unused and intentionally set to empty
- propInfo{"A", "string"},
- propInfo{"B", "bool"},
- propInfo{"D", "int64"},
- propInfo{"Name", "string"},
+ propInfo{Name: "A", Type: "string", Value: ""},
+ propInfo{Name: "B", Type: "bool", Value: "true"},
+ propInfo{Name: "D", Type: "int64", Value: "123"},
+ propInfo{Name: "Name", Type: "string", Value: "foo"},
},
},
{
@@ -666,8 +674,8 @@ func TestUsedProperties(t *testing.T) {
}
`,
expectedProps: []propInfo{
- propInfo{"Nested.E", "string"},
- propInfo{"Name", "string"},
+ propInfo{Name: "Name", Type: "string", Value: "foo"},
+ propInfo{Name: "Nested.E", Type: "string", Value: "abc"},
},
},
{
@@ -682,8 +690,8 @@ func TestUsedProperties(t *testing.T) {
}
`,
expectedProps: []propInfo{
- propInfo{"Name", "string"},
- propInfo{"Arch.X86_64.A", "string"},
+ propInfo{Name: "Arch.X86_64.A", Type: "string", Value: "abc"},
+ propInfo{Name: "Name", Type: "string", Value: "foo"},
},
},
{
@@ -694,8 +702,34 @@ func TestUsedProperties(t *testing.T) {
}
`,
expectedProps: []propInfo{
- propInfo{"Embedded_prop", "string"},
- propInfo{"Name", "string"},
+ propInfo{Name: "Embedded_prop", Type: "string", Value: "a"},
+ propInfo{Name: "Name", Type: "string", Value: "foo"},
+ },
+ },
+ {
+ desc: "struct slice",
+ bp: `test {
+ name: "foo",
+ slice_of_struct: [
+ {
+ g: "abc",
+ h: false,
+ i: ["baz"],
+ },
+ {
+ g: "def",
+ h: true,
+ i: [],
+ },
+ ]
+ }
+ `,
+ expectedProps: []propInfo{
+ propInfo{Name: "Name", Type: "string", Value: "foo"},
+ propInfo{Name: "Slice_of_struct", Type: "struct slice", Values: []string{
+ `android.StructInSlice{G: abc, H: false, I: [baz]}`,
+ `android.StructInSlice{G: def, H: true, I: []}`,
+ }},
},
},
{
@@ -705,19 +739,20 @@ test_defaults {
name: "foo_defaults",
a: "a",
b: true,
+ c: ["default_c"],
embedded_prop:"a",
arch: {
x86_64: {
- a: "a",
+ a: "x86_64 a",
},
},
}
test {
name: "foo",
defaults: ["foo_defaults"],
- c: ["a"],
+ c: ["c"],
nested: {
- e: "d",
+ e: "nested e",
},
target: {
linux: {
@@ -727,15 +762,15 @@ test {
}
`,
expectedProps: []propInfo{
- propInfo{"A", "string"},
- propInfo{"B", "bool"},
- propInfo{"C", "string slice"},
- propInfo{"Embedded_prop", "string"},
- propInfo{"Nested.E", "string"},
- propInfo{"Name", "string"},
- propInfo{"Arch.X86_64.A", "string"},
- propInfo{"Target.Linux.A", "string"},
- propInfo{"Defaults", "string slice"},
+ propInfo{Name: "A", Type: "string", Value: "a"},
+ propInfo{Name: "Arch.X86_64.A", Type: "string", Value: "x86_64 a"},
+ propInfo{Name: "B", Type: "bool", Value: "true"},
+ propInfo{Name: "C", Type: "string slice", Values: []string{"default_c", "c"}},
+ propInfo{Name: "Defaults", Type: "string slice", Values: []string{"foo_defaults"}},
+ propInfo{Name: "Embedded_prop", Type: "string", Value: "a"},
+ propInfo{Name: "Name", Type: "string", Value: "foo"},
+ propInfo{Name: "Nested.E", Type: "string", Value: "nested e"},
+ propInfo{Name: "Target.Linux.A", Type: "string", Value: "a"},
},
},
}