summaryrefslogtreecommitdiff
path: root/ci_tests
diff options
context:
space:
mode:
author mrziwang <mrziwang@google.com> 2025-02-26 15:49:50 -0800
committer mrziwang <mrziwang@google.com> 2025-02-28 22:53:20 +0000
commit6a5457abdf9e373b3c28883910824d04b10d8afb (patch)
tree04a74d343709d96762d9fd0fc54936d9f282f65b /ci_tests
parent6d0d41cfd2e6d20148aff668357976e64f886d78 (diff)
Filter out unwanted installed files from test_package
This change also dists platform_tests module. Test: CI and cmp output zip Bug: 388850000 Change-Id: Ibcc301f685a5fddc1dfda51e65b61b60a032a5fd
Diffstat (limited to 'ci_tests')
-rw-r--r--ci_tests/ci_test_package_zip.go26
1 files changed, 22 insertions, 4 deletions
diff --git a/ci_tests/ci_test_package_zip.go b/ci_tests/ci_test_package_zip.go
index acfa8e073..fde7cf81e 100644
--- a/ci_tests/ci_test_package_zip.go
+++ b/ci_tests/ci_test_package_zip.go
@@ -148,9 +148,9 @@ func (p *testPackageZip) GenerateAndroidBuildActions(ctx android.ModuleContext)
ctx.SetOutputFiles(android.Paths{p.output}, "")
// dist the test output
- if ctx.ModuleName() == "platform_tests_soong" {
+ if ctx.ModuleName() == "platform_tests" {
distedName := ctx.Config().Getenv("TARGET_PRODUCT") + "-tests-" + ctx.Config().BuildId() + ".zip"
- ctx.DistForGoalsWithFilename([]string{"droid", "platform_tests"}, p.output, distedName)
+ ctx.DistForGoalWithFilename("platform_tests", p.output, distedName)
}
}
@@ -190,11 +190,23 @@ func createOutput(ctx android.ModuleContext, pctx android.PackageContext) androi
}
for _, installedFile := range installedFilesInfo.InstallFiles {
- // there are additional installed files for some app-class modules, we only need the .apk files in the test package
- if class == "app" && installedFile.Ext() != ".apk" {
+ ext := installedFile.Ext()
+ // there are additional installed files for some app-class modules, we only need the .apk, .odex and .vdex files in the test package
+ excludeInstalledFile := ext != ".apk" && ext != ".odex" && ext != ".vdex"
+ if class == "app" && excludeInstalledFile {
+ continue
+ }
+ // only .jar files should be included for a framework dep
+ if class == "framework" && ext != ".jar" {
continue
}
name := removeFileExtension(installedFile.Base())
+ // some apks have other apk as installed files, these additional files shouldn't be included
+ isAppOrFramework := class == "app" || class == "framework"
+ if isAppOrFramework && name != ctx.OtherModuleName(m) {
+ continue
+ }
+
f := strings.TrimPrefix(installedFile.String(), productOut+"/")
if strings.HasPrefix(f, "out") {
continue
@@ -207,6 +219,12 @@ func createOutput(ctx android.ModuleContext, pctx android.PackageContext) androi
f = strings.ReplaceAll(f, "DATA_other", "system_other")
f = strings.ReplaceAll(f, "system_other/DATA", "system_other/system")
dir := filepath.Dir(f)
+
+ // ignore the additional installed files from test
+ if strings.Contains(dir, "DATA/native_tests") || strings.Count(dir, "DATA") > 1 {
+ continue
+ }
+
tempOut := android.PathForModuleOut(ctx, "STAGING", f)
builder.Command().Text("mkdir").Flag("-p").Text(filepath.Join(stagingDir.String(), dir))
builder.Command().Text("cp").Flag("-Rf").Input(installedFile).Output(tempOut)