diff options
author | 2022-01-20 21:10:28 +0000 | |
---|---|---|
committer | 2022-01-26 19:57:27 +0000 | |
commit | b3342ce580c8211c5fd62b011711c4d149446d1b (patch) | |
tree | c13799af1166da07279e8ea96e3d6dbd92b80b01 /sh/sh_binary_test.go | |
parent | 1e698865b5a0631af134eeefb65d93f9f5056523 (diff) |
build device binary for java_test_host
This commit adds support for a java_host_test that requires a target
binary to run. If the binary has host and target variants and is added
as a dependency in the `data` attribute, then the host variant is used.
Instead, we need a way to force the use of the target variant.
Bug: 182919153
Test: add code from aosp/1647282/1 && atest AuthFsHostTest
Change-Id: I68a6259b41a5e6809e1b82eec3122ffdf5067f56
Diffstat (limited to 'sh/sh_binary_test.go')
-rw-r--r-- | sh/sh_binary_test.go | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/sh/sh_binary_test.go b/sh/sh_binary_test.go index 28b6fb93a..7fe1d8538 100644 --- a/sh/sh_binary_test.go +++ b/sh/sh_binary_test.go @@ -4,6 +4,7 @@ import ( "os" "path/filepath" "strconv" + "strings" "testing" "android/soong/android" @@ -215,3 +216,40 @@ func TestShTestHost_dataDeviceModules(t *testing.T) { actualData := entries.EntryMap["LOCAL_TEST_DATA"] android.AssertStringPathsRelativeToTopEquals(t, "LOCAL_TEST_DATA", config, expectedData, actualData) } + +func TestShTestHost_dataDeviceModulesAutogenTradefedConfig(t *testing.T) { + ctx, config := testShBinary(t, ` + sh_test_host { + name: "foo", + src: "test.sh", + data_device_bins: ["bar"], + data_device_libs: ["libbar"], + } + + cc_binary { + name: "bar", + shared_libs: ["libbar"], + no_libcrt: true, + nocrt: true, + system_shared_libs: [], + stl: "none", + } + + cc_library { + name: "libbar", + no_libcrt: true, + nocrt: true, + system_shared_libs: [], + stl: "none", + } + `) + + buildOS := config.BuildOS.String() + fooModule := ctx.ModuleForTests("foo", buildOS+"_x86_64") + + expectedBinAutogenConfig := `<option name="push-file" key="bar" value="/data/local/tests/unrestricted/foo/bar" />` + autogen := fooModule.Rule("autogen") + if !strings.Contains(autogen.Args["extraConfigs"], expectedBinAutogenConfig) { + t.Errorf("foo extraConfings %v does not contain %q", autogen.Args["extraConfigs"], expectedBinAutogenConfig) + } +} |