Merge "Add GLOBAL_THINLTO env fixture to lto_test" am: c938bec49b

Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2623891

Change-Id: I6d4510c25f54defcc0be231a3b0988644ff708fa
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Yi Kong 2023-06-14 12:10:11 +00:00 committed by Automerger Merge Worker
commit 6c83cba9dd

View file

@ -23,6 +23,12 @@ import (
"github.com/google/blueprint"
)
var NoGlobalThinLTOPreparer = android.GroupFixturePreparers(
prepareForCcTest,
android.FixtureModifyEnv(func(env map[string]string) {
env["GLOBAL_THINLTO"] = "false"
}))
func TestThinLtoDeps(t *testing.T) {
t.Parallel()
bp := `
@ -57,9 +63,7 @@ func TestThinLtoDeps(t *testing.T) {
}
`
result := android.GroupFixturePreparers(
prepareForCcTest,
).RunTestWithBp(t, bp)
result := NoGlobalThinLTOPreparer.RunTestWithBp(t, bp)
libLto := result.ModuleForTests("lto_enabled", "android_arm64_armv8-a_shared").Module()
@ -137,9 +141,7 @@ func TestThinLtoOnlyOnStaticDep(t *testing.T) {
}
`
result := android.GroupFixturePreparers(
prepareForCcTest,
).RunTestWithBp(t, bp)
result := NoGlobalThinLTOPreparer.RunTestWithBp(t, bp)
libRoot := result.ModuleForTests("root", "android_arm64_armv8-a_shared").Module()
libRootLtoNever := result.ModuleForTests("root_no_lto", "android_arm64_armv8-a_shared").Module()
@ -197,9 +199,7 @@ func TestLtoDisabledButEnabledForArch(t *testing.T) {
},
},
}`
result := android.GroupFixturePreparers(
prepareForCcTest,
).RunTestWithBp(t, bp)
result := NoGlobalThinLTOPreparer.RunTestWithBp(t, bp)
libFooWithLto := result.ModuleForTests("libfoo", "android_arm_armv7-a-neon_shared").Rule("ld")
libFooWithoutLto := result.ModuleForTests("libfoo", "android_arm64_armv8-a_shared").Rule("ld")
@ -227,9 +227,7 @@ func TestLtoDoesNotPropagateToRuntimeLibs(t *testing.T) {
},
}`
result := android.GroupFixturePreparers(
prepareForCcTest,
).RunTestWithBp(t, bp)
result := NoGlobalThinLTOPreparer.RunTestWithBp(t, bp)
libFoo := result.ModuleForTests("libfoo", "android_arm_armv7-a-neon_shared").Rule("ld")
libBar := result.ModuleForTests("runtime_libbar", "android_arm_armv7-a-neon_shared").Rule("ld")