diff options
author | Liz Kammer <eakammer@google.com> | 2020-06-12 16:38:45 -0700 |
---|---|---|
committer | Liz Kammer <eakammer@google.com> | 2020-07-27 09:14:06 -0700 |
commit | dd849a81f30d38db789499e1e404def6d3f71783 (patch) | |
tree | 69b046c4a98914ffd496fdfbacab0db3d78f5cef /java/java_test.go | |
parent | 41b4d79dab95b97352dfbc894e65eec7832211ed (diff) |
Add `data_native_bins` property to java_test_host
When multiple os/arch variants are supported, java_test_host could not
find a matching arch due to java having arch:common, whereas native
binaries support a specific architecture. This change adds the property
`data_native_bins` in order to support binaries with the appropriate
os/arch variants.
Test: m FirmwareDtboVerification with data_native_bins
Test: forrest
Bug: 153848038
Change-Id: I45adebff0fde2811d5ef5620c697b97b768c951f
Diffstat (limited to 'java/java_test.go')
-rw-r--r-- | java/java_test.go | 28 |
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) + } +} |