Merge "Write out module owner for prebuilt_etc" am: 0c1fabbb32
am: b765cf67fb
am: 1283de522f
Change-Id: I9986c058a84dce2bba9a813eebbe2954c88ad8dc
This commit is contained in:
commit
a9ff887f48
|
@ -145,6 +145,9 @@ func (p *PrebuiltEtc) AndroidMk() AndroidMkData {
|
|||
fmt.Fprintln(w, "LOCAL_PATH :=", moduleDir)
|
||||
fmt.Fprintln(w, "LOCAL_MODULE :=", name+nameSuffix)
|
||||
fmt.Fprintln(w, "LOCAL_MODULE_CLASS := ETC")
|
||||
if p.commonProperties.Owner != nil {
|
||||
fmt.Fprintln(w, "LOCAL_MODULE_OWNER :=", *p.commonProperties.Owner)
|
||||
}
|
||||
fmt.Fprintln(w, "LOCAL_MODULE_TAGS := optional")
|
||||
fmt.Fprintln(w, "LOCAL_PREBUILT_MODULE_FILE :=", p.outputFilePath.String())
|
||||
fmt.Fprintln(w, "LOCAL_MODULE_PATH :=", "$(OUT_DIR)/"+p.installDirPath.RelPathString())
|
||||
|
|
|
@ -15,8 +15,11 @@
|
|||
package android
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"bytes"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
|
@ -130,3 +133,47 @@ func TestPrebuiltEtcGlob(t *testing.T) {
|
|||
t.Errorf("expected bar.conf, got %q", p.outputFilePath.Base())
|
||||
}
|
||||
}
|
||||
|
||||
func TestPrebuiltEtcAndroidMk(t *testing.T) {
|
||||
ctx := testPrebuiltEtc(t, `
|
||||
prebuilt_etc {
|
||||
name: "foo",
|
||||
src: "foo.conf",
|
||||
owner: "abc",
|
||||
filename_from_src: true,
|
||||
}
|
||||
`)
|
||||
|
||||
data := AndroidMkData{}
|
||||
data.Required = append(data.Required, "modA", "moduleB")
|
||||
|
||||
expected := map[string]string{
|
||||
"LOCAL_MODULE": "foo",
|
||||
"LOCAL_MODULE_CLASS": "ETC",
|
||||
"LOCAL_MODULE_OWNER": "abc",
|
||||
"LOCAL_INSTALLED_MODULE_STEM": "foo.conf",
|
||||
"LOCAL_REQUIRED_MODULES": "modA moduleB",
|
||||
}
|
||||
|
||||
mod := ctx.ModuleForTests("foo", "android_arm64_armv8-a_core").Module().(*PrebuiltEtc)
|
||||
buf := &bytes.Buffer{}
|
||||
mod.AndroidMk().Custom(buf, "foo", "", "", data)
|
||||
for k, expected := range expected {
|
||||
found := false
|
||||
scanner := bufio.NewScanner(bytes.NewReader(buf.Bytes()))
|
||||
for scanner.Scan() {
|
||||
line := scanner.Text()
|
||||
tok := strings.Split(line, " := ")
|
||||
if tok[0] == k {
|
||||
found = true
|
||||
if tok[1] != expected {
|
||||
t.Errorf("Incorrect %s '%s', expected '%s'", k, tok[1], expected)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if !found {
|
||||
t.Errorf("No %s defined, saw %s", k, buf.String())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue