blob: 4e25d1be21b394358ded70b2ddd9b0d87292aae7 [file] [log] [blame]
Rupert Shuttleworth378fc1b2021-07-28 08:03:16 -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 (
18 "android/soong/android"
19 "android/soong/etc"
20
21 "testing"
22)
23
24func runPrebuiltEtcTestCase(t *testing.T, tc bp2buildTestCase) {
25 t.Helper()
26 runBp2BuildTestCase(t, registerPrebuiltEtcModuleTypes, tc)
27}
28
29func registerPrebuiltEtcModuleTypes(ctx android.RegistrationContext) {
30}
31
32func TestPrebuiltEtcSimple(t *testing.T) {
33 runPrebuiltEtcTestCase(t, bp2buildTestCase{
34 description: "prebuilt_etc - simple example",
35 moduleTypeUnderTest: "prebuilt_etc",
36 moduleTypeUnderTestFactory: etc.PrebuiltEtcFactory,
37 moduleTypeUnderTestBp2BuildMutator: etc.PrebuiltEtcBp2Build,
38 filesystem: map[string]string{},
39 blueprint: `
40prebuilt_etc {
41 name: "apex_tz_version",
42 src: "version/tz_version",
43 filename: "tz_version",
44 sub_dir: "tz",
45 installable: false,
46}
47`,
48 expectedBazelTargets: []string{`prebuilt_etc(
49 name = "apex_tz_version",
50 filename = "tz_version",
51 installable = False,
52 src = "version/tz_version",
53 sub_dir = "tz",
54)`}})
55}