From 9da4aa8166efe67d6c4ab1fe7911224d94493cc9 Mon Sep 17 00:00:00 2001 From: Ivan Lozano Date: Fri, 29 Jan 2021 12:48:05 -0500 Subject: rust: Allow rust_tests to include data files. Adds the ability to define data files that should be installed alongside the test. This also fixes a bug wherein rust_test properties were duplicated. Bug: 171710847 Test: rust_test module with "data" property installs files to device. Change-Id: I091489afaf7e76b751a33a28049590d9fb39fe5f --- rust/test_test.go | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'rust/test_test.go') diff --git a/rust/test_test.go b/rust/test_test.go index fea2ad059..892761a07 100644 --- a/rust/test_test.go +++ b/rust/test_test.go @@ -26,6 +26,7 @@ func TestRustTest(t *testing.T) { rust_test_host { name: "my_test", srcs: ["foo.rs"], + data: ["data.txt"], }`) testingModule := ctx.ModuleForTests("my_test", "linux_glibc_x86_64") @@ -34,6 +35,12 @@ func TestRustTest(t *testing.T) { if !strings.Contains(outPath, expectedOut) { t.Errorf("wrong output path: %v; expected: %v", outPath, expectedOut) } + + dataPaths := testingModule.Module().(*Module).compiler.(*testDecorator).dataPaths() + if len(dataPaths) != 1 { + t.Errorf("expected exactly one test data file. test data files: [%s]", dataPaths) + return + } } func TestRustTestLinkage(t *testing.T) { -- cgit v1.2.3-59-g8ed1b