blob: b250ad1a1d82025596f5ae0f005b608442571243 [file] [log] [blame]
Yi Kongd5954a22022-01-26 17:36:26 +08001// Copyright 2022 Google Inc. All rights reserved.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15package cc
16
17import (
Liz Kammer8c8e8d52022-10-31 15:53:36 -040018 "strings"
Yi Kongd5954a22022-01-26 17:36:26 +080019 "testing"
20
21 "android/soong/android"
Liz Kammer8c8e8d52022-10-31 15:53:36 -040022
Yi Kongd5954a22022-01-26 17:36:26 +080023 "github.com/google/blueprint"
24)
25
Liz Kammer8c8e8d52022-10-31 15:53:36 -040026type visitDirectDepsInterface interface {
27 VisitDirectDeps(blueprint.Module, func(dep blueprint.Module))
28}
29
30func hasDirectDep(ctx visitDirectDepsInterface, m android.Module, wantDep android.Module) bool {
31 var found bool
32 ctx.VisitDirectDeps(m, func(dep blueprint.Module) {
33 if dep == wantDep {
34 found = true
35 }
36 })
37 return found
38}
39
Yi Kongd5954a22022-01-26 17:36:26 +080040func TestAfdoDeps(t *testing.T) {
Liz Kammer7c5d1592022-10-31 16:27:38 -040041 t.Parallel()
Yi Kongd5954a22022-01-26 17:36:26 +080042 bp := `
Liz Kammer8c8e8d52022-10-31 15:53:36 -040043 cc_library_shared {
Yi Kongd5954a22022-01-26 17:36:26 +080044 name: "libTest",
Liz Kammer8c8e8d52022-10-31 15:53:36 -040045 srcs: ["test.c"],
Yi Kongd5954a22022-01-26 17:36:26 +080046 static_libs: ["libFoo"],
47 afdo: true,
48 }
49
Liz Kammer8c8e8d52022-10-31 15:53:36 -040050 cc_library_static {
Yi Kongd5954a22022-01-26 17:36:26 +080051 name: "libFoo",
Liz Kammer8c8e8d52022-10-31 15:53:36 -040052 srcs: ["foo.c"],
Yi Kongd5954a22022-01-26 17:36:26 +080053 static_libs: ["libBar"],
54 }
55
Liz Kammer8c8e8d52022-10-31 15:53:36 -040056 cc_library_static {
Yi Kongd5954a22022-01-26 17:36:26 +080057 name: "libBar",
Liz Kammer8c8e8d52022-10-31 15:53:36 -040058 srcs: ["bar.c"],
Yi Kongd5954a22022-01-26 17:36:26 +080059 }
60 `
Yi Kongd5954a22022-01-26 17:36:26 +080061
62 result := android.GroupFixturePreparers(
Vinh Trancde10162023-03-09 22:07:19 -050063 PrepareForTestWithFdoProfile,
Yi Kongd5954a22022-01-26 17:36:26 +080064 prepareForCcTest,
Vinh Tran44cb78c2023-03-09 22:07:19 -050065 android.FixtureAddTextFile("afdo_profiles_package/libTest.afdo", ""),
66 android.FixtureModifyProductVariables(func(variables android.FixtureProductVariables) {
67 variables.AfdoProfiles = []string{
68 "libTest://afdo_profiles_package:libTest_afdo",
69 }
70 }),
71 android.MockFS{
72 "afdo_profiles_package/Android.bp": []byte(`
73 fdo_profile {
74 name: "libTest_afdo",
75 profile: "libTest.afdo",
76 }
77 `),
78 }.AddToFixture(),
Yi Kongd5954a22022-01-26 17:36:26 +080079 ).RunTestWithBp(t, bp)
80
Vinh Tran44cb78c2023-03-09 22:07:19 -050081 expectedCFlag := "-fprofile-sample-use=afdo_profiles_package/libTest.afdo"
Yi Kongd5954a22022-01-26 17:36:26 +080082
Vinh Tran44cb78c2023-03-09 22:07:19 -050083 libTest := result.ModuleForTests("libTest", "android_arm64_armv8-a_shared")
84 libFooAfdoVariant := result.ModuleForTests("libFoo", "android_arm64_armv8-a_static_afdo-libTest")
85 libBarAfdoVariant := result.ModuleForTests("libBar", "android_arm64_armv8-a_static_afdo-libTest")
86
87 // Check cFlags of afdo-enabled module and the afdo-variant of its static deps
88 cFlags := libTest.Rule("cc").Args["cFlags"]
89 if !strings.Contains(cFlags, expectedCFlag) {
90 t.Errorf("Expected 'libTest' to enable afdo, but did not find %q in cflags %q", expectedCFlag, cFlags)
91 }
92
93 cFlags = libFooAfdoVariant.Rule("cc").Args["cFlags"]
94 if !strings.Contains(cFlags, expectedCFlag) {
95 t.Errorf("Expected 'libFooAfdoVariant' to enable afdo, but did not find %q in cflags %q", expectedCFlag, cFlags)
96 }
97
98 cFlags = libBarAfdoVariant.Rule("cc").Args["cFlags"]
99 if !strings.Contains(cFlags, expectedCFlag) {
100 t.Errorf("Expected 'libBarAfdoVariant' to enable afdo, but did not find %q in cflags %q", expectedCFlag, cFlags)
101 }
102
103 // Check dependency edge from afdo-enabled module to static deps
104 if !hasDirectDep(result, libTest.Module(), libFooAfdoVariant.Module()) {
Yi Kongd5954a22022-01-26 17:36:26 +0800105 t.Errorf("libTest missing dependency on afdo variant of libFoo")
106 }
107
Vinh Tran44cb78c2023-03-09 22:07:19 -0500108 if !hasDirectDep(result, libFooAfdoVariant.Module(), libBarAfdoVariant.Module()) {
Yi Kongd5954a22022-01-26 17:36:26 +0800109 t.Errorf("libTest missing dependency on afdo variant of libBar")
110 }
Liz Kammer8c8e8d52022-10-31 15:53:36 -0400111
Vinh Tran44cb78c2023-03-09 22:07:19 -0500112 // Verify non-afdo variant exists and doesn't contain afdo
113 libFoo := result.ModuleForTests("libFoo", "android_arm64_armv8-a_static")
114 libBar := result.ModuleForTests("libBar", "android_arm64_armv8-a_static")
Liz Kammer8c8e8d52022-10-31 15:53:36 -0400115
116 cFlags = libFoo.Rule("cc").Args["cFlags"]
Vinh Tran44cb78c2023-03-09 22:07:19 -0500117 if strings.Contains(cFlags, expectedCFlag) {
118 t.Errorf("Expected 'libFoo' to not enable afdo, but found %q in cflags %q", expectedCFlag, cFlags)
119 }
120 cFlags = libBar.Rule("cc").Args["cFlags"]
121 if strings.Contains(cFlags, expectedCFlag) {
122 t.Errorf("Expected 'libBar' to not enable afdo, but found %q in cflags %q", expectedCFlag, cFlags)
Liz Kammer8c8e8d52022-10-31 15:53:36 -0400123 }
124
Vinh Tran44cb78c2023-03-09 22:07:19 -0500125 // Check dependency edges of static deps
126 if hasDirectDep(result, libTest.Module(), libFoo.Module()) {
127 t.Errorf("libTest should not depend on non-afdo variant of libFoo")
128 }
129
130 if !hasDirectDep(result, libFoo.Module(), libBar.Module()) {
131 t.Errorf("libFoo missing dependency on non-afdo variant of libBar")
Liz Kammer8c8e8d52022-10-31 15:53:36 -0400132 }
133}
134
135func TestAfdoEnabledOnStaticDepNoAfdo(t *testing.T) {
Liz Kammer7c5d1592022-10-31 16:27:38 -0400136 t.Parallel()
Liz Kammer8c8e8d52022-10-31 15:53:36 -0400137 bp := `
138 cc_library_shared {
139 name: "libTest",
140 srcs: ["foo.c"],
141 static_libs: ["libFoo"],
142 }
143
144 cc_library_static {
145 name: "libFoo",
146 srcs: ["foo.c"],
147 static_libs: ["libBar"],
148 afdo: true, // TODO(b/256670524): remove support for enabling afdo from static only libraries, this can only propagate from shared libraries/binaries
149 }
150
151 cc_library_static {
152 name: "libBar",
153 }
154 `
Liz Kammer8c8e8d52022-10-31 15:53:36 -0400155
156 result := android.GroupFixturePreparers(
157 prepareForCcTest,
Vinh Trancde10162023-03-09 22:07:19 -0500158 PrepareForTestWithFdoProfile,
Vinh Tran44cb78c2023-03-09 22:07:19 -0500159 android.FixtureAddTextFile("toolchain/pgo-profiles/sampling/libFoo.afdo", ""),
160 android.MockFS{
161 "afdo_profiles_package/Android.bp": []byte(`
162 soong_namespace {
163 }
164 fdo_profile {
165 name: "libFoo_afdo",
166 profile: "libFoo.afdo",
167 }
168 `),
169 }.AddToFixture(),
Liz Kammer8c8e8d52022-10-31 15:53:36 -0400170 ).RunTestWithBp(t, bp)
171
172 libTest := result.ModuleForTests("libTest", "android_arm64_armv8-a_shared").Module()
173 libFoo := result.ModuleForTests("libFoo", "android_arm64_armv8-a_static")
174 libBar := result.ModuleForTests("libBar", "android_arm64_armv8-a_static").Module()
175
176 if !hasDirectDep(result, libTest, libFoo.Module()) {
177 t.Errorf("libTest missing dependency on afdo variant of libFoo")
178 }
179
180 if !hasDirectDep(result, libFoo.Module(), libBar) {
181 t.Errorf("libFoo missing dependency on afdo variant of libBar")
182 }
183
184 fooVariants := result.ModuleVariantsForTests("foo")
185 for _, v := range fooVariants {
186 if strings.Contains(v, "afdo-") {
187 t.Errorf("Expected no afdo variant of 'foo', got %q", v)
188 }
189 }
190
191 cFlags := libFoo.Rule("cc").Args["cFlags"]
192 if w := "-fprofile-sample-accurate"; strings.Contains(cFlags, w) {
193 t.Errorf("Expected 'foo' to not enable afdo, but found %q in cflags %q", w, cFlags)
194 }
195
196 barVariants := result.ModuleVariantsForTests("bar")
197 for _, v := range barVariants {
198 if strings.Contains(v, "afdo-") {
199 t.Errorf("Expected no afdo variant of 'bar', got %q", v)
200 }
201 }
Yi Kongd5954a22022-01-26 17:36:26 +0800202}
Vinh Tran9c6080c2022-12-05 14:55:38 -0500203
204func TestAfdoEnabledWithRuntimeDepNoAfdo(t *testing.T) {
205 bp := `
206 cc_library {
207 name: "libTest",
208 srcs: ["foo.c"],
209 runtime_libs: ["libFoo"],
210 afdo: true,
211 }
212
213 cc_library {
214 name: "libFoo",
215 }
216 `
Vinh Tran9c6080c2022-12-05 14:55:38 -0500217
218 result := android.GroupFixturePreparers(
219 prepareForCcTest,
Vinh Trancde10162023-03-09 22:07:19 -0500220 PrepareForTestWithFdoProfile,
Vinh Tran44cb78c2023-03-09 22:07:19 -0500221 android.FixtureAddTextFile("afdo_profiles_package/libTest.afdo", ""),
222 android.FixtureModifyProductVariables(func(variables android.FixtureProductVariables) {
223 variables.AfdoProfiles = []string{
224 "libTest://afdo_profiles_package:libTest_afdo",
225 }
226 }),
227 android.MockFS{
228 "afdo_profiles_package/Android.bp": []byte(`
229 fdo_profile {
230 name: "libTest_afdo",
231 profile: "libTest.afdo",
232 }
233 `),
234 }.AddToFixture(),
Vinh Tran9c6080c2022-12-05 14:55:38 -0500235 ).RunTestWithBp(t, bp)
236
237 libFooVariants := result.ModuleVariantsForTests("libFoo")
238 for _, v := range libFooVariants {
239 if strings.Contains(v, "afdo-") {
240 t.Errorf("Expected no afdo variant of 'foo', got %q", v)
241 }
242 }
243}
Vinh Tran2e7b0fd2023-03-27 11:30:19 -0400244
245func TestAfdoEnabledWithMultiArchs(t *testing.T) {
Vinh Tran2e7b0fd2023-03-27 11:30:19 -0400246 bp := `
247 cc_library_shared {
248 name: "foo",
249 srcs: ["test.c"],
250 afdo: true,
251 compile_multilib: "both",
252 }
253`
254 result := android.GroupFixturePreparers(
Vinh Trancde10162023-03-09 22:07:19 -0500255 PrepareForTestWithFdoProfile,
Vinh Tran2e7b0fd2023-03-27 11:30:19 -0400256 prepareForCcTest,
Vinh Tran44cb78c2023-03-09 22:07:19 -0500257 android.FixtureAddTextFile("afdo_profiles_package/foo_arm.afdo", ""),
258 android.FixtureAddTextFile("afdo_profiles_package/foo_arm64.afdo", ""),
259 android.FixtureModifyProductVariables(func(variables android.FixtureProductVariables) {
260 variables.AfdoProfiles = []string{
261 "foo://afdo_profiles_package:foo_afdo",
262 }
263 }),
264 android.MockFS{
265 "afdo_profiles_package/Android.bp": []byte(`
266 soong_namespace {
267 }
268 fdo_profile {
269 name: "foo_afdo",
270 arch: {
271 arm: {
272 profile: "foo_arm.afdo",
273 },
274 arm64: {
275 profile: "foo_arm64.afdo",
276 }
277 }
278 }
279 `),
280 }.AddToFixture(),
Vinh Tran2e7b0fd2023-03-27 11:30:19 -0400281 ).RunTestWithBp(t, bp)
282
283 fooArm := result.ModuleForTests("foo", "android_arm_armv7-a-neon_shared")
284 fooArmCFlags := fooArm.Rule("cc").Args["cFlags"]
Vinh Tran44cb78c2023-03-09 22:07:19 -0500285 if w := "-fprofile-sample-use=afdo_profiles_package/foo_arm.afdo"; !strings.Contains(fooArmCFlags, w) {
Vinh Tran2e7b0fd2023-03-27 11:30:19 -0400286 t.Errorf("Expected 'foo' to enable afdo, but did not find %q in cflags %q", w, fooArmCFlags)
287 }
288
289 fooArm64 := result.ModuleForTests("foo", "android_arm64_armv8-a_shared")
290 fooArm64CFlags := fooArm64.Rule("cc").Args["cFlags"]
Vinh Tran44cb78c2023-03-09 22:07:19 -0500291 if w := "-fprofile-sample-use=afdo_profiles_package/foo_arm64.afdo"; !strings.Contains(fooArm64CFlags, w) {
Vinh Tran2e7b0fd2023-03-27 11:30:19 -0400292 t.Errorf("Expected 'foo' to enable afdo, but did not find %q in cflags %q", w, fooArm64CFlags)
293 }
294}
295
296func TestMultipleAfdoRDeps(t *testing.T) {
297 t.Parallel()
298 bp := `
299 cc_library_shared {
300 name: "libTest",
301 srcs: ["test.c"],
302 static_libs: ["libFoo"],
303 afdo: true,
304 }
305
306 cc_library_shared {
307 name: "libBar",
308 srcs: ["bar.c"],
309 static_libs: ["libFoo"],
310 afdo: true,
311 }
312
313 cc_library_static {
314 name: "libFoo",
315 srcs: ["foo.c"],
316 }
317 `
318
319 result := android.GroupFixturePreparers(
Vinh Trancde10162023-03-09 22:07:19 -0500320 PrepareForTestWithFdoProfile,
Vinh Tran2e7b0fd2023-03-27 11:30:19 -0400321 prepareForCcTest,
Vinh Tran44cb78c2023-03-09 22:07:19 -0500322 android.FixtureAddTextFile("afdo_profiles_package/libTest.afdo", ""),
323 android.FixtureAddTextFile("afdo_profiles_package/libBar.afdo", ""),
324 android.FixtureModifyProductVariables(func(variables android.FixtureProductVariables) {
325 variables.AfdoProfiles = []string{
326 "libTest://afdo_profiles_package:libTest_afdo",
327 "libBar://afdo_profiles_package:libBar_afdo",
328 }
329 }),
330 android.MockFS{
331 "afdo_profiles_package/Android.bp": []byte(`
332 fdo_profile {
333 name: "libTest_afdo",
334 profile: "libTest.afdo",
335 }
336 fdo_profile {
337 name: "libBar_afdo",
338 profile: "libBar.afdo",
339 }
340 `),
341 }.AddToFixture(),
Vinh Tran2e7b0fd2023-03-27 11:30:19 -0400342 ).RunTestWithBp(t, bp)
343
Vinh Tran44cb78c2023-03-09 22:07:19 -0500344 expectedCFlagLibTest := "-fprofile-sample-use=afdo_profiles_package/libTest.afdo"
345 expectedCFlagLibBar := "-fprofile-sample-use=afdo_profiles_package/libBar.afdo"
Vinh Tran2e7b0fd2023-03-27 11:30:19 -0400346
347 libTest := result.ModuleForTests("libTest", "android_arm64_armv8-a_shared")
Vinh Tran44cb78c2023-03-09 22:07:19 -0500348 libFooAfdoVariantWithLibTest := result.ModuleForTests("libFoo", "android_arm64_armv8-a_static_afdo-libTest")
Vinh Tran2e7b0fd2023-03-27 11:30:19 -0400349
350 libBar := result.ModuleForTests("libBar", "android_arm64_armv8-a_shared")
Vinh Tran44cb78c2023-03-09 22:07:19 -0500351 libFooAfdoVariantWithLibBar := result.ModuleForTests("libFoo", "android_arm64_armv8-a_static_afdo-libBar")
Vinh Tran2e7b0fd2023-03-27 11:30:19 -0400352
Vinh Tran44cb78c2023-03-09 22:07:19 -0500353 // Check cFlags of afdo-enabled module and the afdo-variant of its static deps
Vinh Tran2e7b0fd2023-03-27 11:30:19 -0400354 cFlags := libTest.Rule("cc").Args["cFlags"]
355 if !strings.Contains(cFlags, expectedCFlagLibTest) {
356 t.Errorf("Expected 'libTest' to enable afdo, but did not find %q in cflags %q", expectedCFlagLibTest, cFlags)
357 }
358 cFlags = libBar.Rule("cc").Args["cFlags"]
359 if !strings.Contains(cFlags, expectedCFlagLibBar) {
Vinh Tran44cb78c2023-03-09 22:07:19 -0500360 t.Errorf("Expected 'libTest' to enable afdo, but did not find %q in cflags %q", expectedCFlagLibBar, cFlags)
Vinh Tran2e7b0fd2023-03-27 11:30:19 -0400361 }
362
Vinh Tran44cb78c2023-03-09 22:07:19 -0500363 cFlags = libFooAfdoVariantWithLibTest.Rule("cc").Args["cFlags"]
Vinh Tran2e7b0fd2023-03-27 11:30:19 -0400364 if !strings.Contains(cFlags, expectedCFlagLibTest) {
Vinh Tran44cb78c2023-03-09 22:07:19 -0500365 t.Errorf("Expected 'libFooAfdoVariantWithLibTest' to enable afdo, but did not find %q in cflags %q", expectedCFlagLibTest, cFlags)
Vinh Tran2e7b0fd2023-03-27 11:30:19 -0400366 }
367
Vinh Tran44cb78c2023-03-09 22:07:19 -0500368 cFlags = libFooAfdoVariantWithLibBar.Rule("cc").Args["cFlags"]
Vinh Tran2e7b0fd2023-03-27 11:30:19 -0400369 if !strings.Contains(cFlags, expectedCFlagLibBar) {
Vinh Tran44cb78c2023-03-09 22:07:19 -0500370 t.Errorf("Expected 'libBarAfdoVariant' to enable afdo, but did not find %q in cflags %q", expectedCFlagLibBar, cFlags)
Vinh Tran2e7b0fd2023-03-27 11:30:19 -0400371 }
372
373 // Check dependency edges of static deps
Vinh Tran44cb78c2023-03-09 22:07:19 -0500374 if !hasDirectDep(result, libTest.Module(), libFooAfdoVariantWithLibTest.Module()) {
Vinh Tran2e7b0fd2023-03-27 11:30:19 -0400375 t.Errorf("libTest missing dependency on afdo variant of libFoo")
376 }
377
Vinh Tran44cb78c2023-03-09 22:07:19 -0500378 if !hasDirectDep(result, libBar.Module(), libFooAfdoVariantWithLibBar.Module()) {
379 t.Errorf("libFoo missing dependency on non-afdo variant of libBar")
Vinh Tran2e7b0fd2023-03-27 11:30:19 -0400380 }
381}
Yabin Cui01c44562023-04-20 14:07:29 -0700382
383func TestAfdoDepsWithoutProfile(t *testing.T) {
384 t.Parallel()
385 bp := `
386 cc_library_shared {
387 name: "libTest",
388 srcs: ["test.c"],
389 static_libs: ["libFoo"],
390 afdo: true,
391 }
392
393 cc_library_static {
394 name: "libFoo",
395 srcs: ["foo.c"],
396 static_libs: ["libBar"],
397 }
398
399 cc_library_static {
400 name: "libBar",
401 srcs: ["bar.c"],
402 }
403 `
404
405 result := android.GroupFixturePreparers(
406 PrepareForTestWithFdoProfile,
407 prepareForCcTest,
408 ).RunTestWithBp(t, bp)
409
410 // Even without a profile path, the afdo enabled libraries should be built with
411 // -funique-internal-linkage-names.
412 expectedCFlag := "-funique-internal-linkage-names"
413
414 libTest := result.ModuleForTests("libTest", "android_arm64_armv8-a_shared")
415 libFooAfdoVariant := result.ModuleForTests("libFoo", "android_arm64_armv8-a_static_afdo-libTest")
416 libBarAfdoVariant := result.ModuleForTests("libBar", "android_arm64_armv8-a_static_afdo-libTest")
417
418 // Check cFlags of afdo-enabled module and the afdo-variant of its static deps
419 cFlags := libTest.Rule("cc").Args["cFlags"]
420 if !strings.Contains(cFlags, expectedCFlag) {
421 t.Errorf("Expected 'libTest' to enable afdo, but did not find %q in cflags %q", expectedCFlag, cFlags)
422 }
423
424 cFlags = libFooAfdoVariant.Rule("cc").Args["cFlags"]
425 if !strings.Contains(cFlags, expectedCFlag) {
426 t.Errorf("Expected 'libFooAfdoVariant' to enable afdo, but did not find %q in cflags %q", expectedCFlag, cFlags)
427 }
428
429 cFlags = libBarAfdoVariant.Rule("cc").Args["cFlags"]
430 if !strings.Contains(cFlags, expectedCFlag) {
431 t.Errorf("Expected 'libBarAfdoVariant' to enable afdo, but did not find %q in cflags %q", expectedCFlag, cFlags)
432 }
433 // Check dependency edge from afdo-enabled module to static deps
434 if !hasDirectDep(result, libTest.Module(), libFooAfdoVariant.Module()) {
435 t.Errorf("libTest missing dependency on afdo variant of libFoo")
436 }
437
438 if !hasDirectDep(result, libFooAfdoVariant.Module(), libBarAfdoVariant.Module()) {
439 t.Errorf("libTest missing dependency on afdo variant of libBar")
440 }
441
442 // Verify non-afdo variant exists and doesn't contain afdo
443 libFoo := result.ModuleForTests("libFoo", "android_arm64_armv8-a_static")
444 libBar := result.ModuleForTests("libBar", "android_arm64_armv8-a_static")
445
446 cFlags = libFoo.Rule("cc").Args["cFlags"]
447 if strings.Contains(cFlags, expectedCFlag) {
448 t.Errorf("Expected 'libFoo' to not enable afdo, but found %q in cflags %q", expectedCFlag, cFlags)
449 }
450 cFlags = libBar.Rule("cc").Args["cFlags"]
451 if strings.Contains(cFlags, expectedCFlag) {
452 t.Errorf("Expected 'libBar' to not enable afdo, but found %q in cflags %q", expectedCFlag, cFlags)
453 }
454
455 // Check dependency edges of static deps
456 if hasDirectDep(result, libTest.Module(), libFoo.Module()) {
457 t.Errorf("libTest should not depend on non-afdo variant of libFoo")
458 }
459
460 if !hasDirectDep(result, libFoo.Module(), libBar.Module()) {
461 t.Errorf("libFoo missing dependency on non-afdo variant of libBar")
462 }
463}