From e00614ecbafcecc425e3ae1ff8213ae5444c0d06 Mon Sep 17 00:00:00 2001 From: Colin Cross Date: Fri, 9 Feb 2024 12:19:55 -0800 Subject: [PATCH] Fix TestAfdoDeps for darwin LTO does not set the -import-instr-limit flag when building for darwin, don't test it on darwin host modules. Test: afdo_test.go Change-Id: I83f77006a875f8b0a6af9ae11eb3bad88b0681b1 --- cc/afdo_test.go | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/cc/afdo_test.go b/cc/afdo_test.go index 3eab03921..0679d1386 100644 --- a/cc/afdo_test.go +++ b/cc/afdo_test.go @@ -15,6 +15,7 @@ package cc import ( + "runtime" "strings" "testing" @@ -228,12 +229,14 @@ func TestAfdoDeps(t *testing.T) { uniqueInternalLinkageNamesCFlag, cFlags) } - ldFlags = libTestHost.Rule("ld").Args["ldFlags"] - if !strings.Contains(ldFlags, noAfdoLtoLdFlag) { - t.Errorf("Expected host 'libTest' to not enable afdo, but did not find %q in ldflags %q", noAfdoLtoLdFlag, ldFlags) - } - if strings.Contains(ldFlags, afdoLtoLdFlag) { - t.Errorf("Expected host 'libTest' to not enable afdo, but found %q in ldflags %q", afdoLtoLdFlag, ldFlags) + if runtime.GOOS != "darwin" { + ldFlags := libTestHost.Rule("ld").Args["ldFlags"] + if !strings.Contains(ldFlags, noAfdoLtoLdFlag) { + t.Errorf("Expected host 'libTest' to not enable afdo, but did not find %q in ldflags %q", noAfdoLtoLdFlag, ldFlags) + } + if strings.Contains(ldFlags, afdoLtoLdFlag) { + t.Errorf("Expected host 'libTest' to not enable afdo, but found %q in ldflags %q", afdoLtoLdFlag, ldFlags) + } } // Check dependency edge from afdo-enabled module to static deps