Jason Wu | 6d8d44a | 2023-08-08 22:09:12 -0400 | [diff] [blame^] | 1 | // Copyright 2023 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 | |
| 15 | package bp2build |
| 16 | |
| 17 | import ( |
| 18 | "testing" |
| 19 | |
| 20 | "android/soong/android" |
| 21 | "android/soong/sh" |
| 22 | ) |
| 23 | |
| 24 | func TestShTestSimple(t *testing.T) { |
| 25 | RunBp2BuildTestCase(t, func(ctx android.RegistrationContext) {}, Bp2buildTestCase{ |
| 26 | Description: "sh_test test", |
| 27 | ModuleTypeUnderTest: "sh_test", |
| 28 | ModuleTypeUnderTestFactory: sh.ShTestFactory, |
| 29 | Blueprint: `sh_test{ |
| 30 | name: "sts-rootcanal-sidebins", |
| 31 | src: "empty.sh", |
| 32 | test_suites: [ |
| 33 | "sts", |
| 34 | "sts-lite", |
| 35 | ], |
| 36 | data_bins: [ |
| 37 | "android.hardware.bluetooth@1.1-service.sim", |
| 38 | "android.hardware.bluetooth@1.1-impl-sim" |
| 39 | ], |
| 40 | data: ["android.hardware.bluetooth@1.1-service.sim.rc"], |
| 41 | data_libs: ["libc++","libcrypto"], |
| 42 | test_config: "art-gtests-target-install-apex.xml", |
| 43 | test_config_template: ":art-run-test-target-template", |
| 44 | auto_gen_config: false, |
| 45 | test_options:{tags: ["no-remote"], |
| 46 | }, |
| 47 | }`, |
| 48 | ExpectedBazelTargets: []string{ |
| 49 | MakeBazelTarget("sh_test", "sts-rootcanal-sidebins", AttrNameToString{ |
| 50 | "srcs": `["empty.sh"]`, |
| 51 | "data": `[ |
| 52 | "android.hardware.bluetooth@1.1-service.sim.rc", |
| 53 | "android.hardware.bluetooth@1.1-service.sim", |
| 54 | "android.hardware.bluetooth@1.1-impl-sim", |
| 55 | "libc++", |
| 56 | "libcrypto", |
| 57 | ]`, |
| 58 | "test_config": `"art-gtests-target-install-apex.xml"`, |
| 59 | "test_config_template": `":art-run-test-target-template"`, |
| 60 | "auto_gen_config": "False", |
| 61 | "tags": `["no-remote"]`, |
| 62 | })}, |
| 63 | }) |
| 64 | } |
| 65 | |
| 66 | func TestShTestHostSimple(t *testing.T) { |
| 67 | RunBp2BuildTestCase(t, func(ctx android.RegistrationContext) {}, Bp2buildTestCase{ |
| 68 | Description: "sh_test_host test", |
| 69 | ModuleTypeUnderTest: "sh_test_host", |
| 70 | ModuleTypeUnderTestFactory: sh.ShTestHostFactory, |
| 71 | Blueprint: `sh_test_host{ |
| 72 | name: "sts-rootcanal-sidebins", |
| 73 | src: "empty.sh", |
| 74 | test_suites: [ |
| 75 | "sts", |
| 76 | "sts-lite", |
| 77 | ], |
| 78 | data_bins: [ |
| 79 | "android.hardware.bluetooth@1.1-service.sim", |
| 80 | "android.hardware.bluetooth@1.1-impl-sim" |
| 81 | ], |
| 82 | data: ["android.hardware.bluetooth@1.1-service.sim.rc"], |
| 83 | data_libs: ["libc++","libcrypto"], |
| 84 | test_config: "art-gtests-target-install-apex.xml", |
| 85 | test_config_template: ":art-run-test-target-template", |
| 86 | auto_gen_config: false, |
| 87 | test_options:{tags: ["no-remote"], |
| 88 | }, |
| 89 | }`, |
| 90 | ExpectedBazelTargets: []string{ |
| 91 | MakeBazelTarget("sh_test", "sts-rootcanal-sidebins", AttrNameToString{ |
| 92 | "srcs": `["empty.sh"]`, |
| 93 | "data": `[ |
| 94 | "android.hardware.bluetooth@1.1-service.sim.rc", |
| 95 | "android.hardware.bluetooth@1.1-service.sim", |
| 96 | "android.hardware.bluetooth@1.1-impl-sim", |
| 97 | "libc++", |
| 98 | "libcrypto", |
| 99 | ]`, |
| 100 | "tags": `["no-remote"]`, |
| 101 | "test_config": `"art-gtests-target-install-apex.xml"`, |
| 102 | "test_config_template": `":art-run-test-target-template"`, |
| 103 | "auto_gen_config": "False", |
| 104 | "target_compatible_with": `select({ |
| 105 | "//build/bazel/platforms/os:android": ["@platforms//:incompatible"], |
| 106 | "//conditions:default": [], |
| 107 | })`, |
| 108 | })}, |
| 109 | }) |
| 110 | } |
| 111 | |
| 112 | func TestShTestSimpleUnset(t *testing.T) { |
| 113 | RunBp2BuildTestCase(t, func(ctx android.RegistrationContext) {}, Bp2buildTestCase{ |
| 114 | Description: "sh_test test", |
| 115 | ModuleTypeUnderTest: "sh_test", |
| 116 | ModuleTypeUnderTestFactory: sh.ShTestFactory, |
| 117 | Blueprint: `sh_test{ |
| 118 | name: "sts-rootcanal-sidebins", |
| 119 | src: "empty.sh", |
| 120 | test_suites: [ |
| 121 | "sts", |
| 122 | "sts-lite", |
| 123 | ], |
| 124 | data_bins: [ |
| 125 | "android.hardware.bluetooth@1.1-service.sim", |
| 126 | "android.hardware.bluetooth@1.1-impl-sim" |
| 127 | ], |
| 128 | data: ["android.hardware.bluetooth@1.1-service.sim.rc"], |
| 129 | data_libs: ["libc++","libcrypto"], |
| 130 | test_options:{tags: ["no-remote"], |
| 131 | }, |
| 132 | }`, |
| 133 | ExpectedBazelTargets: []string{ |
| 134 | MakeBazelTarget("sh_test", "sts-rootcanal-sidebins", AttrNameToString{ |
| 135 | "srcs": `["empty.sh"]`, |
| 136 | "data": `[ |
| 137 | "android.hardware.bluetooth@1.1-service.sim.rc", |
| 138 | "android.hardware.bluetooth@1.1-service.sim", |
| 139 | "android.hardware.bluetooth@1.1-impl-sim", |
| 140 | "libc++", |
| 141 | "libcrypto", |
| 142 | ]`, |
| 143 | "tags": `["no-remote"]`, |
| 144 | })}, |
| 145 | }) |
| 146 | } |
| 147 | |
| 148 | func TestShTestHostSimpleUnset(t *testing.T) { |
| 149 | RunBp2BuildTestCase(t, func(ctx android.RegistrationContext) {}, Bp2buildTestCase{ |
| 150 | Description: "sh_test_host test", |
| 151 | ModuleTypeUnderTest: "sh_test_host", |
| 152 | ModuleTypeUnderTestFactory: sh.ShTestHostFactory, |
| 153 | Blueprint: `sh_test_host{ |
| 154 | name: "sts-rootcanal-sidebins", |
| 155 | src: "empty.sh", |
| 156 | test_suites: [ |
| 157 | "sts", |
| 158 | "sts-lite", |
| 159 | ], |
| 160 | data_bins: [ |
| 161 | "android.hardware.bluetooth@1.1-service.sim", |
| 162 | "android.hardware.bluetooth@1.1-impl-sim" |
| 163 | ], |
| 164 | data: ["android.hardware.bluetooth@1.1-service.sim.rc"], |
| 165 | data_libs: ["libc++","libcrypto"], |
| 166 | test_options:{tags: ["no-remote"], |
| 167 | }, |
| 168 | }`, |
| 169 | ExpectedBazelTargets: []string{ |
| 170 | MakeBazelTarget("sh_test", "sts-rootcanal-sidebins", AttrNameToString{ |
| 171 | "srcs": `["empty.sh"]`, |
| 172 | "data": `[ |
| 173 | "android.hardware.bluetooth@1.1-service.sim.rc", |
| 174 | "android.hardware.bluetooth@1.1-service.sim", |
| 175 | "android.hardware.bluetooth@1.1-impl-sim", |
| 176 | "libc++", |
| 177 | "libcrypto", |
| 178 | ]`, |
| 179 | "tags": `["no-remote"]`, |
| 180 | "target_compatible_with": `select({ |
| 181 | "//build/bazel/platforms/os:android": ["@platforms//:incompatible"], |
| 182 | "//conditions:default": [], |
| 183 | })`, |
| 184 | })}, |
| 185 | }) |
| 186 | } |