Install test deps and configs in soong-only
Test: set PRODUCT_SOONG_ONLY locally
Test: rm -rf out/target/product/vsoc_x86_64 && atest CtsHealthConnectControllerTestCases
(one test fails, I will verify if this is specific to soong-only in
followup work)
Bug: 391924360
Change-Id: I72a05c0762d124dd0a8e4dd6b59eda6266cd2cf6
diff --git a/java/app.go b/java/app.go
index 17c7b22..da7eb02 100644
--- a/java/app.go
+++ b/java/app.go
@@ -1616,6 +1616,19 @@
a.data = append(a.data, android.PathsForModuleSrc(ctx, a.testProperties.Device_first_data)...)
a.data = append(a.data, android.PathsForModuleSrc(ctx, a.testProperties.Device_first_prefer32_data)...)
+ // Install test deps
+ if !ctx.Config().KatiEnabled() {
+ pathInTestCases := android.PathForModuleInstall(ctx, ctx.Module().Name())
+ if a.testConfig != nil {
+ ctx.InstallFile(pathInTestCases, ctx.Module().Name()+".config", a.testConfig)
+ }
+ testDeps := append(a.data, a.extraTestConfigs...)
+ for _, data := range android.SortedUniquePaths(testDeps) {
+ dataPath := android.DataPath{SrcPath: data}
+ ctx.InstallTestData(pathInTestCases, []android.DataPath{dataPath})
+ }
+ }
+
android.SetProvider(ctx, tradefed.BaseTestProviderKey, tradefed.BaseTestProviderData{
TestcaseRelDataFiles: testcaseRel(a.data),
OutputFile: a.OutputFile(),
diff --git a/tradefed_modules/test_suite.go b/tradefed_modules/test_suite.go
index 00585f5..8b7babf 100644
--- a/tradefed_modules/test_suite.go
+++ b/tradefed_modules/test_suite.go
@@ -26,12 +26,12 @@
const testSuiteModuleType = "test_suite"
-type testSuiteTag struct{
+type testSuiteTag struct {
blueprint.BaseDependencyTag
}
type testSuiteManifest struct {
- Name string `json:"name"`
+ Name string `json:"name"`
Files []string `json:"files"`
}
@@ -49,7 +49,7 @@
type testSuiteProperties struct {
Description string
- Tests []string `android:"path,arch_variant"`
+ Tests []string `android:"path,arch_variant"`
}
type testSuiteModule struct {
@@ -109,7 +109,7 @@
}
manifestPath := android.PathForSuiteInstall(ctx, suiteName, suiteName+".json")
- b, err := json.Marshal(testSuiteManifest{Name: suiteName, Files: files})
+ b, err := json.Marshal(testSuiteManifest{Name: suiteName, Files: android.SortedUniqueStrings(files)})
if err != nil {
ctx.ModuleErrorf("Failed to marshal manifest: %v", err)
return
@@ -160,7 +160,7 @@
// Install config file.
if tp.TestConfig != nil {
moduleRoot := suiteRoot.Join(ctx, hostOrTarget, "testcases", module.Name())
- installed = append(installed, ctx.InstallFile(moduleRoot, module.Name() + ".config", tp.TestConfig))
+ installed = append(installed, ctx.InstallFile(moduleRoot, module.Name()+".config", tp.TestConfig))
}
// Add to phony and manifest, manifestpaths are relative to suiteRoot.