blob: c44574aab7e658a20581fcd319d0c5f3e2573a0c [file] [log] [blame]
Tao Bao0ba5c942018-08-14 22:20:22 -07001// Copyright 2018 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
Jaewoong Jung4b79e982020-06-01 10:45:49 -070015package etc
Tao Bao0ba5c942018-08-14 22:20:22 -070016
17import (
Jaewoong Jung4b79e982020-06-01 10:45:49 -070018 "os"
Patrice Arruda300cef92019-02-22 15:47:57 -080019 "path/filepath"
Tao Bao0ba5c942018-08-14 22:20:22 -070020 "testing"
Jaewoong Jung4b79e982020-06-01 10:45:49 -070021
Kiyoung Kimae11c232021-07-19 11:38:04 +090022 "github.com/google/blueprint/proptools"
23
Jaewoong Jung4b79e982020-06-01 10:45:49 -070024 "android/soong/android"
Tao Bao0ba5c942018-08-14 22:20:22 -070025)
26
Jaewoong Jung4b79e982020-06-01 10:45:49 -070027func TestMain(m *testing.M) {
Paul Duffin5f9f7712021-03-15 15:35:49 +000028 os.Exit(m.Run())
Jaewoong Jung4b79e982020-06-01 10:45:49 -070029}
30
Paul Duffin89648f92021-03-20 00:36:55 +000031var prepareForPrebuiltEtcTest = android.GroupFixturePreparers(
Paul Duffin1172fed2021-03-08 11:28:18 +000032 android.PrepareForTestWithArchMutator,
33 PrepareForTestWithPrebuiltEtc,
34 android.FixtureMergeMockFs(android.MockFS{
Colin Cross98be1bb2019-12-13 20:41:13 -080035 "foo.conf": nil,
36 "bar.conf": nil,
37 "baz.conf": nil,
Paul Duffin1172fed2021-03-08 11:28:18 +000038 }),
39)
Colin Cross98be1bb2019-12-13 20:41:13 -080040
Tao Bao0ba5c942018-08-14 22:20:22 -070041func TestPrebuiltEtcVariants(t *testing.T) {
Paul Duffin89648f92021-03-20 00:36:55 +000042 result := prepareForPrebuiltEtcTest.RunTestWithBp(t, `
Tao Bao0ba5c942018-08-14 22:20:22 -070043 prebuilt_etc {
44 name: "foo.conf",
45 src: "foo.conf",
46 }
47 prebuilt_etc {
48 name: "bar.conf",
49 src: "bar.conf",
50 recovery_available: true,
51 }
52 prebuilt_etc {
53 name: "baz.conf",
54 src: "baz.conf",
55 recovery: true,
56 }
57 `)
58
Paul Duffin921fac72021-03-10 09:00:58 +000059 foo_variants := result.ModuleVariantsForTests("foo.conf")
Tao Bao0ba5c942018-08-14 22:20:22 -070060 if len(foo_variants) != 1 {
61 t.Errorf("expected 1, got %#v", foo_variants)
62 }
63
Paul Duffin921fac72021-03-10 09:00:58 +000064 bar_variants := result.ModuleVariantsForTests("bar.conf")
Tao Bao0ba5c942018-08-14 22:20:22 -070065 if len(bar_variants) != 2 {
66 t.Errorf("expected 2, got %#v", bar_variants)
67 }
68
Paul Duffin921fac72021-03-10 09:00:58 +000069 baz_variants := result.ModuleVariantsForTests("baz.conf")
Tao Bao0ba5c942018-08-14 22:20:22 -070070 if len(baz_variants) != 1 {
Cole Faustdff9c142023-09-01 16:11:47 -070071 t.Errorf("expected 1, got %#v", baz_variants)
Tao Bao0ba5c942018-08-14 22:20:22 -070072 }
73}
Jiyong Park139a2e62018-10-26 21:49:39 +090074
75func TestPrebuiltEtcOutputPath(t *testing.T) {
Paul Duffin89648f92021-03-20 00:36:55 +000076 result := prepareForPrebuiltEtcTest.RunTestWithBp(t, `
Jiyong Park139a2e62018-10-26 21:49:39 +090077 prebuilt_etc {
78 name: "foo.conf",
79 src: "foo.conf",
80 filename: "foo.installed.conf",
81 }
82 `)
83
Paul Duffin921fac72021-03-10 09:00:58 +000084 p := result.Module("foo.conf", "android_arm64_armv8-a").(*PrebuiltEtc)
Thiébaud Weksteen00e8b312024-03-18 14:06:00 +110085 android.AssertStringEquals(t, "output file path", "foo.installed.conf", p.outputFilePaths[0].Base())
Jiyong Park139a2e62018-10-26 21:49:39 +090086}
Jiyong Park1a7cf082018-11-13 11:59:12 +090087
88func TestPrebuiltEtcGlob(t *testing.T) {
Paul Duffin89648f92021-03-20 00:36:55 +000089 result := prepareForPrebuiltEtcTest.RunTestWithBp(t, `
Jiyong Park1a7cf082018-11-13 11:59:12 +090090 prebuilt_etc {
91 name: "my_foo",
92 src: "foo.*",
93 }
94 prebuilt_etc {
95 name: "my_bar",
96 src: "bar.*",
97 filename_from_src: true,
98 }
99 `)
100
Paul Duffin921fac72021-03-10 09:00:58 +0000101 p := result.Module("my_foo", "android_arm64_armv8-a").(*PrebuiltEtc)
Thiébaud Weksteen00e8b312024-03-18 14:06:00 +1100102 android.AssertStringEquals(t, "my_foo output file path", "my_foo", p.outputFilePaths[0].Base())
Jiyong Park1a7cf082018-11-13 11:59:12 +0900103
Paul Duffin921fac72021-03-10 09:00:58 +0000104 p = result.Module("my_bar", "android_arm64_armv8-a").(*PrebuiltEtc)
Thiébaud Weksteen00e8b312024-03-18 14:06:00 +1100105 android.AssertStringEquals(t, "my_bar output file path", "bar.conf", p.outputFilePaths[0].Base())
106}
107
108func TestPrebuiltEtcMultipleSrcs(t *testing.T) {
109 result := prepareForPrebuiltEtcTest.RunTestWithBp(t, `
110 prebuilt_etc {
111 name: "foo",
112 srcs: ["*.conf"],
113 }
114 `)
115
116 p := result.Module("foo", "android_arm64_armv8-a").(*PrebuiltEtc)
117 android.AssertStringEquals(t, "output file path", "bar.conf", p.outputFilePaths[0].Base())
118 android.AssertStringEquals(t, "output file path", "baz.conf", p.outputFilePaths[1].Base())
119 android.AssertStringEquals(t, "output file path", "foo.conf", p.outputFilePaths[2].Base())
Jiyong Park1a7cf082018-11-13 11:59:12 +0900120}
Anton Hanssonce0e2582019-02-04 14:19:27 +0000121
122func TestPrebuiltEtcAndroidMk(t *testing.T) {
Paul Duffin89648f92021-03-20 00:36:55 +0000123 result := prepareForPrebuiltEtcTest.RunTestWithBp(t, `
Anton Hanssonce0e2582019-02-04 14:19:27 +0000124 prebuilt_etc {
125 name: "foo",
126 src: "foo.conf",
127 owner: "abc",
128 filename_from_src: true,
Jaewoong Jung9aa3ab12019-04-03 15:47:29 -0700129 required: ["modA", "moduleB"],
130 host_required: ["hostModA", "hostModB"],
131 target_required: ["targetModA"],
Anton Hanssonce0e2582019-02-04 14:19:27 +0000132 }
133 `)
134
Jaewoong Jung9aa3ab12019-04-03 15:47:29 -0700135 expected := map[string][]string{
136 "LOCAL_MODULE": {"foo"},
137 "LOCAL_MODULE_CLASS": {"ETC"},
138 "LOCAL_MODULE_OWNER": {"abc"},
139 "LOCAL_INSTALLED_MODULE_STEM": {"foo.conf"},
140 "LOCAL_REQUIRED_MODULES": {"modA", "moduleB"},
141 "LOCAL_HOST_REQUIRED_MODULES": {"hostModA", "hostModB"},
142 "LOCAL_TARGET_REQUIRED_MODULES": {"targetModA"},
Wei Li598f92d2023-01-04 17:12:24 -0800143 "LOCAL_SOONG_MODULE_TYPE": {"prebuilt_etc"},
Anton Hanssonce0e2582019-02-04 14:19:27 +0000144 }
145
Paul Duffin921fac72021-03-10 09:00:58 +0000146 mod := result.Module("foo", "android_arm64_armv8-a").(*PrebuiltEtc)
147 entries := android.AndroidMkEntriesForTest(t, result.TestContext, mod)[0]
Jaewoong Jung9aa3ab12019-04-03 15:47:29 -0700148 for k, expectedValue := range expected {
149 if value, ok := entries.EntryMap[k]; ok {
Paul Duffine84b1332021-03-12 11:59:43 +0000150 android.AssertDeepEquals(t, k, expectedValue, value)
Jaewoong Jung9aa3ab12019-04-03 15:47:29 -0700151 } else {
152 t.Errorf("No %s defined, saw %q", k, entries.EntryMap)
Anton Hanssonce0e2582019-02-04 14:19:27 +0000153 }
154 }
155}
Jaewoong Jung24788182019-02-04 14:34:10 -0800156
Liz Kammer0449a632020-06-26 10:12:36 -0700157func TestPrebuiltEtcRelativeInstallPathInstallDirPath(t *testing.T) {
Paul Duffin89648f92021-03-20 00:36:55 +0000158 result := prepareForPrebuiltEtcTest.RunTestWithBp(t, `
Liz Kammer0449a632020-06-26 10:12:36 -0700159 prebuilt_etc {
160 name: "foo.conf",
161 src: "foo.conf",
162 relative_install_path: "bar",
163 }
164 `)
165
Paul Duffin921fac72021-03-10 09:00:58 +0000166 p := result.Module("foo.conf", "android_arm64_armv8-a").(*PrebuiltEtc)
Paul Duffin5f9f7712021-03-15 15:35:49 +0000167 expected := "out/soong/target/product/test_device/system/etc/bar"
168 android.AssertPathRelativeToTopEquals(t, "install dir", expected, p.installDirPath)
Liz Kammer0449a632020-06-26 10:12:36 -0700169}
170
171func TestPrebuiltEtcCannotSetRelativeInstallPathAndSubDir(t *testing.T) {
Paul Duffin89648f92021-03-20 00:36:55 +0000172 prepareForPrebuiltEtcTest.
Paul Duffin1172fed2021-03-08 11:28:18 +0000173 ExtendWithErrorHandler(android.FixtureExpectsAtLeastOneErrorMatchingPattern("relative_install_path is set. Cannot set sub_dir")).
174 RunTestWithBp(t, `
175 prebuilt_etc {
176 name: "foo.conf",
177 src: "foo.conf",
178 sub_dir: "bar",
179 relative_install_path: "bar",
180 }
181 `)
Liz Kammer0449a632020-06-26 10:12:36 -0700182}
183
Jaewoong Jung24788182019-02-04 14:34:10 -0800184func TestPrebuiltEtcHost(t *testing.T) {
Paul Duffin89648f92021-03-20 00:36:55 +0000185 result := prepareForPrebuiltEtcTest.RunTestWithBp(t, `
Jaewoong Jung24788182019-02-04 14:34:10 -0800186 prebuilt_etc_host {
187 name: "foo.conf",
188 src: "foo.conf",
189 }
190 `)
191
Colin Cross0c66bc62021-07-20 09:47:41 -0700192 buildOS := result.Config.BuildOS.String()
Paul Duffin921fac72021-03-10 09:00:58 +0000193 p := result.Module("foo.conf", buildOS+"_common").(*PrebuiltEtc)
Jaewoong Jung24788182019-02-04 14:34:10 -0800194 if !p.Host() {
195 t.Errorf("host bit is not set for a prebuilt_etc_host module.")
196 }
197}
Jaewoong Jungc3fcdb42019-02-13 05:50:33 -0800198
Colin Cross725eac62022-10-03 15:31:29 -0700199func TestPrebuiltEtcAllowMissingDependencies(t *testing.T) {
200 result := android.GroupFixturePreparers(
201 prepareForPrebuiltEtcTest,
202 android.PrepareForTestDisallowNonExistentPaths,
203 android.FixtureModifyConfig(
204 func(config android.Config) {
205 config.TestProductVariables.Allow_missing_dependencies = proptools.BoolPtr(true)
206 }),
207 ).RunTestWithBp(t, `
208 prebuilt_etc {
209 name: "foo.conf",
210 filename_from_src: true,
211 arch: {
212 x86: {
213 src: "x86.conf",
214 },
215 },
216 }
217 `)
218
219 android.AssertStringEquals(t, "expected error rule", "android/soong/android.Error",
220 result.ModuleForTests("foo.conf", "android_arm64_armv8-a").Output("foo.conf").Rule.String())
221}
222
Inseob Kim27408bf2021-04-06 21:00:17 +0900223func TestPrebuiltRootInstallDirPath(t *testing.T) {
224 result := prepareForPrebuiltEtcTest.RunTestWithBp(t, `
225 prebuilt_root {
226 name: "foo.conf",
227 src: "foo.conf",
228 filename: "foo.conf",
229 }
230 `)
231
232 p := result.Module("foo.conf", "android_arm64_armv8-a").(*PrebuiltEtc)
233 expected := "out/soong/target/product/test_device/system"
234 android.AssertPathRelativeToTopEquals(t, "install dir", expected, p.installDirPath)
235}
236
237func TestPrebuiltRootInstallDirPathValidate(t *testing.T) {
238 prepareForPrebuiltEtcTest.ExtendWithErrorHandler(android.FixtureExpectsAtLeastOneErrorMatchingPattern("filename cannot contain separator")).RunTestWithBp(t, `
239 prebuilt_root {
240 name: "foo.conf",
241 src: "foo.conf",
242 filename: "foo/bar.conf",
243 }
244 `)
245}
246
Jaewoong Jungc3fcdb42019-02-13 05:50:33 -0800247func TestPrebuiltUserShareInstallDirPath(t *testing.T) {
Paul Duffin89648f92021-03-20 00:36:55 +0000248 result := prepareForPrebuiltEtcTest.RunTestWithBp(t, `
Jaewoong Jungc3fcdb42019-02-13 05:50:33 -0800249 prebuilt_usr_share {
250 name: "foo.conf",
251 src: "foo.conf",
252 sub_dir: "bar",
253 }
254 `)
255
Paul Duffin921fac72021-03-10 09:00:58 +0000256 p := result.Module("foo.conf", "android_arm64_armv8-a").(*PrebuiltEtc)
Paul Duffin5f9f7712021-03-15 15:35:49 +0000257 expected := "out/soong/target/product/test_device/system/usr/share/bar"
258 android.AssertPathRelativeToTopEquals(t, "install dir", expected, p.installDirPath)
Jaewoong Jungc3fcdb42019-02-13 05:50:33 -0800259}
Patrice Arruda300cef92019-02-22 15:47:57 -0800260
261func TestPrebuiltUserShareHostInstallDirPath(t *testing.T) {
Paul Duffin89648f92021-03-20 00:36:55 +0000262 result := prepareForPrebuiltEtcTest.RunTestWithBp(t, `
Patrice Arruda300cef92019-02-22 15:47:57 -0800263 prebuilt_usr_share_host {
264 name: "foo.conf",
265 src: "foo.conf",
266 sub_dir: "bar",
267 }
268 `)
269
Colin Cross0c66bc62021-07-20 09:47:41 -0700270 buildOS := result.Config.BuildOS.String()
Paul Duffin921fac72021-03-10 09:00:58 +0000271 p := result.Module("foo.conf", buildOS+"_common").(*PrebuiltEtc)
Paul Duffin5f9f7712021-03-15 15:35:49 +0000272 expected := filepath.Join("out/soong/host", result.Config.PrebuiltOS(), "usr", "share", "bar")
273 android.AssertPathRelativeToTopEquals(t, "install dir", expected, p.installDirPath)
Patrice Arruda300cef92019-02-22 15:47:57 -0800274}
Patrice Arruda61583eb2019-05-14 08:20:45 -0700275
yangbill63c5e192024-03-27 09:02:12 +0000276func TestPrebuiltPrebuiltUserHyphenDataInstallDirPath(t *testing.T) {
277 result := prepareForPrebuiltEtcTest.RunTestWithBp(t, `
278 prebuilt_usr_hyphendata {
279 name: "foo.conf",
280 src: "foo.conf",
281 sub_dir: "bar",
282 }
283 `)
284
285 p := result.Module("foo.conf", "android_arm64_armv8-a").(*PrebuiltEtc)
286 expected := "out/soong/target/product/test_device/system/usr/hyphen-data/bar"
287 android.AssertPathRelativeToTopEquals(t, "install dir", expected, p.installDirPath)
288}
289
yangbill85527e62024-04-30 08:24:50 +0000290func TestPrebuiltPrebuiltUserKeyLayoutInstallDirPath(t *testing.T) {
291 result := prepareForPrebuiltEtcTest.RunTestWithBp(t, `
292 prebuilt_usr_keylayout {
293 name: "foo.conf",
294 src: "foo.conf",
295 sub_dir: "bar",
296 }
297 `)
298
299 p := result.Module("foo.conf", "android_arm64_armv8-a").(*PrebuiltEtc)
300 expected := "out/soong/target/product/test_device/system/usr/keylayout/bar"
301 android.AssertPathRelativeToTopEquals(t, "install dir", expected, p.installDirPath)
302}
303
304func TestPrebuiltPrebuiltUserKeyCharsInstallDirPath(t *testing.T) {
305 result := prepareForPrebuiltEtcTest.RunTestWithBp(t, `
306 prebuilt_usr_keychars {
307 name: "foo.conf",
308 src: "foo.conf",
309 sub_dir: "bar",
310 }
311 `)
312
313 p := result.Module("foo.conf", "android_arm64_armv8-a").(*PrebuiltEtc)
314 expected := "out/soong/target/product/test_device/system/usr/keychars/bar"
315 android.AssertPathRelativeToTopEquals(t, "install dir", expected, p.installDirPath)
316}
317
318func TestPrebuiltPrebuiltUserIdcInstallDirPath(t *testing.T) {
319 result := prepareForPrebuiltEtcTest.RunTestWithBp(t, `
320 prebuilt_usr_idc {
321 name: "foo.conf",
322 src: "foo.conf",
323 sub_dir: "bar",
324 }
325 `)
326
327 p := result.Module("foo.conf", "android_arm64_armv8-a").(*PrebuiltEtc)
328 expected := "out/soong/target/product/test_device/system/usr/idc/bar"
329 android.AssertPathRelativeToTopEquals(t, "install dir", expected, p.installDirPath)
330}
331
Patrice Arruda61583eb2019-05-14 08:20:45 -0700332func TestPrebuiltFontInstallDirPath(t *testing.T) {
Paul Duffin89648f92021-03-20 00:36:55 +0000333 result := prepareForPrebuiltEtcTest.RunTestWithBp(t, `
Patrice Arruda61583eb2019-05-14 08:20:45 -0700334 prebuilt_font {
335 name: "foo.conf",
336 src: "foo.conf",
337 }
338 `)
339
Paul Duffin921fac72021-03-10 09:00:58 +0000340 p := result.Module("foo.conf", "android_arm64_armv8-a").(*PrebuiltEtc)
Paul Duffin5f9f7712021-03-15 15:35:49 +0000341 expected := "out/soong/target/product/test_device/system/fonts"
342 android.AssertPathRelativeToTopEquals(t, "install dir", expected, p.installDirPath)
Patrice Arruda61583eb2019-05-14 08:20:45 -0700343}
Patrice Arruda057a8b12019-06-03 15:29:27 -0700344
Kevin93f7cd82024-05-02 12:37:59 +0200345func TestPrebuiltOverlayInstallDirPath(t *testing.T) {
346 result := prepareForPrebuiltEtcTest.RunTestWithBp(t, `
347 prebuilt_overlay {
348 name: "foo.conf",
349 src: "foo.conf",
350 }
351 `)
352
353 p := result.Module("foo.conf", "android_arm64_armv8-a").(*PrebuiltEtc)
354 expected := "out/soong/target/product/test_device/system/overlay"
355 android.AssertPathRelativeToTopEquals(t, "install dir", expected, p.installDirPath)
356}
357
Patrice Arruda057a8b12019-06-03 15:29:27 -0700358func TestPrebuiltFirmwareDirPath(t *testing.T) {
Paul Duffin5f9f7712021-03-15 15:35:49 +0000359 targetPath := "out/soong/target/product/test_device"
Patrice Arruda057a8b12019-06-03 15:29:27 -0700360 tests := []struct {
361 description string
362 config string
363 expectedPath string
364 }{{
365 description: "prebuilt: system firmware",
366 config: `
367 prebuilt_firmware {
368 name: "foo.conf",
369 src: "foo.conf",
370 }`,
371 expectedPath: filepath.Join(targetPath, "system/etc/firmware"),
372 }, {
373 description: "prebuilt: vendor firmware",
374 config: `
375 prebuilt_firmware {
376 name: "foo.conf",
377 src: "foo.conf",
378 soc_specific: true,
379 sub_dir: "sub_dir",
380 }`,
381 expectedPath: filepath.Join(targetPath, "vendor/firmware/sub_dir"),
382 }}
383 for _, tt := range tests {
384 t.Run(tt.description, func(t *testing.T) {
Paul Duffin89648f92021-03-20 00:36:55 +0000385 result := prepareForPrebuiltEtcTest.RunTestWithBp(t, tt.config)
Paul Duffin921fac72021-03-10 09:00:58 +0000386 p := result.Module("foo.conf", "android_arm64_armv8-a").(*PrebuiltEtc)
Paul Duffin5f9f7712021-03-15 15:35:49 +0000387 android.AssertPathRelativeToTopEquals(t, "install dir", tt.expectedPath, p.installDirPath)
Patrice Arruda057a8b12019-06-03 15:29:27 -0700388 })
389 }
390}
Patrice Arruda0f688002020-06-08 21:40:25 +0000391
392func TestPrebuiltDSPDirPath(t *testing.T) {
Paul Duffin5f9f7712021-03-15 15:35:49 +0000393 targetPath := "out/soong/target/product/test_device"
Patrice Arruda0f688002020-06-08 21:40:25 +0000394 tests := []struct {
395 description string
396 config string
397 expectedPath string
398 }{{
399 description: "prebuilt: system dsp",
400 config: `
401 prebuilt_dsp {
402 name: "foo.conf",
403 src: "foo.conf",
404 }`,
405 expectedPath: filepath.Join(targetPath, "system/etc/dsp"),
406 }, {
407 description: "prebuilt: vendor dsp",
408 config: `
409 prebuilt_dsp {
410 name: "foo.conf",
411 src: "foo.conf",
412 soc_specific: true,
413 sub_dir: "sub_dir",
414 }`,
415 expectedPath: filepath.Join(targetPath, "vendor/dsp/sub_dir"),
416 }}
417 for _, tt := range tests {
418 t.Run(tt.description, func(t *testing.T) {
Paul Duffin89648f92021-03-20 00:36:55 +0000419 result := prepareForPrebuiltEtcTest.RunTestWithBp(t, tt.config)
Paul Duffin921fac72021-03-10 09:00:58 +0000420 p := result.Module("foo.conf", "android_arm64_armv8-a").(*PrebuiltEtc)
Paul Duffin5f9f7712021-03-15 15:35:49 +0000421 android.AssertPathRelativeToTopEquals(t, "install dir", tt.expectedPath, p.installDirPath)
Patrice Arruda0f688002020-06-08 21:40:25 +0000422 })
423 }
424}
Colin Cross83ebf232021-04-09 09:41:23 -0700425
426func TestPrebuiltRFSADirPath(t *testing.T) {
427 targetPath := "out/soong/target/product/test_device"
428 tests := []struct {
429 description string
430 config string
431 expectedPath string
432 }{{
433 description: "prebuilt: system rfsa",
434 config: `
435 prebuilt_rfsa {
436 name: "foo.conf",
437 src: "foo.conf",
438 }`,
439 expectedPath: filepath.Join(targetPath, "system/lib/rfsa"),
440 }, {
441 description: "prebuilt: vendor rfsa",
442 config: `
443 prebuilt_rfsa {
444 name: "foo.conf",
445 src: "foo.conf",
446 soc_specific: true,
447 sub_dir: "sub_dir",
448 }`,
449 expectedPath: filepath.Join(targetPath, "vendor/lib/rfsa/sub_dir"),
450 }}
451 for _, tt := range tests {
452 t.Run(tt.description, func(t *testing.T) {
453 result := prepareForPrebuiltEtcTest.RunTestWithBp(t, tt.config)
454 p := result.Module("foo.conf", "android_arm64_armv8-a").(*PrebuiltEtc)
455 android.AssertPathRelativeToTopEquals(t, "install dir", tt.expectedPath, p.installDirPath)
456 })
457 }
458}