blob: dab5bb80407a05bb6cf7283ef4b55d4c641bd08c [file] [log] [blame]
Colin Crossad59e752017-11-16 14:29:11 -08001// Copyright 2017 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 (
18 "reflect"
19 "testing"
Jooyung Hanaed150d2020-04-02 01:41:41 +090020
21 "android/soong/android"
Chris Parsons94a0bba2021-06-04 15:03:47 -040022 "android/soong/bazel/cquery"
Colin Crossad59e752017-11-16 14:29:11 -080023)
24
25func TestLibraryReuse(t *testing.T) {
Liz Kammer7c5d1592022-10-31 16:27:38 -040026 t.Parallel()
Colin Crossad59e752017-11-16 14:29:11 -080027 t.Run("simple", func(t *testing.T) {
28 ctx := testCc(t, `
29 cc_library {
30 name: "libfoo",
Pete Bentleyfcf55bf2019-08-16 20:14:32 +010031 srcs: ["foo.c", "baz.o"],
Colin Crossad59e752017-11-16 14:29:11 -080032 }`)
33
Colin Cross7113d202019-11-20 16:39:12 -080034 libfooShared := ctx.ModuleForTests("libfoo", "android_arm_armv7-a-neon_shared").Rule("ld")
35 libfooStatic := ctx.ModuleForTests("libfoo", "android_arm_armv7-a-neon_static").Output("libfoo.a")
Colin Crossad59e752017-11-16 14:29:11 -080036
Pete Bentleyfcf55bf2019-08-16 20:14:32 +010037 if len(libfooShared.Inputs) != 2 {
Colin Crossad59e752017-11-16 14:29:11 -080038 t.Fatalf("unexpected inputs to libfoo shared: %#v", libfooShared.Inputs.Strings())
39 }
40
Pete Bentleyfcf55bf2019-08-16 20:14:32 +010041 if len(libfooStatic.Inputs) != 2 {
Colin Crossad59e752017-11-16 14:29:11 -080042 t.Fatalf("unexpected inputs to libfoo static: %#v", libfooStatic.Inputs.Strings())
43 }
44
45 if libfooShared.Inputs[0] != libfooStatic.Inputs[0] {
46 t.Errorf("static object not reused for shared library")
47 }
Pete Bentleyfcf55bf2019-08-16 20:14:32 +010048 if libfooShared.Inputs[1] != libfooStatic.Inputs[1] {
49 t.Errorf("static object not reused for shared library")
50 }
Colin Crossad59e752017-11-16 14:29:11 -080051 })
52
53 t.Run("extra static source", func(t *testing.T) {
54 ctx := testCc(t, `
55 cc_library {
56 name: "libfoo",
57 srcs: ["foo.c"],
58 static: {
59 srcs: ["bar.c"]
60 },
61 }`)
62
Colin Cross7113d202019-11-20 16:39:12 -080063 libfooShared := ctx.ModuleForTests("libfoo", "android_arm_armv7-a-neon_shared").Rule("ld")
64 libfooStatic := ctx.ModuleForTests("libfoo", "android_arm_armv7-a-neon_static").Output("libfoo.a")
Colin Crossad59e752017-11-16 14:29:11 -080065
66 if len(libfooShared.Inputs) != 1 {
67 t.Fatalf("unexpected inputs to libfoo shared: %#v", libfooShared.Inputs.Strings())
68 }
69
70 if len(libfooStatic.Inputs) != 2 {
71 t.Fatalf("unexpected inputs to libfoo static: %#v", libfooStatic.Inputs.Strings())
72 }
73
74 if libfooShared.Inputs[0] != libfooStatic.Inputs[0] {
75 t.Errorf("static object not reused for shared library")
76 }
77 })
78
79 t.Run("extra shared source", func(t *testing.T) {
80 ctx := testCc(t, `
81 cc_library {
82 name: "libfoo",
83 srcs: ["foo.c"],
84 shared: {
85 srcs: ["bar.c"]
86 },
87 }`)
88
Colin Cross7113d202019-11-20 16:39:12 -080089 libfooShared := ctx.ModuleForTests("libfoo", "android_arm_armv7-a-neon_shared").Rule("ld")
90 libfooStatic := ctx.ModuleForTests("libfoo", "android_arm_armv7-a-neon_static").Output("libfoo.a")
Colin Crossad59e752017-11-16 14:29:11 -080091
92 if len(libfooShared.Inputs) != 2 {
93 t.Fatalf("unexpected inputs to libfoo shared: %#v", libfooShared.Inputs.Strings())
94 }
95
96 if len(libfooStatic.Inputs) != 1 {
97 t.Fatalf("unexpected inputs to libfoo static: %#v", libfooStatic.Inputs.Strings())
98 }
99
100 if libfooShared.Inputs[0] != libfooStatic.Inputs[0] {
101 t.Errorf("static object not reused for shared library")
102 }
103 })
104
105 t.Run("extra static cflags", func(t *testing.T) {
106 ctx := testCc(t, `
107 cc_library {
108 name: "libfoo",
109 srcs: ["foo.c"],
110 static: {
111 cflags: ["-DFOO"],
112 },
113 }`)
114
Colin Cross7113d202019-11-20 16:39:12 -0800115 libfooShared := ctx.ModuleForTests("libfoo", "android_arm_armv7-a-neon_shared").Rule("ld")
116 libfooStatic := ctx.ModuleForTests("libfoo", "android_arm_armv7-a-neon_static").Output("libfoo.a")
Colin Crossad59e752017-11-16 14:29:11 -0800117
118 if len(libfooShared.Inputs) != 1 {
119 t.Fatalf("unexpected inputs to libfoo shared: %#v", libfooShared.Inputs.Strings())
120 }
121
122 if len(libfooStatic.Inputs) != 1 {
123 t.Fatalf("unexpected inputs to libfoo static: %#v", libfooStatic.Inputs.Strings())
124 }
125
126 if libfooShared.Inputs[0] == libfooStatic.Inputs[0] {
127 t.Errorf("static object reused for shared library when it shouldn't be")
128 }
129 })
130
131 t.Run("extra shared cflags", func(t *testing.T) {
132 ctx := testCc(t, `
133 cc_library {
134 name: "libfoo",
135 srcs: ["foo.c"],
136 shared: {
137 cflags: ["-DFOO"],
138 },
139 }`)
140
Colin Cross7113d202019-11-20 16:39:12 -0800141 libfooShared := ctx.ModuleForTests("libfoo", "android_arm_armv7-a-neon_shared").Rule("ld")
142 libfooStatic := ctx.ModuleForTests("libfoo", "android_arm_armv7-a-neon_static").Output("libfoo.a")
Colin Crossad59e752017-11-16 14:29:11 -0800143
144 if len(libfooShared.Inputs) != 1 {
145 t.Fatalf("unexpected inputs to libfoo shared: %#v", libfooShared.Inputs.Strings())
146 }
147
148 if len(libfooStatic.Inputs) != 1 {
149 t.Fatalf("unexpected inputs to libfoo static: %#v", libfooStatic.Inputs.Strings())
150 }
151
152 if libfooShared.Inputs[0] == libfooStatic.Inputs[0] {
153 t.Errorf("static object reused for shared library when it shouldn't be")
154 }
155 })
156
157 t.Run("global cflags for reused generated sources", func(t *testing.T) {
158 ctx := testCc(t, `
159 cc_library {
160 name: "libfoo",
161 srcs: [
162 "foo.c",
163 "a.proto",
164 ],
165 shared: {
166 srcs: [
167 "bar.c",
168 ],
169 },
170 }`)
171
Colin Cross7113d202019-11-20 16:39:12 -0800172 libfooShared := ctx.ModuleForTests("libfoo", "android_arm_armv7-a-neon_shared").Rule("ld")
173 libfooStatic := ctx.ModuleForTests("libfoo", "android_arm_armv7-a-neon_static").Output("libfoo.a")
Colin Crossad59e752017-11-16 14:29:11 -0800174
175 if len(libfooShared.Inputs) != 3 {
176 t.Fatalf("unexpected inputs to libfoo shared: %#v", libfooShared.Inputs.Strings())
177 }
178
179 if len(libfooStatic.Inputs) != 2 {
180 t.Fatalf("unexpected inputs to libfoo static: %#v", libfooStatic.Inputs.Strings())
181 }
182
183 if !reflect.DeepEqual(libfooShared.Inputs[0:2].Strings(), libfooStatic.Inputs.Strings()) {
184 t.Errorf("static objects not reused for shared library")
185 }
186
Colin Cross7113d202019-11-20 16:39:12 -0800187 libfoo := ctx.ModuleForTests("libfoo", "android_arm_armv7-a-neon_shared").Module().(*Module)
Colin Cross4af21ed2019-11-04 09:37:55 -0800188 if !inList("-DGOOGLE_PROTOBUF_NO_RTTI", libfoo.flags.Local.CFlags) {
Colin Crossad59e752017-11-16 14:29:11 -0800189 t.Errorf("missing protobuf cflags")
190 }
191 })
192}
Jooyung Hanaed150d2020-04-02 01:41:41 +0900193
194func TestStubsVersions(t *testing.T) {
Liz Kammer7c5d1592022-10-31 16:27:38 -0400195 t.Parallel()
Jooyung Hanaed150d2020-04-02 01:41:41 +0900196 bp := `
197 cc_library {
198 name: "libfoo",
199 srcs: ["foo.c"],
200 stubs: {
Dan Albertc8060532020-07-22 22:32:17 -0700201 versions: ["29", "R", "current"],
Jooyung Hanaed150d2020-04-02 01:41:41 +0900202 },
203 }
204 `
Paul Duffinc3e6ce02021-03-22 23:21:32 +0000205 config := TestConfig(t.TempDir(), android.Android, nil, bp, nil)
Jooyung Hanaed150d2020-04-02 01:41:41 +0900206 config.TestProductVariables.Platform_version_active_codenames = []string{"R"}
207 ctx := testCcWithConfig(t, config)
208
209 variants := ctx.ModuleVariantsForTests("libfoo")
Dan Albertc8060532020-07-22 22:32:17 -0700210 for _, expectedVer := range []string{"29", "R", "current"} {
Jooyung Hanaed150d2020-04-02 01:41:41 +0900211 expectedVariant := "android_arm_armv7-a-neon_shared_" + expectedVer
212 if !inList(expectedVariant, variants) {
213 t.Errorf("missing expected variant: %q", expectedVariant)
214 }
215 }
216}
217
218func TestStubsVersions_NotSorted(t *testing.T) {
Liz Kammer7c5d1592022-10-31 16:27:38 -0400219 t.Parallel()
Jooyung Hanaed150d2020-04-02 01:41:41 +0900220 bp := `
221 cc_library {
222 name: "libfoo",
223 srcs: ["foo.c"],
224 stubs: {
Dan Albertc8060532020-07-22 22:32:17 -0700225 versions: ["29", "current", "R"],
Jooyung Hanaed150d2020-04-02 01:41:41 +0900226 },
227 }
228 `
Paul Duffinc3e6ce02021-03-22 23:21:32 +0000229 config := TestConfig(t.TempDir(), android.Android, nil, bp, nil)
Jooyung Hanaed150d2020-04-02 01:41:41 +0900230 config.TestProductVariables.Platform_version_active_codenames = []string{"R"}
231 testCcErrorWithConfig(t, `"libfoo" .*: versions: not sorted`, config)
232}
233
234func TestStubsVersions_ParseError(t *testing.T) {
Liz Kammer7c5d1592022-10-31 16:27:38 -0400235 t.Parallel()
Jooyung Hanaed150d2020-04-02 01:41:41 +0900236 bp := `
237 cc_library {
238 name: "libfoo",
239 srcs: ["foo.c"],
240 stubs: {
Dan Albertc8060532020-07-22 22:32:17 -0700241 versions: ["29", "current", "X"],
Jooyung Hanaed150d2020-04-02 01:41:41 +0900242 },
243 }
244 `
245
Dan Albertc8060532020-07-22 22:32:17 -0700246 testCcError(t, `"libfoo" .*: versions: "X" could not be parsed as an integer and is not a recognized codename`, bp)
Jooyung Hanaed150d2020-04-02 01:41:41 +0900247}
Chris Parsons94a0bba2021-06-04 15:03:47 -0400248
249func TestCcLibraryWithBazel(t *testing.T) {
Liz Kammer7c5d1592022-10-31 16:27:38 -0400250 t.Parallel()
Chris Parsons94a0bba2021-06-04 15:03:47 -0400251 bp := `
252cc_library {
253 name: "foo",
254 srcs: ["foo.cc"],
255 bazel_module: { label: "//foo/bar:bar" },
256}`
257 config := TestConfig(t.TempDir(), android.Android, nil, bp, nil)
258 config.BazelContext = android.MockBazelContext{
259 OutputBaseDir: "outputbase",
260 LabelToCcInfo: map[string]cquery.CcInfo{
261 "//foo/bar:bar": cquery.CcInfo{
262 CcObjectFiles: []string{"foo.o"},
263 Includes: []string{"include"},
264 SystemIncludes: []string{"system_include"},
Liz Kammereb2d6d12021-12-06 14:56:25 -0500265 Headers: []string{"foo.h"},
Chris Parsons94a0bba2021-06-04 15:03:47 -0400266 RootDynamicLibraries: []string{"foo.so"},
Sasha Smundakedd16662022-10-07 14:44:50 -0700267 UnstrippedOutput: "foo_unstripped.so",
Chris Parsons94a0bba2021-06-04 15:03:47 -0400268 },
Chris Parsons77acf2e2021-12-03 17:27:16 -0500269 "//foo/bar:bar_bp2build_cc_library_static": cquery.CcInfo{
270 CcObjectFiles: []string{"foo.o"},
271 Includes: []string{"include"},
272 SystemIncludes: []string{"system_include"},
Liz Kammereb2d6d12021-12-06 14:56:25 -0500273 Headers: []string{"foo.h"},
Chris Parsons77acf2e2021-12-03 17:27:16 -0500274 RootStaticArchives: []string{"foo.a"},
275 },
Chris Parsons94a0bba2021-06-04 15:03:47 -0400276 },
277 }
278 ctx := testCcWithConfig(t, config)
279
280 staticFoo := ctx.ModuleForTests("foo", "android_arm_armv7-a-neon_static").Module()
281 outputFiles, err := staticFoo.(android.OutputFileProducer).OutputFiles("")
282 if err != nil {
283 t.Errorf("Unexpected error getting cc_object outputfiles %s", err)
284 }
285
286 expectedOutputFiles := []string{"outputbase/execroot/__main__/foo.a"}
287 android.AssertDeepEquals(t, "output files", expectedOutputFiles, outputFiles.Strings())
288
Liz Kammereb2d6d12021-12-06 14:56:25 -0500289 flagExporter := ctx.ModuleProvider(staticFoo, FlagExporterInfoProvider).(FlagExporterInfo)
290 android.AssertPathsRelativeToTopEquals(t, "exported include dirs", []string{"outputbase/execroot/__main__/include"}, flagExporter.IncludeDirs)
291 android.AssertPathsRelativeToTopEquals(t, "exported system include dirs", []string{"outputbase/execroot/__main__/system_include"}, flagExporter.SystemIncludeDirs)
292 android.AssertPathsRelativeToTopEquals(t, "exported headers", []string{"outputbase/execroot/__main__/foo.h"}, flagExporter.GeneratedHeaders)
293 android.AssertPathsRelativeToTopEquals(t, "deps", []string{"outputbase/execroot/__main__/foo.h"}, flagExporter.Deps)
294
Chris Parsons94a0bba2021-06-04 15:03:47 -0400295 sharedFoo := ctx.ModuleForTests("foo", "android_arm_armv7-a-neon_shared").Module()
296 outputFiles, err = sharedFoo.(android.OutputFileProducer).OutputFiles("")
297 if err != nil {
Liz Kammereb2d6d12021-12-06 14:56:25 -0500298 t.Errorf("Unexpected error getting cc_library outputfiles %s", err)
Chris Parsons94a0bba2021-06-04 15:03:47 -0400299 }
300 expectedOutputFiles = []string{"outputbase/execroot/__main__/foo.so"}
301 android.AssertDeepEquals(t, "output files", expectedOutputFiles, outputFiles.Strings())
302
Sasha Smundakedd16662022-10-07 14:44:50 -0700303 android.AssertStringEquals(t, "unstripped shared library", "outputbase/execroot/__main__/foo_unstripped.so", sharedFoo.(*Module).linker.unstrippedOutputFilePath().String())
Liz Kammereb2d6d12021-12-06 14:56:25 -0500304 flagExporter = ctx.ModuleProvider(sharedFoo, FlagExporterInfoProvider).(FlagExporterInfo)
305 android.AssertPathsRelativeToTopEquals(t, "exported include dirs", []string{"outputbase/execroot/__main__/include"}, flagExporter.IncludeDirs)
306 android.AssertPathsRelativeToTopEquals(t, "exported system include dirs", []string{"outputbase/execroot/__main__/system_include"}, flagExporter.SystemIncludeDirs)
307 android.AssertPathsRelativeToTopEquals(t, "exported headers", []string{"outputbase/execroot/__main__/foo.h"}, flagExporter.GeneratedHeaders)
308 android.AssertPathsRelativeToTopEquals(t, "deps", []string{"outputbase/execroot/__main__/foo.h"}, flagExporter.Deps)
Chris Parsons94a0bba2021-06-04 15:03:47 -0400309}
Colin Cross59422382021-07-22 16:35:24 -0700310
311func TestLibraryVersionScript(t *testing.T) {
Liz Kammer7c5d1592022-10-31 16:27:38 -0400312 t.Parallel()
Colin Cross59422382021-07-22 16:35:24 -0700313 result := PrepareForIntegrationTestWithCc.RunTestWithBp(t, `
314 cc_library {
315 name: "libfoo",
316 srcs: ["foo.c"],
317 version_script: "foo.map.txt",
318 }`)
319
320 libfoo := result.ModuleForTests("libfoo", "android_arm64_armv8-a_shared").Rule("ld")
321
322 android.AssertStringListContains(t, "missing dependency on version_script",
323 libfoo.Implicits.Strings(), "foo.map.txt")
324 android.AssertStringDoesContain(t, "missing flag for version_script",
325 libfoo.Args["ldFlags"], "-Wl,--version-script,foo.map.txt")
326
327}
328
329func TestLibraryDynamicList(t *testing.T) {
Liz Kammer7c5d1592022-10-31 16:27:38 -0400330 t.Parallel()
Colin Cross59422382021-07-22 16:35:24 -0700331 result := PrepareForIntegrationTestWithCc.RunTestWithBp(t, `
332 cc_library {
333 name: "libfoo",
334 srcs: ["foo.c"],
335 dynamic_list: "foo.dynamic.txt",
336 }`)
337
338 libfoo := result.ModuleForTests("libfoo", "android_arm64_armv8-a_shared").Rule("ld")
339
340 android.AssertStringListContains(t, "missing dependency on dynamic_list",
341 libfoo.Implicits.Strings(), "foo.dynamic.txt")
342 android.AssertStringDoesContain(t, "missing flag for dynamic_list",
343 libfoo.Args["ldFlags"], "-Wl,--dynamic-list,foo.dynamic.txt")
344
345}
Alex Márquez Pérez Muñíz Díaz Púras Thaureauxbc4e7342021-09-14 20:58:25 +0000346
347func TestCcLibrarySharedWithBazel(t *testing.T) {
Liz Kammer7c5d1592022-10-31 16:27:38 -0400348 t.Parallel()
Alex Márquez Pérez Muñíz Díaz Púras Thaureauxbc4e7342021-09-14 20:58:25 +0000349 bp := `
350cc_library_shared {
351 name: "foo",
352 srcs: ["foo.cc"],
353 bazel_module: { label: "//foo/bar:bar" },
354}`
355 config := TestConfig(t.TempDir(), android.Android, nil, bp, nil)
356 config.BazelContext = android.MockBazelContext{
357 OutputBaseDir: "outputbase",
358 LabelToCcInfo: map[string]cquery.CcInfo{
359 "//foo/bar:bar": cquery.CcInfo{
360 CcObjectFiles: []string{"foo.o"},
361 Includes: []string{"include"},
362 SystemIncludes: []string{"system_include"},
363 RootDynamicLibraries: []string{"foo.so"},
Alex Márquez Pérez Muñíz Díaz Púras Thaureaux62585e82021-09-14 21:19:31 +0000364 TocFile: "foo.so.toc",
Alex Márquez Pérez Muñíz Díaz Púras Thaureauxbc4e7342021-09-14 20:58:25 +0000365 },
366 },
367 }
368 ctx := testCcWithConfig(t, config)
369
370 sharedFoo := ctx.ModuleForTests("foo", "android_arm_armv7-a-neon_shared").Module()
Alex Márquez Pérez Muñíz Díaz Púras Thaureaux62585e82021-09-14 21:19:31 +0000371 producer := sharedFoo.(android.OutputFileProducer)
372 outputFiles, err := producer.OutputFiles("")
Alex Márquez Pérez Muñíz Díaz Púras Thaureauxbc4e7342021-09-14 20:58:25 +0000373 if err != nil {
374 t.Errorf("Unexpected error getting cc_object outputfiles %s", err)
375 }
376 expectedOutputFiles := []string{"outputbase/execroot/__main__/foo.so"}
377 android.AssertDeepEquals(t, "output files", expectedOutputFiles, outputFiles.Strings())
378
Alex Márquez Pérez Muñíz Díaz Púras Thaureaux62585e82021-09-14 21:19:31 +0000379 tocFilePath := sharedFoo.(*Module).Toc()
380 if !tocFilePath.Valid() {
381 t.Errorf("Invalid tocFilePath: %s", tocFilePath)
382 }
383 tocFile := tocFilePath.Path()
384 expectedToc := "outputbase/execroot/__main__/foo.so.toc"
385 android.AssertStringEquals(t, "toc file", expectedToc, tocFile.String())
386
Alex Márquez Pérez Muñíz Díaz Púras Thaureauxbc4e7342021-09-14 20:58:25 +0000387 entries := android.AndroidMkEntriesForTest(t, ctx, sharedFoo)[0]
388 expectedFlags := []string{"-Ioutputbase/execroot/__main__/include", "-isystem outputbase/execroot/__main__/system_include"}
389 gotFlags := entries.EntryMap["LOCAL_EXPORT_CFLAGS"]
390 android.AssertDeepEquals(t, "androidmk exported cflags", expectedFlags, gotFlags)
391}
Colin Crossa2bcf2c2022-02-11 13:11:55 -0800392
393func TestWholeStaticLibPrebuilts(t *testing.T) {
Liz Kammer7c5d1592022-10-31 16:27:38 -0400394 t.Parallel()
Colin Crossa2bcf2c2022-02-11 13:11:55 -0800395 result := PrepareForIntegrationTestWithCc.RunTestWithBp(t, `
396 cc_prebuilt_library_static {
397 name: "libprebuilt",
398 srcs: ["foo.a"],
399 }
400
401 cc_library_static {
402 name: "libdirect",
403 whole_static_libs: ["libprebuilt"],
404 }
405
406 cc_library_static {
407 name: "libtransitive",
408 whole_static_libs: ["libdirect"],
409 }
410
411 cc_library_static {
412 name: "libdirect_with_srcs",
413 srcs: ["bar.c"],
414 whole_static_libs: ["libprebuilt"],
415 }
416
417 cc_library_static {
418 name: "libtransitive_with_srcs",
419 srcs: ["baz.c"],
420 whole_static_libs: ["libdirect_with_srcs"],
421 }
422 `)
423
424 libdirect := result.ModuleForTests("libdirect", "android_arm64_armv8-a_static").Rule("arWithLibs")
425 libtransitive := result.ModuleForTests("libtransitive", "android_arm64_armv8-a_static").Rule("arWithLibs")
426
427 libdirectWithSrcs := result.ModuleForTests("libdirect_with_srcs", "android_arm64_armv8-a_static").Rule("arWithLibs")
428 libtransitiveWithSrcs := result.ModuleForTests("libtransitive_with_srcs", "android_arm64_armv8-a_static").Rule("arWithLibs")
429
430 barObj := result.ModuleForTests("libdirect_with_srcs", "android_arm64_armv8-a_static").Rule("cc")
431 bazObj := result.ModuleForTests("libtransitive_with_srcs", "android_arm64_armv8-a_static").Rule("cc")
432
433 android.AssertStringListContains(t, "missing dependency on foo.a",
434 libdirect.Inputs.Strings(), "foo.a")
435 android.AssertStringDoesContain(t, "missing flag for foo.a",
436 libdirect.Args["arLibs"], "foo.a")
437
438 android.AssertStringListContains(t, "missing dependency on foo.a",
439 libtransitive.Inputs.Strings(), "foo.a")
440 android.AssertStringDoesContain(t, "missing flag for foo.a",
441 libtransitive.Args["arLibs"], "foo.a")
442
443 android.AssertStringListContains(t, "missing dependency on foo.a",
444 libdirectWithSrcs.Inputs.Strings(), "foo.a")
445 android.AssertStringDoesContain(t, "missing flag for foo.a",
446 libdirectWithSrcs.Args["arLibs"], "foo.a")
447 android.AssertStringListContains(t, "missing dependency on bar.o",
448 libdirectWithSrcs.Inputs.Strings(), barObj.Output.String())
449 android.AssertStringDoesContain(t, "missing flag for bar.o",
450 libdirectWithSrcs.Args["arObjs"], barObj.Output.String())
451
452 android.AssertStringListContains(t, "missing dependency on foo.a",
453 libtransitiveWithSrcs.Inputs.Strings(), "foo.a")
454 android.AssertStringDoesContain(t, "missing flag for foo.a",
455 libtransitiveWithSrcs.Args["arLibs"], "foo.a")
456
457 android.AssertStringListContains(t, "missing dependency on bar.o",
458 libtransitiveWithSrcs.Inputs.Strings(), barObj.Output.String())
459 android.AssertStringDoesContain(t, "missing flag for bar.o",
460 libtransitiveWithSrcs.Args["arObjs"], barObj.Output.String())
461
462 android.AssertStringListContains(t, "missing dependency on baz.o",
463 libtransitiveWithSrcs.Inputs.Strings(), bazObj.Output.String())
464 android.AssertStringDoesContain(t, "missing flag for baz.o",
465 libtransitiveWithSrcs.Args["arObjs"], bazObj.Output.String())
466}