From 9c6080cc4b51ef106840b8cb5b907f480647203f Mon Sep 17 00:00:00 2001 From: Vinh Tran Date: Mon, 5 Dec 2022 14:55:38 -0500 Subject: [PATCH] Add Soong test to verify runtime_deps doesn't have afdo variant Test: go test Change-Id: If6ef4f5ee529b322a251b11ebdceca4bbcacdd63 --- cc/afdo_test.go | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/cc/afdo_test.go b/cc/afdo_test.go index fe3392ad3..f5d27ff3a 100644 --- a/cc/afdo_test.go +++ b/cc/afdo_test.go @@ -150,3 +150,31 @@ func TestAfdoEnabledOnStaticDepNoAfdo(t *testing.T) { } } + +func TestAfdoEnabledWithRuntimeDepNoAfdo(t *testing.T) { + bp := ` + cc_library { + name: "libTest", + srcs: ["foo.c"], + runtime_libs: ["libFoo"], + afdo: true, + } + + cc_library { + name: "libFoo", + } + ` + prepareForAfdoTest := android.FixtureAddTextFile("toolchain/pgo-profiles/sampling/libTest.afdo", "TEST") + + result := android.GroupFixturePreparers( + prepareForCcTest, + prepareForAfdoTest, + ).RunTestWithBp(t, bp) + + libFooVariants := result.ModuleVariantsForTests("libFoo") + for _, v := range libFooVariants { + if strings.Contains(v, "afdo-") { + t.Errorf("Expected no afdo variant of 'foo', got %q", v) + } + } +}