diff options
author | 2023-11-15 12:39:40 -0800 | |
---|---|---|
committer | 2023-11-30 13:38:49 -0800 | |
commit | 5c1d5fb21b19d6bcc8b0f83bc68124c21b31fabc (patch) | |
tree | 5cf196863f57dfc7ae817cf9ede98cf53126559f /android/androidmk.go | |
parent | 312634eb0fd02c2e084a6925c4f00e5fc00fca54 (diff) |
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
Diffstat (limited to 'android/androidmk.go')
-rw-r--r-- | android/androidmk.go | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/android/androidmk.go b/android/androidmk.go index f6e8799f3..c4b93c77f 100644 --- a/android/androidmk.go +++ b/android/androidmk.go @@ -540,6 +540,10 @@ func (a *AndroidMkEntries) fillInEntries(ctx fillInEntriesContext, mod blueprint a.SetPaths("LOCAL_SOONG_INSTALL_SYMLINKS", base.katiSymlinks.InstallPaths().Paths()) } + if len(base.testData) > 0 { + a.AddStrings("LOCAL_TEST_DATA", androidMkDataPaths(base.testData)...) + } + if am, ok := mod.(ApexModule); ok { a.SetBoolIfTrue("LOCAL_NOT_AVAILABLE_FOR_PLATFORM", am.NotAvailableForPlatform()) } @@ -936,10 +940,13 @@ func shouldSkipAndroidMkProcessing(module *ModuleBase) bool { // A utility func to format LOCAL_TEST_DATA outputs. See the comments on DataPath to understand how // to use this func. -func AndroidMkDataPaths(data []DataPath) []string { +func androidMkDataPaths(data []DataPath) []string { var testFiles []string for _, d := range data { rel := d.SrcPath.Rel() + if d.WithoutRel { + rel = d.SrcPath.Base() + } path := d.SrcPath.String() // LOCAL_TEST_DATA requires the rel portion of the path to be removed from the path. if !strings.HasSuffix(path, rel) { |