blob: af03dffa7a50ac7a9fe8810fb0eb07535169823c [file] [log] [blame]
Rupert Shuttleworthc5fa3062021-09-08 10:36:41 -04001// Copyright 2021 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 bp2build
16
17import (
Yu Liud6201012022-10-17 12:29:15 -070018 "fmt"
Liz Kammer0db0e342023-07-18 11:39:30 -040019 "path/filepath"
Yu Liud6201012022-10-17 12:29:15 -070020 "testing"
21
Rupert Shuttleworthc5fa3062021-09-08 10:36:41 -040022 "android/soong/android"
Sam Delmericocd1b80f2022-01-11 21:55:46 +000023 "android/soong/cc"
Rupert Shuttleworthc5fa3062021-09-08 10:36:41 -040024 "android/soong/genrule"
Sam Delmericocd1b80f2022-01-11 21:55:46 +000025 "android/soong/java"
Rupert Shuttleworthc5fa3062021-09-08 10:36:41 -040026)
27
Liz Kammer78cfdaa2021-11-08 12:56:31 -050028func registerGenruleModuleTypes(ctx android.RegistrationContext) {
29 ctx.RegisterModuleType("genrule_defaults", func() android.Module { return genrule.DefaultsFactory() })
Spandan Dasf62e80a2023-08-17 22:35:04 +000030 ctx.RegisterModuleType("cc_binary", func() android.Module { return cc.BinaryFactory() })
31 ctx.RegisterModuleType("soong_namespace", func() android.Module { return android.NamespaceFactory() })
Liz Kammer78cfdaa2021-11-08 12:56:31 -050032}
33
Sam Delmerico3177a6e2022-06-21 19:28:33 +000034func runGenruleTestCase(t *testing.T, tc Bp2buildTestCase) {
Liz Kammer78cfdaa2021-11-08 12:56:31 -050035 t.Helper()
Sam Delmerico3177a6e2022-06-21 19:28:33 +000036 (&tc).ModuleTypeUnderTest = "genrule"
37 (&tc).ModuleTypeUnderTestFactory = genrule.GenRuleFactory
38 RunBp2BuildTestCase(t, registerGenruleModuleTypes, tc)
Liz Kammer78cfdaa2021-11-08 12:56:31 -050039}
40
Sam Delmericocd1b80f2022-01-11 21:55:46 +000041func otherGenruleBp(genruleTarget string) map[string]string {
42 return map[string]string{
43 "other/Android.bp": fmt.Sprintf(`%s {
Rupert Shuttleworthc5fa3062021-09-08 10:36:41 -040044 name: "foo.tool",
45 out: ["foo_tool.out"],
46 srcs: ["foo_tool.in"],
47 cmd: "cp $(in) $(out)",
48}
Sam Delmericocd1b80f2022-01-11 21:55:46 +000049%s {
Rupert Shuttleworthc5fa3062021-09-08 10:36:41 -040050 name: "other.tool",
51 out: ["other_tool.out"],
52 srcs: ["other_tool.in"],
53 cmd: "cp $(in) $(out)",
Sam Delmericocd1b80f2022-01-11 21:55:46 +000054}`, genruleTarget, genruleTarget),
Liz Kammer1e753242023-06-02 19:03:06 -040055 "other/file.txt": "",
Sam Delmericocd1b80f2022-01-11 21:55:46 +000056 }
57}
58
59func TestGenruleCliVariableReplacement(t *testing.T) {
60 testCases := []struct {
61 moduleType string
62 factory android.ModuleFactory
63 genDir string
Liz Kammerdfeb1202022-05-13 17:20:20 -040064 hod android.HostOrDeviceSupported
Sam Delmericocd1b80f2022-01-11 21:55:46 +000065 }{
66 {
67 moduleType: "genrule",
68 factory: genrule.GenRuleFactory,
Vinh Tranf19b6582022-09-21 17:01:49 -040069 genDir: "$(RULEDIR)",
Sam Delmericocd1b80f2022-01-11 21:55:46 +000070 },
71 {
72 moduleType: "cc_genrule",
73 factory: cc.GenRuleFactory,
74 genDir: "$(RULEDIR)",
Liz Kammerdfeb1202022-05-13 17:20:20 -040075 hod: android.DeviceSupported,
Sam Delmericocd1b80f2022-01-11 21:55:46 +000076 },
77 {
78 moduleType: "java_genrule",
79 factory: java.GenRuleFactory,
80 genDir: "$(RULEDIR)",
Liz Kammerdfeb1202022-05-13 17:20:20 -040081 hod: android.DeviceSupported,
Sam Delmericocd1b80f2022-01-11 21:55:46 +000082 },
83 {
84 moduleType: "java_genrule_host",
85 factory: java.GenRuleFactoryHost,
86 genDir: "$(RULEDIR)",
Liz Kammerdfeb1202022-05-13 17:20:20 -040087 hod: android.HostSupported,
Sam Delmericocd1b80f2022-01-11 21:55:46 +000088 },
Rupert Shuttleworthc5fa3062021-09-08 10:36:41 -040089 }
90
Sam Delmericocd1b80f2022-01-11 21:55:46 +000091 bp := `%s {
Rupert Shuttleworthc5fa3062021-09-08 10:36:41 -040092 name: "foo.tool",
93 out: ["foo_tool.out"],
94 srcs: ["foo_tool.in"],
95 cmd: "cp $(in) $(out)",
Rupert Shuttleworthc5fa3062021-09-08 10:36:41 -040096}
97
Sam Delmericocd1b80f2022-01-11 21:55:46 +000098%s {
Rupert Shuttleworthc5fa3062021-09-08 10:36:41 -040099 name: "foo",
100 out: ["foo.out"],
101 srcs: ["foo.in"],
102 tools: [":foo.tool"],
103 cmd: "$(location :foo.tool) --genDir=$(genDir) arg $(in) $(out)",
104 bazel_module: { bp2build_available: true },
Sam Delmericocd1b80f2022-01-11 21:55:46 +0000105}`
106
107 for _, tc := range testCases {
Sam Delmerico3177a6e2022-06-21 19:28:33 +0000108 moduleAttrs := AttrNameToString{
Sam Delmerico75539d62022-01-31 14:37:29 +0000109 "cmd": fmt.Sprintf(`"$(location :foo.tool) --genDir=%s arg $(SRCS) $(OUTS)"`, tc.genDir),
110 "outs": `["foo.out"]`,
111 "srcs": `["foo.in"]`,
112 "tools": `[":foo.tool"]`,
113 }
114
Sam Delmericocd1b80f2022-01-11 21:55:46 +0000115 expectedBazelTargets := []string{
Liz Kammerdfeb1202022-05-13 17:20:20 -0400116 makeBazelTargetHostOrDevice("genrule", "foo", moduleAttrs, tc.hod),
Sam Delmericocd1b80f2022-01-11 21:55:46 +0000117 }
118
119 t.Run(tc.moduleType, func(t *testing.T) {
Sam Delmerico3177a6e2022-06-21 19:28:33 +0000120 RunBp2BuildTestCase(t, func(ctx android.RegistrationContext) {},
121 Bp2buildTestCase{
122 ModuleTypeUnderTest: tc.moduleType,
123 ModuleTypeUnderTestFactory: tc.factory,
124 Blueprint: fmt.Sprintf(bp, tc.moduleType, tc.moduleType),
125 ExpectedBazelTargets: expectedBazelTargets,
Chris Parsonscd209032023-09-19 01:12:48 +0000126 StubbedBuildDefinitions: []string{"foo.tool", "other.tool"},
Sam Delmericocd1b80f2022-01-11 21:55:46 +0000127 })
128 })
129 }
130}
131
132func TestGenruleLocationsLabel(t *testing.T) {
133 testCases := []struct {
134 moduleType string
135 factory android.ModuleFactory
Liz Kammerdfeb1202022-05-13 17:20:20 -0400136 hod android.HostOrDeviceSupported
Sam Delmericocd1b80f2022-01-11 21:55:46 +0000137 }{
138 {
139 moduleType: "genrule",
140 factory: genrule.GenRuleFactory,
Rupert Shuttleworthc5fa3062021-09-08 10:36:41 -0400141 },
142 {
Sam Delmericocd1b80f2022-01-11 21:55:46 +0000143 moduleType: "cc_genrule",
144 factory: cc.GenRuleFactory,
Liz Kammerdfeb1202022-05-13 17:20:20 -0400145 hod: android.DeviceSupported,
Sam Delmericocd1b80f2022-01-11 21:55:46 +0000146 },
147 {
148 moduleType: "java_genrule",
149 factory: java.GenRuleFactory,
Liz Kammerdfeb1202022-05-13 17:20:20 -0400150 hod: android.DeviceSupported,
Sam Delmericocd1b80f2022-01-11 21:55:46 +0000151 },
152 {
153 moduleType: "java_genrule_host",
154 factory: java.GenRuleFactoryHost,
Liz Kammerdfeb1202022-05-13 17:20:20 -0400155 hod: android.HostSupported,
Sam Delmericocd1b80f2022-01-11 21:55:46 +0000156 },
157 }
158
159 bp := `%s {
Rupert Shuttleworthc5fa3062021-09-08 10:36:41 -0400160 name: "foo.tools",
161 out: ["foo_tool.out", "foo_tool2.out"],
162 srcs: ["foo_tool.in"],
163 cmd: "cp $(in) $(out)",
164 bazel_module: { bp2build_available: true },
165}
166
Sam Delmericocd1b80f2022-01-11 21:55:46 +0000167%s {
Rupert Shuttleworthc5fa3062021-09-08 10:36:41 -0400168 name: "foo",
169 out: ["foo.out"],
170 srcs: ["foo.in"],
171 tools: [":foo.tools"],
172 cmd: "$(locations :foo.tools) -s $(out) $(in)",
173 bazel_module: { bp2build_available: true },
Sam Delmericocd1b80f2022-01-11 21:55:46 +0000174}`
175
Sam Delmerico75539d62022-01-31 14:37:29 +0000176 for _, tc := range testCases {
Sam Delmerico3177a6e2022-06-21 19:28:33 +0000177 fooAttrs := AttrNameToString{
Sam Delmerico75539d62022-01-31 14:37:29 +0000178 "cmd": `"$(locations :foo.tools) -s $(OUTS) $(SRCS)"`,
179 "outs": `["foo.out"]`,
180 "srcs": `["foo.in"]`,
181 "tools": `[":foo.tools"]`,
182 }
Sam Delmerico3177a6e2022-06-21 19:28:33 +0000183 fooToolsAttrs := AttrNameToString{
Sam Delmerico75539d62022-01-31 14:37:29 +0000184 "cmd": `"cp $(SRCS) $(OUTS)"`,
185 "outs": `[
Rupert Shuttleworthc5fa3062021-09-08 10:36:41 -0400186 "foo_tool.out",
187 "foo_tool2.out",
Liz Kammer78cfdaa2021-11-08 12:56:31 -0500188 ]`,
Sam Delmerico75539d62022-01-31 14:37:29 +0000189 "srcs": `["foo_tool.in"]`,
Sam Delmericocd1b80f2022-01-11 21:55:46 +0000190 }
191
Sam Delmerico75539d62022-01-31 14:37:29 +0000192 expectedBazelTargets := []string{
Liz Kammerdfeb1202022-05-13 17:20:20 -0400193 makeBazelTargetHostOrDevice("genrule", "foo", fooAttrs, tc.hod),
194 makeBazelTargetHostOrDevice("genrule", "foo.tools", fooToolsAttrs, tc.hod),
Sam Delmerico75539d62022-01-31 14:37:29 +0000195 }
196
Sam Delmericocd1b80f2022-01-11 21:55:46 +0000197 t.Run(tc.moduleType, func(t *testing.T) {
Sam Delmerico3177a6e2022-06-21 19:28:33 +0000198 RunBp2BuildTestCase(t, func(ctx android.RegistrationContext) {},
199 Bp2buildTestCase{
200 ModuleTypeUnderTest: tc.moduleType,
201 ModuleTypeUnderTestFactory: tc.factory,
202 Blueprint: fmt.Sprintf(bp, tc.moduleType, tc.moduleType),
203 ExpectedBazelTargets: expectedBazelTargets,
Sam Delmericocd1b80f2022-01-11 21:55:46 +0000204 })
205 })
206 }
207}
208
209func TestGenruleLocationsAbsoluteLabel(t *testing.T) {
210 testCases := []struct {
211 moduleType string
212 factory android.ModuleFactory
Liz Kammerdfeb1202022-05-13 17:20:20 -0400213 hod android.HostOrDeviceSupported
Sam Delmericocd1b80f2022-01-11 21:55:46 +0000214 }{
215 {
216 moduleType: "genrule",
217 factory: genrule.GenRuleFactory,
Rupert Shuttleworthc5fa3062021-09-08 10:36:41 -0400218 },
219 {
Sam Delmericocd1b80f2022-01-11 21:55:46 +0000220 moduleType: "cc_genrule",
221 factory: cc.GenRuleFactory,
Liz Kammerdfeb1202022-05-13 17:20:20 -0400222 hod: android.DeviceSupported,
Sam Delmericocd1b80f2022-01-11 21:55:46 +0000223 },
224 {
225 moduleType: "java_genrule",
226 factory: java.GenRuleFactory,
Liz Kammerdfeb1202022-05-13 17:20:20 -0400227 hod: android.DeviceSupported,
Sam Delmericocd1b80f2022-01-11 21:55:46 +0000228 },
229 {
230 moduleType: "java_genrule_host",
231 factory: java.GenRuleFactoryHost,
Liz Kammerdfeb1202022-05-13 17:20:20 -0400232 hod: android.HostSupported,
Sam Delmericocd1b80f2022-01-11 21:55:46 +0000233 },
234 }
235
236 bp := `%s {
Rupert Shuttleworthc5fa3062021-09-08 10:36:41 -0400237 name: "foo",
238 out: ["foo.out"],
239 srcs: ["foo.in"],
240 tool_files: [":foo.tool"],
241 cmd: "$(locations :foo.tool) -s $(out) $(in)",
242 bazel_module: { bp2build_available: true },
Sam Delmericocd1b80f2022-01-11 21:55:46 +0000243}`
244
Sam Delmerico75539d62022-01-31 14:37:29 +0000245 for _, tc := range testCases {
Sam Delmerico3177a6e2022-06-21 19:28:33 +0000246 moduleAttrs := AttrNameToString{
Sam Delmericocd1b80f2022-01-11 21:55:46 +0000247 "cmd": `"$(locations //other:foo.tool) -s $(OUTS) $(SRCS)"`,
248 "outs": `["foo.out"]`,
249 "srcs": `["foo.in"]`,
250 "tools": `["//other:foo.tool"]`,
Sam Delmerico75539d62022-01-31 14:37:29 +0000251 }
Sam Delmericocd1b80f2022-01-11 21:55:46 +0000252
Sam Delmerico75539d62022-01-31 14:37:29 +0000253 expectedBazelTargets := []string{
Liz Kammerdfeb1202022-05-13 17:20:20 -0400254 makeBazelTargetHostOrDevice("genrule", "foo", moduleAttrs, tc.hod),
Sam Delmerico75539d62022-01-31 14:37:29 +0000255 }
256
Sam Delmericocd1b80f2022-01-11 21:55:46 +0000257 t.Run(tc.moduleType, func(t *testing.T) {
Sam Delmerico3177a6e2022-06-21 19:28:33 +0000258 RunBp2BuildTestCase(t, func(ctx android.RegistrationContext) {},
259 Bp2buildTestCase{
260 ModuleTypeUnderTest: tc.moduleType,
261 ModuleTypeUnderTestFactory: tc.factory,
262 Blueprint: fmt.Sprintf(bp, tc.moduleType),
263 ExpectedBazelTargets: expectedBazelTargets,
264 Filesystem: otherGenruleBp(tc.moduleType),
Chris Parsonscd209032023-09-19 01:12:48 +0000265 StubbedBuildDefinitions: []string{"//other:foo.tool"},
Sam Delmericocd1b80f2022-01-11 21:55:46 +0000266 })
267 })
268 }
269}
270
271func TestGenruleSrcsLocationsAbsoluteLabel(t *testing.T) {
272 testCases := []struct {
273 moduleType string
274 factory android.ModuleFactory
Liz Kammerdfeb1202022-05-13 17:20:20 -0400275 hod android.HostOrDeviceSupported
Sam Delmericocd1b80f2022-01-11 21:55:46 +0000276 }{
277 {
278 moduleType: "genrule",
279 factory: genrule.GenRuleFactory,
Rupert Shuttleworthc5fa3062021-09-08 10:36:41 -0400280 },
281 {
Sam Delmericocd1b80f2022-01-11 21:55:46 +0000282 moduleType: "cc_genrule",
283 factory: cc.GenRuleFactory,
Liz Kammerdfeb1202022-05-13 17:20:20 -0400284 hod: android.DeviceSupported,
Sam Delmericocd1b80f2022-01-11 21:55:46 +0000285 },
286 {
287 moduleType: "java_genrule",
288 factory: java.GenRuleFactory,
Liz Kammerdfeb1202022-05-13 17:20:20 -0400289 hod: android.DeviceSupported,
Sam Delmericocd1b80f2022-01-11 21:55:46 +0000290 },
291 {
292 moduleType: "java_genrule_host",
293 factory: java.GenRuleFactoryHost,
Liz Kammerdfeb1202022-05-13 17:20:20 -0400294 hod: android.HostSupported,
Sam Delmericocd1b80f2022-01-11 21:55:46 +0000295 },
296 }
297
298 bp := `%s {
Rupert Shuttleworthc5fa3062021-09-08 10:36:41 -0400299 name: "foo",
300 out: ["foo.out"],
Liz Kammer1e753242023-06-02 19:03:06 -0400301 srcs: [":other.tool", "other/file.txt",],
Rupert Shuttleworthc5fa3062021-09-08 10:36:41 -0400302 tool_files: [":foo.tool"],
Liz Kammer1e753242023-06-02 19:03:06 -0400303 cmd: "$(locations :foo.tool) $(location other/file.txt) -s $(out) $(location :other.tool)",
Rupert Shuttleworthc5fa3062021-09-08 10:36:41 -0400304 bazel_module: { bp2build_available: true },
Sam Delmericocd1b80f2022-01-11 21:55:46 +0000305}`
306
Sam Delmerico75539d62022-01-31 14:37:29 +0000307 for _, tc := range testCases {
Sam Delmerico3177a6e2022-06-21 19:28:33 +0000308 moduleAttrs := AttrNameToString{
Liz Kammer1e753242023-06-02 19:03:06 -0400309 "cmd": `"$(locations //other:foo.tool) $(location //other:file.txt) -s $(OUTS) $(location //other:other.tool)"`,
310 "outs": `["foo.out"]`,
311 "srcs": `[
312 "//other:other.tool",
313 "//other:file.txt",
314 ]`,
Sam Delmericocd1b80f2022-01-11 21:55:46 +0000315 "tools": `["//other:foo.tool"]`,
Sam Delmerico75539d62022-01-31 14:37:29 +0000316 }
Sam Delmericocd1b80f2022-01-11 21:55:46 +0000317
Sam Delmerico75539d62022-01-31 14:37:29 +0000318 expectedBazelTargets := []string{
Liz Kammerdfeb1202022-05-13 17:20:20 -0400319 makeBazelTargetHostOrDevice("genrule", "foo", moduleAttrs, tc.hod),
Sam Delmerico75539d62022-01-31 14:37:29 +0000320 }
321
Sam Delmericocd1b80f2022-01-11 21:55:46 +0000322 t.Run(tc.moduleType, func(t *testing.T) {
Sam Delmerico3177a6e2022-06-21 19:28:33 +0000323 RunBp2BuildTestCase(t, func(ctx android.RegistrationContext) {},
324 Bp2buildTestCase{
325 ModuleTypeUnderTest: tc.moduleType,
326 ModuleTypeUnderTestFactory: tc.factory,
327 Blueprint: fmt.Sprintf(bp, tc.moduleType),
328 ExpectedBazelTargets: expectedBazelTargets,
329 Filesystem: otherGenruleBp(tc.moduleType),
Chris Parsonscd209032023-09-19 01:12:48 +0000330 StubbedBuildDefinitions: []string{"//other:foo.tool", "//other:other.tool"},
Sam Delmericocd1b80f2022-01-11 21:55:46 +0000331 })
332 })
333 }
334}
335
336func TestGenruleLocationLabelShouldSubstituteFirstToolLabel(t *testing.T) {
337 testCases := []struct {
338 moduleType string
339 factory android.ModuleFactory
Liz Kammerdfeb1202022-05-13 17:20:20 -0400340 hod android.HostOrDeviceSupported
Sam Delmericocd1b80f2022-01-11 21:55:46 +0000341 }{
342 {
343 moduleType: "genrule",
344 factory: genrule.GenRuleFactory,
Rupert Shuttleworthc5fa3062021-09-08 10:36:41 -0400345 },
346 {
Sam Delmericocd1b80f2022-01-11 21:55:46 +0000347 moduleType: "cc_genrule",
348 factory: cc.GenRuleFactory,
Liz Kammerdfeb1202022-05-13 17:20:20 -0400349 hod: android.DeviceSupported,
Sam Delmericocd1b80f2022-01-11 21:55:46 +0000350 },
351 {
352 moduleType: "java_genrule",
353 factory: java.GenRuleFactory,
Liz Kammerdfeb1202022-05-13 17:20:20 -0400354 hod: android.DeviceSupported,
Sam Delmericocd1b80f2022-01-11 21:55:46 +0000355 },
356 {
357 moduleType: "java_genrule_host",
358 factory: java.GenRuleFactoryHost,
Liz Kammerdfeb1202022-05-13 17:20:20 -0400359 hod: android.HostSupported,
Sam Delmericocd1b80f2022-01-11 21:55:46 +0000360 },
361 }
362
363 bp := `%s {
Rupert Shuttleworthc5fa3062021-09-08 10:36:41 -0400364 name: "foo",
365 out: ["foo.out"],
366 srcs: ["foo.in"],
367 tool_files: [":foo.tool", ":other.tool"],
368 cmd: "$(location) -s $(out) $(in)",
369 bazel_module: { bp2build_available: true },
Sam Delmericocd1b80f2022-01-11 21:55:46 +0000370}`
371
Sam Delmerico75539d62022-01-31 14:37:29 +0000372 for _, tc := range testCases {
Sam Delmerico3177a6e2022-06-21 19:28:33 +0000373 moduleAttrs := AttrNameToString{
Sam Delmericocd1b80f2022-01-11 21:55:46 +0000374 "cmd": `"$(location //other:foo.tool) -s $(OUTS) $(SRCS)"`,
375 "outs": `["foo.out"]`,
376 "srcs": `["foo.in"]`,
377 "tools": `[
Rupert Shuttleworthc5fa3062021-09-08 10:36:41 -0400378 "//other:foo.tool",
379 "//other:other.tool",
Liz Kammer78cfdaa2021-11-08 12:56:31 -0500380 ]`,
Sam Delmerico75539d62022-01-31 14:37:29 +0000381 }
Sam Delmericocd1b80f2022-01-11 21:55:46 +0000382
Sam Delmerico75539d62022-01-31 14:37:29 +0000383 expectedBazelTargets := []string{
Liz Kammerdfeb1202022-05-13 17:20:20 -0400384 makeBazelTargetHostOrDevice("genrule", "foo", moduleAttrs, tc.hod),
Sam Delmerico75539d62022-01-31 14:37:29 +0000385 }
386
Sam Delmericocd1b80f2022-01-11 21:55:46 +0000387 t.Run(tc.moduleType, func(t *testing.T) {
Sam Delmerico3177a6e2022-06-21 19:28:33 +0000388 RunBp2BuildTestCase(t, func(ctx android.RegistrationContext) {},
389 Bp2buildTestCase{
390 ModuleTypeUnderTest: tc.moduleType,
391 ModuleTypeUnderTestFactory: tc.factory,
392 Blueprint: fmt.Sprintf(bp, tc.moduleType),
393 ExpectedBazelTargets: expectedBazelTargets,
394 Filesystem: otherGenruleBp(tc.moduleType),
Chris Parsonscd209032023-09-19 01:12:48 +0000395 StubbedBuildDefinitions: []string{"//other:foo.tool", "//other:other.tool"},
Sam Delmericocd1b80f2022-01-11 21:55:46 +0000396 })
397 })
398 }
399}
400
401func TestGenruleLocationsLabelShouldSubstituteFirstToolLabel(t *testing.T) {
402 testCases := []struct {
403 moduleType string
404 factory android.ModuleFactory
Liz Kammerdfeb1202022-05-13 17:20:20 -0400405 hod android.HostOrDeviceSupported
Sam Delmericocd1b80f2022-01-11 21:55:46 +0000406 }{
407 {
408 moduleType: "genrule",
409 factory: genrule.GenRuleFactory,
Rupert Shuttleworthc5fa3062021-09-08 10:36:41 -0400410 },
411 {
Sam Delmericocd1b80f2022-01-11 21:55:46 +0000412 moduleType: "cc_genrule",
413 factory: cc.GenRuleFactory,
Liz Kammerdfeb1202022-05-13 17:20:20 -0400414 hod: android.DeviceSupported,
Sam Delmericocd1b80f2022-01-11 21:55:46 +0000415 },
416 {
417 moduleType: "java_genrule",
418 factory: java.GenRuleFactory,
Liz Kammerdfeb1202022-05-13 17:20:20 -0400419 hod: android.DeviceSupported,
Sam Delmericocd1b80f2022-01-11 21:55:46 +0000420 },
421 {
422 moduleType: "java_genrule_host",
423 factory: java.GenRuleFactoryHost,
Liz Kammerdfeb1202022-05-13 17:20:20 -0400424 hod: android.HostSupported,
Sam Delmericocd1b80f2022-01-11 21:55:46 +0000425 },
426 }
427
428 bp := `%s {
Rupert Shuttleworthc5fa3062021-09-08 10:36:41 -0400429 name: "foo",
430 out: ["foo.out"],
431 srcs: ["foo.in"],
Sam Delmericocd1b80f2022-01-11 21:55:46 +0000432 tool_files: [":foo.tool", ":other.tool"],
Rupert Shuttleworthc5fa3062021-09-08 10:36:41 -0400433 cmd: "$(locations) -s $(out) $(in)",
434 bazel_module: { bp2build_available: true },
Sam Delmericocd1b80f2022-01-11 21:55:46 +0000435}`
436
Sam Delmerico75539d62022-01-31 14:37:29 +0000437 for _, tc := range testCases {
Sam Delmerico3177a6e2022-06-21 19:28:33 +0000438 moduleAttrs := AttrNameToString{
Sam Delmericocd1b80f2022-01-11 21:55:46 +0000439 "cmd": `"$(locations //other:foo.tool) -s $(OUTS) $(SRCS)"`,
440 "outs": `["foo.out"]`,
441 "srcs": `["foo.in"]`,
442 "tools": `[
Rupert Shuttleworthc5fa3062021-09-08 10:36:41 -0400443 "//other:foo.tool",
444 "//other:other.tool",
Liz Kammer78cfdaa2021-11-08 12:56:31 -0500445 ]`,
Sam Delmerico75539d62022-01-31 14:37:29 +0000446 }
Sam Delmericocd1b80f2022-01-11 21:55:46 +0000447
Sam Delmerico75539d62022-01-31 14:37:29 +0000448 expectedBazelTargets := []string{
Liz Kammerdfeb1202022-05-13 17:20:20 -0400449 makeBazelTargetHostOrDevice("genrule", "foo", moduleAttrs, tc.hod),
Sam Delmerico75539d62022-01-31 14:37:29 +0000450 }
451
Sam Delmericocd1b80f2022-01-11 21:55:46 +0000452 t.Run(tc.moduleType, func(t *testing.T) {
Sam Delmerico3177a6e2022-06-21 19:28:33 +0000453 RunBp2BuildTestCase(t, func(ctx android.RegistrationContext) {},
454 Bp2buildTestCase{
455 ModuleTypeUnderTest: tc.moduleType,
456 ModuleTypeUnderTestFactory: tc.factory,
457 Blueprint: fmt.Sprintf(bp, tc.moduleType),
458 ExpectedBazelTargets: expectedBazelTargets,
459 Filesystem: otherGenruleBp(tc.moduleType),
Chris Parsonscd209032023-09-19 01:12:48 +0000460 StubbedBuildDefinitions: []string{"//other:foo.tool", "//other:other.tool"},
Sam Delmericocd1b80f2022-01-11 21:55:46 +0000461 })
462 })
463 }
464}
465
466func TestGenruleWithoutToolsOrToolFiles(t *testing.T) {
467 testCases := []struct {
468 moduleType string
469 factory android.ModuleFactory
Liz Kammerdfeb1202022-05-13 17:20:20 -0400470 hod android.HostOrDeviceSupported
Sam Delmericocd1b80f2022-01-11 21:55:46 +0000471 }{
472 {
473 moduleType: "genrule",
474 factory: genrule.GenRuleFactory,
Rupert Shuttleworthc5fa3062021-09-08 10:36:41 -0400475 },
476 {
Sam Delmericocd1b80f2022-01-11 21:55:46 +0000477 moduleType: "cc_genrule",
478 factory: cc.GenRuleFactory,
Liz Kammerdfeb1202022-05-13 17:20:20 -0400479 hod: android.DeviceSupported,
Sam Delmericocd1b80f2022-01-11 21:55:46 +0000480 },
481 {
482 moduleType: "java_genrule",
483 factory: java.GenRuleFactory,
Liz Kammerdfeb1202022-05-13 17:20:20 -0400484 hod: android.DeviceSupported,
Sam Delmericocd1b80f2022-01-11 21:55:46 +0000485 },
486 {
487 moduleType: "java_genrule_host",
488 factory: java.GenRuleFactoryHost,
Liz Kammerdfeb1202022-05-13 17:20:20 -0400489 hod: android.HostSupported,
Sam Delmericocd1b80f2022-01-11 21:55:46 +0000490 },
491 }
492
493 bp := `%s {
Rupert Shuttleworthc5fa3062021-09-08 10:36:41 -0400494 name: "foo",
495 out: ["foo.out"],
496 srcs: ["foo.in"],
497 cmd: "cp $(in) $(out)",
498 bazel_module: { bp2build_available: true },
Sam Delmericocd1b80f2022-01-11 21:55:46 +0000499}`
Rupert Shuttleworthc5fa3062021-09-08 10:36:41 -0400500
Sam Delmerico75539d62022-01-31 14:37:29 +0000501 for _, tc := range testCases {
Sam Delmerico3177a6e2022-06-21 19:28:33 +0000502 moduleAttrs := AttrNameToString{
Sam Delmericocd1b80f2022-01-11 21:55:46 +0000503 "cmd": `"cp $(SRCS) $(OUTS)"`,
504 "outs": `["foo.out"]`,
505 "srcs": `["foo.in"]`,
Sam Delmerico75539d62022-01-31 14:37:29 +0000506 }
Sam Delmericocd1b80f2022-01-11 21:55:46 +0000507
Sam Delmerico75539d62022-01-31 14:37:29 +0000508 expectedBazelTargets := []string{
Liz Kammerdfeb1202022-05-13 17:20:20 -0400509 makeBazelTargetHostOrDevice("genrule", "foo", moduleAttrs, tc.hod),
Sam Delmerico75539d62022-01-31 14:37:29 +0000510 }
511
Sam Delmericocd1b80f2022-01-11 21:55:46 +0000512 t.Run(tc.moduleType, func(t *testing.T) {
Sam Delmerico3177a6e2022-06-21 19:28:33 +0000513 RunBp2BuildTestCase(t, func(ctx android.RegistrationContext) {},
514 Bp2buildTestCase{
515 ModuleTypeUnderTest: tc.moduleType,
516 ModuleTypeUnderTestFactory: tc.factory,
517 Blueprint: fmt.Sprintf(bp, tc.moduleType),
518 ExpectedBazelTargets: expectedBazelTargets,
Sam Delmericocd1b80f2022-01-11 21:55:46 +0000519 })
Liz Kammer78cfdaa2021-11-08 12:56:31 -0500520 })
Rupert Shuttleworthc5fa3062021-09-08 10:36:41 -0400521 }
522}
523
Sam Delmericocd1b80f2022-01-11 21:55:46 +0000524func TestGenruleBp2BuildInlinesDefaults(t *testing.T) {
Sam Delmerico3177a6e2022-06-21 19:28:33 +0000525 testCases := []Bp2buildTestCase{
Rupert Shuttleworthc5fa3062021-09-08 10:36:41 -0400526 {
Sam Delmerico3177a6e2022-06-21 19:28:33 +0000527 Description: "genrule applies properties from a genrule_defaults dependency if not specified",
528 Blueprint: `genrule_defaults {
Rupert Shuttleworthc5fa3062021-09-08 10:36:41 -0400529 name: "gen_defaults",
530 cmd: "do-something $(in) $(out)",
531}
532genrule {
533 name: "gen",
534 out: ["out"],
535 srcs: ["in1"],
536 defaults: ["gen_defaults"],
537 bazel_module: { bp2build_available: true },
538}
539`,
Sam Delmerico3177a6e2022-06-21 19:28:33 +0000540 ExpectedBazelTargets: []string{
541 MakeBazelTargetNoRestrictions("genrule", "gen", AttrNameToString{
Liz Kammer78cfdaa2021-11-08 12:56:31 -0500542 "cmd": `"do-something $(SRCS) $(OUTS)"`,
543 "outs": `["out"]`,
544 "srcs": `["in1"]`,
545 }),
546 },
Rupert Shuttleworthc5fa3062021-09-08 10:36:41 -0400547 },
548 {
Sam Delmerico3177a6e2022-06-21 19:28:33 +0000549 Description: "genrule does merges properties from a genrule_defaults dependency, latest-first",
550 Blueprint: `genrule_defaults {
Rupert Shuttleworthc5fa3062021-09-08 10:36:41 -0400551 name: "gen_defaults",
552 out: ["out-from-defaults"],
553 srcs: ["in-from-defaults"],
554 cmd: "cmd-from-defaults",
555}
556genrule {
557 name: "gen",
558 out: ["out"],
559 srcs: ["in1"],
560 defaults: ["gen_defaults"],
561 cmd: "do-something $(in) $(out)",
562 bazel_module: { bp2build_available: true },
563}
564`,
Sam Delmerico3177a6e2022-06-21 19:28:33 +0000565 ExpectedBazelTargets: []string{
566 MakeBazelTargetNoRestrictions("genrule", "gen", AttrNameToString{
Liz Kammer78cfdaa2021-11-08 12:56:31 -0500567 "cmd": `"do-something $(SRCS) $(OUTS)"`,
568 "outs": `[
Rupert Shuttleworthc5fa3062021-09-08 10:36:41 -0400569 "out-from-defaults",
570 "out",
Liz Kammer78cfdaa2021-11-08 12:56:31 -0500571 ]`,
572 "srcs": `[
Rupert Shuttleworthc5fa3062021-09-08 10:36:41 -0400573 "in-from-defaults",
574 "in1",
Liz Kammer78cfdaa2021-11-08 12:56:31 -0500575 ]`,
576 }),
577 },
Rupert Shuttleworthc5fa3062021-09-08 10:36:41 -0400578 },
579 {
Sam Delmerico3177a6e2022-06-21 19:28:33 +0000580 Description: "genrule applies properties from list of genrule_defaults",
581 Blueprint: `genrule_defaults {
Rupert Shuttleworthc5fa3062021-09-08 10:36:41 -0400582 name: "gen_defaults1",
583 cmd: "cp $(in) $(out)",
584}
585
586genrule_defaults {
587 name: "gen_defaults2",
588 srcs: ["in1"],
589}
590
591genrule {
592 name: "gen",
593 out: ["out"],
594 defaults: ["gen_defaults1", "gen_defaults2"],
595 bazel_module: { bp2build_available: true },
596}
597`,
Sam Delmerico3177a6e2022-06-21 19:28:33 +0000598 ExpectedBazelTargets: []string{
599 MakeBazelTargetNoRestrictions("genrule", "gen", AttrNameToString{
Liz Kammer78cfdaa2021-11-08 12:56:31 -0500600 "cmd": `"cp $(SRCS) $(OUTS)"`,
601 "outs": `["out"]`,
602 "srcs": `["in1"]`,
603 }),
604 },
Rupert Shuttleworthc5fa3062021-09-08 10:36:41 -0400605 },
606 {
Sam Delmerico3177a6e2022-06-21 19:28:33 +0000607 Description: "genrule applies properties from genrule_defaults transitively",
608 Blueprint: `genrule_defaults {
Rupert Shuttleworthc5fa3062021-09-08 10:36:41 -0400609 name: "gen_defaults1",
610 defaults: ["gen_defaults2"],
611 cmd: "cmd1 $(in) $(out)", // overrides gen_defaults2's cmd property value.
612}
613
614genrule_defaults {
615 name: "gen_defaults2",
616 defaults: ["gen_defaults3"],
617 cmd: "cmd2 $(in) $(out)",
618 out: ["out-from-2"],
619 srcs: ["in1"],
620}
621
622genrule_defaults {
623 name: "gen_defaults3",
624 out: ["out-from-3"],
625 srcs: ["srcs-from-3"],
626}
627
628genrule {
629 name: "gen",
630 out: ["out"],
631 defaults: ["gen_defaults1"],
632 bazel_module: { bp2build_available: true },
633}
634`,
Sam Delmerico3177a6e2022-06-21 19:28:33 +0000635 ExpectedBazelTargets: []string{
636 MakeBazelTargetNoRestrictions("genrule", "gen", AttrNameToString{
Liz Kammer78cfdaa2021-11-08 12:56:31 -0500637 "cmd": `"cmd1 $(SRCS) $(OUTS)"`,
638 "outs": `[
Rupert Shuttleworthc5fa3062021-09-08 10:36:41 -0400639 "out-from-3",
640 "out-from-2",
641 "out",
Liz Kammer78cfdaa2021-11-08 12:56:31 -0500642 ]`,
643 "srcs": `[
Rupert Shuttleworthc5fa3062021-09-08 10:36:41 -0400644 "srcs-from-3",
645 "in1",
Liz Kammer78cfdaa2021-11-08 12:56:31 -0500646 ]`,
647 }),
648 },
Rupert Shuttleworthc5fa3062021-09-08 10:36:41 -0400649 },
650 }
651
Rupert Shuttleworthc5fa3062021-09-08 10:36:41 -0400652 for _, testCase := range testCases {
Sam Delmerico3177a6e2022-06-21 19:28:33 +0000653 t.Run(testCase.Description, func(t *testing.T) {
Liz Kammer78cfdaa2021-11-08 12:56:31 -0500654 runGenruleTestCase(t, testCase)
655 })
Rupert Shuttleworthc5fa3062021-09-08 10:36:41 -0400656 }
657}
Yu Liud6201012022-10-17 12:29:15 -0700658
659func TestCcGenruleArchAndExcludeSrcs(t *testing.T) {
660 name := "cc_genrule with arch"
661 bp := `
662 cc_genrule {
663 name: "foo",
664 srcs: [
665 "foo1.in",
666 "foo2.in",
667 ],
668 exclude_srcs: ["foo2.in"],
669 arch: {
670 arm: {
671 srcs: [
672 "foo1_arch.in",
673 "foo2_arch.in",
674 ],
675 exclude_srcs: ["foo2_arch.in"],
676 },
677 },
678 cmd: "cat $(in) > $(out)",
679 bazel_module: { bp2build_available: true },
680 }`
681
682 expectedBazelAttrs := AttrNameToString{
683 "srcs": `["foo1.in"] + select({
Jingwen Chen9c2e3ee2023-10-11 10:51:28 +0000684 "//build/bazel_common_rules/platforms/arch:arm": ["foo1_arch.in"],
Yu Liud6201012022-10-17 12:29:15 -0700685 "//conditions:default": [],
686 })`,
687 "cmd": `"cat $(SRCS) > $(OUTS)"`,
Jingwen Chen9c2e3ee2023-10-11 10:51:28 +0000688 "target_compatible_with": `["//build/bazel_common_rules/platforms/os:android"]`,
Yu Liud6201012022-10-17 12:29:15 -0700689 }
690
691 expectedBazelTargets := []string{
692 MakeBazelTargetNoRestrictions("genrule", "foo", expectedBazelAttrs),
693 }
694
695 t.Run(name, func(t *testing.T) {
696 RunBp2BuildTestCase(t, func(ctx android.RegistrationContext) {},
697 Bp2buildTestCase{
698 ModuleTypeUnderTest: "cc_genrule",
699 ModuleTypeUnderTestFactory: cc.GenRuleFactory,
700 Blueprint: bp,
701 ExpectedBazelTargets: expectedBazelTargets,
702 })
703 })
704}
Liz Kammer0db0e342023-07-18 11:39:30 -0400705
706func TestGenruleWithExportIncludeDirs(t *testing.T) {
707 testCases := []struct {
708 moduleType string
709 factory android.ModuleFactory
710 hod android.HostOrDeviceSupported
711 }{
712 {
713 moduleType: "genrule",
714 factory: genrule.GenRuleFactory,
715 },
716 {
717 moduleType: "cc_genrule",
718 factory: cc.GenRuleFactory,
719 hod: android.DeviceSupported,
720 },
721 {
722 moduleType: "java_genrule",
723 factory: java.GenRuleFactory,
724 hod: android.DeviceSupported,
725 },
726 {
727 moduleType: "java_genrule_host",
728 factory: java.GenRuleFactoryHost,
729 hod: android.HostSupported,
730 },
731 }
732
733 dir := "baz"
734
735 bp := `%s {
736 name: "foo",
737 out: ["foo.out.h"],
738 srcs: ["foo.in"],
739 cmd: "cp $(in) $(out)",
740 export_include_dirs: ["foo", "bar", "."],
741 bazel_module: { bp2build_available: true },
742}`
743
744 for _, tc := range testCases {
745 moduleAttrs := AttrNameToString{
746 "cmd": `"cp $(SRCS) $(OUTS)"`,
747 "outs": `["foo.out.h"]`,
748 "srcs": `["foo.in"]`,
749 }
750
751 expectedBazelTargets := []string{
752 makeBazelTargetHostOrDevice("genrule", "foo", moduleAttrs, tc.hod),
753 makeBazelTargetHostOrDevice("cc_library_headers", "foo__header_library", AttrNameToString{
754 "hdrs": `[":foo"]`,
755 "export_includes": `[
756 "foo",
757 "baz/foo",
758 "bar",
759 "baz/bar",
760 ".",
761 "baz",
762 ]`,
763 },
764 tc.hod),
765 }
766
767 t.Run(tc.moduleType, func(t *testing.T) {
768 RunBp2BuildTestCase(t, func(ctx android.RegistrationContext) {},
769 Bp2buildTestCase{
770 ModuleTypeUnderTest: tc.moduleType,
771 ModuleTypeUnderTestFactory: tc.factory,
772 Filesystem: map[string]string{
773 filepath.Join(dir, "Android.bp"): fmt.Sprintf(bp, tc.moduleType),
774 },
775 Dir: dir,
776 ExpectedBazelTargets: expectedBazelTargets,
777 })
778 })
779 }
780}
Cole Faustf0d4d4f2023-08-14 11:37:54 -0700781
Cole Fausted940002023-08-15 11:59:24 -0700782func TestGenruleWithSoongConfigVariableConfiguredCmd(t *testing.T) {
Cole Faustf0d4d4f2023-08-14 11:37:54 -0700783 testCases := []struct {
784 moduleType string
785 factory android.ModuleFactory
786 hod android.HostOrDeviceSupported
787 }{
788 {
789 moduleType: "genrule",
790 factory: genrule.GenRuleFactory,
791 },
792 {
793 moduleType: "cc_genrule",
794 factory: cc.GenRuleFactory,
795 hod: android.DeviceSupported,
796 },
797 {
798 moduleType: "java_genrule",
799 factory: java.GenRuleFactory,
800 hod: android.DeviceSupported,
801 },
802 {
803 moduleType: "java_genrule_host",
804 factory: java.GenRuleFactoryHost,
805 hod: android.HostSupported,
806 },
807 }
808
809 bp := `
810soong_config_module_type {
811 name: "my_genrule",
812 module_type: "%s",
813 config_namespace: "my_namespace",
814 bool_variables: ["my_variable"],
815 properties: ["cmd"],
816}
817
818my_genrule {
819 name: "foo",
820 out: ["foo.txt"],
821 cmd: "echo 'no variable' > $(out)",
822 soong_config_variables: {
823 my_variable: {
824 cmd: "echo 'with variable' > $(out)",
825 },
826 },
827 bazel_module: { bp2build_available: true },
828}
829`
830
831 for _, tc := range testCases {
832 moduleAttrs := AttrNameToString{
833 "cmd": `select({
834 "//build/bazel/product_config/config_settings:my_namespace__my_variable": "echo 'with variable' > $(OUTS)",
835 "//conditions:default": "echo 'no variable' > $(OUTS)",
836 })`,
837 "outs": `["foo.txt"]`,
838 }
839
840 expectedBazelTargets := []string{
841 makeBazelTargetHostOrDevice("genrule", "foo", moduleAttrs, tc.hod),
842 }
843
844 t.Run(tc.moduleType, func(t *testing.T) {
845 RunBp2BuildTestCase(t, func(ctx android.RegistrationContext) { android.RegisterSoongConfigModuleBuildComponents(ctx) },
846 Bp2buildTestCase{
847 Blueprint: fmt.Sprintf(bp, tc.moduleType),
848 ModuleTypeUnderTest: tc.moduleType,
849 ModuleTypeUnderTestFactory: tc.factory,
850 ExpectedBazelTargets: expectedBazelTargets,
851 })
852 })
853 }
854}
Cole Fausted940002023-08-15 11:59:24 -0700855
856func TestGenruleWithProductVariableConfiguredCmd(t *testing.T) {
857 testCases := []struct {
858 moduleType string
859 factory android.ModuleFactory
860 hod android.HostOrDeviceSupported
861 }{
862 {
863 moduleType: "genrule",
864 factory: genrule.GenRuleFactory,
865 },
866 {
867 moduleType: "cc_genrule",
868 factory: cc.GenRuleFactory,
869 hod: android.DeviceSupported,
870 },
871 {
872 moduleType: "java_genrule",
873 factory: java.GenRuleFactory,
874 hod: android.DeviceSupported,
875 },
876 {
877 moduleType: "java_genrule_host",
878 factory: java.GenRuleFactoryHost,
879 hod: android.HostSupported,
880 },
881 }
882
883 bp := `
884
885%s {
886 name: "foo",
887 out: ["foo.txt"],
888 cmd: "echo 'no variable' > $(out)",
889 product_variables: {
890 debuggable: {
891 cmd: "echo 'with variable' > $(out)",
892 },
893 },
894 bazel_module: { bp2build_available: true },
895}
896`
897
898 for _, tc := range testCases {
899 moduleAttrs := AttrNameToString{
900 "cmd": `select({
901 "//build/bazel/product_config/config_settings:debuggable": "echo 'with variable' > $(OUTS)",
902 "//conditions:default": "echo 'no variable' > $(OUTS)",
903 })`,
904 "outs": `["foo.txt"]`,
905 }
906
907 expectedBazelTargets := []string{
908 makeBazelTargetHostOrDevice("genrule", "foo", moduleAttrs, tc.hod),
909 }
910
911 t.Run(tc.moduleType, func(t *testing.T) {
912 RunBp2BuildTestCase(t, func(ctx android.RegistrationContext) { android.RegisterSoongConfigModuleBuildComponents(ctx) },
913 Bp2buildTestCase{
914 Blueprint: fmt.Sprintf(bp, tc.moduleType),
915 ModuleTypeUnderTest: tc.moduleType,
916 ModuleTypeUnderTestFactory: tc.factory,
917 ExpectedBazelTargets: expectedBazelTargets,
918 })
919 })
920 }
921}
Spandan Dasf62e80a2023-08-17 22:35:04 +0000922
923func TestGenruleWithModulesInNamespaces(t *testing.T) {
924 bp := `
925genrule {
926 name: "mygenrule",
927 cmd: "echo $(location //mynamespace:mymodule) > $(out)",
928 srcs: ["//mynamespace:mymodule"],
929 out: ["myout"],
930}
931`
932 fs := map[string]string{
933 "mynamespace/Android.bp": `soong_namespace {}`,
934 "mynamespace/dir/Android.bp": `cc_binary {name: "mymodule"}`,
935 }
936 expectedBazelTargets := []string{
937 MakeBazelTargetNoRestrictions("genrule", "mygenrule", AttrNameToString{
938 // The fully qualified soong label is <namespace>:<module_name>
939 // - here the prefix is mynamespace
940 // The fully qualifed bazel label is <package>:<module_name>
941 // - here the prefix is mynamespace/dir, since there is a BUILD file at each level of this FS path
942 "cmd": `"echo $(location //mynamespace/dir:mymodule) > $(OUTS)"`,
943 "outs": `["myout"]`,
944 "srcs": `["//mynamespace/dir:mymodule"]`,
945 }),
946 }
947
948 t.Run("genrule that uses module from a different namespace", func(t *testing.T) {
949 runGenruleTestCase(t, Bp2buildTestCase{
950 Blueprint: bp,
951 Filesystem: fs,
952 ModuleTypeUnderTest: "genrule",
953 ModuleTypeUnderTestFactory: genrule.GenRuleFactory,
954 ExpectedBazelTargets: expectedBazelTargets,
Chris Parsonscd209032023-09-19 01:12:48 +0000955 StubbedBuildDefinitions: []string{"//mynamespace/dir:mymodule"},
Spandan Dasf62e80a2023-08-17 22:35:04 +0000956 })
957 })
958
959}