summaryrefslogtreecommitdiff
path: root/java/java_test.go
diff options
context:
space:
mode:
author Liz Kammer <eakammer@google.com> 2020-07-28 16:15:56 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2020-07-28 16:15:56 +0000
commit8ffde8c9d51810b3090ea85ccba415c9f4641afa (patch)
tree0cdd7b5f638ada4152194b4e6dac871ba8842c4f /java/java_test.go
parent75117fcdd05cb73e08b9b4647ed634a266b69eab (diff)
parentdd849a81f30d38db789499e1e404def6d3f71783 (diff)
Merge "Add `data_native_bins` property to java_test_host"
Diffstat (limited to 'java/java_test.go')
-rw-r--r--java/java_test.go28
1 files changed, 28 insertions, 0 deletions
diff --git a/java/java_test.go b/java/java_test.go
index db3f18740..73e6792b4 100644
--- a/java/java_test.go
+++ b/java/java_test.go
@@ -31,6 +31,7 @@ import (
"android/soong/cc"
"android/soong/dexpreopt"
"android/soong/genrule"
+ "android/soong/python"
)
var buildDir string
@@ -81,6 +82,7 @@ func testContext() *android.TestContext {
ctx.RegisterModuleType("java_plugin", PluginFactory)
ctx.RegisterModuleType("filegroup", android.FileGroupFactory)
ctx.RegisterModuleType("genrule", genrule.GenRuleFactory)
+ ctx.RegisterModuleType("python_binary_host", python.PythonBinaryHostFactory)
RegisterDocsBuildComponents(ctx)
RegisterStubsBuildComponents(ctx)
RegisterSdkLibraryBuildComponents(ctx)
@@ -89,6 +91,7 @@ func testContext() *android.TestContext {
RegisterPrebuiltApisBuildComponents(ctx)
+ ctx.PreDepsMutators(python.RegisterPythonPreDepsMutators)
ctx.PostDepsMutators(android.RegisterOverridePostDepsMutators)
ctx.RegisterPreSingletonType("overlay", android.SingletonFactoryAdaptor(OverlaySingletonFactory))
ctx.RegisterPreSingletonType("sdk_versions", android.SingletonFactoryAdaptor(sdkPreSingletonFactory))
@@ -2008,3 +2011,28 @@ func TestAidlExportIncludeDirsFromImports(t *testing.T) {
t.Errorf("aidl command %q does not contain %q", aidlCommand, expectedAidlFlag)
}
}
+
+func TestDataNativeBinaries(t *testing.T) {
+ ctx, config := testJava(t, `
+ java_test_host {
+ name: "foo",
+ srcs: ["a.java"],
+ data_native_bins: ["bin"]
+ }
+
+ python_binary_host {
+ name: "bin",
+ srcs: ["bin.py"],
+ }
+ `)
+
+ buildOS := android.BuildOs.String()
+
+ test := ctx.ModuleForTests("foo", buildOS+"_common").Module().(*TestHost)
+ entries := android.AndroidMkEntriesForTest(t, config, "", test)[0]
+ expected := []string{buildDir + "/.intermediates/bin/" + buildOS + "_x86_64_PY3/bin:bin"}
+ actual := entries.EntryMap["LOCAL_COMPATIBILITY_SUPPORT_FILES"]
+ if !reflect.DeepEqual(expected, actual) {
+ t.Errorf("Unexpected test data - expected: %q, actual: %q", expected, actual)
+ }
+}