Merge "Add test that LTO isn't propagated to runtime_libs" am: 0620c7c56a

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

Change-Id: I5a4729c5623e6ec2e5db7518b354e9bfea97e1ea
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Trevor Radcliffe
2023-02-14 17:58:20 +00:00
committed by Automerger Merge Worker

View File

@@ -209,3 +209,33 @@ func TestLtoDisabledButEnabledForArch(t *testing.T) {
android.AssertStringDoesNotContain(t, "got flag for LTO in variant that doesn't expect it", android.AssertStringDoesNotContain(t, "got flag for LTO in variant that doesn't expect it",
libFooWithoutLto.Args["ldFlags"], "-flto=thin") libFooWithoutLto.Args["ldFlags"], "-flto=thin")
} }
func TestLtoDoesNotPropagateToRuntimeLibs(t *testing.T) {
t.Parallel()
bp := `
cc_library {
name: "runtime_libbar",
srcs: ["bar.c"],
}
cc_library {
name: "libfoo",
srcs: ["foo.c"],
runtime_libs: ["runtime_libbar"],
lto: {
thin: true,
},
}`
result := android.GroupFixturePreparers(
prepareForCcTest,
).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")
android.AssertStringDoesContain(t, "missing flag for LTO in LTO enabled library",
libFoo.Args["ldFlags"], "-flto=thin")
android.AssertStringDoesNotContain(t, "got flag for LTO in runtime_lib",
libBar.Args["ldFlags"], "-flto=thin")
}