Colin Cross | 0fce0ba | 2021-01-08 16:40:12 -0800 | [diff] [blame] | 1 | // 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 | |
| 15 | package cc |
| 16 | |
| 17 | import ( |
| 18 | "android/soong/android" |
| 19 | "fmt" |
| 20 | "path/filepath" |
Colin Cross | 2e577f3 | 2021-01-22 13:06:25 -0800 | [diff] [blame] | 21 | "reflect" |
Colin Cross | 0fce0ba | 2021-01-08 16:40:12 -0800 | [diff] [blame] | 22 | "strings" |
| 23 | "testing" |
| 24 | ) |
| 25 | |
Colin Cross | f61d03d | 2023-11-02 16:56:39 -0700 | [diff] [blame^] | 26 | func checkJsonContents(t *testing.T, ctx *android.TestContext, snapshotSingleton android.TestingSingleton, jsonPath string, key string, value string) { |
| 27 | jsonOut := snapshotSingleton.MaybeOutput(jsonPath) |
Justin Yun | 3cc7846 | 2023-05-08 21:06:59 +0900 | [diff] [blame] | 28 | if jsonOut.Rule == nil { |
| 29 | t.Errorf("%q expected but not found", jsonPath) |
| 30 | return |
| 31 | } |
Colin Cross | f61d03d | 2023-11-02 16:56:39 -0700 | [diff] [blame^] | 32 | content := android.ContentFromFileRuleForTests(t, ctx, jsonOut) |
| 33 | if !strings.Contains(content, fmt.Sprintf("%q:%q", key, value)) { |
Justin Yun | 3cc7846 | 2023-05-08 21:06:59 +0900 | [diff] [blame] | 34 | t.Errorf("%q must include %q:%q but it only has %v", jsonPath, key, value, jsonOut.Args["content"]) |
| 35 | } |
| 36 | } |
| 37 | |
Colin Cross | 0fce0ba | 2021-01-08 16:40:12 -0800 | [diff] [blame] | 38 | func TestVendorSnapshotCapture(t *testing.T) { |
| 39 | bp := ` |
| 40 | cc_library { |
| 41 | name: "libvndk", |
| 42 | vendor_available: true, |
| 43 | product_available: true, |
| 44 | vndk: { |
| 45 | enabled: true, |
| 46 | }, |
| 47 | nocrt: true, |
| 48 | } |
| 49 | |
| 50 | cc_library { |
| 51 | name: "libvendor", |
| 52 | vendor: true, |
| 53 | nocrt: true, |
| 54 | } |
| 55 | |
| 56 | cc_library { |
Inseob Kim | a1888ce | 2022-10-04 14:42:02 +0900 | [diff] [blame] | 57 | name: "libvendor_override", |
| 58 | vendor: true, |
| 59 | nocrt: true, |
| 60 | overrides: ["libvendor"], |
| 61 | } |
| 62 | |
| 63 | cc_library { |
Colin Cross | 0fce0ba | 2021-01-08 16:40:12 -0800 | [diff] [blame] | 64 | name: "libvendor_available", |
| 65 | vendor_available: true, |
| 66 | nocrt: true, |
Justin Yun | 3cc7846 | 2023-05-08 21:06:59 +0900 | [diff] [blame] | 67 | min_sdk_version: "29", |
Colin Cross | 0fce0ba | 2021-01-08 16:40:12 -0800 | [diff] [blame] | 68 | } |
| 69 | |
| 70 | cc_library_headers { |
| 71 | name: "libvendor_headers", |
| 72 | vendor_available: true, |
| 73 | nocrt: true, |
| 74 | } |
| 75 | |
| 76 | cc_binary { |
| 77 | name: "vendor_bin", |
| 78 | vendor: true, |
| 79 | nocrt: true, |
| 80 | } |
| 81 | |
| 82 | cc_binary { |
| 83 | name: "vendor_available_bin", |
| 84 | vendor_available: true, |
| 85 | nocrt: true, |
| 86 | } |
| 87 | |
Inseob Kim | a1888ce | 2022-10-04 14:42:02 +0900 | [diff] [blame] | 88 | cc_binary { |
| 89 | name: "vendor_bin_override", |
| 90 | vendor: true, |
| 91 | nocrt: true, |
| 92 | overrides: ["vendor_bin"], |
| 93 | } |
| 94 | |
Liz Kammer | 718eb27 | 2022-01-07 10:53:37 -0500 | [diff] [blame] | 95 | cc_prebuilt_library_static { |
Colin Cross | 0fce0ba | 2021-01-08 16:40:12 -0800 | [diff] [blame] | 96 | name: "libb", |
| 97 | vendor_available: true, |
Liz Kammer | 718eb27 | 2022-01-07 10:53:37 -0500 | [diff] [blame] | 98 | srcs: ["libb.a"], |
| 99 | nocrt: true, |
| 100 | no_libcrt: true, |
| 101 | stl: "none", |
Colin Cross | 0fce0ba | 2021-01-08 16:40:12 -0800 | [diff] [blame] | 102 | } |
| 103 | |
| 104 | cc_object { |
| 105 | name: "obj", |
| 106 | vendor_available: true, |
| 107 | } |
| 108 | |
| 109 | cc_library { |
| 110 | name: "libllndk", |
Colin Cross | 203b421 | 2021-04-26 17:19:41 -0700 | [diff] [blame] | 111 | llndk: { |
| 112 | symbol_file: "libllndk.map.txt", |
| 113 | }, |
Colin Cross | 0fce0ba | 2021-01-08 16:40:12 -0800 | [diff] [blame] | 114 | } |
| 115 | ` |
Colin Cross | 203b421 | 2021-04-26 17:19:41 -0700 | [diff] [blame] | 116 | |
Paul Duffin | c3e6ce0 | 2021-03-22 23:21:32 +0000 | [diff] [blame] | 117 | config := TestConfig(t.TempDir(), android.Android, nil, bp, nil) |
Colin Cross | 0fce0ba | 2021-01-08 16:40:12 -0800 | [diff] [blame] | 118 | config.TestProductVariables.DeviceVndkVersion = StringPtr("current") |
Jiyong Park | f58c46e | 2021-04-01 21:35:20 +0900 | [diff] [blame] | 119 | config.TestProductVariables.Platform_vndk_version = StringPtr("29") |
Colin Cross | 0fce0ba | 2021-01-08 16:40:12 -0800 | [diff] [blame] | 120 | ctx := testCcWithConfig(t, config) |
| 121 | |
| 122 | // Check Vendor snapshot output. |
| 123 | |
| 124 | snapshotDir := "vendor-snapshot" |
Paul Duffin | c3e6ce0 | 2021-03-22 23:21:32 +0000 | [diff] [blame] | 125 | snapshotVariantPath := filepath.Join("out/soong", snapshotDir, "arm64") |
Colin Cross | 0fce0ba | 2021-01-08 16:40:12 -0800 | [diff] [blame] | 126 | snapshotSingleton := ctx.SingletonForTests("vendor-snapshot") |
| 127 | |
| 128 | var jsonFiles []string |
| 129 | |
| 130 | for _, arch := range [][]string{ |
| 131 | []string{"arm64", "armv8-a"}, |
| 132 | []string{"arm", "armv7-a-neon"}, |
| 133 | } { |
| 134 | archType := arch[0] |
| 135 | archVariant := arch[1] |
| 136 | archDir := fmt.Sprintf("arch-%s-%s", archType, archVariant) |
| 137 | |
| 138 | // For shared libraries, only non-VNDK vendor_available modules are captured |
Jiyong Park | f58c46e | 2021-04-01 21:35:20 +0900 | [diff] [blame] | 139 | sharedVariant := fmt.Sprintf("android_vendor.29_%s_%s_shared", archType, archVariant) |
Colin Cross | 0fce0ba | 2021-01-08 16:40:12 -0800 | [diff] [blame] | 140 | sharedDir := filepath.Join(snapshotVariantPath, archDir, "shared") |
Ivan Lozano | d67a6b0 | 2021-05-20 13:01:32 -0400 | [diff] [blame] | 141 | CheckSnapshot(t, ctx, snapshotSingleton, "libvendor", "libvendor.so", sharedDir, sharedVariant) |
| 142 | CheckSnapshot(t, ctx, snapshotSingleton, "libvendor_available", "libvendor_available.so", sharedDir, sharedVariant) |
Colin Cross | 0fce0ba | 2021-01-08 16:40:12 -0800 | [diff] [blame] | 143 | jsonFiles = append(jsonFiles, |
| 144 | filepath.Join(sharedDir, "libvendor.so.json"), |
| 145 | filepath.Join(sharedDir, "libvendor_available.so.json")) |
| 146 | |
| 147 | // LLNDK modules are not captured |
Ivan Lozano | d67a6b0 | 2021-05-20 13:01:32 -0400 | [diff] [blame] | 148 | CheckSnapshotExclude(t, ctx, snapshotSingleton, "libllndk", "libllndk.so", sharedDir, sharedVariant) |
Colin Cross | 0fce0ba | 2021-01-08 16:40:12 -0800 | [diff] [blame] | 149 | |
| 150 | // For static libraries, all vendor:true and vendor_available modules (including VNDK) are captured. |
| 151 | // Also cfi variants are captured, except for prebuilts like toolchain_library |
Jiyong Park | f58c46e | 2021-04-01 21:35:20 +0900 | [diff] [blame] | 152 | staticVariant := fmt.Sprintf("android_vendor.29_%s_%s_static", archType, archVariant) |
| 153 | staticCfiVariant := fmt.Sprintf("android_vendor.29_%s_%s_static_cfi", archType, archVariant) |
Colin Cross | 0fce0ba | 2021-01-08 16:40:12 -0800 | [diff] [blame] | 154 | staticDir := filepath.Join(snapshotVariantPath, archDir, "static") |
Ivan Lozano | d67a6b0 | 2021-05-20 13:01:32 -0400 | [diff] [blame] | 155 | CheckSnapshot(t, ctx, snapshotSingleton, "libb", "libb.a", staticDir, staticVariant) |
| 156 | CheckSnapshot(t, ctx, snapshotSingleton, "libvndk", "libvndk.a", staticDir, staticVariant) |
| 157 | CheckSnapshot(t, ctx, snapshotSingleton, "libvndk", "libvndk.cfi.a", staticDir, staticCfiVariant) |
| 158 | CheckSnapshot(t, ctx, snapshotSingleton, "libvendor", "libvendor.a", staticDir, staticVariant) |
| 159 | CheckSnapshot(t, ctx, snapshotSingleton, "libvendor", "libvendor.cfi.a", staticDir, staticCfiVariant) |
| 160 | CheckSnapshot(t, ctx, snapshotSingleton, "libvendor_available", "libvendor_available.a", staticDir, staticVariant) |
| 161 | CheckSnapshot(t, ctx, snapshotSingleton, "libvendor_available", "libvendor_available.cfi.a", staticDir, staticCfiVariant) |
Colin Cross | 0fce0ba | 2021-01-08 16:40:12 -0800 | [diff] [blame] | 162 | jsonFiles = append(jsonFiles, |
| 163 | filepath.Join(staticDir, "libb.a.json"), |
| 164 | filepath.Join(staticDir, "libvndk.a.json"), |
| 165 | filepath.Join(staticDir, "libvndk.cfi.a.json"), |
| 166 | filepath.Join(staticDir, "libvendor.a.json"), |
| 167 | filepath.Join(staticDir, "libvendor.cfi.a.json"), |
| 168 | filepath.Join(staticDir, "libvendor_available.a.json"), |
| 169 | filepath.Join(staticDir, "libvendor_available.cfi.a.json")) |
| 170 | |
Colin Cross | f61d03d | 2023-11-02 16:56:39 -0700 | [diff] [blame^] | 171 | checkJsonContents(t, ctx, snapshotSingleton, filepath.Join(staticDir, "libb.a.json"), "MinSdkVersion", "apex_inherit") |
| 172 | checkJsonContents(t, ctx, snapshotSingleton, filepath.Join(staticDir, "libvendor_available.a.json"), "MinSdkVersion", "29") |
Justin Yun | 3cc7846 | 2023-05-08 21:06:59 +0900 | [diff] [blame] | 173 | |
Colin Cross | 0fce0ba | 2021-01-08 16:40:12 -0800 | [diff] [blame] | 174 | // For binary executables, all vendor:true and vendor_available modules are captured. |
| 175 | if archType == "arm64" { |
Jiyong Park | f58c46e | 2021-04-01 21:35:20 +0900 | [diff] [blame] | 176 | binaryVariant := fmt.Sprintf("android_vendor.29_%s_%s", archType, archVariant) |
Colin Cross | 0fce0ba | 2021-01-08 16:40:12 -0800 | [diff] [blame] | 177 | binaryDir := filepath.Join(snapshotVariantPath, archDir, "binary") |
Ivan Lozano | d67a6b0 | 2021-05-20 13:01:32 -0400 | [diff] [blame] | 178 | CheckSnapshot(t, ctx, snapshotSingleton, "vendor_bin", "vendor_bin", binaryDir, binaryVariant) |
| 179 | CheckSnapshot(t, ctx, snapshotSingleton, "vendor_available_bin", "vendor_available_bin", binaryDir, binaryVariant) |
Colin Cross | 0fce0ba | 2021-01-08 16:40:12 -0800 | [diff] [blame] | 180 | jsonFiles = append(jsonFiles, |
| 181 | filepath.Join(binaryDir, "vendor_bin.json"), |
| 182 | filepath.Join(binaryDir, "vendor_available_bin.json")) |
Inseob Kim | a1888ce | 2022-10-04 14:42:02 +0900 | [diff] [blame] | 183 | |
| 184 | checkOverrides(t, ctx, snapshotSingleton, filepath.Join(binaryDir, "vendor_bin_override.json"), []string{"vendor_bin"}) |
Colin Cross | 0fce0ba | 2021-01-08 16:40:12 -0800 | [diff] [blame] | 185 | } |
| 186 | |
| 187 | // For header libraries, all vendor:true and vendor_available modules are captured. |
| 188 | headerDir := filepath.Join(snapshotVariantPath, archDir, "header") |
| 189 | jsonFiles = append(jsonFiles, filepath.Join(headerDir, "libvendor_headers.json")) |
| 190 | |
| 191 | // For object modules, all vendor:true and vendor_available modules are captured. |
Jiyong Park | f58c46e | 2021-04-01 21:35:20 +0900 | [diff] [blame] | 192 | objectVariant := fmt.Sprintf("android_vendor.29_%s_%s", archType, archVariant) |
Colin Cross | 0fce0ba | 2021-01-08 16:40:12 -0800 | [diff] [blame] | 193 | objectDir := filepath.Join(snapshotVariantPath, archDir, "object") |
Ivan Lozano | d67a6b0 | 2021-05-20 13:01:32 -0400 | [diff] [blame] | 194 | CheckSnapshot(t, ctx, snapshotSingleton, "obj", "obj.o", objectDir, objectVariant) |
Colin Cross | 0fce0ba | 2021-01-08 16:40:12 -0800 | [diff] [blame] | 195 | jsonFiles = append(jsonFiles, filepath.Join(objectDir, "obj.o.json")) |
Inseob Kim | a1888ce | 2022-10-04 14:42:02 +0900 | [diff] [blame] | 196 | |
| 197 | checkOverrides(t, ctx, snapshotSingleton, filepath.Join(sharedDir, "libvendor_override.so.json"), []string{"libvendor"}) |
Colin Cross | 0fce0ba | 2021-01-08 16:40:12 -0800 | [diff] [blame] | 198 | } |
| 199 | |
| 200 | for _, jsonFile := range jsonFiles { |
| 201 | // verify all json files exist |
| 202 | if snapshotSingleton.MaybeOutput(jsonFile).Rule == nil { |
| 203 | t.Errorf("%q expected but not found", jsonFile) |
| 204 | } |
| 205 | } |
| 206 | |
| 207 | // fake snapshot should have all outputs in the normal snapshot. |
| 208 | fakeSnapshotSingleton := ctx.SingletonForTests("vendor-fake-snapshot") |
| 209 | for _, output := range snapshotSingleton.AllOutputs() { |
| 210 | fakeOutput := strings.Replace(output, "/vendor-snapshot/", "/fake/vendor-snapshot/", 1) |
| 211 | if fakeSnapshotSingleton.MaybeOutput(fakeOutput).Rule == nil { |
| 212 | t.Errorf("%q expected but not found", fakeOutput) |
| 213 | } |
| 214 | } |
| 215 | } |
| 216 | |
| 217 | func TestVendorSnapshotDirected(t *testing.T) { |
| 218 | bp := ` |
| 219 | cc_library_shared { |
| 220 | name: "libvendor", |
| 221 | vendor: true, |
| 222 | nocrt: true, |
| 223 | } |
| 224 | |
| 225 | cc_library_shared { |
| 226 | name: "libvendor_available", |
| 227 | vendor_available: true, |
| 228 | nocrt: true, |
| 229 | } |
| 230 | |
| 231 | genrule { |
| 232 | name: "libfoo_gen", |
| 233 | cmd: "", |
| 234 | out: ["libfoo.so"], |
| 235 | } |
| 236 | |
| 237 | cc_prebuilt_library_shared { |
| 238 | name: "libfoo", |
| 239 | vendor: true, |
| 240 | prefer: true, |
| 241 | srcs: [":libfoo_gen"], |
| 242 | } |
| 243 | |
| 244 | cc_library_shared { |
| 245 | name: "libfoo", |
| 246 | vendor: true, |
| 247 | nocrt: true, |
| 248 | } |
| 249 | ` |
Paul Duffin | c3e6ce0 | 2021-03-22 23:21:32 +0000 | [diff] [blame] | 250 | config := TestConfig(t.TempDir(), android.Android, nil, bp, nil) |
Colin Cross | 0fce0ba | 2021-01-08 16:40:12 -0800 | [diff] [blame] | 251 | config.TestProductVariables.DeviceVndkVersion = StringPtr("current") |
Jiyong Park | f58c46e | 2021-04-01 21:35:20 +0900 | [diff] [blame] | 252 | config.TestProductVariables.Platform_vndk_version = StringPtr("29") |
Colin Cross | 0fce0ba | 2021-01-08 16:40:12 -0800 | [diff] [blame] | 253 | config.TestProductVariables.DirectedVendorSnapshot = true |
| 254 | config.TestProductVariables.VendorSnapshotModules = make(map[string]bool) |
| 255 | config.TestProductVariables.VendorSnapshotModules["libvendor"] = true |
| 256 | config.TestProductVariables.VendorSnapshotModules["libfoo"] = true |
| 257 | ctx := testCcWithConfig(t, config) |
| 258 | |
| 259 | // Check Vendor snapshot output. |
| 260 | |
| 261 | snapshotDir := "vendor-snapshot" |
Paul Duffin | c3e6ce0 | 2021-03-22 23:21:32 +0000 | [diff] [blame] | 262 | snapshotVariantPath := filepath.Join("out/soong", snapshotDir, "arm64") |
Colin Cross | 0fce0ba | 2021-01-08 16:40:12 -0800 | [diff] [blame] | 263 | snapshotSingleton := ctx.SingletonForTests("vendor-snapshot") |
| 264 | |
| 265 | var includeJsonFiles []string |
Colin Cross | 0fce0ba | 2021-01-08 16:40:12 -0800 | [diff] [blame] | 266 | |
| 267 | for _, arch := range [][]string{ |
| 268 | []string{"arm64", "armv8-a"}, |
| 269 | []string{"arm", "armv7-a-neon"}, |
| 270 | } { |
| 271 | archType := arch[0] |
| 272 | archVariant := arch[1] |
| 273 | archDir := fmt.Sprintf("arch-%s-%s", archType, archVariant) |
| 274 | |
Jiyong Park | f58c46e | 2021-04-01 21:35:20 +0900 | [diff] [blame] | 275 | sharedVariant := fmt.Sprintf("android_vendor.29_%s_%s_shared", archType, archVariant) |
Colin Cross | 0fce0ba | 2021-01-08 16:40:12 -0800 | [diff] [blame] | 276 | sharedDir := filepath.Join(snapshotVariantPath, archDir, "shared") |
| 277 | |
| 278 | // Included modules |
Ivan Lozano | d67a6b0 | 2021-05-20 13:01:32 -0400 | [diff] [blame] | 279 | CheckSnapshot(t, ctx, snapshotSingleton, "libvendor", "libvendor.so", sharedDir, sharedVariant) |
Colin Cross | 0fce0ba | 2021-01-08 16:40:12 -0800 | [diff] [blame] | 280 | includeJsonFiles = append(includeJsonFiles, filepath.Join(sharedDir, "libvendor.so.json")) |
| 281 | // Check that snapshot captures "prefer: true" prebuilt |
Ivan Lozano | d67a6b0 | 2021-05-20 13:01:32 -0400 | [diff] [blame] | 282 | CheckSnapshot(t, ctx, snapshotSingleton, "prebuilt_libfoo", "libfoo.so", sharedDir, sharedVariant) |
Colin Cross | 0fce0ba | 2021-01-08 16:40:12 -0800 | [diff] [blame] | 283 | includeJsonFiles = append(includeJsonFiles, filepath.Join(sharedDir, "libfoo.so.json")) |
| 284 | |
Jose Galmes | 0a942a0 | 2021-02-03 14:23:15 -0800 | [diff] [blame] | 285 | // Excluded modules. Modules not included in the directed vendor snapshot |
| 286 | // are still include as fake modules. |
Ivan Lozano | d67a6b0 | 2021-05-20 13:01:32 -0400 | [diff] [blame] | 287 | CheckSnapshotRule(t, ctx, snapshotSingleton, "libvendor_available", "libvendor_available.so", sharedDir, sharedVariant) |
Jose Galmes | 0a942a0 | 2021-02-03 14:23:15 -0800 | [diff] [blame] | 288 | includeJsonFiles = append(includeJsonFiles, filepath.Join(sharedDir, "libvendor_available.so.json")) |
Colin Cross | 0fce0ba | 2021-01-08 16:40:12 -0800 | [diff] [blame] | 289 | } |
| 290 | |
| 291 | // Verify that each json file for an included module has a rule. |
| 292 | for _, jsonFile := range includeJsonFiles { |
| 293 | if snapshotSingleton.MaybeOutput(jsonFile).Rule == nil { |
| 294 | t.Errorf("include json file %q not found", jsonFile) |
| 295 | } |
| 296 | } |
Colin Cross | 0fce0ba | 2021-01-08 16:40:12 -0800 | [diff] [blame] | 297 | } |
| 298 | |
| 299 | func TestVendorSnapshotUse(t *testing.T) { |
| 300 | frameworkBp := ` |
| 301 | cc_library { |
| 302 | name: "libvndk", |
| 303 | vendor_available: true, |
| 304 | product_available: true, |
| 305 | vndk: { |
| 306 | enabled: true, |
| 307 | }, |
| 308 | nocrt: true, |
Colin Cross | 0fce0ba | 2021-01-08 16:40:12 -0800 | [diff] [blame] | 309 | } |
| 310 | |
| 311 | cc_library { |
| 312 | name: "libvendor", |
| 313 | vendor: true, |
| 314 | nocrt: true, |
| 315 | no_libcrt: true, |
| 316 | stl: "none", |
| 317 | system_shared_libs: [], |
Colin Cross | 0fce0ba | 2021-01-08 16:40:12 -0800 | [diff] [blame] | 318 | } |
| 319 | |
Colin Cross | 2e577f3 | 2021-01-22 13:06:25 -0800 | [diff] [blame] | 320 | cc_library { |
| 321 | name: "libvendor_available", |
| 322 | vendor_available: true, |
| 323 | nocrt: true, |
| 324 | no_libcrt: true, |
| 325 | stl: "none", |
| 326 | system_shared_libs: [], |
Jose Galmes | f9523ed | 2021-04-06 19:48:10 -0700 | [diff] [blame] | 327 | } |
| 328 | |
| 329 | cc_library { |
| 330 | name: "lib32", |
| 331 | vendor: true, |
| 332 | nocrt: true, |
| 333 | no_libcrt: true, |
| 334 | stl: "none", |
| 335 | system_shared_libs: [], |
| 336 | compile_multilib: "32", |
| 337 | } |
| 338 | |
| 339 | cc_library { |
| 340 | name: "lib64", |
| 341 | vendor: true, |
| 342 | nocrt: true, |
| 343 | no_libcrt: true, |
| 344 | stl: "none", |
| 345 | system_shared_libs: [], |
Colin Cross | 2e577f3 | 2021-01-22 13:06:25 -0800 | [diff] [blame] | 346 | compile_multilib: "64", |
| 347 | } |
| 348 | |
Justin Yun | dee806f | 2021-05-18 23:10:00 +0900 | [diff] [blame] | 349 | cc_library { |
| 350 | name: "libllndk", |
| 351 | llndk: { |
| 352 | symbol_file: "libllndk.map.txt", |
| 353 | }, |
| 354 | } |
| 355 | |
Colin Cross | 0fce0ba | 2021-01-08 16:40:12 -0800 | [diff] [blame] | 356 | cc_binary { |
| 357 | name: "bin", |
| 358 | vendor: true, |
| 359 | nocrt: true, |
| 360 | no_libcrt: true, |
| 361 | stl: "none", |
| 362 | system_shared_libs: [], |
Jose Galmes | f9523ed | 2021-04-06 19:48:10 -0700 | [diff] [blame] | 363 | } |
| 364 | |
| 365 | cc_binary { |
| 366 | name: "bin32", |
| 367 | vendor: true, |
| 368 | nocrt: true, |
| 369 | no_libcrt: true, |
| 370 | stl: "none", |
| 371 | system_shared_libs: [], |
| 372 | compile_multilib: "32", |
Colin Cross | 0fce0ba | 2021-01-08 16:40:12 -0800 | [diff] [blame] | 373 | } |
| 374 | ` |
| 375 | |
| 376 | vndkBp := ` |
| 377 | vndk_prebuilt_shared { |
| 378 | name: "libvndk", |
Justin Yun | dee806f | 2021-05-18 23:10:00 +0900 | [diff] [blame] | 379 | version: "31", |
Colin Cross | 0fce0ba | 2021-01-08 16:40:12 -0800 | [diff] [blame] | 380 | target_arch: "arm64", |
| 381 | vendor_available: true, |
| 382 | product_available: true, |
| 383 | vndk: { |
| 384 | enabled: true, |
| 385 | }, |
| 386 | arch: { |
| 387 | arm64: { |
| 388 | srcs: ["libvndk.so"], |
| 389 | export_include_dirs: ["include/libvndk"], |
| 390 | }, |
Jose Galmes | f9523ed | 2021-04-06 19:48:10 -0700 | [diff] [blame] | 391 | arm: { |
| 392 | srcs: ["libvndk.so"], |
| 393 | export_include_dirs: ["include/libvndk"], |
| 394 | }, |
Colin Cross | 0fce0ba | 2021-01-08 16:40:12 -0800 | [diff] [blame] | 395 | }, |
| 396 | } |
Colin Cross | e0edaf9 | 2021-01-11 17:31:17 -0800 | [diff] [blame] | 397 | |
| 398 | // old snapshot module which has to be ignored |
| 399 | vndk_prebuilt_shared { |
| 400 | name: "libvndk", |
Jiyong Park | f58c46e | 2021-04-01 21:35:20 +0900 | [diff] [blame] | 401 | version: "26", |
Colin Cross | e0edaf9 | 2021-01-11 17:31:17 -0800 | [diff] [blame] | 402 | target_arch: "arm64", |
| 403 | vendor_available: true, |
| 404 | product_available: true, |
| 405 | vndk: { |
| 406 | enabled: true, |
| 407 | }, |
| 408 | arch: { |
| 409 | arm64: { |
| 410 | srcs: ["libvndk.so"], |
| 411 | export_include_dirs: ["include/libvndk"], |
| 412 | }, |
Jose Galmes | f9523ed | 2021-04-06 19:48:10 -0700 | [diff] [blame] | 413 | arm: { |
| 414 | srcs: ["libvndk.so"], |
| 415 | export_include_dirs: ["include/libvndk"], |
| 416 | }, |
| 417 | }, |
| 418 | } |
| 419 | |
| 420 | // different arch snapshot which has to be ignored |
| 421 | vndk_prebuilt_shared { |
| 422 | name: "libvndk", |
Justin Yun | dee806f | 2021-05-18 23:10:00 +0900 | [diff] [blame] | 423 | version: "31", |
Jose Galmes | f9523ed | 2021-04-06 19:48:10 -0700 | [diff] [blame] | 424 | target_arch: "arm", |
| 425 | vendor_available: true, |
| 426 | product_available: true, |
| 427 | vndk: { |
| 428 | enabled: true, |
| 429 | }, |
| 430 | arch: { |
| 431 | arm: { |
| 432 | srcs: ["libvndk.so"], |
| 433 | export_include_dirs: ["include/libvndk"], |
| 434 | }, |
Colin Cross | e0edaf9 | 2021-01-11 17:31:17 -0800 | [diff] [blame] | 435 | }, |
| 436 | } |
Justin Yun | dee806f | 2021-05-18 23:10:00 +0900 | [diff] [blame] | 437 | |
| 438 | vndk_prebuilt_shared { |
| 439 | name: "libllndk", |
| 440 | version: "31", |
| 441 | target_arch: "arm64", |
| 442 | vendor_available: true, |
| 443 | product_available: true, |
| 444 | arch: { |
| 445 | arm64: { |
| 446 | srcs: ["libllndk.so"], |
| 447 | }, |
| 448 | arm: { |
| 449 | srcs: ["libllndk.so"], |
| 450 | }, |
| 451 | }, |
| 452 | } |
Colin Cross | 0fce0ba | 2021-01-08 16:40:12 -0800 | [diff] [blame] | 453 | ` |
| 454 | |
| 455 | vendorProprietaryBp := ` |
| 456 | cc_library { |
| 457 | name: "libvendor_without_snapshot", |
| 458 | vendor: true, |
| 459 | nocrt: true, |
| 460 | no_libcrt: true, |
| 461 | stl: "none", |
| 462 | system_shared_libs: [], |
Colin Cross | 0fce0ba | 2021-01-08 16:40:12 -0800 | [diff] [blame] | 463 | } |
| 464 | |
| 465 | cc_library_shared { |
| 466 | name: "libclient", |
| 467 | vendor: true, |
| 468 | nocrt: true, |
| 469 | no_libcrt: true, |
| 470 | stl: "none", |
| 471 | system_shared_libs: [], |
Justin Yun | dee806f | 2021-05-18 23:10:00 +0900 | [diff] [blame] | 472 | shared_libs: ["libvndk", "libvendor_available", "libllndk"], |
Colin Cross | 0fce0ba | 2021-01-08 16:40:12 -0800 | [diff] [blame] | 473 | static_libs: ["libvendor", "libvendor_without_snapshot"], |
Jose Galmes | f9523ed | 2021-04-06 19:48:10 -0700 | [diff] [blame] | 474 | arch: { |
| 475 | arm64: { |
| 476 | shared_libs: ["lib64"], |
| 477 | }, |
| 478 | arm: { |
| 479 | shared_libs: ["lib32"], |
| 480 | }, |
| 481 | }, |
Colin Cross | 0fce0ba | 2021-01-08 16:40:12 -0800 | [diff] [blame] | 482 | srcs: ["client.cpp"], |
| 483 | } |
| 484 | |
Inseob Kim | f7aadf7 | 2021-04-13 10:15:31 +0900 | [diff] [blame] | 485 | cc_library_shared { |
| 486 | name: "libclient_cfi", |
| 487 | vendor: true, |
| 488 | nocrt: true, |
| 489 | no_libcrt: true, |
| 490 | stl: "none", |
| 491 | system_shared_libs: [], |
| 492 | static_libs: ["libvendor"], |
| 493 | sanitize: { |
| 494 | cfi: true, |
| 495 | }, |
| 496 | srcs: ["client.cpp"], |
| 497 | } |
| 498 | |
Justin Yun | 27b9572 | 2021-07-28 17:04:44 +0900 | [diff] [blame] | 499 | cc_library_shared { |
| 500 | name: "libvndkext", |
| 501 | vendor: true, |
| 502 | nocrt: true, |
| 503 | no_libcrt: true, |
| 504 | stl: "none", |
| 505 | system_shared_libs: [], |
| 506 | vndk: { |
| 507 | extends: "libvndk", |
| 508 | enabled: true, |
| 509 | } |
| 510 | } |
| 511 | |
Colin Cross | 0fce0ba | 2021-01-08 16:40:12 -0800 | [diff] [blame] | 512 | cc_binary { |
| 513 | name: "bin_without_snapshot", |
| 514 | vendor: true, |
| 515 | nocrt: true, |
| 516 | no_libcrt: true, |
Inseob Kim | d4c9f55 | 2021-04-08 19:28:28 +0900 | [diff] [blame] | 517 | stl: "libc++_static", |
Colin Cross | 0fce0ba | 2021-01-08 16:40:12 -0800 | [diff] [blame] | 518 | system_shared_libs: [], |
| 519 | static_libs: ["libvndk"], |
Colin Cross | 0fce0ba | 2021-01-08 16:40:12 -0800 | [diff] [blame] | 520 | srcs: ["bin.cpp"], |
| 521 | } |
| 522 | |
Colin Cross | e0edaf9 | 2021-01-11 17:31:17 -0800 | [diff] [blame] | 523 | vendor_snapshot { |
| 524 | name: "vendor_snapshot", |
Justin Yun | dee806f | 2021-05-18 23:10:00 +0900 | [diff] [blame] | 525 | version: "31", |
Jose Galmes | f9523ed | 2021-04-06 19:48:10 -0700 | [diff] [blame] | 526 | arch: { |
| 527 | arm64: { |
| 528 | vndk_libs: [ |
| 529 | "libvndk", |
Justin Yun | dee806f | 2021-05-18 23:10:00 +0900 | [diff] [blame] | 530 | "libllndk", |
Jose Galmes | f9523ed | 2021-04-06 19:48:10 -0700 | [diff] [blame] | 531 | ], |
| 532 | static_libs: [ |
Inseob Kim | d4c9f55 | 2021-04-08 19:28:28 +0900 | [diff] [blame] | 533 | "libc++_static", |
| 534 | "libc++demangle", |
Justin Yun | dee806f | 2021-05-18 23:10:00 +0900 | [diff] [blame] | 535 | "libunwind", |
Jose Galmes | f9523ed | 2021-04-06 19:48:10 -0700 | [diff] [blame] | 536 | "libvendor", |
| 537 | "libvendor_available", |
| 538 | "libvndk", |
| 539 | "lib64", |
| 540 | ], |
| 541 | shared_libs: [ |
| 542 | "libvendor", |
Inseob Kim | a1888ce | 2022-10-04 14:42:02 +0900 | [diff] [blame] | 543 | "libvendor_override", |
Jose Galmes | f9523ed | 2021-04-06 19:48:10 -0700 | [diff] [blame] | 544 | "libvendor_available", |
| 545 | "lib64", |
| 546 | ], |
| 547 | binaries: [ |
| 548 | "bin", |
Inseob Kim | a1888ce | 2022-10-04 14:42:02 +0900 | [diff] [blame] | 549 | "bin_override", |
Jose Galmes | f9523ed | 2021-04-06 19:48:10 -0700 | [diff] [blame] | 550 | ], |
| 551 | }, |
| 552 | arm: { |
| 553 | vndk_libs: [ |
| 554 | "libvndk", |
Justin Yun | dee806f | 2021-05-18 23:10:00 +0900 | [diff] [blame] | 555 | "libllndk", |
Jose Galmes | f9523ed | 2021-04-06 19:48:10 -0700 | [diff] [blame] | 556 | ], |
| 557 | static_libs: [ |
| 558 | "libvendor", |
| 559 | "libvendor_available", |
| 560 | "libvndk", |
| 561 | "lib32", |
| 562 | ], |
| 563 | shared_libs: [ |
| 564 | "libvendor", |
Inseob Kim | a1888ce | 2022-10-04 14:42:02 +0900 | [diff] [blame] | 565 | "libvendor_override", |
Jose Galmes | f9523ed | 2021-04-06 19:48:10 -0700 | [diff] [blame] | 566 | "libvendor_available", |
| 567 | "lib32", |
| 568 | ], |
| 569 | binaries: [ |
| 570 | "bin32", |
| 571 | ], |
| 572 | }, |
| 573 | } |
Colin Cross | e0edaf9 | 2021-01-11 17:31:17 -0800 | [diff] [blame] | 574 | } |
| 575 | |
Colin Cross | 0fce0ba | 2021-01-08 16:40:12 -0800 | [diff] [blame] | 576 | vendor_snapshot_static { |
| 577 | name: "libvndk", |
Justin Yun | dee806f | 2021-05-18 23:10:00 +0900 | [diff] [blame] | 578 | version: "31", |
Colin Cross | 0fce0ba | 2021-01-08 16:40:12 -0800 | [diff] [blame] | 579 | target_arch: "arm64", |
Jose Galmes | f9523ed | 2021-04-06 19:48:10 -0700 | [diff] [blame] | 580 | compile_multilib: "both", |
Colin Cross | 0fce0ba | 2021-01-08 16:40:12 -0800 | [diff] [blame] | 581 | vendor: true, |
| 582 | arch: { |
| 583 | arm64: { |
| 584 | src: "libvndk.a", |
Colin Cross | 0fce0ba | 2021-01-08 16:40:12 -0800 | [diff] [blame] | 585 | }, |
Jose Galmes | f9523ed | 2021-04-06 19:48:10 -0700 | [diff] [blame] | 586 | arm: { |
| 587 | src: "libvndk.a", |
Jose Galmes | f9523ed | 2021-04-06 19:48:10 -0700 | [diff] [blame] | 588 | }, |
Colin Cross | 0fce0ba | 2021-01-08 16:40:12 -0800 | [diff] [blame] | 589 | }, |
Inseob Kim | dd0295d | 2021-04-12 21:09:59 +0900 | [diff] [blame] | 590 | shared_libs: ["libvndk"], |
| 591 | export_shared_lib_headers: ["libvndk"], |
Colin Cross | 0fce0ba | 2021-01-08 16:40:12 -0800 | [diff] [blame] | 592 | } |
| 593 | |
| 594 | vendor_snapshot_shared { |
| 595 | name: "libvendor", |
Justin Yun | dee806f | 2021-05-18 23:10:00 +0900 | [diff] [blame] | 596 | version: "31", |
Colin Cross | 0fce0ba | 2021-01-08 16:40:12 -0800 | [diff] [blame] | 597 | target_arch: "arm64", |
Jose Galmes | f9523ed | 2021-04-06 19:48:10 -0700 | [diff] [blame] | 598 | compile_multilib: "both", |
Colin Cross | 0fce0ba | 2021-01-08 16:40:12 -0800 | [diff] [blame] | 599 | vendor: true, |
Justin Yun | 4813867 | 2021-02-25 18:21:27 +0900 | [diff] [blame] | 600 | shared_libs: [ |
| 601 | "libvendor_without_snapshot", |
| 602 | "libvendor_available", |
Justin Yun | 07b9f86 | 2021-02-26 14:00:03 +0900 | [diff] [blame] | 603 | "libvndk", |
Justin Yun | 4813867 | 2021-02-25 18:21:27 +0900 | [diff] [blame] | 604 | ], |
Colin Cross | 0fce0ba | 2021-01-08 16:40:12 -0800 | [diff] [blame] | 605 | arch: { |
| 606 | arm64: { |
| 607 | src: "libvendor.so", |
| 608 | export_include_dirs: ["include/libvendor"], |
| 609 | }, |
Jose Galmes | f9523ed | 2021-04-06 19:48:10 -0700 | [diff] [blame] | 610 | arm: { |
| 611 | src: "libvendor.so", |
| 612 | export_include_dirs: ["include/libvendor"], |
| 613 | }, |
| 614 | }, |
| 615 | } |
| 616 | |
Inseob Kim | a1888ce | 2022-10-04 14:42:02 +0900 | [diff] [blame] | 617 | vendor_snapshot_shared { |
| 618 | name: "libvendor_override", |
| 619 | version: "31", |
| 620 | target_arch: "arm64", |
| 621 | compile_multilib: "both", |
| 622 | vendor: true, |
| 623 | overrides: ["libvendor"], |
| 624 | shared_libs: [ |
| 625 | "libvendor_without_snapshot", |
| 626 | "libvendor_available", |
| 627 | "libvndk", |
| 628 | ], |
| 629 | arch: { |
| 630 | arm64: { |
| 631 | src: "override/libvendor.so", |
| 632 | export_include_dirs: ["include/libvendor"], |
| 633 | }, |
| 634 | arm: { |
| 635 | src: "override/libvendor.so", |
| 636 | export_include_dirs: ["include/libvendor"], |
| 637 | }, |
| 638 | }, |
| 639 | } |
| 640 | |
Jose Galmes | f9523ed | 2021-04-06 19:48:10 -0700 | [diff] [blame] | 641 | vendor_snapshot_static { |
| 642 | name: "lib32", |
Justin Yun | dee806f | 2021-05-18 23:10:00 +0900 | [diff] [blame] | 643 | version: "31", |
Jose Galmes | f9523ed | 2021-04-06 19:48:10 -0700 | [diff] [blame] | 644 | target_arch: "arm64", |
| 645 | compile_multilib: "32", |
| 646 | vendor: true, |
| 647 | arch: { |
| 648 | arm: { |
| 649 | src: "lib32.a", |
| 650 | }, |
| 651 | }, |
| 652 | } |
| 653 | |
| 654 | vendor_snapshot_shared { |
| 655 | name: "lib32", |
Justin Yun | dee806f | 2021-05-18 23:10:00 +0900 | [diff] [blame] | 656 | version: "31", |
Jose Galmes | f9523ed | 2021-04-06 19:48:10 -0700 | [diff] [blame] | 657 | target_arch: "arm64", |
| 658 | compile_multilib: "32", |
| 659 | vendor: true, |
| 660 | arch: { |
| 661 | arm: { |
| 662 | src: "lib32.so", |
| 663 | }, |
| 664 | }, |
| 665 | } |
| 666 | |
| 667 | vendor_snapshot_static { |
| 668 | name: "lib64", |
Justin Yun | dee806f | 2021-05-18 23:10:00 +0900 | [diff] [blame] | 669 | version: "31", |
Jose Galmes | f9523ed | 2021-04-06 19:48:10 -0700 | [diff] [blame] | 670 | target_arch: "arm64", |
| 671 | compile_multilib: "64", |
| 672 | vendor: true, |
| 673 | arch: { |
| 674 | arm64: { |
| 675 | src: "lib64.a", |
| 676 | }, |
| 677 | }, |
| 678 | } |
| 679 | |
| 680 | vendor_snapshot_shared { |
| 681 | name: "lib64", |
Justin Yun | dee806f | 2021-05-18 23:10:00 +0900 | [diff] [blame] | 682 | version: "31", |
Jose Galmes | f9523ed | 2021-04-06 19:48:10 -0700 | [diff] [blame] | 683 | target_arch: "arm64", |
| 684 | compile_multilib: "64", |
| 685 | vendor: true, |
| 686 | arch: { |
| 687 | arm64: { |
| 688 | src: "lib64.so", |
| 689 | }, |
Colin Cross | 0fce0ba | 2021-01-08 16:40:12 -0800 | [diff] [blame] | 690 | }, |
| 691 | } |
| 692 | |
| 693 | vendor_snapshot_static { |
| 694 | name: "libvendor", |
Justin Yun | dee806f | 2021-05-18 23:10:00 +0900 | [diff] [blame] | 695 | version: "31", |
Colin Cross | 0fce0ba | 2021-01-08 16:40:12 -0800 | [diff] [blame] | 696 | target_arch: "arm64", |
Jose Galmes | f9523ed | 2021-04-06 19:48:10 -0700 | [diff] [blame] | 697 | compile_multilib: "both", |
Colin Cross | 0fce0ba | 2021-01-08 16:40:12 -0800 | [diff] [blame] | 698 | vendor: true, |
| 699 | arch: { |
| 700 | arm64: { |
Inseob Kim | f7aadf7 | 2021-04-13 10:15:31 +0900 | [diff] [blame] | 701 | cfi: { |
| 702 | src: "libvendor.cfi.a", |
| 703 | export_include_dirs: ["include/libvendor_cfi"], |
| 704 | }, |
Colin Cross | 0fce0ba | 2021-01-08 16:40:12 -0800 | [diff] [blame] | 705 | src: "libvendor.a", |
| 706 | export_include_dirs: ["include/libvendor"], |
| 707 | }, |
Jose Galmes | f9523ed | 2021-04-06 19:48:10 -0700 | [diff] [blame] | 708 | arm: { |
Inseob Kim | f7aadf7 | 2021-04-13 10:15:31 +0900 | [diff] [blame] | 709 | cfi: { |
| 710 | src: "libvendor.cfi.a", |
| 711 | export_include_dirs: ["include/libvendor_cfi"], |
| 712 | }, |
Jose Galmes | f9523ed | 2021-04-06 19:48:10 -0700 | [diff] [blame] | 713 | src: "libvendor.a", |
| 714 | export_include_dirs: ["include/libvendor"], |
| 715 | }, |
Colin Cross | 0fce0ba | 2021-01-08 16:40:12 -0800 | [diff] [blame] | 716 | }, |
| 717 | } |
| 718 | |
Colin Cross | 2e577f3 | 2021-01-22 13:06:25 -0800 | [diff] [blame] | 719 | vendor_snapshot_shared { |
| 720 | name: "libvendor_available", |
Justin Yun | dee806f | 2021-05-18 23:10:00 +0900 | [diff] [blame] | 721 | version: "31", |
Colin Cross | 2e577f3 | 2021-01-22 13:06:25 -0800 | [diff] [blame] | 722 | target_arch: "arm64", |
Jose Galmes | f9523ed | 2021-04-06 19:48:10 -0700 | [diff] [blame] | 723 | compile_multilib: "both", |
Colin Cross | 2e577f3 | 2021-01-22 13:06:25 -0800 | [diff] [blame] | 724 | vendor: true, |
| 725 | arch: { |
| 726 | arm64: { |
| 727 | src: "libvendor_available.so", |
| 728 | export_include_dirs: ["include/libvendor"], |
| 729 | }, |
Jose Galmes | f9523ed | 2021-04-06 19:48:10 -0700 | [diff] [blame] | 730 | arm: { |
| 731 | src: "libvendor_available.so", |
| 732 | export_include_dirs: ["include/libvendor"], |
| 733 | }, |
Colin Cross | 2e577f3 | 2021-01-22 13:06:25 -0800 | [diff] [blame] | 734 | }, |
| 735 | } |
| 736 | |
| 737 | vendor_snapshot_static { |
| 738 | name: "libvendor_available", |
Justin Yun | dee806f | 2021-05-18 23:10:00 +0900 | [diff] [blame] | 739 | version: "31", |
Colin Cross | 2e577f3 | 2021-01-22 13:06:25 -0800 | [diff] [blame] | 740 | target_arch: "arm64", |
Jose Galmes | f9523ed | 2021-04-06 19:48:10 -0700 | [diff] [blame] | 741 | compile_multilib: "both", |
Colin Cross | 2e577f3 | 2021-01-22 13:06:25 -0800 | [diff] [blame] | 742 | vendor: true, |
| 743 | arch: { |
| 744 | arm64: { |
| 745 | src: "libvendor_available.a", |
| 746 | export_include_dirs: ["include/libvendor"], |
| 747 | }, |
Jose Galmes | f9523ed | 2021-04-06 19:48:10 -0700 | [diff] [blame] | 748 | arm: { |
| 749 | src: "libvendor_available.so", |
| 750 | export_include_dirs: ["include/libvendor"], |
| 751 | }, |
Colin Cross | 2e577f3 | 2021-01-22 13:06:25 -0800 | [diff] [blame] | 752 | }, |
| 753 | } |
| 754 | |
Inseob Kim | d4c9f55 | 2021-04-08 19:28:28 +0900 | [diff] [blame] | 755 | vendor_snapshot_static { |
| 756 | name: "libc++_static", |
Justin Yun | dee806f | 2021-05-18 23:10:00 +0900 | [diff] [blame] | 757 | version: "31", |
Inseob Kim | d4c9f55 | 2021-04-08 19:28:28 +0900 | [diff] [blame] | 758 | target_arch: "arm64", |
| 759 | compile_multilib: "64", |
| 760 | vendor: true, |
| 761 | arch: { |
| 762 | arm64: { |
| 763 | src: "libc++_static.a", |
| 764 | }, |
| 765 | }, |
| 766 | } |
| 767 | |
| 768 | vendor_snapshot_static { |
| 769 | name: "libc++demangle", |
Justin Yun | dee806f | 2021-05-18 23:10:00 +0900 | [diff] [blame] | 770 | version: "31", |
Inseob Kim | d4c9f55 | 2021-04-08 19:28:28 +0900 | [diff] [blame] | 771 | target_arch: "arm64", |
| 772 | compile_multilib: "64", |
| 773 | vendor: true, |
| 774 | arch: { |
| 775 | arm64: { |
| 776 | src: "libc++demangle.a", |
| 777 | }, |
| 778 | }, |
| 779 | } |
| 780 | |
| 781 | vendor_snapshot_static { |
Justin Yun | dee806f | 2021-05-18 23:10:00 +0900 | [diff] [blame] | 782 | name: "libunwind", |
| 783 | version: "31", |
Inseob Kim | d4c9f55 | 2021-04-08 19:28:28 +0900 | [diff] [blame] | 784 | target_arch: "arm64", |
| 785 | compile_multilib: "64", |
| 786 | vendor: true, |
| 787 | arch: { |
| 788 | arm64: { |
Justin Yun | dee806f | 2021-05-18 23:10:00 +0900 | [diff] [blame] | 789 | src: "libunwind.a", |
Inseob Kim | d4c9f55 | 2021-04-08 19:28:28 +0900 | [diff] [blame] | 790 | }, |
| 791 | }, |
| 792 | } |
| 793 | |
Colin Cross | 0fce0ba | 2021-01-08 16:40:12 -0800 | [diff] [blame] | 794 | vendor_snapshot_binary { |
| 795 | name: "bin", |
Justin Yun | dee806f | 2021-05-18 23:10:00 +0900 | [diff] [blame] | 796 | version: "31", |
Colin Cross | 0fce0ba | 2021-01-08 16:40:12 -0800 | [diff] [blame] | 797 | target_arch: "arm64", |
Jose Galmes | f9523ed | 2021-04-06 19:48:10 -0700 | [diff] [blame] | 798 | compile_multilib: "64", |
Colin Cross | 0fce0ba | 2021-01-08 16:40:12 -0800 | [diff] [blame] | 799 | vendor: true, |
| 800 | arch: { |
| 801 | arm64: { |
| 802 | src: "bin", |
| 803 | }, |
| 804 | }, |
Inseob Kim | 4d945ee | 2022-02-24 10:29:18 +0900 | [diff] [blame] | 805 | symlinks: ["binfoo", "binbar"], |
Colin Cross | 0fce0ba | 2021-01-08 16:40:12 -0800 | [diff] [blame] | 806 | } |
Colin Cross | e0edaf9 | 2021-01-11 17:31:17 -0800 | [diff] [blame] | 807 | |
Jose Galmes | f9523ed | 2021-04-06 19:48:10 -0700 | [diff] [blame] | 808 | vendor_snapshot_binary { |
Inseob Kim | a1888ce | 2022-10-04 14:42:02 +0900 | [diff] [blame] | 809 | name: "bin_override", |
| 810 | version: "31", |
| 811 | target_arch: "arm64", |
| 812 | compile_multilib: "64", |
| 813 | vendor: true, |
| 814 | overrides: ["bin"], |
| 815 | arch: { |
| 816 | arm64: { |
| 817 | src: "override/bin", |
| 818 | }, |
| 819 | }, |
| 820 | symlinks: ["binfoo", "binbar"], |
| 821 | } |
| 822 | |
| 823 | vendor_snapshot_binary { |
Jose Galmes | f9523ed | 2021-04-06 19:48:10 -0700 | [diff] [blame] | 824 | name: "bin32", |
Justin Yun | dee806f | 2021-05-18 23:10:00 +0900 | [diff] [blame] | 825 | version: "31", |
Jose Galmes | f9523ed | 2021-04-06 19:48:10 -0700 | [diff] [blame] | 826 | target_arch: "arm64", |
| 827 | compile_multilib: "32", |
| 828 | vendor: true, |
| 829 | arch: { |
| 830 | arm: { |
| 831 | src: "bin32", |
| 832 | }, |
| 833 | }, |
| 834 | } |
| 835 | |
Colin Cross | e0edaf9 | 2021-01-11 17:31:17 -0800 | [diff] [blame] | 836 | // old snapshot module which has to be ignored |
| 837 | vendor_snapshot_binary { |
| 838 | name: "bin", |
Jiyong Park | f58c46e | 2021-04-01 21:35:20 +0900 | [diff] [blame] | 839 | version: "26", |
Colin Cross | e0edaf9 | 2021-01-11 17:31:17 -0800 | [diff] [blame] | 840 | target_arch: "arm64", |
Jose Galmes | f9523ed | 2021-04-06 19:48:10 -0700 | [diff] [blame] | 841 | compile_multilib: "first", |
| 842 | vendor: true, |
| 843 | arch: { |
| 844 | arm64: { |
| 845 | src: "bin", |
| 846 | }, |
| 847 | }, |
| 848 | } |
| 849 | |
| 850 | // different arch snapshot which has to be ignored |
| 851 | vendor_snapshot_binary { |
| 852 | name: "bin", |
Justin Yun | dee806f | 2021-05-18 23:10:00 +0900 | [diff] [blame] | 853 | version: "31", |
Jose Galmes | f9523ed | 2021-04-06 19:48:10 -0700 | [diff] [blame] | 854 | target_arch: "arm", |
| 855 | compile_multilib: "first", |
Colin Cross | e0edaf9 | 2021-01-11 17:31:17 -0800 | [diff] [blame] | 856 | vendor: true, |
| 857 | arch: { |
| 858 | arm64: { |
| 859 | src: "bin", |
| 860 | }, |
| 861 | }, |
| 862 | } |
Colin Cross | 0fce0ba | 2021-01-08 16:40:12 -0800 | [diff] [blame] | 863 | ` |
| 864 | depsBp := GatherRequiredDepsForTest(android.Android) |
| 865 | |
| 866 | mockFS := map[string][]byte{ |
Inseob Kim | f7aadf7 | 2021-04-13 10:15:31 +0900 | [diff] [blame] | 867 | "deps/Android.bp": []byte(depsBp), |
| 868 | "framework/Android.bp": []byte(frameworkBp), |
| 869 | "framework/symbol.txt": nil, |
| 870 | "vendor/Android.bp": []byte(vendorProprietaryBp), |
| 871 | "vendor/bin": nil, |
Inseob Kim | a1888ce | 2022-10-04 14:42:02 +0900 | [diff] [blame] | 872 | "vendor/override/bin": nil, |
Inseob Kim | f7aadf7 | 2021-04-13 10:15:31 +0900 | [diff] [blame] | 873 | "vendor/bin32": nil, |
| 874 | "vendor/bin.cpp": nil, |
| 875 | "vendor/client.cpp": nil, |
| 876 | "vendor/include/libvndk/a.h": nil, |
| 877 | "vendor/include/libvendor/b.h": nil, |
| 878 | "vendor/include/libvendor_cfi/c.h": nil, |
| 879 | "vendor/libc++_static.a": nil, |
| 880 | "vendor/libc++demangle.a": nil, |
Justin Yun | dee806f | 2021-05-18 23:10:00 +0900 | [diff] [blame] | 881 | "vendor/libunwind.a": nil, |
Inseob Kim | f7aadf7 | 2021-04-13 10:15:31 +0900 | [diff] [blame] | 882 | "vendor/libvndk.a": nil, |
| 883 | "vendor/libvendor.a": nil, |
| 884 | "vendor/libvendor.cfi.a": nil, |
| 885 | "vendor/libvendor.so": nil, |
Inseob Kim | a1888ce | 2022-10-04 14:42:02 +0900 | [diff] [blame] | 886 | "vendor/override/libvendor.so": nil, |
Inseob Kim | f7aadf7 | 2021-04-13 10:15:31 +0900 | [diff] [blame] | 887 | "vendor/lib32.a": nil, |
| 888 | "vendor/lib32.so": nil, |
| 889 | "vendor/lib64.a": nil, |
| 890 | "vendor/lib64.so": nil, |
| 891 | "vndk/Android.bp": []byte(vndkBp), |
| 892 | "vndk/include/libvndk/a.h": nil, |
| 893 | "vndk/libvndk.so": nil, |
Justin Yun | dee806f | 2021-05-18 23:10:00 +0900 | [diff] [blame] | 894 | "vndk/libllndk.so": nil, |
Colin Cross | 0fce0ba | 2021-01-08 16:40:12 -0800 | [diff] [blame] | 895 | } |
| 896 | |
Paul Duffin | c3e6ce0 | 2021-03-22 23:21:32 +0000 | [diff] [blame] | 897 | config := TestConfig(t.TempDir(), android.Android, nil, "", mockFS) |
Justin Yun | dee806f | 2021-05-18 23:10:00 +0900 | [diff] [blame] | 898 | config.TestProductVariables.DeviceVndkVersion = StringPtr("31") |
| 899 | config.TestProductVariables.Platform_vndk_version = StringPtr("32") |
Colin Cross | 0fce0ba | 2021-01-08 16:40:12 -0800 | [diff] [blame] | 900 | ctx := CreateTestContext(config) |
| 901 | ctx.Register() |
| 902 | |
| 903 | _, errs := ctx.ParseFileList(".", []string{"deps/Android.bp", "framework/Android.bp", "vendor/Android.bp", "vndk/Android.bp"}) |
| 904 | android.FailIfErrored(t, errs) |
| 905 | _, errs = ctx.PrepareBuildActions(config) |
| 906 | android.FailIfErrored(t, errs) |
| 907 | |
Justin Yun | dee806f | 2021-05-18 23:10:00 +0900 | [diff] [blame] | 908 | sharedVariant := "android_vendor.31_arm64_armv8-a_shared" |
| 909 | staticVariant := "android_vendor.31_arm64_armv8-a_static" |
| 910 | binaryVariant := "android_vendor.31_arm64_armv8-a" |
Colin Cross | 0fce0ba | 2021-01-08 16:40:12 -0800 | [diff] [blame] | 911 | |
Justin Yun | dee806f | 2021-05-18 23:10:00 +0900 | [diff] [blame] | 912 | sharedCfiVariant := "android_vendor.31_arm64_armv8-a_shared_cfi" |
| 913 | staticCfiVariant := "android_vendor.31_arm64_armv8-a_static_cfi" |
Inseob Kim | f7aadf7 | 2021-04-13 10:15:31 +0900 | [diff] [blame] | 914 | |
Justin Yun | dee806f | 2021-05-18 23:10:00 +0900 | [diff] [blame] | 915 | shared32Variant := "android_vendor.31_arm_armv7-a-neon_shared" |
| 916 | binary32Variant := "android_vendor.31_arm_armv7-a-neon" |
Jose Galmes | f9523ed | 2021-04-06 19:48:10 -0700 | [diff] [blame] | 917 | |
Justin Yun | dee806f | 2021-05-18 23:10:00 +0900 | [diff] [blame] | 918 | // libclient uses libvndk.vndk.31.arm64, libvendor.vendor_static.31.arm64, libvendor_without_snapshot |
Colin Cross | 0fce0ba | 2021-01-08 16:40:12 -0800 | [diff] [blame] | 919 | libclientCcFlags := ctx.ModuleForTests("libclient", sharedVariant).Rule("cc").Args["cFlags"] |
| 920 | for _, includeFlags := range []string{ |
| 921 | "-Ivndk/include/libvndk", // libvndk |
| 922 | "-Ivendor/include/libvendor", // libvendor |
| 923 | } { |
| 924 | if !strings.Contains(libclientCcFlags, includeFlags) { |
| 925 | t.Errorf("flags for libclient must contain %#v, but was %#v.", |
| 926 | includeFlags, libclientCcFlags) |
| 927 | } |
| 928 | } |
| 929 | |
| 930 | libclientLdFlags := ctx.ModuleForTests("libclient", sharedVariant).Rule("ld").Args["libFlags"] |
| 931 | for _, input := range [][]string{ |
Justin Yun | dee806f | 2021-05-18 23:10:00 +0900 | [diff] [blame] | 932 | []string{sharedVariant, "libvndk.vndk.31.arm64"}, |
| 933 | []string{sharedVariant, "libllndk.vndk.31.arm64"}, |
| 934 | []string{staticVariant, "libvendor.vendor_static.31.arm64"}, |
Colin Cross | 0fce0ba | 2021-01-08 16:40:12 -0800 | [diff] [blame] | 935 | []string{staticVariant, "libvendor_without_snapshot"}, |
| 936 | } { |
Ivan Lozano | d67a6b0 | 2021-05-20 13:01:32 -0400 | [diff] [blame] | 937 | outputPaths := GetOutputPaths(ctx, input[0] /* variant */, []string{input[1]} /* module name */) |
Colin Cross | 0fce0ba | 2021-01-08 16:40:12 -0800 | [diff] [blame] | 938 | if !strings.Contains(libclientLdFlags, outputPaths[0].String()) { |
| 939 | t.Errorf("libflags for libclient must contain %#v, but was %#v", outputPaths[0], libclientLdFlags) |
| 940 | } |
Ivan Lozano | d67a6b0 | 2021-05-20 13:01:32 -0400 | [diff] [blame] | 941 | |
Colin Cross | 0fce0ba | 2021-01-08 16:40:12 -0800 | [diff] [blame] | 942 | } |
| 943 | |
Colin Cross | 2e577f3 | 2021-01-22 13:06:25 -0800 | [diff] [blame] | 944 | libclientAndroidMkSharedLibs := ctx.ModuleForTests("libclient", sharedVariant).Module().(*Module).Properties.AndroidMkSharedLibs |
Justin Yun | dee806f | 2021-05-18 23:10:00 +0900 | [diff] [blame] | 945 | if g, w := libclientAndroidMkSharedLibs, []string{"libvndk.vendor", "libvendor_available.vendor", "libllndk.vendor", "lib64"}; !reflect.DeepEqual(g, w) { |
Colin Cross | 2e577f3 | 2021-01-22 13:06:25 -0800 | [diff] [blame] | 946 | t.Errorf("wanted libclient AndroidMkSharedLibs %q, got %q", w, g) |
| 947 | } |
| 948 | |
| 949 | libclientAndroidMkStaticLibs := ctx.ModuleForTests("libclient", sharedVariant).Module().(*Module).Properties.AndroidMkStaticLibs |
| 950 | if g, w := libclientAndroidMkStaticLibs, []string{"libvendor", "libvendor_without_snapshot"}; !reflect.DeepEqual(g, w) { |
| 951 | t.Errorf("wanted libclient AndroidMkStaticLibs %q, got %q", w, g) |
| 952 | } |
| 953 | |
Jose Galmes | f9523ed | 2021-04-06 19:48:10 -0700 | [diff] [blame] | 954 | libclient32AndroidMkSharedLibs := ctx.ModuleForTests("libclient", shared32Variant).Module().(*Module).Properties.AndroidMkSharedLibs |
Justin Yun | dee806f | 2021-05-18 23:10:00 +0900 | [diff] [blame] | 955 | if g, w := libclient32AndroidMkSharedLibs, []string{"libvndk.vendor", "libvendor_available.vendor", "libllndk.vendor", "lib32"}; !reflect.DeepEqual(g, w) { |
Jose Galmes | f9523ed | 2021-04-06 19:48:10 -0700 | [diff] [blame] | 956 | t.Errorf("wanted libclient32 AndroidMkSharedLibs %q, got %q", w, g) |
| 957 | } |
| 958 | |
Justin Yun | dee806f | 2021-05-18 23:10:00 +0900 | [diff] [blame] | 959 | // libclient_cfi uses libvendor.vendor_static.31.arm64's cfi variant |
Inseob Kim | f7aadf7 | 2021-04-13 10:15:31 +0900 | [diff] [blame] | 960 | libclientCfiCcFlags := ctx.ModuleForTests("libclient_cfi", sharedCfiVariant).Rule("cc").Args["cFlags"] |
| 961 | if !strings.Contains(libclientCfiCcFlags, "-Ivendor/include/libvendor_cfi") { |
| 962 | t.Errorf("flags for libclient_cfi must contain %#v, but was %#v.", |
| 963 | "-Ivendor/include/libvendor_cfi", libclientCfiCcFlags) |
| 964 | } |
| 965 | |
| 966 | libclientCfiLdFlags := ctx.ModuleForTests("libclient_cfi", sharedCfiVariant).Rule("ld").Args["libFlags"] |
Ivan Lozano | d67a6b0 | 2021-05-20 13:01:32 -0400 | [diff] [blame] | 967 | libvendorCfiOutputPaths := GetOutputPaths(ctx, staticCfiVariant, []string{"libvendor.vendor_static.31.arm64"}) |
Inseob Kim | f7aadf7 | 2021-04-13 10:15:31 +0900 | [diff] [blame] | 968 | if !strings.Contains(libclientCfiLdFlags, libvendorCfiOutputPaths[0].String()) { |
| 969 | t.Errorf("libflags for libclientCfi must contain %#v, but was %#v", libvendorCfiOutputPaths[0], libclientCfiLdFlags) |
| 970 | } |
| 971 | |
Justin Yun | dee806f | 2021-05-18 23:10:00 +0900 | [diff] [blame] | 972 | // bin_without_snapshot uses libvndk.vendor_static.31.arm64 (which reexports vndk's exported headers) |
Colin Cross | 0fce0ba | 2021-01-08 16:40:12 -0800 | [diff] [blame] | 973 | binWithoutSnapshotCcFlags := ctx.ModuleForTests("bin_without_snapshot", binaryVariant).Rule("cc").Args["cFlags"] |
Inseob Kim | dd0295d | 2021-04-12 21:09:59 +0900 | [diff] [blame] | 974 | if !strings.Contains(binWithoutSnapshotCcFlags, "-Ivndk/include/libvndk") { |
Colin Cross | 0fce0ba | 2021-01-08 16:40:12 -0800 | [diff] [blame] | 975 | t.Errorf("flags for bin_without_snapshot must contain %#v, but was %#v.", |
| 976 | "-Ivendor/include/libvndk", binWithoutSnapshotCcFlags) |
| 977 | } |
| 978 | |
| 979 | binWithoutSnapshotLdFlags := ctx.ModuleForTests("bin_without_snapshot", binaryVariant).Rule("ld").Args["libFlags"] |
Ivan Lozano | d67a6b0 | 2021-05-20 13:01:32 -0400 | [diff] [blame] | 980 | libVndkStaticOutputPaths := GetOutputPaths(ctx, staticVariant, []string{"libvndk.vendor_static.31.arm64"}) |
Colin Cross | 0fce0ba | 2021-01-08 16:40:12 -0800 | [diff] [blame] | 981 | if !strings.Contains(binWithoutSnapshotLdFlags, libVndkStaticOutputPaths[0].String()) { |
| 982 | t.Errorf("libflags for bin_without_snapshot must contain %#v, but was %#v", |
| 983 | libVndkStaticOutputPaths[0], binWithoutSnapshotLdFlags) |
| 984 | } |
| 985 | |
Justin Yun | dee806f | 2021-05-18 23:10:00 +0900 | [diff] [blame] | 986 | // libvendor.so is installed by libvendor.vendor_shared.31.arm64 |
| 987 | ctx.ModuleForTests("libvendor.vendor_shared.31.arm64", sharedVariant).Output("libvendor.so") |
Colin Cross | 0fce0ba | 2021-01-08 16:40:12 -0800 | [diff] [blame] | 988 | |
Justin Yun | dee806f | 2021-05-18 23:10:00 +0900 | [diff] [blame] | 989 | // lib64.so is installed by lib64.vendor_shared.31.arm64 |
| 990 | ctx.ModuleForTests("lib64.vendor_shared.31.arm64", sharedVariant).Output("lib64.so") |
Jose Galmes | f9523ed | 2021-04-06 19:48:10 -0700 | [diff] [blame] | 991 | |
Justin Yun | dee806f | 2021-05-18 23:10:00 +0900 | [diff] [blame] | 992 | // lib32.so is installed by lib32.vendor_shared.31.arm64 |
| 993 | ctx.ModuleForTests("lib32.vendor_shared.31.arm64", shared32Variant).Output("lib32.so") |
Jose Galmes | f9523ed | 2021-04-06 19:48:10 -0700 | [diff] [blame] | 994 | |
Justin Yun | dee806f | 2021-05-18 23:10:00 +0900 | [diff] [blame] | 995 | // libvendor_available.so is installed by libvendor_available.vendor_shared.31.arm64 |
| 996 | ctx.ModuleForTests("libvendor_available.vendor_shared.31.arm64", sharedVariant).Output("libvendor_available.so") |
Colin Cross | 2e577f3 | 2021-01-22 13:06:25 -0800 | [diff] [blame] | 997 | |
Colin Cross | 0fce0ba | 2021-01-08 16:40:12 -0800 | [diff] [blame] | 998 | // libvendor_without_snapshot.so is installed by libvendor_without_snapshot |
| 999 | ctx.ModuleForTests("libvendor_without_snapshot", sharedVariant).Output("libvendor_without_snapshot.so") |
| 1000 | |
Justin Yun | dee806f | 2021-05-18 23:10:00 +0900 | [diff] [blame] | 1001 | // bin is installed by bin.vendor_binary.31.arm64 |
Inseob Kim | 4d945ee | 2022-02-24 10:29:18 +0900 | [diff] [blame] | 1002 | bin64Module := ctx.ModuleForTests("bin.vendor_binary.31.arm64", binaryVariant) |
| 1003 | bin64Module.Output("bin") |
| 1004 | |
| 1005 | // also test symlinks |
| 1006 | bin64MkEntries := android.AndroidMkEntriesForTest(t, ctx, bin64Module.Module()) |
| 1007 | bin64KatiSymlinks := bin64MkEntries[0].EntryMap["LOCAL_SOONG_INSTALL_SYMLINKS"] |
| 1008 | |
| 1009 | // Either AndroidMk entries contain symlinks, or symlinks should be installed by Soong |
| 1010 | for _, symlink := range []string{"binfoo", "binbar"} { |
| 1011 | if inList(symlink, bin64KatiSymlinks) { |
| 1012 | continue |
| 1013 | } |
| 1014 | |
| 1015 | bin64Module.Output(symlink) |
| 1016 | } |
Colin Cross | 0fce0ba | 2021-01-08 16:40:12 -0800 | [diff] [blame] | 1017 | |
Justin Yun | dee806f | 2021-05-18 23:10:00 +0900 | [diff] [blame] | 1018 | // bin32 is installed by bin32.vendor_binary.31.arm64 |
| 1019 | ctx.ModuleForTests("bin32.vendor_binary.31.arm64", binary32Variant).Output("bin32") |
Jose Galmes | f9523ed | 2021-04-06 19:48:10 -0700 | [diff] [blame] | 1020 | |
Colin Cross | 0fce0ba | 2021-01-08 16:40:12 -0800 | [diff] [blame] | 1021 | // bin_without_snapshot is installed by bin_without_snapshot |
| 1022 | ctx.ModuleForTests("bin_without_snapshot", binaryVariant).Output("bin_without_snapshot") |
| 1023 | |
Justin Yun | dee806f | 2021-05-18 23:10:00 +0900 | [diff] [blame] | 1024 | // libvendor, libvendor_available and bin don't have vendor.31 variant |
Colin Cross | 0fce0ba | 2021-01-08 16:40:12 -0800 | [diff] [blame] | 1025 | libvendorVariants := ctx.ModuleVariantsForTests("libvendor") |
| 1026 | if inList(sharedVariant, libvendorVariants) { |
| 1027 | t.Errorf("libvendor must not have variant %#v, but it does", sharedVariant) |
| 1028 | } |
| 1029 | |
Colin Cross | 2e577f3 | 2021-01-22 13:06:25 -0800 | [diff] [blame] | 1030 | libvendorAvailableVariants := ctx.ModuleVariantsForTests("libvendor_available") |
| 1031 | if inList(sharedVariant, libvendorAvailableVariants) { |
| 1032 | t.Errorf("libvendor_available must not have variant %#v, but it does", sharedVariant) |
| 1033 | } |
| 1034 | |
Colin Cross | 0fce0ba | 2021-01-08 16:40:12 -0800 | [diff] [blame] | 1035 | binVariants := ctx.ModuleVariantsForTests("bin") |
| 1036 | if inList(binaryVariant, binVariants) { |
| 1037 | t.Errorf("bin must not have variant %#v, but it does", sharedVariant) |
| 1038 | } |
Inseob Kim | a1888ce | 2022-10-04 14:42:02 +0900 | [diff] [blame] | 1039 | |
| 1040 | // test overrides property |
| 1041 | binOverrideModule := ctx.ModuleForTests("bin_override.vendor_binary.31.arm64", binaryVariant) |
| 1042 | binOverrideModule.Output("bin") |
| 1043 | binOverrideMkEntries := android.AndroidMkEntriesForTest(t, ctx, binOverrideModule.Module()) |
| 1044 | binOverrideEntry := binOverrideMkEntries[0].EntryMap["LOCAL_OVERRIDES_MODULES"] |
| 1045 | if !inList("bin", binOverrideEntry) { |
| 1046 | t.Errorf("bin_override must override bin but was %q\n", binOverrideEntry) |
| 1047 | } |
| 1048 | |
| 1049 | libvendorOverrideModule := ctx.ModuleForTests("libvendor_override.vendor_shared.31.arm64", sharedVariant) |
| 1050 | libvendorOverrideModule.Output("libvendor.so") |
| 1051 | libvendorOverrideMkEntries := android.AndroidMkEntriesForTest(t, ctx, libvendorOverrideModule.Module()) |
| 1052 | libvendorOverrideEntry := libvendorOverrideMkEntries[0].EntryMap["LOCAL_OVERRIDES_MODULES"] |
| 1053 | if !inList("libvendor", libvendorOverrideEntry) { |
| 1054 | t.Errorf("libvendor_override must override libvendor but was %q\n", libvendorOverrideEntry) |
| 1055 | } |
Colin Cross | 0fce0ba | 2021-01-08 16:40:12 -0800 | [diff] [blame] | 1056 | } |
| 1057 | |
| 1058 | func TestVendorSnapshotSanitizer(t *testing.T) { |
| 1059 | bp := ` |
Inseob Kim | 253f521 | 2021-04-08 17:10:31 +0900 | [diff] [blame] | 1060 | vendor_snapshot { |
| 1061 | name: "vendor_snapshot", |
| 1062 | version: "28", |
| 1063 | arch: { |
| 1064 | arm64: { |
| 1065 | static_libs: [ |
| 1066 | "libsnapshot", |
| 1067 | "note_memtag_heap_sync", |
| 1068 | ], |
Justin Yun | 08270c6 | 2022-12-19 17:01:26 +0900 | [diff] [blame] | 1069 | objects: [ |
| 1070 | "snapshot_object", |
| 1071 | ], |
| 1072 | vndk_libs: [ |
| 1073 | "libclang_rt.hwasan", |
| 1074 | ], |
Inseob Kim | 253f521 | 2021-04-08 17:10:31 +0900 | [diff] [blame] | 1075 | }, |
| 1076 | }, |
| 1077 | } |
Justin Yun | 39c3031 | 2022-11-23 16:20:12 +0900 | [diff] [blame] | 1078 | |
Colin Cross | 0fce0ba | 2021-01-08 16:40:12 -0800 | [diff] [blame] | 1079 | vendor_snapshot_static { |
| 1080 | name: "libsnapshot", |
| 1081 | vendor: true, |
| 1082 | target_arch: "arm64", |
Jiyong Park | f58c46e | 2021-04-01 21:35:20 +0900 | [diff] [blame] | 1083 | version: "28", |
Colin Cross | 0fce0ba | 2021-01-08 16:40:12 -0800 | [diff] [blame] | 1084 | arch: { |
| 1085 | arm64: { |
| 1086 | src: "libsnapshot.a", |
| 1087 | cfi: { |
| 1088 | src: "libsnapshot.cfi.a", |
Justin Yun | 39c3031 | 2022-11-23 16:20:12 +0900 | [diff] [blame] | 1089 | }, |
| 1090 | hwasan: { |
| 1091 | src: "libsnapshot.hwasan.a", |
| 1092 | }, |
Colin Cross | 0fce0ba | 2021-01-08 16:40:12 -0800 | [diff] [blame] | 1093 | }, |
| 1094 | }, |
| 1095 | } |
Inseob Kim | 253f521 | 2021-04-08 17:10:31 +0900 | [diff] [blame] | 1096 | |
| 1097 | vendor_snapshot_static { |
| 1098 | name: "note_memtag_heap_sync", |
| 1099 | vendor: true, |
| 1100 | target_arch: "arm64", |
| 1101 | version: "28", |
| 1102 | arch: { |
| 1103 | arm64: { |
| 1104 | src: "note_memtag_heap_sync.a", |
| 1105 | }, |
| 1106 | }, |
| 1107 | } |
| 1108 | |
Justin Yun | 08270c6 | 2022-12-19 17:01:26 +0900 | [diff] [blame] | 1109 | vndk_prebuilt_shared { |
| 1110 | name: "libclang_rt.hwasan", |
| 1111 | version: "28", |
| 1112 | target_arch: "arm64", |
| 1113 | vendor_available: true, |
| 1114 | product_available: true, |
| 1115 | vndk: { |
| 1116 | enabled: true, |
| 1117 | }, |
| 1118 | arch: { |
| 1119 | arm64: { |
| 1120 | srcs: ["libclang_rt.hwasan.so"], |
| 1121 | }, |
| 1122 | }, |
| 1123 | } |
| 1124 | |
| 1125 | vendor_snapshot_object { |
| 1126 | name: "snapshot_object", |
| 1127 | vendor: true, |
| 1128 | target_arch: "arm64", |
| 1129 | version: "28", |
| 1130 | arch: { |
| 1131 | arm64: { |
| 1132 | src: "snapshot_object.o", |
| 1133 | }, |
| 1134 | }, |
| 1135 | stl: "none", |
| 1136 | } |
| 1137 | |
Inseob Kim | 253f521 | 2021-04-08 17:10:31 +0900 | [diff] [blame] | 1138 | cc_test { |
| 1139 | name: "vstest", |
| 1140 | gtest: false, |
| 1141 | vendor: true, |
| 1142 | compile_multilib: "64", |
| 1143 | nocrt: true, |
| 1144 | no_libcrt: true, |
| 1145 | stl: "none", |
| 1146 | static_libs: ["libsnapshot"], |
| 1147 | system_shared_libs: [], |
| 1148 | } |
Colin Cross | 0fce0ba | 2021-01-08 16:40:12 -0800 | [diff] [blame] | 1149 | ` |
Inseob Kim | 253f521 | 2021-04-08 17:10:31 +0900 | [diff] [blame] | 1150 | |
| 1151 | mockFS := map[string][]byte{ |
| 1152 | "vendor/Android.bp": []byte(bp), |
| 1153 | "vendor/libc++demangle.a": nil, |
Justin Yun | 08270c6 | 2022-12-19 17:01:26 +0900 | [diff] [blame] | 1154 | "vendor/libclang_rt.hwasan.so": nil, |
Inseob Kim | 253f521 | 2021-04-08 17:10:31 +0900 | [diff] [blame] | 1155 | "vendor/libsnapshot.a": nil, |
| 1156 | "vendor/libsnapshot.cfi.a": nil, |
Justin Yun | 39c3031 | 2022-11-23 16:20:12 +0900 | [diff] [blame] | 1157 | "vendor/libsnapshot.hwasan.a": nil, |
Inseob Kim | 253f521 | 2021-04-08 17:10:31 +0900 | [diff] [blame] | 1158 | "vendor/note_memtag_heap_sync.a": nil, |
Justin Yun | 08270c6 | 2022-12-19 17:01:26 +0900 | [diff] [blame] | 1159 | "vendor/snapshot_object.o": nil, |
Inseob Kim | 253f521 | 2021-04-08 17:10:31 +0900 | [diff] [blame] | 1160 | } |
| 1161 | |
| 1162 | config := TestConfig(t.TempDir(), android.Android, nil, "", mockFS) |
Jiyong Park | f58c46e | 2021-04-01 21:35:20 +0900 | [diff] [blame] | 1163 | config.TestProductVariables.DeviceVndkVersion = StringPtr("28") |
| 1164 | config.TestProductVariables.Platform_vndk_version = StringPtr("29") |
Justin Yun | 08270c6 | 2022-12-19 17:01:26 +0900 | [diff] [blame] | 1165 | config.TestProductVariables.SanitizeDevice = []string{"hwaddress"} |
Colin Cross | 0fce0ba | 2021-01-08 16:40:12 -0800 | [diff] [blame] | 1166 | ctx := testCcWithConfig(t, config) |
| 1167 | |
Justin Yun | 39c3031 | 2022-11-23 16:20:12 +0900 | [diff] [blame] | 1168 | // Check non-cfi, cfi and hwasan variant. |
Jiyong Park | f58c46e | 2021-04-01 21:35:20 +0900 | [diff] [blame] | 1169 | staticVariant := "android_vendor.28_arm64_armv8-a_static" |
| 1170 | staticCfiVariant := "android_vendor.28_arm64_armv8-a_static_cfi" |
Justin Yun | 39c3031 | 2022-11-23 16:20:12 +0900 | [diff] [blame] | 1171 | staticHwasanVariant := "android_vendor.28_arm64_armv8-a_static_hwasan" |
| 1172 | staticHwasanCfiVariant := "android_vendor.28_arm64_armv8-a_static_hwasan_cfi" |
Colin Cross | 0fce0ba | 2021-01-08 16:40:12 -0800 | [diff] [blame] | 1173 | |
Jiyong Park | f58c46e | 2021-04-01 21:35:20 +0900 | [diff] [blame] | 1174 | staticModule := ctx.ModuleForTests("libsnapshot.vendor_static.28.arm64", staticVariant).Module().(*Module) |
Colin Cross | 0fce0ba | 2021-01-08 16:40:12 -0800 | [diff] [blame] | 1175 | assertString(t, staticModule.outputFile.Path().Base(), "libsnapshot.a") |
| 1176 | |
Jiyong Park | f58c46e | 2021-04-01 21:35:20 +0900 | [diff] [blame] | 1177 | staticCfiModule := ctx.ModuleForTests("libsnapshot.vendor_static.28.arm64", staticCfiVariant).Module().(*Module) |
Colin Cross | 0fce0ba | 2021-01-08 16:40:12 -0800 | [diff] [blame] | 1178 | assertString(t, staticCfiModule.outputFile.Path().Base(), "libsnapshot.cfi.a") |
Justin Yun | 39c3031 | 2022-11-23 16:20:12 +0900 | [diff] [blame] | 1179 | |
| 1180 | staticHwasanModule := ctx.ModuleForTests("libsnapshot.vendor_static.28.arm64", staticHwasanVariant).Module().(*Module) |
| 1181 | assertString(t, staticHwasanModule.outputFile.Path().Base(), "libsnapshot.hwasan.a") |
| 1182 | |
| 1183 | staticHwasanCfiModule := ctx.ModuleForTests("libsnapshot.vendor_static.28.arm64", staticHwasanCfiVariant).Module().(*Module) |
| 1184 | if !staticHwasanCfiModule.HiddenFromMake() || !staticHwasanCfiModule.PreventInstall() { |
| 1185 | t.Errorf("Hwasan and Cfi cannot enabled at the same time.") |
| 1186 | } |
Justin Yun | 08270c6 | 2022-12-19 17:01:26 +0900 | [diff] [blame] | 1187 | |
| 1188 | snapshotObjModule := ctx.ModuleForTests("snapshot_object.vendor_object.28.arm64", "android_vendor.28_arm64_armv8-a").Module() |
| 1189 | snapshotObjMkEntries := android.AndroidMkEntriesForTest(t, ctx, snapshotObjModule) |
| 1190 | // snapshot object must not add ".hwasan" suffix |
| 1191 | assertString(t, snapshotObjMkEntries[0].EntryMap["LOCAL_MODULE"][0], "snapshot_object") |
Colin Cross | 0fce0ba | 2021-01-08 16:40:12 -0800 | [diff] [blame] | 1192 | } |
| 1193 | |
Colin Cross | 0fce0ba | 2021-01-08 16:40:12 -0800 | [diff] [blame] | 1194 | func TestVendorSnapshotExclude(t *testing.T) { |
| 1195 | |
| 1196 | // This test verifies that the exclude_from_vendor_snapshot property |
| 1197 | // makes its way from the Android.bp source file into the module data |
| 1198 | // structure. It also verifies that modules are correctly included or |
| 1199 | // excluded in the vendor snapshot based on their path (framework or |
| 1200 | // vendor) and the exclude_from_vendor_snapshot property. |
| 1201 | |
| 1202 | frameworkBp := ` |
| 1203 | cc_library_shared { |
| 1204 | name: "libinclude", |
| 1205 | srcs: ["src/include.cpp"], |
| 1206 | vendor_available: true, |
| 1207 | } |
| 1208 | cc_library_shared { |
| 1209 | name: "libexclude", |
| 1210 | srcs: ["src/exclude.cpp"], |
| 1211 | vendor: true, |
| 1212 | exclude_from_vendor_snapshot: true, |
| 1213 | } |
| 1214 | cc_library_shared { |
| 1215 | name: "libavailable_exclude", |
| 1216 | srcs: ["src/exclude.cpp"], |
| 1217 | vendor_available: true, |
| 1218 | exclude_from_vendor_snapshot: true, |
| 1219 | } |
| 1220 | ` |
| 1221 | |
| 1222 | vendorProprietaryBp := ` |
| 1223 | cc_library_shared { |
| 1224 | name: "libvendor", |
| 1225 | srcs: ["vendor.cpp"], |
| 1226 | vendor: true, |
| 1227 | } |
| 1228 | ` |
| 1229 | |
| 1230 | depsBp := GatherRequiredDepsForTest(android.Android) |
| 1231 | |
| 1232 | mockFS := map[string][]byte{ |
| 1233 | "deps/Android.bp": []byte(depsBp), |
| 1234 | "framework/Android.bp": []byte(frameworkBp), |
| 1235 | "framework/include.cpp": nil, |
| 1236 | "framework/exclude.cpp": nil, |
| 1237 | "device/Android.bp": []byte(vendorProprietaryBp), |
| 1238 | "device/vendor.cpp": nil, |
| 1239 | } |
| 1240 | |
Paul Duffin | c3e6ce0 | 2021-03-22 23:21:32 +0000 | [diff] [blame] | 1241 | config := TestConfig(t.TempDir(), android.Android, nil, "", mockFS) |
Colin Cross | 0fce0ba | 2021-01-08 16:40:12 -0800 | [diff] [blame] | 1242 | config.TestProductVariables.DeviceVndkVersion = StringPtr("current") |
Jiyong Park | f58c46e | 2021-04-01 21:35:20 +0900 | [diff] [blame] | 1243 | config.TestProductVariables.Platform_vndk_version = StringPtr("29") |
Colin Cross | 0fce0ba | 2021-01-08 16:40:12 -0800 | [diff] [blame] | 1244 | ctx := CreateTestContext(config) |
| 1245 | ctx.Register() |
| 1246 | |
| 1247 | _, errs := ctx.ParseFileList(".", []string{"deps/Android.bp", "framework/Android.bp", "device/Android.bp"}) |
| 1248 | android.FailIfErrored(t, errs) |
| 1249 | _, errs = ctx.PrepareBuildActions(config) |
| 1250 | android.FailIfErrored(t, errs) |
| 1251 | |
| 1252 | // Test an include and exclude framework module. |
Ivan Lozano | d67a6b0 | 2021-05-20 13:01:32 -0400 | [diff] [blame] | 1253 | AssertExcludeFromVendorSnapshotIs(t, ctx, "libinclude", false, vendorVariant) |
| 1254 | AssertExcludeFromVendorSnapshotIs(t, ctx, "libexclude", true, vendorVariant) |
| 1255 | AssertExcludeFromVendorSnapshotIs(t, ctx, "libavailable_exclude", true, vendorVariant) |
Colin Cross | 0fce0ba | 2021-01-08 16:40:12 -0800 | [diff] [blame] | 1256 | |
| 1257 | // A vendor module is excluded, but by its path, not the |
| 1258 | // exclude_from_vendor_snapshot property. |
Ivan Lozano | d67a6b0 | 2021-05-20 13:01:32 -0400 | [diff] [blame] | 1259 | AssertExcludeFromVendorSnapshotIs(t, ctx, "libvendor", false, vendorVariant) |
Colin Cross | 0fce0ba | 2021-01-08 16:40:12 -0800 | [diff] [blame] | 1260 | |
| 1261 | // Verify the content of the vendor snapshot. |
| 1262 | |
| 1263 | snapshotDir := "vendor-snapshot" |
Paul Duffin | c3e6ce0 | 2021-03-22 23:21:32 +0000 | [diff] [blame] | 1264 | snapshotVariantPath := filepath.Join("out/soong", snapshotDir, "arm64") |
Colin Cross | 0fce0ba | 2021-01-08 16:40:12 -0800 | [diff] [blame] | 1265 | snapshotSingleton := ctx.SingletonForTests("vendor-snapshot") |
| 1266 | |
| 1267 | var includeJsonFiles []string |
| 1268 | var excludeJsonFiles []string |
| 1269 | |
| 1270 | for _, arch := range [][]string{ |
| 1271 | []string{"arm64", "armv8-a"}, |
| 1272 | []string{"arm", "armv7-a-neon"}, |
| 1273 | } { |
| 1274 | archType := arch[0] |
| 1275 | archVariant := arch[1] |
| 1276 | archDir := fmt.Sprintf("arch-%s-%s", archType, archVariant) |
| 1277 | |
Jiyong Park | f58c46e | 2021-04-01 21:35:20 +0900 | [diff] [blame] | 1278 | sharedVariant := fmt.Sprintf("android_vendor.29_%s_%s_shared", archType, archVariant) |
Colin Cross | 0fce0ba | 2021-01-08 16:40:12 -0800 | [diff] [blame] | 1279 | sharedDir := filepath.Join(snapshotVariantPath, archDir, "shared") |
| 1280 | |
| 1281 | // Included modules |
Ivan Lozano | d67a6b0 | 2021-05-20 13:01:32 -0400 | [diff] [blame] | 1282 | CheckSnapshot(t, ctx, snapshotSingleton, "libinclude", "libinclude.so", sharedDir, sharedVariant) |
Colin Cross | 0fce0ba | 2021-01-08 16:40:12 -0800 | [diff] [blame] | 1283 | includeJsonFiles = append(includeJsonFiles, filepath.Join(sharedDir, "libinclude.so.json")) |
| 1284 | |
| 1285 | // Excluded modules |
Ivan Lozano | d67a6b0 | 2021-05-20 13:01:32 -0400 | [diff] [blame] | 1286 | CheckSnapshotExclude(t, ctx, snapshotSingleton, "libexclude", "libexclude.so", sharedDir, sharedVariant) |
Colin Cross | 0fce0ba | 2021-01-08 16:40:12 -0800 | [diff] [blame] | 1287 | excludeJsonFiles = append(excludeJsonFiles, filepath.Join(sharedDir, "libexclude.so.json")) |
Ivan Lozano | d67a6b0 | 2021-05-20 13:01:32 -0400 | [diff] [blame] | 1288 | CheckSnapshotExclude(t, ctx, snapshotSingleton, "libvendor", "libvendor.so", sharedDir, sharedVariant) |
Colin Cross | 0fce0ba | 2021-01-08 16:40:12 -0800 | [diff] [blame] | 1289 | excludeJsonFiles = append(excludeJsonFiles, filepath.Join(sharedDir, "libvendor.so.json")) |
Ivan Lozano | d67a6b0 | 2021-05-20 13:01:32 -0400 | [diff] [blame] | 1290 | CheckSnapshotExclude(t, ctx, snapshotSingleton, "libavailable_exclude", "libavailable_exclude.so", sharedDir, sharedVariant) |
Colin Cross | 0fce0ba | 2021-01-08 16:40:12 -0800 | [diff] [blame] | 1291 | excludeJsonFiles = append(excludeJsonFiles, filepath.Join(sharedDir, "libavailable_exclude.so.json")) |
| 1292 | } |
| 1293 | |
| 1294 | // Verify that each json file for an included module has a rule. |
| 1295 | for _, jsonFile := range includeJsonFiles { |
| 1296 | if snapshotSingleton.MaybeOutput(jsonFile).Rule == nil { |
| 1297 | t.Errorf("include json file %q not found", jsonFile) |
| 1298 | } |
| 1299 | } |
| 1300 | |
| 1301 | // Verify that each json file for an excluded module has no rule. |
| 1302 | for _, jsonFile := range excludeJsonFiles { |
| 1303 | if snapshotSingleton.MaybeOutput(jsonFile).Rule != nil { |
| 1304 | t.Errorf("exclude json file %q found", jsonFile) |
| 1305 | } |
| 1306 | } |
| 1307 | } |
| 1308 | |
| 1309 | func TestVendorSnapshotExcludeInVendorProprietaryPathErrors(t *testing.T) { |
| 1310 | |
| 1311 | // This test verifies that using the exclude_from_vendor_snapshot |
| 1312 | // property on a module in a vendor proprietary path generates an |
| 1313 | // error. These modules are already excluded, so we prohibit using the |
| 1314 | // property in this way, which could add to confusion. |
| 1315 | |
| 1316 | vendorProprietaryBp := ` |
| 1317 | cc_library_shared { |
| 1318 | name: "libvendor", |
| 1319 | srcs: ["vendor.cpp"], |
| 1320 | vendor: true, |
| 1321 | exclude_from_vendor_snapshot: true, |
| 1322 | } |
| 1323 | ` |
| 1324 | |
| 1325 | depsBp := GatherRequiredDepsForTest(android.Android) |
| 1326 | |
| 1327 | mockFS := map[string][]byte{ |
| 1328 | "deps/Android.bp": []byte(depsBp), |
| 1329 | "device/Android.bp": []byte(vendorProprietaryBp), |
| 1330 | "device/vendor.cpp": nil, |
| 1331 | } |
| 1332 | |
Paul Duffin | c3e6ce0 | 2021-03-22 23:21:32 +0000 | [diff] [blame] | 1333 | config := TestConfig(t.TempDir(), android.Android, nil, "", mockFS) |
Colin Cross | 0fce0ba | 2021-01-08 16:40:12 -0800 | [diff] [blame] | 1334 | config.TestProductVariables.DeviceVndkVersion = StringPtr("current") |
Jiyong Park | f58c46e | 2021-04-01 21:35:20 +0900 | [diff] [blame] | 1335 | config.TestProductVariables.Platform_vndk_version = StringPtr("29") |
Colin Cross | 0fce0ba | 2021-01-08 16:40:12 -0800 | [diff] [blame] | 1336 | ctx := CreateTestContext(config) |
| 1337 | ctx.Register() |
| 1338 | |
| 1339 | _, errs := ctx.ParseFileList(".", []string{"deps/Android.bp", "device/Android.bp"}) |
| 1340 | android.FailIfErrored(t, errs) |
| 1341 | |
| 1342 | _, errs = ctx.PrepareBuildActions(config) |
| 1343 | android.CheckErrorsAgainstExpectations(t, errs, []string{ |
| 1344 | `module "libvendor\{.+,image:vendor.+,arch:arm64_.+\}" in vendor proprietary path "device" may not use "exclude_from_vendor_snapshot: true"`, |
| 1345 | `module "libvendor\{.+,image:vendor.+,arch:arm_.+\}" in vendor proprietary path "device" may not use "exclude_from_vendor_snapshot: true"`, |
| 1346 | `module "libvendor\{.+,image:vendor.+,arch:arm64_.+\}" in vendor proprietary path "device" may not use "exclude_from_vendor_snapshot: true"`, |
| 1347 | `module "libvendor\{.+,image:vendor.+,arch:arm_.+\}" in vendor proprietary path "device" may not use "exclude_from_vendor_snapshot: true"`, |
| 1348 | `module "libvendor\{.+,image:vendor.+,arch:arm64_.+\}" in vendor proprietary path "device" may not use "exclude_from_vendor_snapshot: true"`, |
| 1349 | `module "libvendor\{.+,image:vendor.+,arch:arm_.+\}" in vendor proprietary path "device" may not use "exclude_from_vendor_snapshot: true"`, |
| 1350 | }) |
| 1351 | } |
| 1352 | |
| 1353 | func TestRecoverySnapshotCapture(t *testing.T) { |
| 1354 | bp := ` |
| 1355 | cc_library { |
| 1356 | name: "libvndk", |
| 1357 | vendor_available: true, |
| 1358 | recovery_available: true, |
| 1359 | product_available: true, |
| 1360 | vndk: { |
| 1361 | enabled: true, |
| 1362 | }, |
| 1363 | nocrt: true, |
| 1364 | } |
| 1365 | |
| 1366 | cc_library { |
| 1367 | name: "librecovery", |
| 1368 | recovery: true, |
| 1369 | nocrt: true, |
| 1370 | } |
| 1371 | |
| 1372 | cc_library { |
| 1373 | name: "librecovery_available", |
| 1374 | recovery_available: true, |
| 1375 | nocrt: true, |
| 1376 | } |
| 1377 | |
| 1378 | cc_library_headers { |
| 1379 | name: "librecovery_headers", |
| 1380 | recovery_available: true, |
| 1381 | nocrt: true, |
| 1382 | } |
| 1383 | |
| 1384 | cc_binary { |
| 1385 | name: "recovery_bin", |
| 1386 | recovery: true, |
| 1387 | nocrt: true, |
| 1388 | } |
| 1389 | |
| 1390 | cc_binary { |
| 1391 | name: "recovery_available_bin", |
| 1392 | recovery_available: true, |
| 1393 | nocrt: true, |
| 1394 | } |
| 1395 | |
Liz Kammer | 718eb27 | 2022-01-07 10:53:37 -0500 | [diff] [blame] | 1396 | cc_prebuilt_library_static { |
Colin Cross | 0fce0ba | 2021-01-08 16:40:12 -0800 | [diff] [blame] | 1397 | name: "libb", |
| 1398 | recovery_available: true, |
Liz Kammer | 718eb27 | 2022-01-07 10:53:37 -0500 | [diff] [blame] | 1399 | srcs: ["libb.a"], |
| 1400 | nocrt: true, |
| 1401 | no_libcrt: true, |
| 1402 | stl: "none", |
Colin Cross | 0fce0ba | 2021-01-08 16:40:12 -0800 | [diff] [blame] | 1403 | } |
| 1404 | |
| 1405 | cc_object { |
| 1406 | name: "obj", |
| 1407 | recovery_available: true, |
| 1408 | } |
| 1409 | ` |
Paul Duffin | c3e6ce0 | 2021-03-22 23:21:32 +0000 | [diff] [blame] | 1410 | config := TestConfig(t.TempDir(), android.Android, nil, bp, nil) |
Colin Cross | 0fce0ba | 2021-01-08 16:40:12 -0800 | [diff] [blame] | 1411 | config.TestProductVariables.RecoverySnapshotVersion = StringPtr("current") |
Jiyong Park | f58c46e | 2021-04-01 21:35:20 +0900 | [diff] [blame] | 1412 | config.TestProductVariables.Platform_vndk_version = StringPtr("29") |
Colin Cross | 0fce0ba | 2021-01-08 16:40:12 -0800 | [diff] [blame] | 1413 | ctx := testCcWithConfig(t, config) |
| 1414 | |
| 1415 | // Check Recovery snapshot output. |
| 1416 | |
| 1417 | snapshotDir := "recovery-snapshot" |
Paul Duffin | c3e6ce0 | 2021-03-22 23:21:32 +0000 | [diff] [blame] | 1418 | snapshotVariantPath := filepath.Join("out/soong", snapshotDir, "arm64") |
Colin Cross | 0fce0ba | 2021-01-08 16:40:12 -0800 | [diff] [blame] | 1419 | snapshotSingleton := ctx.SingletonForTests("recovery-snapshot") |
| 1420 | |
| 1421 | var jsonFiles []string |
| 1422 | |
| 1423 | for _, arch := range [][]string{ |
| 1424 | []string{"arm64", "armv8-a"}, |
| 1425 | } { |
| 1426 | archType := arch[0] |
| 1427 | archVariant := arch[1] |
| 1428 | archDir := fmt.Sprintf("arch-%s-%s", archType, archVariant) |
| 1429 | |
| 1430 | // For shared libraries, only recovery_available modules are captured. |
| 1431 | sharedVariant := fmt.Sprintf("android_recovery_%s_%s_shared", archType, archVariant) |
| 1432 | sharedDir := filepath.Join(snapshotVariantPath, archDir, "shared") |
Ivan Lozano | d67a6b0 | 2021-05-20 13:01:32 -0400 | [diff] [blame] | 1433 | CheckSnapshot(t, ctx, snapshotSingleton, "libvndk", "libvndk.so", sharedDir, sharedVariant) |
| 1434 | CheckSnapshot(t, ctx, snapshotSingleton, "librecovery", "librecovery.so", sharedDir, sharedVariant) |
| 1435 | CheckSnapshot(t, ctx, snapshotSingleton, "librecovery_available", "librecovery_available.so", sharedDir, sharedVariant) |
Colin Cross | 0fce0ba | 2021-01-08 16:40:12 -0800 | [diff] [blame] | 1436 | jsonFiles = append(jsonFiles, |
| 1437 | filepath.Join(sharedDir, "libvndk.so.json"), |
| 1438 | filepath.Join(sharedDir, "librecovery.so.json"), |
| 1439 | filepath.Join(sharedDir, "librecovery_available.so.json")) |
| 1440 | |
| 1441 | // For static libraries, all recovery:true and recovery_available modules are captured. |
| 1442 | staticVariant := fmt.Sprintf("android_recovery_%s_%s_static", archType, archVariant) |
| 1443 | staticDir := filepath.Join(snapshotVariantPath, archDir, "static") |
Ivan Lozano | d67a6b0 | 2021-05-20 13:01:32 -0400 | [diff] [blame] | 1444 | CheckSnapshot(t, ctx, snapshotSingleton, "libb", "libb.a", staticDir, staticVariant) |
| 1445 | CheckSnapshot(t, ctx, snapshotSingleton, "librecovery", "librecovery.a", staticDir, staticVariant) |
| 1446 | CheckSnapshot(t, ctx, snapshotSingleton, "librecovery_available", "librecovery_available.a", staticDir, staticVariant) |
Colin Cross | 0fce0ba | 2021-01-08 16:40:12 -0800 | [diff] [blame] | 1447 | jsonFiles = append(jsonFiles, |
| 1448 | filepath.Join(staticDir, "libb.a.json"), |
| 1449 | filepath.Join(staticDir, "librecovery.a.json"), |
| 1450 | filepath.Join(staticDir, "librecovery_available.a.json")) |
| 1451 | |
| 1452 | // For binary executables, all recovery:true and recovery_available modules are captured. |
| 1453 | if archType == "arm64" { |
| 1454 | binaryVariant := fmt.Sprintf("android_recovery_%s_%s", archType, archVariant) |
| 1455 | binaryDir := filepath.Join(snapshotVariantPath, archDir, "binary") |
Ivan Lozano | d67a6b0 | 2021-05-20 13:01:32 -0400 | [diff] [blame] | 1456 | CheckSnapshot(t, ctx, snapshotSingleton, "recovery_bin", "recovery_bin", binaryDir, binaryVariant) |
| 1457 | CheckSnapshot(t, ctx, snapshotSingleton, "recovery_available_bin", "recovery_available_bin", binaryDir, binaryVariant) |
Colin Cross | 0fce0ba | 2021-01-08 16:40:12 -0800 | [diff] [blame] | 1458 | jsonFiles = append(jsonFiles, |
| 1459 | filepath.Join(binaryDir, "recovery_bin.json"), |
| 1460 | filepath.Join(binaryDir, "recovery_available_bin.json")) |
| 1461 | } |
| 1462 | |
| 1463 | // For header libraries, all vendor:true and vendor_available modules are captured. |
| 1464 | headerDir := filepath.Join(snapshotVariantPath, archDir, "header") |
| 1465 | jsonFiles = append(jsonFiles, filepath.Join(headerDir, "librecovery_headers.json")) |
| 1466 | |
| 1467 | // For object modules, all vendor:true and vendor_available modules are captured. |
| 1468 | objectVariant := fmt.Sprintf("android_recovery_%s_%s", archType, archVariant) |
| 1469 | objectDir := filepath.Join(snapshotVariantPath, archDir, "object") |
Ivan Lozano | d67a6b0 | 2021-05-20 13:01:32 -0400 | [diff] [blame] | 1470 | CheckSnapshot(t, ctx, snapshotSingleton, "obj", "obj.o", objectDir, objectVariant) |
Colin Cross | 0fce0ba | 2021-01-08 16:40:12 -0800 | [diff] [blame] | 1471 | jsonFiles = append(jsonFiles, filepath.Join(objectDir, "obj.o.json")) |
| 1472 | } |
| 1473 | |
| 1474 | for _, jsonFile := range jsonFiles { |
| 1475 | // verify all json files exist |
| 1476 | if snapshotSingleton.MaybeOutput(jsonFile).Rule == nil { |
| 1477 | t.Errorf("%q expected but not found", jsonFile) |
| 1478 | } |
| 1479 | } |
| 1480 | } |
| 1481 | |
| 1482 | func TestRecoverySnapshotExclude(t *testing.T) { |
| 1483 | // This test verifies that the exclude_from_recovery_snapshot property |
| 1484 | // makes its way from the Android.bp source file into the module data |
| 1485 | // structure. It also verifies that modules are correctly included or |
| 1486 | // excluded in the recovery snapshot based on their path (framework or |
| 1487 | // vendor) and the exclude_from_recovery_snapshot property. |
| 1488 | |
| 1489 | frameworkBp := ` |
| 1490 | cc_library_shared { |
| 1491 | name: "libinclude", |
| 1492 | srcs: ["src/include.cpp"], |
| 1493 | recovery_available: true, |
| 1494 | } |
| 1495 | cc_library_shared { |
| 1496 | name: "libexclude", |
| 1497 | srcs: ["src/exclude.cpp"], |
| 1498 | recovery: true, |
| 1499 | exclude_from_recovery_snapshot: true, |
| 1500 | } |
| 1501 | cc_library_shared { |
| 1502 | name: "libavailable_exclude", |
| 1503 | srcs: ["src/exclude.cpp"], |
| 1504 | recovery_available: true, |
| 1505 | exclude_from_recovery_snapshot: true, |
| 1506 | } |
| 1507 | ` |
| 1508 | |
| 1509 | vendorProprietaryBp := ` |
| 1510 | cc_library_shared { |
| 1511 | name: "librecovery", |
| 1512 | srcs: ["recovery.cpp"], |
| 1513 | recovery: true, |
| 1514 | } |
| 1515 | ` |
| 1516 | |
| 1517 | depsBp := GatherRequiredDepsForTest(android.Android) |
| 1518 | |
| 1519 | mockFS := map[string][]byte{ |
| 1520 | "deps/Android.bp": []byte(depsBp), |
| 1521 | "framework/Android.bp": []byte(frameworkBp), |
| 1522 | "framework/include.cpp": nil, |
| 1523 | "framework/exclude.cpp": nil, |
| 1524 | "device/Android.bp": []byte(vendorProprietaryBp), |
| 1525 | "device/recovery.cpp": nil, |
| 1526 | } |
| 1527 | |
Paul Duffin | c3e6ce0 | 2021-03-22 23:21:32 +0000 | [diff] [blame] | 1528 | config := TestConfig(t.TempDir(), android.Android, nil, "", mockFS) |
Colin Cross | 0fce0ba | 2021-01-08 16:40:12 -0800 | [diff] [blame] | 1529 | config.TestProductVariables.RecoverySnapshotVersion = StringPtr("current") |
Jiyong Park | f58c46e | 2021-04-01 21:35:20 +0900 | [diff] [blame] | 1530 | config.TestProductVariables.Platform_vndk_version = StringPtr("29") |
Colin Cross | 0fce0ba | 2021-01-08 16:40:12 -0800 | [diff] [blame] | 1531 | ctx := CreateTestContext(config) |
| 1532 | ctx.Register() |
| 1533 | |
| 1534 | _, errs := ctx.ParseFileList(".", []string{"deps/Android.bp", "framework/Android.bp", "device/Android.bp"}) |
| 1535 | android.FailIfErrored(t, errs) |
| 1536 | _, errs = ctx.PrepareBuildActions(config) |
| 1537 | android.FailIfErrored(t, errs) |
| 1538 | |
| 1539 | // Test an include and exclude framework module. |
Ivan Lozano | c2ca1ee | 2021-11-09 16:23:40 -0500 | [diff] [blame] | 1540 | AssertExcludeFromRecoverySnapshotIs(t, ctx, "libinclude", false, recoveryVariant) |
| 1541 | AssertExcludeFromRecoverySnapshotIs(t, ctx, "libexclude", true, recoveryVariant) |
| 1542 | AssertExcludeFromRecoverySnapshotIs(t, ctx, "libavailable_exclude", true, recoveryVariant) |
Colin Cross | 0fce0ba | 2021-01-08 16:40:12 -0800 | [diff] [blame] | 1543 | |
| 1544 | // A recovery module is excluded, but by its path, not the |
| 1545 | // exclude_from_recovery_snapshot property. |
Ivan Lozano | c2ca1ee | 2021-11-09 16:23:40 -0500 | [diff] [blame] | 1546 | AssertExcludeFromRecoverySnapshotIs(t, ctx, "librecovery", false, recoveryVariant) |
Colin Cross | 0fce0ba | 2021-01-08 16:40:12 -0800 | [diff] [blame] | 1547 | |
| 1548 | // Verify the content of the recovery snapshot. |
| 1549 | |
| 1550 | snapshotDir := "recovery-snapshot" |
Paul Duffin | c3e6ce0 | 2021-03-22 23:21:32 +0000 | [diff] [blame] | 1551 | snapshotVariantPath := filepath.Join("out/soong", snapshotDir, "arm64") |
Colin Cross | 0fce0ba | 2021-01-08 16:40:12 -0800 | [diff] [blame] | 1552 | snapshotSingleton := ctx.SingletonForTests("recovery-snapshot") |
| 1553 | |
| 1554 | var includeJsonFiles []string |
| 1555 | var excludeJsonFiles []string |
| 1556 | |
| 1557 | for _, arch := range [][]string{ |
| 1558 | []string{"arm64", "armv8-a"}, |
| 1559 | } { |
| 1560 | archType := arch[0] |
| 1561 | archVariant := arch[1] |
| 1562 | archDir := fmt.Sprintf("arch-%s-%s", archType, archVariant) |
| 1563 | |
| 1564 | sharedVariant := fmt.Sprintf("android_recovery_%s_%s_shared", archType, archVariant) |
| 1565 | sharedDir := filepath.Join(snapshotVariantPath, archDir, "shared") |
| 1566 | |
| 1567 | // Included modules |
Ivan Lozano | d67a6b0 | 2021-05-20 13:01:32 -0400 | [diff] [blame] | 1568 | CheckSnapshot(t, ctx, snapshotSingleton, "libinclude", "libinclude.so", sharedDir, sharedVariant) |
Colin Cross | 0fce0ba | 2021-01-08 16:40:12 -0800 | [diff] [blame] | 1569 | includeJsonFiles = append(includeJsonFiles, filepath.Join(sharedDir, "libinclude.so.json")) |
| 1570 | |
| 1571 | // Excluded modules |
Ivan Lozano | d67a6b0 | 2021-05-20 13:01:32 -0400 | [diff] [blame] | 1572 | CheckSnapshotExclude(t, ctx, snapshotSingleton, "libexclude", "libexclude.so", sharedDir, sharedVariant) |
Colin Cross | 0fce0ba | 2021-01-08 16:40:12 -0800 | [diff] [blame] | 1573 | excludeJsonFiles = append(excludeJsonFiles, filepath.Join(sharedDir, "libexclude.so.json")) |
Ivan Lozano | d67a6b0 | 2021-05-20 13:01:32 -0400 | [diff] [blame] | 1574 | CheckSnapshotExclude(t, ctx, snapshotSingleton, "librecovery", "librecovery.so", sharedDir, sharedVariant) |
Colin Cross | 0fce0ba | 2021-01-08 16:40:12 -0800 | [diff] [blame] | 1575 | excludeJsonFiles = append(excludeJsonFiles, filepath.Join(sharedDir, "librecovery.so.json")) |
Ivan Lozano | d67a6b0 | 2021-05-20 13:01:32 -0400 | [diff] [blame] | 1576 | CheckSnapshotExclude(t, ctx, snapshotSingleton, "libavailable_exclude", "libavailable_exclude.so", sharedDir, sharedVariant) |
Colin Cross | 0fce0ba | 2021-01-08 16:40:12 -0800 | [diff] [blame] | 1577 | excludeJsonFiles = append(excludeJsonFiles, filepath.Join(sharedDir, "libavailable_exclude.so.json")) |
| 1578 | } |
| 1579 | |
| 1580 | // Verify that each json file for an included module has a rule. |
| 1581 | for _, jsonFile := range includeJsonFiles { |
| 1582 | if snapshotSingleton.MaybeOutput(jsonFile).Rule == nil { |
| 1583 | t.Errorf("include json file %q not found", jsonFile) |
| 1584 | } |
| 1585 | } |
| 1586 | |
| 1587 | // Verify that each json file for an excluded module has no rule. |
| 1588 | for _, jsonFile := range excludeJsonFiles { |
| 1589 | if snapshotSingleton.MaybeOutput(jsonFile).Rule != nil { |
| 1590 | t.Errorf("exclude json file %q found", jsonFile) |
| 1591 | } |
| 1592 | } |
| 1593 | } |
Jose Galmes | 4c6895e | 2021-02-09 07:44:30 -0800 | [diff] [blame] | 1594 | |
| 1595 | func TestRecoverySnapshotDirected(t *testing.T) { |
| 1596 | bp := ` |
| 1597 | cc_library_shared { |
| 1598 | name: "librecovery", |
| 1599 | recovery: true, |
| 1600 | nocrt: true, |
| 1601 | } |
| 1602 | |
| 1603 | cc_library_shared { |
| 1604 | name: "librecovery_available", |
| 1605 | recovery_available: true, |
| 1606 | nocrt: true, |
| 1607 | } |
| 1608 | |
| 1609 | genrule { |
| 1610 | name: "libfoo_gen", |
| 1611 | cmd: "", |
| 1612 | out: ["libfoo.so"], |
| 1613 | } |
| 1614 | |
| 1615 | cc_prebuilt_library_shared { |
| 1616 | name: "libfoo", |
| 1617 | recovery: true, |
| 1618 | prefer: true, |
| 1619 | srcs: [":libfoo_gen"], |
| 1620 | } |
| 1621 | |
| 1622 | cc_library_shared { |
| 1623 | name: "libfoo", |
| 1624 | recovery: true, |
| 1625 | nocrt: true, |
| 1626 | } |
| 1627 | ` |
Paul Duffin | c3e6ce0 | 2021-03-22 23:21:32 +0000 | [diff] [blame] | 1628 | config := TestConfig(t.TempDir(), android.Android, nil, bp, nil) |
Jose Galmes | 4c6895e | 2021-02-09 07:44:30 -0800 | [diff] [blame] | 1629 | config.TestProductVariables.DeviceVndkVersion = StringPtr("current") |
| 1630 | config.TestProductVariables.RecoverySnapshotVersion = StringPtr("current") |
Jiyong Park | f58c46e | 2021-04-01 21:35:20 +0900 | [diff] [blame] | 1631 | config.TestProductVariables.Platform_vndk_version = StringPtr("29") |
Jose Galmes | 4c6895e | 2021-02-09 07:44:30 -0800 | [diff] [blame] | 1632 | config.TestProductVariables.DirectedRecoverySnapshot = true |
| 1633 | config.TestProductVariables.RecoverySnapshotModules = make(map[string]bool) |
| 1634 | config.TestProductVariables.RecoverySnapshotModules["librecovery"] = true |
| 1635 | config.TestProductVariables.RecoverySnapshotModules["libfoo"] = true |
| 1636 | ctx := testCcWithConfig(t, config) |
| 1637 | |
| 1638 | // Check recovery snapshot output. |
| 1639 | |
| 1640 | snapshotDir := "recovery-snapshot" |
Paul Duffin | c3e6ce0 | 2021-03-22 23:21:32 +0000 | [diff] [blame] | 1641 | snapshotVariantPath := filepath.Join("out/soong", snapshotDir, "arm64") |
Jose Galmes | 4c6895e | 2021-02-09 07:44:30 -0800 | [diff] [blame] | 1642 | snapshotSingleton := ctx.SingletonForTests("recovery-snapshot") |
| 1643 | |
| 1644 | var includeJsonFiles []string |
| 1645 | |
| 1646 | for _, arch := range [][]string{ |
| 1647 | []string{"arm64", "armv8-a"}, |
| 1648 | } { |
| 1649 | archType := arch[0] |
| 1650 | archVariant := arch[1] |
| 1651 | archDir := fmt.Sprintf("arch-%s-%s", archType, archVariant) |
| 1652 | |
| 1653 | sharedVariant := fmt.Sprintf("android_recovery_%s_%s_shared", archType, archVariant) |
| 1654 | sharedDir := filepath.Join(snapshotVariantPath, archDir, "shared") |
| 1655 | |
| 1656 | // Included modules |
Ivan Lozano | d67a6b0 | 2021-05-20 13:01:32 -0400 | [diff] [blame] | 1657 | CheckSnapshot(t, ctx, snapshotSingleton, "librecovery", "librecovery.so", sharedDir, sharedVariant) |
Jose Galmes | 4c6895e | 2021-02-09 07:44:30 -0800 | [diff] [blame] | 1658 | includeJsonFiles = append(includeJsonFiles, filepath.Join(sharedDir, "librecovery.so.json")) |
| 1659 | // Check that snapshot captures "prefer: true" prebuilt |
Ivan Lozano | d67a6b0 | 2021-05-20 13:01:32 -0400 | [diff] [blame] | 1660 | CheckSnapshot(t, ctx, snapshotSingleton, "prebuilt_libfoo", "libfoo.so", sharedDir, sharedVariant) |
Jose Galmes | 4c6895e | 2021-02-09 07:44:30 -0800 | [diff] [blame] | 1661 | includeJsonFiles = append(includeJsonFiles, filepath.Join(sharedDir, "libfoo.so.json")) |
| 1662 | |
| 1663 | // Excluded modules. Modules not included in the directed recovery snapshot |
| 1664 | // are still include as fake modules. |
Ivan Lozano | d67a6b0 | 2021-05-20 13:01:32 -0400 | [diff] [blame] | 1665 | CheckSnapshotRule(t, ctx, snapshotSingleton, "librecovery_available", "librecovery_available.so", sharedDir, sharedVariant) |
Jose Galmes | 4c6895e | 2021-02-09 07:44:30 -0800 | [diff] [blame] | 1666 | includeJsonFiles = append(includeJsonFiles, filepath.Join(sharedDir, "librecovery_available.so.json")) |
| 1667 | } |
| 1668 | |
| 1669 | // Verify that each json file for an included module has a rule. |
| 1670 | for _, jsonFile := range includeJsonFiles { |
| 1671 | if snapshotSingleton.MaybeOutput(jsonFile).Rule == nil { |
| 1672 | t.Errorf("include json file %q not found", jsonFile) |
| 1673 | } |
| 1674 | } |
| 1675 | } |
Justin Yun | 17d0ee2 | 2023-05-02 14:56:38 +0900 | [diff] [blame] | 1676 | |
| 1677 | func TestSnapshotInRelativeInstallPath(t *testing.T) { |
| 1678 | bp := ` |
| 1679 | cc_library { |
| 1680 | name: "libvendor_available", |
| 1681 | vendor_available: true, |
| 1682 | nocrt: true, |
| 1683 | } |
| 1684 | |
| 1685 | cc_library { |
| 1686 | name: "libvendor_available_var", |
| 1687 | vendor_available: true, |
| 1688 | stem: "libvendor_available", |
| 1689 | relative_install_path: "var", |
| 1690 | nocrt: true, |
| 1691 | } |
| 1692 | ` |
| 1693 | |
| 1694 | config := TestConfig(t.TempDir(), android.Android, nil, bp, nil) |
| 1695 | config.TestProductVariables.DeviceVndkVersion = StringPtr("current") |
| 1696 | config.TestProductVariables.Platform_vndk_version = StringPtr("29") |
| 1697 | ctx := testCcWithConfig(t, config) |
| 1698 | |
| 1699 | // Check Vendor snapshot output. |
| 1700 | |
| 1701 | snapshotDir := "vendor-snapshot" |
| 1702 | snapshotVariantPath := filepath.Join("out/soong", snapshotDir, "arm64") |
| 1703 | snapshotSingleton := ctx.SingletonForTests("vendor-snapshot") |
| 1704 | |
| 1705 | var jsonFiles []string |
| 1706 | |
| 1707 | for _, arch := range [][]string{ |
| 1708 | []string{"arm64", "armv8-a"}, |
| 1709 | []string{"arm", "armv7-a-neon"}, |
| 1710 | } { |
| 1711 | archType := arch[0] |
| 1712 | archVariant := arch[1] |
| 1713 | archDir := fmt.Sprintf("arch-%s-%s", archType, archVariant) |
| 1714 | |
| 1715 | // For shared libraries, only non-VNDK vendor_available modules are captured |
| 1716 | sharedVariant := fmt.Sprintf("android_vendor.29_%s_%s_shared", archType, archVariant) |
| 1717 | sharedDir := filepath.Join(snapshotVariantPath, archDir, "shared") |
| 1718 | sharedDirVar := filepath.Join(sharedDir, "var") |
| 1719 | CheckSnapshot(t, ctx, snapshotSingleton, "libvendor_available", "libvendor_available.so", sharedDir, sharedVariant) |
| 1720 | CheckSnapshot(t, ctx, snapshotSingleton, "libvendor_available_var", "libvendor_available.so", sharedDirVar, sharedVariant) |
| 1721 | jsonFiles = append(jsonFiles, |
| 1722 | filepath.Join(sharedDir, "libvendor_available.so.json"), |
| 1723 | filepath.Join(sharedDirVar, "libvendor_available.so.json")) |
| 1724 | } |
| 1725 | |
| 1726 | for _, jsonFile := range jsonFiles { |
| 1727 | // verify all json files exist |
| 1728 | if snapshotSingleton.MaybeOutput(jsonFile).Rule == nil { |
| 1729 | t.Errorf("%q expected but not found", jsonFile) |
| 1730 | } |
| 1731 | } |
| 1732 | |
| 1733 | // fake snapshot should have all outputs in the normal snapshot. |
| 1734 | fakeSnapshotSingleton := ctx.SingletonForTests("vendor-fake-snapshot") |
| 1735 | for _, output := range snapshotSingleton.AllOutputs() { |
| 1736 | fakeOutput := strings.Replace(output, "/vendor-snapshot/", "/fake/vendor-snapshot/", 1) |
| 1737 | if fakeSnapshotSingleton.MaybeOutput(fakeOutput).Rule == nil { |
| 1738 | t.Errorf("%q expected but not found", fakeOutput) |
| 1739 | } |
| 1740 | } |
| 1741 | } |