diff options
author | 2025-02-18 15:18:18 -0800 | |
---|---|---|
committer | 2025-02-18 15:19:56 -0800 | |
commit | b361442aa66c644efba22c6c3da846ac0644d86a (patch) | |
tree | df6345e8800f50ca577044e9fcd7ccde232bf475 /java/java_test.go | |
parent | 6029aed8b971969c87f42cd940434f0fe1da904b (diff) |
Implement host_common_data property for cc, java, rust and sh test modules
Implement the host_common_data property that will copy a host common
module into the test data directory. This property can be used to
copy a custom Tradefed test runner jar alongside the test.
Bug: 262397555
Test: TestHostCommonData
Change-Id: Iacef0778254a3dda400c9e221f442c47d8db7b02
Diffstat (limited to 'java/java_test.go')
-rw-r--r-- | java/java_test.go | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/java/java_test.go b/java/java_test.go index f097762eb..b04ab1780 100644 --- a/java/java_test.go +++ b/java/java_test.go @@ -627,6 +627,29 @@ func TestTest(t *testing.T) { } } +func TestHostCommonData(t *testing.T) { + t.Parallel() + ctx, _ := testJava(t, ` + java_library_host { + name: "host", + srcs: ["a.java"], + } + + java_test { + name: "foo", + srcs: ["a.java"], + host_common_data: [":host"], + } + `) + + foo := ctx.ModuleForTests(t, "foo", "android_common").Module().(*Test) + host := ctx.ModuleForTests(t, "host", ctx.Config().BuildOSCommonTarget.String()).Module().(*Library) + + if g, w := foo.data.RelativeToTop().Strings(), []string{host.outputFile.RelativeToTop().String()}; !slices.Equal(g, w) { + t.Errorf("expected test data %q, got %q\n", w, g) + } +} + func TestHostBinaryNoJavaDebugInfoOverride(t *testing.T) { t.Parallel() bp := ` |