diff options
author | Jooyung Han <jooyung@google.com> | 2019-07-22 15:48:36 +0900 |
---|---|---|
committer | Jooyung Han <jooyung@google.com> | 2019-07-22 16:15:25 +0900 |
commit | a0171822bea3ecf558df7dec78438410f5aa1b63 (patch) | |
tree | fe4ed91ac618294a603083e4568f30cf249c5abf /xml/xml_test.go | |
parent | 2ac2befc9ae5d461fda9434c553ee911fecaa4db (diff) |
fix: prebuilt_etc_xml
Since aosp/872653 and aosp/904233 landed, prebuilt_etc_xml has been broken.
aosp/872653: Enable arch variant properties in prebuilt_etc.
aosp/904233: Add a prebuilt module type for usr/share.
This change fixes
1) pass baseDir "etc" to initialize PrebuiltEtc struct
2) change "multlib" argument to MultilibFirst to reflect aosp/872653
Bug: 138082739
Test: m com.google.vr.platform.xml && see if it is installed in /system/etc
Change-Id: I4802107fd8ccf28a1170d7d165700c92df32e341
Diffstat (limited to 'xml/xml_test.go')
-rw-r--r-- | xml/xml_test.go | 37 |
1 files changed, 29 insertions, 8 deletions
diff --git a/xml/xml_test.go b/xml/xml_test.go index e8fa49c2b..ae3e9fe3c 100644 --- a/xml/xml_test.go +++ b/xml/xml_test.go @@ -34,6 +34,7 @@ func testXml(t *testing.T, bp string) *android.TestContext { "foo.dtd": nil, "bar.xml": nil, "bar.xsd": nil, + "baz.xml": nil, } ctx.MockFileSystem(mockFiles) _, errs := ctx.ParseFileList(".", []string{"Android.bp"}) @@ -59,6 +60,13 @@ func teardown(buildDir string) { os.RemoveAll(buildDir) } +func assertEqual(t *testing.T, name, expected, actual string) { + t.Helper() + if expected != actual { + t.Errorf(name+" expected %q != got %q", expected, actual) + } +} + // Minimal test func TestPrebuiltEtcXml(t *testing.T) { ctx := testXml(t, ` @@ -72,15 +80,28 @@ func TestPrebuiltEtcXml(t *testing.T) { src: "bar.xml", schema: "bar.xsd", } + prebuilt_etc_xml { + name: "baz.xml", + src: "baz.xml", + } `) - xmllint := ctx.ModuleForTests("foo.xml", "android_common").Rule("xmllint") - input := xmllint.Input.String() - if input != "foo.xml" { - t.Errorf("input expected %q != got %q", "foo.xml", input) - } - schema := xmllint.Args["dtd"] - if schema != "foo.dtd" { - t.Errorf("dtd expected %q != got %q", "foo.dtdl", schema) + for _, tc := range []struct { + rule, input, schemaType, schema string + }{ + {rule: "xmllint-dtd", input: "foo.xml", schemaType: "dtd", schema: "foo.dtd"}, + {rule: "xmllint-xsd", input: "bar.xml", schemaType: "xsd", schema: "bar.xsd"}, + {rule: "xmllint-minimal", input: "baz.xml"}, + } { + t.Run(tc.schemaType, func(t *testing.T) { + rule := ctx.ModuleForTests(tc.input, "android_arm64_armv8-a").Rule(tc.rule) + assertEqual(t, "input", tc.input, rule.Input.String()) + if tc.schemaType != "" { + assertEqual(t, "schema", tc.schema, rule.Args[tc.schemaType]) + } + }) } + + m := ctx.ModuleForTests("foo.xml", "android_arm64_armv8-a").Module().(*prebuiltEtcXml) + assertEqual(t, "installDir", "target/product/test_device/system/etc", m.InstallDirPath().RelPathString()) } |