summaryrefslogtreecommitdiff
path: root/filesystem/filesystem_test.go
diff options
context:
space:
mode:
author Jooyung Han <jooyung@google.com> 2023-03-16 13:11:17 +0900
committer Jooyung Han <jooyung@google.com> 2023-03-16 13:11:17 +0900
commite606759ddfcbb4f8cba27e5cbc926e1cc8ebfe1f (patch)
treeb3cd13e11c52acf38ef05d08935b6be929a1ae76 /filesystem/filesystem_test.go
parent58fa5a3f362ea32b91100746347833fccf4586f0 (diff)
Make filesystem aware of coverage
filesystem should have coverage variants with coverage-enabled build. Otherwise, it would fail to collect dependencies. Bug: 273238141 Test: m nothing (soong tests) Test: compare the artifacts $ SKIP_ABI_CHECKS=true SOONG_COLLECT_JAVA_DEPS=true EMMA_INSTRUMENT=true\ EMMA_INSTRUMENT_FRAMEWORK=true CLANG_COVERAGE=true\ NATIVE_COVERAGE_PATHS='*' m microdroid $ m microdroid Change-Id: I792458ace00a63b4b5213898fd3209351a6e00be
Diffstat (limited to 'filesystem/filesystem_test.go')
-rw-r--r--filesystem/filesystem_test.go57
1 files changed, 57 insertions, 0 deletions
diff --git a/filesystem/filesystem_test.go b/filesystem/filesystem_test.go
index a65d9dd5f..aef475650 100644
--- a/filesystem/filesystem_test.go
+++ b/filesystem/filesystem_test.go
@@ -20,6 +20,9 @@ import (
"android/soong/android"
"android/soong/cc"
+ "android/soong/etc"
+
+ "github.com/google/blueprint/proptools"
)
func TestMain(m *testing.M) {
@@ -28,6 +31,7 @@ func TestMain(m *testing.M) {
var fixture = android.GroupFixturePreparers(
android.PrepareForIntegrationTestWithAndroid,
+ etc.PrepareForTestWithPrebuiltEtc,
cc.PrepareForIntegrationTestWithCc,
PrepareForTestWithFilesystemBuildComponents,
)
@@ -225,3 +229,56 @@ func TestFileSystemShouldInstallCoreVariantIfTargetBuildAppsIsSet(t *testing.T)
inputs.Strings(),
"out/soong/.intermediates/libbar/android_arm64_armv8-a_shared/libbar.so")
}
+
+func TestFileSystemWithCoverageVariants(t *testing.T) {
+ context := android.GroupFixturePreparers(
+ fixture,
+ android.FixtureModifyProductVariables(func(variables android.FixtureProductVariables) {
+ variables.GcovCoverage = proptools.BoolPtr(true)
+ variables.Native_coverage = proptools.BoolPtr(true)
+ }),
+ )
+
+ result := context.RunTestWithBp(t, `
+ prebuilt_etc {
+ name: "prebuilt",
+ src: ":myfilesystem",
+ }
+
+ android_system_image {
+ name: "myfilesystem",
+ deps: [
+ "libfoo",
+ ],
+ linker_config_src: "linker.config.json",
+ }
+
+ cc_library {
+ name: "libfoo",
+ shared_libs: [
+ "libbar",
+ ],
+ stl: "none",
+ }
+
+ cc_library {
+ name: "libbar",
+ stl: "none",
+ }
+ `)
+
+ filesystem := result.ModuleForTests("myfilesystem", "android_common_cov")
+ inputs := filesystem.Output("deps.zip").Implicits
+ android.AssertStringListContains(t, "filesystem should have libfoo(cov)",
+ inputs.Strings(),
+ "out/soong/.intermediates/libfoo/android_arm64_armv8-a_shared_cov/libfoo.so")
+ android.AssertStringListContains(t, "filesystem should have libbar(cov)",
+ inputs.Strings(),
+ "out/soong/.intermediates/libbar/android_arm64_armv8-a_shared_cov/libbar.so")
+
+ filesystemOutput := filesystem.Output("myfilesystem.img").Output
+ prebuiltInput := result.ModuleForTests("prebuilt", "android_arm64_armv8-a").Rule("Cp").Input
+ if filesystemOutput != prebuiltInput {
+ t.Error("prebuilt should use cov variant of filesystem")
+ }
+}