From 5c1d5fb21b19d6bcc8b0f83bc68124c21b31fabc Mon Sep 17 00:00:00 2001 From: Colin Cross Date: Wed, 15 Nov 2023 12:39:40 -0800 Subject: Move test data installation to Soong To generate module-info.json in Soong for b/309006256 Soong needs to know the test data paths. Moving test data installation into Soong will also help later for test suite packaging. Add ModuleContext.InstallTestData that installs the files listed in a []DataPath alongside the test. The files will also be passed to Make to allow it to continue packaging them into the test suites for now. Update the module types that are producing LOCAL_TEST_DATA entries in their Android.mk files to go through InstallTestData instead. Bug: 311428265 Test: atest --host toybox-gtests --test-timeout=120000 Change-Id: Ia8b964f86e584ea464667fd86a48d754d118bead --- sh/sh_binary_test.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'sh/sh_binary_test.go') diff --git a/sh/sh_binary_test.go b/sh/sh_binary_test.go index 5fcb58d20..37450b0e2 100644 --- a/sh/sh_binary_test.go +++ b/sh/sh_binary_test.go @@ -135,7 +135,7 @@ func TestShTest_dataModules(t *testing.T) { if arch == "darwin_x86_64" { libExt = ".dylib" } - relocated := variant.Output("relocated/lib64/libbar" + libExt) + relocated := variant.Output(filepath.Join("out/soong/.intermediates/foo", arch, "relocated/lib64/libbar"+libExt)) expectedInput := "out/soong/.intermediates/libbar/" + arch + "_shared/libbar" + libExt android.AssertPathRelativeToTopEquals(t, "relocation input", expectedInput, relocated.Input) @@ -204,18 +204,19 @@ func TestShTestHost_dataDeviceModules(t *testing.T) { `) buildOS := config.BuildOS.String() - variant := ctx.ModuleForTests("foo", buildOS+"_x86_64") + variant := buildOS + "_x86_64" + foo := ctx.ModuleForTests("foo", variant) - relocated := variant.Output("relocated/lib64/libbar.so") + relocated := foo.Output(filepath.Join("out/soong/.intermediates/foo", variant, "relocated/lib64/libbar.so")) expectedInput := "out/soong/.intermediates/libbar/android_arm64_armv8-a_shared/libbar.so" android.AssertPathRelativeToTopEquals(t, "relocation input", expectedInput, relocated.Input) - mod := variant.Module().(*ShTest) + mod := foo.Module().(*ShTest) entries := android.AndroidMkEntriesForTest(t, ctx, mod)[0] expectedData := []string{ "out/soong/.intermediates/bar/android_arm64_armv8-a/:bar", // libbar has been relocated, and so has a variant that matches the host arch. - "out/soong/.intermediates/foo/" + buildOS + "_x86_64/relocated/:lib64/libbar.so", + "out/soong/.intermediates/foo/" + variant + "/relocated/:lib64/libbar.so", } actualData := entries.EntryMap["LOCAL_TEST_DATA"] android.AssertStringPathsRelativeToTopEquals(t, "LOCAL_TEST_DATA", config, expectedData, actualData) -- cgit v1.2.3-59-g8ed1b