| Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 1 | // Copyright (C) 2019 The Android Open Source Project | 
 | 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 sdk | 
 | 16 |  | 
 | 17 | import ( | 
| Paul Duffin | 6369622 | 2021-09-06 10:28:34 +0100 | [diff] [blame] | 18 | 	"fmt" | 
| Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 19 | 	"testing" | 
 | 20 |  | 
| Paul Duffin | 1356d8c | 2020-02-25 19:26:33 +0000 | [diff] [blame] | 21 | 	"android/soong/android" | 
| Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 22 | 	"android/soong/cc" | 
 | 23 | ) | 
 | 24 |  | 
| Paul Duffin | 4a2a29c | 2021-03-09 22:27:13 +0000 | [diff] [blame] | 25 | var ccTestFs = android.MockFS{ | 
| Paul Duffin | 86b02a7 | 2021-02-22 11:50:04 +0000 | [diff] [blame] | 26 | 	"Test.cpp":                        nil, | 
 | 27 | 	"myinclude/Test.h":                nil, | 
 | 28 | 	"myinclude-android/AndroidTest.h": nil, | 
 | 29 | 	"myinclude-host/HostTest.h":       nil, | 
 | 30 | 	"arm64/include/Arm64Test.h":       nil, | 
 | 31 | 	"libfoo.so":                       nil, | 
 | 32 | 	"aidl/foo/bar/Test.aidl":          nil, | 
 | 33 | 	"some/where/stubslib.map.txt":     nil, | 
| Martin Stjernholm | 7feceb2 | 2020-07-11 04:33:29 +0100 | [diff] [blame] | 34 | } | 
 | 35 |  | 
| Paul Duffin | 93b750e | 2019-11-19 19:44:10 +0000 | [diff] [blame] | 36 | // Adds a native bridge target to the configured list of targets. | 
 | 37 | var prepareForTestWithNativeBridgeTarget = android.FixtureModifyConfig(func(config android.Config) { | 
 | 38 | 	config.Targets[android.Android] = append(config.Targets[android.Android], android.Target{ | 
 | 39 | 		Os: android.Android, | 
 | 40 | 		Arch: android.Arch{ | 
 | 41 | 			ArchType:     android.Arm64, | 
 | 42 | 			ArchVariant:  "armv8-a", | 
 | 43 | 			CpuVariant:   "cpu", | 
 | 44 | 			Abi:          nil, | 
 | 45 | 			ArchFeatures: nil, | 
 | 46 | 		}, | 
 | 47 | 		NativeBridge:             android.NativeBridgeEnabled, | 
 | 48 | 		NativeBridgeHostArchName: "x86_64", | 
 | 49 | 		NativeBridgeRelativePath: "native_bridge", | 
 | 50 | 	}) | 
 | 51 | }) | 
 | 52 |  | 
| Paul Duffin | 4a2a29c | 2021-03-09 22:27:13 +0000 | [diff] [blame] | 53 | func testSdkWithCc(t *testing.T, bp string) *android.TestResult { | 
| Paul Duffin | d835daa | 2019-11-30 17:49:09 +0000 | [diff] [blame] | 54 | 	t.Helper() | 
| Martin Stjernholm | 7feceb2 | 2020-07-11 04:33:29 +0100 | [diff] [blame] | 55 | 	return testSdkWithFs(t, bp, ccTestFs) | 
| Paul Duffin | d835daa | 2019-11-30 17:49:09 +0000 | [diff] [blame] | 56 | } | 
 | 57 |  | 
| Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 58 | // Contains tests for SDK members provided by the cc package. | 
 | 59 |  | 
| Martin Stjernholm | caa47d7 | 2020-07-11 04:52:24 +0100 | [diff] [blame] | 60 | func TestSingleDeviceOsAssumption(t *testing.T) { | 
 | 61 | 	// Mock a module with DeviceSupported() == true. | 
 | 62 | 	s := &sdk{} | 
 | 63 | 	android.InitAndroidArchModule(s, android.DeviceSupported, android.MultilibCommon) | 
 | 64 |  | 
 | 65 | 	osTypes := s.getPossibleOsTypes() | 
 | 66 | 	if len(osTypes) != 1 { | 
 | 67 | 		// The snapshot generation assumes there is a single device OS. If more are | 
 | 68 | 		// added it might need to disable them by default, like it does for host | 
 | 69 | 		// OS'es. | 
 | 70 | 		t.Errorf("expected a single device OS, got %v", osTypes) | 
 | 71 | 	} | 
 | 72 | } | 
 | 73 |  | 
| Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 74 | func TestSdkIsCompileMultilibBoth(t *testing.T) { | 
| Paul Duffin | d835daa | 2019-11-30 17:49:09 +0000 | [diff] [blame] | 75 | 	result := testSdkWithCc(t, ` | 
| Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 76 | 		sdk { | 
 | 77 | 			name: "mysdk", | 
 | 78 | 			native_shared_libs: ["sdkmember"], | 
 | 79 | 		} | 
 | 80 |  | 
 | 81 | 		cc_library_shared { | 
 | 82 | 			name: "sdkmember", | 
 | 83 | 			srcs: ["Test.cpp"], | 
| Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 84 | 			stl: "none", | 
 | 85 | 		} | 
 | 86 | 	`) | 
 | 87 |  | 
| Colin Cross | 7113d20 | 2019-11-20 16:39:12 -0800 | [diff] [blame] | 88 | 	armOutput := result.Module("sdkmember", "android_arm_armv7-a-neon_shared").(*cc.Module).OutputFile() | 
 | 89 | 	arm64Output := result.Module("sdkmember", "android_arm64_armv8-a_shared").(*cc.Module).OutputFile() | 
| Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 90 |  | 
 | 91 | 	var inputs []string | 
| Paul Duffin | 1356d8c | 2020-02-25 19:26:33 +0000 | [diff] [blame] | 92 | 	buildParams := result.Module("mysdk", android.CommonOS.Name).BuildParamsForTests() | 
| Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 93 | 	for _, bp := range buildParams { | 
 | 94 | 		if bp.Input != nil { | 
 | 95 | 			inputs = append(inputs, bp.Input.String()) | 
 | 96 | 		} | 
 | 97 | 	} | 
 | 98 |  | 
 | 99 | 	// ensure that both 32/64 outputs are inputs of the sdk snapshot | 
 | 100 | 	ensureListContains(t, inputs, armOutput.String()) | 
 | 101 | 	ensureListContains(t, inputs, arm64Output.String()) | 
 | 102 | } | 
 | 103 |  | 
| Martin Stjernholm | 26ab8e8 | 2020-06-30 20:34:00 +0100 | [diff] [blame] | 104 | func TestSdkCompileMultilibOverride(t *testing.T) { | 
 | 105 | 	result := testSdkWithCc(t, ` | 
 | 106 | 		sdk { | 
 | 107 | 			name: "mysdk", | 
| Martin Stjernholm | 89238f4 | 2020-07-10 00:14:03 +0100 | [diff] [blame] | 108 | 			host_supported: true, | 
| Martin Stjernholm | 26ab8e8 | 2020-06-30 20:34:00 +0100 | [diff] [blame] | 109 | 			native_shared_libs: ["sdkmember"], | 
 | 110 | 			compile_multilib: "64", | 
 | 111 | 		} | 
 | 112 |  | 
 | 113 | 		cc_library_shared { | 
 | 114 | 			name: "sdkmember", | 
| Martin Stjernholm | 89238f4 | 2020-07-10 00:14:03 +0100 | [diff] [blame] | 115 | 			host_supported: true, | 
| Martin Stjernholm | 26ab8e8 | 2020-06-30 20:34:00 +0100 | [diff] [blame] | 116 | 			srcs: ["Test.cpp"], | 
 | 117 | 			stl: "none", | 
 | 118 | 			compile_multilib: "64", | 
 | 119 | 		} | 
 | 120 | 	`) | 
 | 121 |  | 
| Paul Duffin | 36474d3 | 2021-03-12 12:19:43 +0000 | [diff] [blame] | 122 | 	CheckSnapshot(t, result, "mysdk", "", | 
| Paul Duffin | b01ac4b | 2022-05-24 20:10:05 +0000 | [diff] [blame] | 123 | 		checkAndroidBpContents(` | 
| Martin Stjernholm | 89238f4 | 2020-07-10 00:14:03 +0100 | [diff] [blame] | 124 | // This is auto-generated. DO NOT EDIT. | 
 | 125 |  | 
 | 126 | cc_prebuilt_library_shared { | 
| Paul Duffin | 75b902a | 2021-02-22 12:13:13 +0000 | [diff] [blame] | 127 |     name: "sdkmember", | 
 | 128 |     prefer: false, | 
| Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 129 |     visibility: ["//visibility:public"], | 
| Martin Stjernholm | 1e04109 | 2020-11-03 00:11:09 +0000 | [diff] [blame] | 130 |     apex_available: ["//apex_available:platform"], | 
| Martin Stjernholm | 89238f4 | 2020-07-10 00:14:03 +0100 | [diff] [blame] | 131 |     host_supported: true, | 
| Martin Stjernholm | 89238f4 | 2020-07-10 00:14:03 +0100 | [diff] [blame] | 132 |     stl: "none", | 
 | 133 |     compile_multilib: "64", | 
| Martin Stjernholm | 4cfa2c6 | 2020-07-10 19:55:36 +0100 | [diff] [blame] | 134 |     target: { | 
| Martin Stjernholm | caa47d7 | 2020-07-11 04:52:24 +0100 | [diff] [blame] | 135 |         host: { | 
 | 136 |             enabled: false, | 
 | 137 |         }, | 
| Martin Stjernholm | 4cfa2c6 | 2020-07-10 19:55:36 +0100 | [diff] [blame] | 138 |         android_arm64: { | 
 | 139 |             srcs: ["android/arm64/lib/sdkmember.so"], | 
 | 140 |         }, | 
 | 141 |         linux_glibc_x86_64: { | 
| Jiyong Park | 8fe14e6 | 2020-10-19 22:47:34 +0900 | [diff] [blame] | 142 |             enabled: true, | 
| Martin Stjernholm | 4cfa2c6 | 2020-07-10 19:55:36 +0100 | [diff] [blame] | 143 |             srcs: ["linux_glibc/x86_64/lib/sdkmember.so"], | 
| Martin Stjernholm | 89238f4 | 2020-07-10 00:14:03 +0100 | [diff] [blame] | 144 |         }, | 
 | 145 |     }, | 
 | 146 | } | 
| Paul Duffin | 75b902a | 2021-02-22 12:13:13 +0000 | [diff] [blame] | 147 | `), | 
| Martin Stjernholm | 26ab8e8 | 2020-06-30 20:34:00 +0100 | [diff] [blame] | 148 | 		checkAllCopyRules(` | 
| Martin Stjernholm | 4cfa2c6 | 2020-07-10 19:55:36 +0100 | [diff] [blame] | 149 | .intermediates/sdkmember/android_arm64_armv8-a_shared/sdkmember.so -> android/arm64/lib/sdkmember.so | 
 | 150 | .intermediates/sdkmember/linux_glibc_x86_64_shared/sdkmember.so -> linux_glibc/x86_64/lib/sdkmember.so | 
| Martin Stjernholm | 26ab8e8 | 2020-06-30 20:34:00 +0100 | [diff] [blame] | 151 | `)) | 
 | 152 | } | 
 | 153 |  | 
| Paul Duffin | a0843f6 | 2019-12-13 19:50:38 +0000 | [diff] [blame] | 154 | // Make sure the sdk can use host specific cc libraries static/shared and both. | 
 | 155 | func TestHostSdkWithCc(t *testing.T) { | 
 | 156 | 	testSdkWithCc(t, ` | 
 | 157 | 		sdk { | 
 | 158 | 			name: "mysdk", | 
 | 159 | 			device_supported: false, | 
 | 160 | 			host_supported: true, | 
 | 161 | 			native_shared_libs: ["sdkshared"], | 
 | 162 | 			native_static_libs: ["sdkstatic"], | 
 | 163 | 		} | 
 | 164 |  | 
 | 165 | 		cc_library_host_shared { | 
 | 166 | 			name: "sdkshared", | 
| Paul Duffin | a0843f6 | 2019-12-13 19:50:38 +0000 | [diff] [blame] | 167 | 			stl: "none", | 
 | 168 | 		} | 
 | 169 |  | 
 | 170 | 		cc_library_host_static { | 
 | 171 | 			name: "sdkstatic", | 
| Paul Duffin | a0843f6 | 2019-12-13 19:50:38 +0000 | [diff] [blame] | 172 | 			stl: "none", | 
 | 173 | 		} | 
 | 174 | 	`) | 
 | 175 | } | 
 | 176 |  | 
 | 177 | // Make sure the sdk can use cc libraries static/shared and both. | 
 | 178 | func TestSdkWithCc(t *testing.T) { | 
 | 179 | 	testSdkWithCc(t, ` | 
 | 180 | 		sdk { | 
 | 181 | 			name: "mysdk", | 
 | 182 | 			native_shared_libs: ["sdkshared", "sdkboth1"], | 
 | 183 | 			native_static_libs: ["sdkstatic", "sdkboth2"], | 
 | 184 | 		} | 
 | 185 |  | 
 | 186 | 		cc_library_shared { | 
 | 187 | 			name: "sdkshared", | 
| Paul Duffin | a0843f6 | 2019-12-13 19:50:38 +0000 | [diff] [blame] | 188 | 			stl: "none", | 
 | 189 | 		} | 
 | 190 |  | 
 | 191 | 		cc_library_static { | 
 | 192 | 			name: "sdkstatic", | 
| Paul Duffin | a0843f6 | 2019-12-13 19:50:38 +0000 | [diff] [blame] | 193 | 			stl: "none", | 
 | 194 | 		} | 
 | 195 |  | 
 | 196 | 		cc_library { | 
 | 197 | 			name: "sdkboth1", | 
| Paul Duffin | a0843f6 | 2019-12-13 19:50:38 +0000 | [diff] [blame] | 198 | 			stl: "none", | 
 | 199 | 		} | 
 | 200 |  | 
 | 201 | 		cc_library { | 
 | 202 | 			name: "sdkboth2", | 
| Paul Duffin | a0843f6 | 2019-12-13 19:50:38 +0000 | [diff] [blame] | 203 | 			stl: "none", | 
 | 204 | 		} | 
 | 205 | 	`) | 
 | 206 | } | 
 | 207 |  | 
| Martin Stjernholm | cd07bce | 2020-03-10 22:37:59 +0000 | [diff] [blame] | 208 | func TestSnapshotWithObject(t *testing.T) { | 
 | 209 | 	result := testSdkWithCc(t, ` | 
 | 210 | 		sdk { | 
 | 211 | 			name: "mysdk", | 
 | 212 | 			native_objects: ["crtobj"], | 
 | 213 | 		} | 
 | 214 |  | 
 | 215 | 		cc_object { | 
 | 216 | 			name: "crtobj", | 
 | 217 | 			stl: "none", | 
| Colin Cross | 6b8f425 | 2021-07-22 11:39:44 -0700 | [diff] [blame] | 218 | 			system_shared_libs: [], | 
| Martin Stjernholm | fbb486f | 2020-08-21 18:43:51 +0100 | [diff] [blame] | 219 | 			sanitize: { | 
 | 220 | 				never: true, | 
 | 221 | 			}, | 
| Martin Stjernholm | cd07bce | 2020-03-10 22:37:59 +0000 | [diff] [blame] | 222 | 		} | 
 | 223 | 	`) | 
 | 224 |  | 
| Paul Duffin | 36474d3 | 2021-03-12 12:19:43 +0000 | [diff] [blame] | 225 | 	CheckSnapshot(t, result, "mysdk", "", | 
| Paul Duffin | b01ac4b | 2022-05-24 20:10:05 +0000 | [diff] [blame] | 226 | 		checkAndroidBpContents(` | 
| Martin Stjernholm | cd07bce | 2020-03-10 22:37:59 +0000 | [diff] [blame] | 227 | // This is auto-generated. DO NOT EDIT. | 
 | 228 |  | 
 | 229 | cc_prebuilt_object { | 
| Paul Duffin | 75b902a | 2021-02-22 12:13:13 +0000 | [diff] [blame] | 230 |     name: "crtobj", | 
 | 231 |     prefer: false, | 
| Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 232 |     visibility: ["//visibility:public"], | 
| Martin Stjernholm | 1e04109 | 2020-11-03 00:11:09 +0000 | [diff] [blame] | 233 |     apex_available: ["//apex_available:platform"], | 
| Martin Stjernholm | cd07bce | 2020-03-10 22:37:59 +0000 | [diff] [blame] | 234 |     stl: "none", | 
| Martin Stjernholm | 89238f4 | 2020-07-10 00:14:03 +0100 | [diff] [blame] | 235 |     compile_multilib: "both", | 
| Colin Cross | 6b8f425 | 2021-07-22 11:39:44 -0700 | [diff] [blame] | 236 |     system_shared_libs: [], | 
| Martin Stjernholm | fbb486f | 2020-08-21 18:43:51 +0100 | [diff] [blame] | 237 |     sanitize: { | 
 | 238 |         never: true, | 
 | 239 |     }, | 
| Martin Stjernholm | cd07bce | 2020-03-10 22:37:59 +0000 | [diff] [blame] | 240 |     arch: { | 
 | 241 |         arm64: { | 
 | 242 |             srcs: ["arm64/lib/crtobj.o"], | 
 | 243 |         }, | 
 | 244 |         arm: { | 
 | 245 |             srcs: ["arm/lib/crtobj.o"], | 
 | 246 |         }, | 
 | 247 |     }, | 
 | 248 | } | 
| Paul Duffin | 75b902a | 2021-02-22 12:13:13 +0000 | [diff] [blame] | 249 | `), | 
| Martin Stjernholm | cd07bce | 2020-03-10 22:37:59 +0000 | [diff] [blame] | 250 | 		checkAllCopyRules(` | 
 | 251 | .intermediates/crtobj/android_arm64_armv8-a/crtobj.o -> arm64/lib/crtobj.o | 
 | 252 | .intermediates/crtobj/android_arm_armv7-a-neon/crtobj.o -> arm/lib/crtobj.o | 
 | 253 | `), | 
 | 254 | 	) | 
 | 255 | } | 
 | 256 |  | 
| Paul Duffin | c62a510 | 2019-12-11 18:34:15 +0000 | [diff] [blame] | 257 | func TestSnapshotWithCcDuplicateHeaders(t *testing.T) { | 
 | 258 | 	result := testSdkWithCc(t, ` | 
 | 259 | 		sdk { | 
 | 260 | 			name: "mysdk", | 
 | 261 | 			native_shared_libs: ["mynativelib1", "mynativelib2"], | 
 | 262 | 		} | 
 | 263 |  | 
 | 264 | 		cc_library_shared { | 
 | 265 | 			name: "mynativelib1", | 
 | 266 | 			srcs: [ | 
 | 267 | 				"Test.cpp", | 
 | 268 | 			], | 
| Paul Duffin | 86b02a7 | 2021-02-22 11:50:04 +0000 | [diff] [blame] | 269 | 			export_include_dirs: ["myinclude"], | 
| Paul Duffin | c62a510 | 2019-12-11 18:34:15 +0000 | [diff] [blame] | 270 | 			stl: "none", | 
 | 271 | 		} | 
 | 272 |  | 
 | 273 | 		cc_library_shared { | 
 | 274 | 			name: "mynativelib2", | 
 | 275 | 			srcs: [ | 
 | 276 | 				"Test.cpp", | 
 | 277 | 			], | 
| Paul Duffin | 86b02a7 | 2021-02-22 11:50:04 +0000 | [diff] [blame] | 278 | 			export_include_dirs: ["myinclude"], | 
| Paul Duffin | c62a510 | 2019-12-11 18:34:15 +0000 | [diff] [blame] | 279 | 			stl: "none", | 
 | 280 | 		} | 
 | 281 | 	`) | 
 | 282 |  | 
| Paul Duffin | 36474d3 | 2021-03-12 12:19:43 +0000 | [diff] [blame] | 283 | 	CheckSnapshot(t, result, "mysdk", "", | 
| Paul Duffin | c62a510 | 2019-12-11 18:34:15 +0000 | [diff] [blame] | 284 | 		checkAllCopyRules(` | 
| Paul Duffin | 86b02a7 | 2021-02-22 11:50:04 +0000 | [diff] [blame] | 285 | myinclude/Test.h -> include/myinclude/Test.h | 
| Colin Cross | 7113d20 | 2019-11-20 16:39:12 -0800 | [diff] [blame] | 286 | .intermediates/mynativelib1/android_arm64_armv8-a_shared/mynativelib1.so -> arm64/lib/mynativelib1.so | 
 | 287 | .intermediates/mynativelib1/android_arm_armv7-a-neon_shared/mynativelib1.so -> arm/lib/mynativelib1.so | 
 | 288 | .intermediates/mynativelib2/android_arm64_armv8-a_shared/mynativelib2.so -> arm64/lib/mynativelib2.so | 
 | 289 | .intermediates/mynativelib2/android_arm_armv7-a-neon_shared/mynativelib2.so -> arm/lib/mynativelib2.so | 
| Paul Duffin | c62a510 | 2019-12-11 18:34:15 +0000 | [diff] [blame] | 290 | `), | 
 | 291 | 	) | 
 | 292 | } | 
 | 293 |  | 
| Paul Duffin | a43f927 | 2021-02-17 10:55:25 +0000 | [diff] [blame] | 294 | func TestSnapshotWithCcExportGeneratedHeaders(t *testing.T) { | 
 | 295 | 	result := testSdkWithCc(t, ` | 
 | 296 | 		sdk { | 
 | 297 | 			name: "mysdk", | 
 | 298 | 			native_shared_libs: ["mynativelib"], | 
 | 299 | 		} | 
 | 300 |  | 
 | 301 | 		cc_library_shared { | 
 | 302 | 			name: "mynativelib", | 
 | 303 | 			srcs: [ | 
 | 304 | 				"Test.cpp", | 
 | 305 | 			], | 
 | 306 | 			generated_headers: [ | 
 | 307 | 				"generated_foo", | 
 | 308 | 			], | 
 | 309 | 			export_generated_headers: [ | 
 | 310 | 				"generated_foo", | 
 | 311 | 			], | 
| Paul Duffin | 86b02a7 | 2021-02-22 11:50:04 +0000 | [diff] [blame] | 312 | 			export_include_dirs: ["myinclude"], | 
| Paul Duffin | a43f927 | 2021-02-17 10:55:25 +0000 | [diff] [blame] | 313 | 			stl: "none", | 
 | 314 | 		} | 
 | 315 |  | 
 | 316 | 		genrule { | 
 | 317 | 			name: "generated_foo", | 
 | 318 | 			cmd: "generate-foo", | 
 | 319 | 			out: [ | 
 | 320 | 				"generated_foo/protos/foo/bar.h", | 
 | 321 | 			], | 
 | 322 | 			export_include_dirs: [ | 
 | 323 | 				".", | 
 | 324 | 				"protos", | 
 | 325 | 			], | 
 | 326 | 		} | 
 | 327 | 	`) | 
 | 328 |  | 
| Paul Duffin | db462dd | 2021-03-21 22:01:55 +0000 | [diff] [blame] | 329 | 	// TODO(b/183322862): Remove this and fix the issue. | 
 | 330 | 	errorHandler := android.FixtureExpectsAtLeastOneErrorMatchingPattern(`module source path "snapshot/include_gen/generated_foo/gen/protos" does not exist`) | 
 | 331 |  | 
| Paul Duffin | 36474d3 | 2021-03-12 12:19:43 +0000 | [diff] [blame] | 332 | 	CheckSnapshot(t, result, "mysdk", "", | 
| Paul Duffin | b01ac4b | 2022-05-24 20:10:05 +0000 | [diff] [blame] | 333 | 		checkAndroidBpContents(` | 
| Paul Duffin | a43f927 | 2021-02-17 10:55:25 +0000 | [diff] [blame] | 334 | // This is auto-generated. DO NOT EDIT. | 
 | 335 |  | 
 | 336 | cc_prebuilt_library_shared { | 
 | 337 |     name: "mynativelib", | 
 | 338 |     prefer: false, | 
 | 339 |     visibility: ["//visibility:public"], | 
 | 340 |     apex_available: ["//apex_available:platform"], | 
 | 341 |     stl: "none", | 
 | 342 |     compile_multilib: "both", | 
| Paul Duffin | 7a7d067 | 2021-02-17 12:17:40 +0000 | [diff] [blame] | 343 |     export_include_dirs: [ | 
 | 344 |         "include/myinclude", | 
 | 345 |         "include_gen/generated_foo/gen", | 
 | 346 |         "include_gen/generated_foo/gen/protos", | 
 | 347 |     ], | 
| Paul Duffin | a43f927 | 2021-02-17 10:55:25 +0000 | [diff] [blame] | 348 |     arch: { | 
 | 349 |         arm64: { | 
 | 350 |             srcs: ["arm64/lib/mynativelib.so"], | 
| Paul Duffin | a43f927 | 2021-02-17 10:55:25 +0000 | [diff] [blame] | 351 |         }, | 
 | 352 |         arm: { | 
 | 353 |             srcs: ["arm/lib/mynativelib.so"], | 
| Paul Duffin | a43f927 | 2021-02-17 10:55:25 +0000 | [diff] [blame] | 354 |         }, | 
 | 355 |     }, | 
 | 356 | } | 
 | 357 | `), | 
 | 358 | 		checkAllCopyRules(` | 
| Paul Duffin | 86b02a7 | 2021-02-22 11:50:04 +0000 | [diff] [blame] | 359 | myinclude/Test.h -> include/myinclude/Test.h | 
| Paul Duffin | 7a7d067 | 2021-02-17 12:17:40 +0000 | [diff] [blame] | 360 | .intermediates/generated_foo/gen/generated_foo/protos/foo/bar.h -> include_gen/generated_foo/gen/generated_foo/protos/foo/bar.h | 
| Paul Duffin | a43f927 | 2021-02-17 10:55:25 +0000 | [diff] [blame] | 361 | .intermediates/mynativelib/android_arm64_armv8-a_shared/mynativelib.so -> arm64/lib/mynativelib.so | 
| Paul Duffin | a43f927 | 2021-02-17 10:55:25 +0000 | [diff] [blame] | 362 | .intermediates/mynativelib/android_arm_armv7-a-neon_shared/mynativelib.so -> arm/lib/mynativelib.so | 
| Paul Duffin | a43f927 | 2021-02-17 10:55:25 +0000 | [diff] [blame] | 363 | `), | 
| Paul Duffin | db462dd | 2021-03-21 22:01:55 +0000 | [diff] [blame] | 364 | 		snapshotTestErrorHandler(checkSnapshotWithoutSource, errorHandler), | 
 | 365 | 		snapshotTestErrorHandler(checkSnapshotWithSourcePreferred, errorHandler), | 
 | 366 | 		snapshotTestErrorHandler(checkSnapshotPreferredWithSource, errorHandler), | 
| Paul Duffin | a43f927 | 2021-02-17 10:55:25 +0000 | [diff] [blame] | 367 | 	) | 
 | 368 | } | 
 | 369 |  | 
| Martin Stjernholm | b024957 | 2020-09-15 02:32:35 +0100 | [diff] [blame] | 370 | // Verify that when the shared library has some common and some arch specific | 
 | 371 | // properties that the generated snapshot is optimized properly. Substruct | 
 | 372 | // handling is tested with the sanitize clauses (but note there's a lot of | 
 | 373 | // built-in logic in sanitize.go that can affect those flags). | 
| Paul Duffin | a7cd8c8 | 2019-12-11 20:00:57 +0000 | [diff] [blame] | 374 | func TestSnapshotWithCcSharedLibraryCommonProperties(t *testing.T) { | 
 | 375 | 	result := testSdkWithCc(t, ` | 
 | 376 | 		sdk { | 
 | 377 | 			name: "mysdk", | 
 | 378 | 			native_shared_libs: ["mynativelib"], | 
 | 379 | 		} | 
 | 380 |  | 
 | 381 | 		cc_library_shared { | 
 | 382 | 			name: "mynativelib", | 
 | 383 | 			srcs: [ | 
 | 384 | 				"Test.cpp", | 
 | 385 | 				"aidl/foo/bar/Test.aidl", | 
 | 386 | 			], | 
| Paul Duffin | 86b02a7 | 2021-02-22 11:50:04 +0000 | [diff] [blame] | 387 | 			export_include_dirs: ["myinclude"], | 
| Martin Stjernholm | b024957 | 2020-09-15 02:32:35 +0100 | [diff] [blame] | 388 | 			sanitize: { | 
 | 389 | 				fuzzer: false, | 
 | 390 | 				integer_overflow: true, | 
 | 391 | 				diag: { undefined: false }, | 
 | 392 | 			}, | 
| Paul Duffin | a7cd8c8 | 2019-12-11 20:00:57 +0000 | [diff] [blame] | 393 | 			arch: { | 
 | 394 | 				arm64: { | 
 | 395 | 					export_system_include_dirs: ["arm64/include"], | 
| Martin Stjernholm | b024957 | 2020-09-15 02:32:35 +0100 | [diff] [blame] | 396 | 					sanitize: { | 
| Martin Stjernholm | b024957 | 2020-09-15 02:32:35 +0100 | [diff] [blame] | 397 | 						integer_overflow: false, | 
 | 398 | 					}, | 
| Paul Duffin | a7cd8c8 | 2019-12-11 20:00:57 +0000 | [diff] [blame] | 399 | 				}, | 
 | 400 | 			}, | 
| Paul Duffin | a7cd8c8 | 2019-12-11 20:00:57 +0000 | [diff] [blame] | 401 | 			stl: "none", | 
 | 402 | 		} | 
 | 403 | 	`) | 
 | 404 |  | 
| Paul Duffin | 36474d3 | 2021-03-12 12:19:43 +0000 | [diff] [blame] | 405 | 	CheckSnapshot(t, result, "mysdk", "", | 
| Paul Duffin | b01ac4b | 2022-05-24 20:10:05 +0000 | [diff] [blame] | 406 | 		checkAndroidBpContents(` | 
| Paul Duffin | a7cd8c8 | 2019-12-11 20:00:57 +0000 | [diff] [blame] | 407 | // This is auto-generated. DO NOT EDIT. | 
 | 408 |  | 
 | 409 | cc_prebuilt_library_shared { | 
| Paul Duffin | a7cd8c8 | 2019-12-11 20:00:57 +0000 | [diff] [blame] | 410 |     name: "mynativelib", | 
 | 411 |     prefer: false, | 
| Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 412 |     visibility: ["//visibility:public"], | 
| Martin Stjernholm | 1e04109 | 2020-11-03 00:11:09 +0000 | [diff] [blame] | 413 |     apex_available: ["//apex_available:platform"], | 
| Paul Duffin | 0174d8d | 2020-03-11 18:42:08 +0000 | [diff] [blame] | 414 |     stl: "none", | 
| Martin Stjernholm | 89238f4 | 2020-07-10 00:14:03 +0100 | [diff] [blame] | 415 |     compile_multilib: "both", | 
| Paul Duffin | 86b02a7 | 2021-02-22 11:50:04 +0000 | [diff] [blame] | 416 |     export_include_dirs: ["include/myinclude"], | 
| Martin Stjernholm | b024957 | 2020-09-15 02:32:35 +0100 | [diff] [blame] | 417 |     sanitize: { | 
 | 418 |         fuzzer: false, | 
 | 419 |         diag: { | 
 | 420 |             undefined: false, | 
 | 421 |         }, | 
 | 422 |     }, | 
| Paul Duffin | a7cd8c8 | 2019-12-11 20:00:57 +0000 | [diff] [blame] | 423 |     arch: { | 
 | 424 |         arm64: { | 
 | 425 |             srcs: ["arm64/lib/mynativelib.so"], | 
 | 426 |             export_system_include_dirs: ["arm64/include/arm64/include"], | 
| Martin Stjernholm | b024957 | 2020-09-15 02:32:35 +0100 | [diff] [blame] | 427 |             sanitize: { | 
| Martin Stjernholm | b024957 | 2020-09-15 02:32:35 +0100 | [diff] [blame] | 428 |                 integer_overflow: false, | 
 | 429 |             }, | 
| Paul Duffin | a7cd8c8 | 2019-12-11 20:00:57 +0000 | [diff] [blame] | 430 |         }, | 
 | 431 |         arm: { | 
 | 432 |             srcs: ["arm/lib/mynativelib.so"], | 
| Martin Stjernholm | b024957 | 2020-09-15 02:32:35 +0100 | [diff] [blame] | 433 |             sanitize: { | 
 | 434 |                 integer_overflow: true, | 
 | 435 |             }, | 
| Paul Duffin | a7cd8c8 | 2019-12-11 20:00:57 +0000 | [diff] [blame] | 436 |         }, | 
 | 437 |     }, | 
| Paul Duffin | a7cd8c8 | 2019-12-11 20:00:57 +0000 | [diff] [blame] | 438 | } | 
| Paul Duffin | a7cd8c8 | 2019-12-11 20:00:57 +0000 | [diff] [blame] | 439 | `), | 
 | 440 | 		checkAllCopyRules(` | 
| Paul Duffin | 86b02a7 | 2021-02-22 11:50:04 +0000 | [diff] [blame] | 441 | myinclude/Test.h -> include/myinclude/Test.h | 
| Martin Stjernholm | 59e0c7a | 2020-10-28 23:38:33 +0000 | [diff] [blame] | 442 | .intermediates/mynativelib/android_arm64_armv8-a_shared/mynativelib.so -> arm64/lib/mynativelib.so | 
| Paul Duffin | a7cd8c8 | 2019-12-11 20:00:57 +0000 | [diff] [blame] | 443 | arm64/include/Arm64Test.h -> arm64/include/arm64/include/Arm64Test.h | 
| Colin Cross | 7113d20 | 2019-11-20 16:39:12 -0800 | [diff] [blame] | 444 | .intermediates/mynativelib/android_arm_armv7-a-neon_shared/mynativelib.so -> arm/lib/mynativelib.so`), | 
| Paul Duffin | a7cd8c8 | 2019-12-11 20:00:57 +0000 | [diff] [blame] | 445 | 	) | 
 | 446 | } | 
 | 447 |  | 
| Paul Duffin | 25ce04b | 2020-01-16 11:47:25 +0000 | [diff] [blame] | 448 | func TestSnapshotWithCcBinary(t *testing.T) { | 
 | 449 | 	result := testSdkWithCc(t, ` | 
 | 450 | 		module_exports { | 
 | 451 | 			name: "mymodule_exports", | 
 | 452 | 			native_binaries: ["mynativebinary"], | 
 | 453 | 		} | 
 | 454 |  | 
 | 455 | 		cc_binary { | 
 | 456 | 			name: "mynativebinary", | 
 | 457 | 			srcs: [ | 
 | 458 | 				"Test.cpp", | 
 | 459 | 			], | 
 | 460 | 			compile_multilib: "both", | 
| Paul Duffin | 25ce04b | 2020-01-16 11:47:25 +0000 | [diff] [blame] | 461 | 		} | 
 | 462 | 	`) | 
 | 463 |  | 
| Paul Duffin | 36474d3 | 2021-03-12 12:19:43 +0000 | [diff] [blame] | 464 | 	CheckSnapshot(t, result, "mymodule_exports", "", | 
| Paul Duffin | b01ac4b | 2022-05-24 20:10:05 +0000 | [diff] [blame] | 465 | 		checkAndroidBpContents(` | 
| Paul Duffin | 25ce04b | 2020-01-16 11:47:25 +0000 | [diff] [blame] | 466 | // This is auto-generated. DO NOT EDIT. | 
 | 467 |  | 
 | 468 | cc_prebuilt_binary { | 
| Paul Duffin | 75b902a | 2021-02-22 12:13:13 +0000 | [diff] [blame] | 469 |     name: "mynativebinary", | 
 | 470 |     prefer: false, | 
| Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 471 |     visibility: ["//visibility:public"], | 
| Martin Stjernholm | 1e04109 | 2020-11-03 00:11:09 +0000 | [diff] [blame] | 472 |     apex_available: ["//apex_available:platform"], | 
| Paul Duffin | 25ce04b | 2020-01-16 11:47:25 +0000 | [diff] [blame] | 473 |     compile_multilib: "both", | 
 | 474 |     arch: { | 
 | 475 |         arm64: { | 
 | 476 |             srcs: ["arm64/bin/mynativebinary"], | 
 | 477 |         }, | 
 | 478 |         arm: { | 
 | 479 |             srcs: ["arm/bin/mynativebinary"], | 
 | 480 |         }, | 
 | 481 |     }, | 
 | 482 | } | 
| Paul Duffin | 75b902a | 2021-02-22 12:13:13 +0000 | [diff] [blame] | 483 | `), | 
| Paul Duffin | 25ce04b | 2020-01-16 11:47:25 +0000 | [diff] [blame] | 484 | 		checkAllCopyRules(` | 
 | 485 | .intermediates/mynativebinary/android_arm64_armv8-a/mynativebinary -> arm64/bin/mynativebinary | 
 | 486 | .intermediates/mynativebinary/android_arm_armv7-a-neon/mynativebinary -> arm/bin/mynativebinary | 
 | 487 | `), | 
 | 488 | 	) | 
 | 489 | } | 
 | 490 |  | 
| Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 491 | func TestMultipleHostOsTypesSnapshotWithCcBinary(t *testing.T) { | 
| Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 492 | 	result := testSdkWithCc(t, ` | 
 | 493 | 		module_exports { | 
 | 494 | 			name: "myexports", | 
 | 495 | 			device_supported: false, | 
 | 496 | 			host_supported: true, | 
 | 497 | 			native_binaries: ["mynativebinary"], | 
 | 498 | 			target: { | 
 | 499 | 				windows: { | 
 | 500 | 					enabled: true, | 
 | 501 | 				}, | 
 | 502 | 			}, | 
 | 503 | 		} | 
 | 504 |  | 
 | 505 | 		cc_binary { | 
 | 506 | 			name: "mynativebinary", | 
 | 507 | 			device_supported: false, | 
 | 508 | 			host_supported: true, | 
 | 509 | 			srcs: [ | 
 | 510 | 				"Test.cpp", | 
 | 511 | 			], | 
 | 512 | 			compile_multilib: "both", | 
| Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 513 | 			stl: "none", | 
 | 514 | 			target: { | 
 | 515 | 				windows: { | 
 | 516 | 					enabled: true, | 
 | 517 | 				}, | 
 | 518 | 			}, | 
 | 519 | 		} | 
 | 520 | 	`) | 
 | 521 |  | 
| Paul Duffin | 36474d3 | 2021-03-12 12:19:43 +0000 | [diff] [blame] | 522 | 	CheckSnapshot(t, result, "myexports", "", | 
| Paul Duffin | b01ac4b | 2022-05-24 20:10:05 +0000 | [diff] [blame] | 523 | 		checkAndroidBpContents(` | 
| Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 524 | // This is auto-generated. DO NOT EDIT. | 
 | 525 |  | 
 | 526 | cc_prebuilt_binary { | 
| Paul Duffin | 75b902a | 2021-02-22 12:13:13 +0000 | [diff] [blame] | 527 |     name: "mynativebinary", | 
 | 528 |     prefer: false, | 
| Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 529 |     visibility: ["//visibility:public"], | 
| Martin Stjernholm | 1e04109 | 2020-11-03 00:11:09 +0000 | [diff] [blame] | 530 |     apex_available: ["//apex_available:platform"], | 
| Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 531 |     device_supported: false, | 
 | 532 |     host_supported: true, | 
| Martin Stjernholm | 7130fab | 2020-05-28 22:58:01 +0100 | [diff] [blame] | 533 |     stl: "none", | 
| Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 534 |     target: { | 
| Martin Stjernholm | caa47d7 | 2020-07-11 04:52:24 +0100 | [diff] [blame] | 535 |         host: { | 
 | 536 |             enabled: false, | 
 | 537 |         }, | 
| Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 538 |         linux_glibc: { | 
 | 539 |             compile_multilib: "both", | 
 | 540 |         }, | 
 | 541 |         linux_glibc_x86_64: { | 
| Jiyong Park | 8fe14e6 | 2020-10-19 22:47:34 +0900 | [diff] [blame] | 542 |             enabled: true, | 
| Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 543 |             srcs: ["linux_glibc/x86_64/bin/mynativebinary"], | 
 | 544 |         }, | 
 | 545 |         linux_glibc_x86: { | 
| Jiyong Park | 8fe14e6 | 2020-10-19 22:47:34 +0900 | [diff] [blame] | 546 |             enabled: true, | 
| Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 547 |             srcs: ["linux_glibc/x86/bin/mynativebinary"], | 
 | 548 |         }, | 
 | 549 |         windows: { | 
 | 550 |             compile_multilib: "64", | 
 | 551 |         }, | 
 | 552 |         windows_x86_64: { | 
| Jiyong Park | 8fe14e6 | 2020-10-19 22:47:34 +0900 | [diff] [blame] | 553 |             enabled: true, | 
| Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 554 |             srcs: ["windows/x86_64/bin/mynativebinary.exe"], | 
 | 555 |         }, | 
 | 556 |     }, | 
 | 557 | } | 
| Paul Duffin | 75b902a | 2021-02-22 12:13:13 +0000 | [diff] [blame] | 558 | `), | 
| Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 559 | 		checkAllCopyRules(` | 
 | 560 | .intermediates/mynativebinary/linux_glibc_x86_64/mynativebinary -> linux_glibc/x86_64/bin/mynativebinary | 
 | 561 | .intermediates/mynativebinary/linux_glibc_x86/mynativebinary -> linux_glibc/x86/bin/mynativebinary | 
 | 562 | .intermediates/mynativebinary/windows_x86_64/mynativebinary.exe -> windows/x86_64/bin/mynativebinary.exe | 
 | 563 | `), | 
 | 564 | 	) | 
 | 565 | } | 
 | 566 |  | 
| Martin Stjernholm | caa47d7 | 2020-07-11 04:52:24 +0100 | [diff] [blame] | 567 | func TestSnapshotWithSingleHostOsType(t *testing.T) { | 
| Paul Duffin | 89648f9 | 2021-03-20 00:36:55 +0000 | [diff] [blame] | 568 | 	result := android.GroupFixturePreparers( | 
 | 569 | 		prepareForSdkTest, | 
| Paul Duffin | 4a2a29c | 2021-03-09 22:27:13 +0000 | [diff] [blame] | 570 | 		ccTestFs.AddToFixture(), | 
 | 571 | 		cc.PrepareForTestOnLinuxBionic, | 
 | 572 | 		android.FixtureModifyConfig(func(config android.Config) { | 
 | 573 | 			config.Targets[android.LinuxBionic] = []android.Target{ | 
 | 574 | 				{android.LinuxBionic, android.Arch{ArchType: android.X86_64}, android.NativeBridgeDisabled, "", "", false}, | 
 | 575 | 			} | 
 | 576 | 		}), | 
 | 577 | 	).RunTestWithBp(t, ` | 
| Martin Stjernholm | caa47d7 | 2020-07-11 04:52:24 +0100 | [diff] [blame] | 578 | 		cc_defaults { | 
 | 579 | 			name: "mydefaults", | 
 | 580 | 			device_supported: false, | 
 | 581 | 			host_supported: true, | 
 | 582 | 			compile_multilib: "64", | 
 | 583 | 			target: { | 
 | 584 | 				host: { | 
 | 585 | 					enabled: false, | 
 | 586 | 				}, | 
 | 587 | 				linux_bionic: { | 
 | 588 | 					enabled: true, | 
 | 589 | 				}, | 
 | 590 | 			}, | 
 | 591 | 		} | 
 | 592 |  | 
 | 593 | 		module_exports { | 
 | 594 | 			name: "myexports", | 
 | 595 | 			defaults: ["mydefaults"], | 
 | 596 | 			native_shared_libs: ["mynativelib"], | 
 | 597 | 			native_binaries: ["mynativebinary"], | 
 | 598 | 			compile_multilib: "64",  // The built-in default in sdk.go overrides mydefaults. | 
 | 599 | 		} | 
 | 600 |  | 
 | 601 | 		cc_library { | 
 | 602 | 			name: "mynativelib", | 
 | 603 | 			defaults: ["mydefaults"], | 
 | 604 | 			srcs: [ | 
 | 605 | 				"Test.cpp", | 
 | 606 | 			], | 
 | 607 | 			stl: "none", | 
 | 608 | 		} | 
 | 609 |  | 
 | 610 | 		cc_binary { | 
 | 611 | 			name: "mynativebinary", | 
 | 612 | 			defaults: ["mydefaults"], | 
 | 613 | 			srcs: [ | 
 | 614 | 				"Test.cpp", | 
 | 615 | 			], | 
 | 616 | 			stl: "none", | 
 | 617 | 		} | 
| Paul Duffin | 4a2a29c | 2021-03-09 22:27:13 +0000 | [diff] [blame] | 618 | 	`) | 
| Martin Stjernholm | caa47d7 | 2020-07-11 04:52:24 +0100 | [diff] [blame] | 619 |  | 
| Paul Duffin | 36474d3 | 2021-03-12 12:19:43 +0000 | [diff] [blame] | 620 | 	CheckSnapshot(t, result, "myexports", "", | 
| Paul Duffin | b01ac4b | 2022-05-24 20:10:05 +0000 | [diff] [blame] | 621 | 		checkAndroidBpContents(` | 
| Paul Duffin | 75b902a | 2021-02-22 12:13:13 +0000 | [diff] [blame] | 622 | // This is auto-generated. DO NOT EDIT. | 
 | 623 |  | 
 | 624 | cc_prebuilt_binary { | 
 | 625 |     name: "mynativebinary", | 
 | 626 |     prefer: false, | 
 | 627 |     visibility: ["//visibility:public"], | 
 | 628 |     apex_available: ["//apex_available:platform"], | 
 | 629 |     device_supported: false, | 
 | 630 |     host_supported: true, | 
 | 631 |     stl: "none", | 
 | 632 |     compile_multilib: "64", | 
 | 633 |     target: { | 
 | 634 |         host: { | 
 | 635 |             enabled: false, | 
 | 636 |         }, | 
 | 637 |         linux_bionic_x86_64: { | 
 | 638 |             enabled: true, | 
 | 639 |             srcs: ["x86_64/bin/mynativebinary"], | 
 | 640 |         }, | 
 | 641 |     }, | 
 | 642 | } | 
 | 643 |  | 
 | 644 | cc_prebuilt_library_shared { | 
 | 645 |     name: "mynativelib", | 
 | 646 |     prefer: false, | 
 | 647 |     visibility: ["//visibility:public"], | 
 | 648 |     apex_available: ["//apex_available:platform"], | 
 | 649 |     device_supported: false, | 
 | 650 |     host_supported: true, | 
 | 651 |     stl: "none", | 
 | 652 |     compile_multilib: "64", | 
 | 653 |     target: { | 
 | 654 |         host: { | 
 | 655 |             enabled: false, | 
 | 656 |         }, | 
 | 657 |         linux_bionic_x86_64: { | 
 | 658 |             enabled: true, | 
 | 659 |             srcs: ["x86_64/lib/mynativelib.so"], | 
 | 660 |         }, | 
 | 661 |     }, | 
 | 662 | } | 
 | 663 | `), | 
| Martin Stjernholm | caa47d7 | 2020-07-11 04:52:24 +0100 | [diff] [blame] | 664 | 		checkAllCopyRules(` | 
 | 665 | .intermediates/mynativebinary/linux_bionic_x86_64/mynativebinary -> x86_64/bin/mynativebinary | 
 | 666 | .intermediates/mynativelib/linux_bionic_x86_64_shared/mynativelib.so -> x86_64/lib/mynativelib.so | 
 | 667 | `), | 
 | 668 | 	) | 
 | 669 | } | 
 | 670 |  | 
| Martin Stjernholm | 7130fab | 2020-05-28 22:58:01 +0100 | [diff] [blame] | 671 | // Test that we support the necessary flags for the linker binary, which is | 
 | 672 | // special in several ways. | 
 | 673 | func TestSnapshotWithCcStaticNocrtBinary(t *testing.T) { | 
| Martin Stjernholm | 7130fab | 2020-05-28 22:58:01 +0100 | [diff] [blame] | 674 | 	result := testSdkWithCc(t, ` | 
 | 675 | 		module_exports { | 
 | 676 | 			name: "mymodule_exports", | 
 | 677 | 			host_supported: true, | 
 | 678 | 			device_supported: false, | 
 | 679 | 			native_binaries: ["linker"], | 
 | 680 | 		} | 
 | 681 |  | 
 | 682 | 		cc_binary { | 
 | 683 | 			name: "linker", | 
 | 684 | 			host_supported: true, | 
 | 685 | 			static_executable: true, | 
 | 686 | 			nocrt: true, | 
 | 687 | 			stl: "none", | 
 | 688 | 			srcs: [ | 
 | 689 | 				"Test.cpp", | 
 | 690 | 			], | 
 | 691 | 			compile_multilib: "both", | 
 | 692 | 		} | 
 | 693 | 	`) | 
 | 694 |  | 
| Paul Duffin | 36474d3 | 2021-03-12 12:19:43 +0000 | [diff] [blame] | 695 | 	CheckSnapshot(t, result, "mymodule_exports", "", | 
| Paul Duffin | b01ac4b | 2022-05-24 20:10:05 +0000 | [diff] [blame] | 696 | 		checkAndroidBpContents(` | 
| Martin Stjernholm | 7130fab | 2020-05-28 22:58:01 +0100 | [diff] [blame] | 697 | // This is auto-generated. DO NOT EDIT. | 
 | 698 |  | 
 | 699 | cc_prebuilt_binary { | 
| Paul Duffin | 75b902a | 2021-02-22 12:13:13 +0000 | [diff] [blame] | 700 |     name: "linker", | 
 | 701 |     prefer: false, | 
| Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 702 |     visibility: ["//visibility:public"], | 
| Martin Stjernholm | 1e04109 | 2020-11-03 00:11:09 +0000 | [diff] [blame] | 703 |     apex_available: ["//apex_available:platform"], | 
| Martin Stjernholm | 7130fab | 2020-05-28 22:58:01 +0100 | [diff] [blame] | 704 |     device_supported: false, | 
 | 705 |     host_supported: true, | 
| Martin Stjernholm | 7130fab | 2020-05-28 22:58:01 +0100 | [diff] [blame] | 706 |     stl: "none", | 
| Martin Stjernholm | 89238f4 | 2020-07-10 00:14:03 +0100 | [diff] [blame] | 707 |     compile_multilib: "both", | 
| Martin Stjernholm | 7130fab | 2020-05-28 22:58:01 +0100 | [diff] [blame] | 708 |     static_executable: true, | 
 | 709 |     nocrt: true, | 
| Martin Stjernholm | caa47d7 | 2020-07-11 04:52:24 +0100 | [diff] [blame] | 710 |     target: { | 
 | 711 |         host: { | 
 | 712 |             enabled: false, | 
 | 713 |         }, | 
| Martin Stjernholm | caa47d7 | 2020-07-11 04:52:24 +0100 | [diff] [blame] | 714 |         linux_glibc_x86_64: { | 
| Jiyong Park | 8fe14e6 | 2020-10-19 22:47:34 +0900 | [diff] [blame] | 715 |             enabled: true, | 
| Martin Stjernholm | 7130fab | 2020-05-28 22:58:01 +0100 | [diff] [blame] | 716 |             srcs: ["x86_64/bin/linker"], | 
 | 717 |         }, | 
| Martin Stjernholm | caa47d7 | 2020-07-11 04:52:24 +0100 | [diff] [blame] | 718 |         linux_glibc_x86: { | 
| Jiyong Park | 8fe14e6 | 2020-10-19 22:47:34 +0900 | [diff] [blame] | 719 |             enabled: true, | 
| Martin Stjernholm | 7130fab | 2020-05-28 22:58:01 +0100 | [diff] [blame] | 720 |             srcs: ["x86/bin/linker"], | 
 | 721 |         }, | 
 | 722 |     }, | 
 | 723 | } | 
| Paul Duffin | 75b902a | 2021-02-22 12:13:13 +0000 | [diff] [blame] | 724 | `), | 
| Martin Stjernholm | 7130fab | 2020-05-28 22:58:01 +0100 | [diff] [blame] | 725 | 		checkAllCopyRules(` | 
 | 726 | .intermediates/linker/linux_glibc_x86_64/linker -> x86_64/bin/linker | 
 | 727 | .intermediates/linker/linux_glibc_x86/linker -> x86/bin/linker | 
 | 728 | `), | 
 | 729 | 	) | 
 | 730 | } | 
 | 731 |  | 
| Paul Duffin | 9ab556f | 2019-12-11 18:42:17 +0000 | [diff] [blame] | 732 | func TestSnapshotWithCcSharedLibrary(t *testing.T) { | 
| Paul Duffin | d835daa | 2019-11-30 17:49:09 +0000 | [diff] [blame] | 733 | 	result := testSdkWithCc(t, ` | 
| Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 734 | 		sdk { | 
 | 735 | 			name: "mysdk", | 
 | 736 | 			native_shared_libs: ["mynativelib"], | 
 | 737 | 		} | 
 | 738 |  | 
 | 739 | 		cc_library_shared { | 
 | 740 | 			name: "mynativelib", | 
 | 741 | 			srcs: [ | 
 | 742 | 				"Test.cpp", | 
 | 743 | 				"aidl/foo/bar/Test.aidl", | 
 | 744 | 			], | 
| Paul Duffin | befa4b9 | 2020-03-04 14:22:45 +0000 | [diff] [blame] | 745 | 			apex_available: ["apex1", "apex2"], | 
| Paul Duffin | 86b02a7 | 2021-02-22 11:50:04 +0000 | [diff] [blame] | 746 | 			export_include_dirs: ["myinclude"], | 
| Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 747 | 			aidl: { | 
 | 748 | 				export_aidl_headers: true, | 
 | 749 | 			}, | 
| Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 750 | 			stl: "none", | 
 | 751 | 		} | 
 | 752 | 	`) | 
 | 753 |  | 
| Paul Duffin | 36474d3 | 2021-03-12 12:19:43 +0000 | [diff] [blame] | 754 | 	CheckSnapshot(t, result, "mysdk", "", | 
| Paul Duffin | b01ac4b | 2022-05-24 20:10:05 +0000 | [diff] [blame] | 755 | 		checkAndroidBpContents(` | 
| Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 756 | // This is auto-generated. DO NOT EDIT. | 
 | 757 |  | 
 | 758 | cc_prebuilt_library_shared { | 
| Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 759 |     name: "mynativelib", | 
 | 760 |     prefer: false, | 
| Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 761 |     visibility: ["//visibility:public"], | 
| Paul Duffin | befa4b9 | 2020-03-04 14:22:45 +0000 | [diff] [blame] | 762 |     apex_available: [ | 
 | 763 |         "apex1", | 
 | 764 |         "apex2", | 
 | 765 |     ], | 
| Paul Duffin | 0174d8d | 2020-03-11 18:42:08 +0000 | [diff] [blame] | 766 |     stl: "none", | 
| Martin Stjernholm | 89238f4 | 2020-07-10 00:14:03 +0100 | [diff] [blame] | 767 |     compile_multilib: "both", | 
| Paul Duffin | 86b02a7 | 2021-02-22 11:50:04 +0000 | [diff] [blame] | 768 |     export_include_dirs: ["include/myinclude"], | 
| Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 769 |     arch: { | 
 | 770 |         arm64: { | 
 | 771 |             srcs: ["arm64/lib/mynativelib.so"], | 
| Paul Duffin | 42dd4e6 | 2021-02-22 11:35:24 +0000 | [diff] [blame] | 772 |             export_include_dirs: ["arm64/include_gen/mynativelib/android_arm64_armv8-a_shared/gen/aidl"], | 
| Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 773 |         }, | 
 | 774 |         arm: { | 
 | 775 |             srcs: ["arm/lib/mynativelib.so"], | 
| Paul Duffin | 42dd4e6 | 2021-02-22 11:35:24 +0000 | [diff] [blame] | 776 |             export_include_dirs: ["arm/include_gen/mynativelib/android_arm_armv7-a-neon_shared/gen/aidl"], | 
| Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 777 |         }, | 
 | 778 |     }, | 
| Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 779 | } | 
| Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 780 | `), | 
 | 781 | 		checkAllCopyRules(` | 
| Paul Duffin | 86b02a7 | 2021-02-22 11:50:04 +0000 | [diff] [blame] | 782 | myinclude/Test.h -> include/myinclude/Test.h | 
| Colin Cross | 7113d20 | 2019-11-20 16:39:12 -0800 | [diff] [blame] | 783 | .intermediates/mynativelib/android_arm64_armv8-a_shared/mynativelib.so -> arm64/lib/mynativelib.so | 
| Paul Duffin | 42dd4e6 | 2021-02-22 11:35:24 +0000 | [diff] [blame] | 784 | .intermediates/mynativelib/android_arm64_armv8-a_shared/gen/aidl/aidl/foo/bar/Test.h -> arm64/include_gen/mynativelib/android_arm64_armv8-a_shared/gen/aidl/aidl/foo/bar/Test.h | 
 | 785 | .intermediates/mynativelib/android_arm64_armv8-a_shared/gen/aidl/aidl/foo/bar/BnTest.h -> arm64/include_gen/mynativelib/android_arm64_armv8-a_shared/gen/aidl/aidl/foo/bar/BnTest.h | 
 | 786 | .intermediates/mynativelib/android_arm64_armv8-a_shared/gen/aidl/aidl/foo/bar/BpTest.h -> arm64/include_gen/mynativelib/android_arm64_armv8-a_shared/gen/aidl/aidl/foo/bar/BpTest.h | 
| Colin Cross | 7113d20 | 2019-11-20 16:39:12 -0800 | [diff] [blame] | 787 | .intermediates/mynativelib/android_arm_armv7-a-neon_shared/mynativelib.so -> arm/lib/mynativelib.so | 
| Paul Duffin | 42dd4e6 | 2021-02-22 11:35:24 +0000 | [diff] [blame] | 788 | .intermediates/mynativelib/android_arm_armv7-a-neon_shared/gen/aidl/aidl/foo/bar/Test.h -> arm/include_gen/mynativelib/android_arm_armv7-a-neon_shared/gen/aidl/aidl/foo/bar/Test.h | 
 | 789 | .intermediates/mynativelib/android_arm_armv7-a-neon_shared/gen/aidl/aidl/foo/bar/BnTest.h -> arm/include_gen/mynativelib/android_arm_armv7-a-neon_shared/gen/aidl/aidl/foo/bar/BnTest.h | 
 | 790 | .intermediates/mynativelib/android_arm_armv7-a-neon_shared/gen/aidl/aidl/foo/bar/BpTest.h -> arm/include_gen/mynativelib/android_arm_armv7-a-neon_shared/gen/aidl/aidl/foo/bar/BpTest.h | 
| Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 791 | `), | 
 | 792 | 	) | 
 | 793 | } | 
 | 794 |  | 
| Paul Duffin | 13f0271 | 2020-03-06 12:30:43 +0000 | [diff] [blame] | 795 | func TestSnapshotWithCcSharedLibrarySharedLibs(t *testing.T) { | 
 | 796 | 	result := testSdkWithCc(t, ` | 
 | 797 | 		sdk { | 
 | 798 | 			name: "mysdk", | 
 | 799 | 			native_shared_libs: [ | 
 | 800 | 				"mynativelib", | 
 | 801 | 				"myothernativelib", | 
 | 802 | 				"mysystemnativelib", | 
 | 803 | 			], | 
 | 804 | 		} | 
 | 805 |  | 
 | 806 | 		cc_library { | 
 | 807 | 			name: "mysystemnativelib", | 
 | 808 | 			srcs: [ | 
 | 809 | 				"Test.cpp", | 
 | 810 | 			], | 
| Paul Duffin | 13f0271 | 2020-03-06 12:30:43 +0000 | [diff] [blame] | 811 | 			stl: "none", | 
 | 812 | 		} | 
 | 813 |  | 
 | 814 | 		cc_library_shared { | 
 | 815 | 			name: "myothernativelib", | 
 | 816 | 			srcs: [ | 
 | 817 | 				"Test.cpp", | 
 | 818 | 			], | 
 | 819 | 			system_shared_libs: [ | 
 | 820 | 				// A reference to a library that is not an sdk member. Uses libm as that | 
 | 821 | 				// is in the default set of modules available to this test and so is available | 
 | 822 | 				// both here and also when the generated Android.bp file is tested in | 
 | 823 | 				// CheckSnapshot(). This ensures that the system_shared_libs property correctly | 
 | 824 | 				// handles references to modules that are not sdk members. | 
 | 825 | 				"libm", | 
 | 826 | 			], | 
 | 827 | 			stl: "none", | 
 | 828 | 		} | 
 | 829 |  | 
 | 830 | 		cc_library { | 
 | 831 | 			name: "mynativelib", | 
 | 832 | 			srcs: [ | 
 | 833 | 				"Test.cpp", | 
 | 834 | 			], | 
 | 835 | 			shared_libs: [ | 
 | 836 | 				// A reference to another sdk member. | 
 | 837 | 				"myothernativelib", | 
 | 838 | 			], | 
 | 839 | 			target: { | 
 | 840 | 				android: { | 
 | 841 | 					shared: { | 
 | 842 | 						shared_libs: [ | 
 | 843 | 							// A reference to a library that is not an sdk member. The libc library | 
 | 844 | 							// is used here to check that the shared_libs property is handled correctly | 
 | 845 | 							// in a similar way to how libm is used to check system_shared_libs above. | 
 | 846 | 							"libc", | 
 | 847 | 						], | 
 | 848 | 					}, | 
 | 849 | 				}, | 
 | 850 | 			}, | 
| Paul Duffin | 13f0271 | 2020-03-06 12:30:43 +0000 | [diff] [blame] | 851 | 			stl: "none", | 
 | 852 | 		} | 
 | 853 | 	`) | 
 | 854 |  | 
| Paul Duffin | 36474d3 | 2021-03-12 12:19:43 +0000 | [diff] [blame] | 855 | 	CheckSnapshot(t, result, "mysdk", "", | 
| Paul Duffin | b01ac4b | 2022-05-24 20:10:05 +0000 | [diff] [blame] | 856 | 		checkAndroidBpContents(` | 
| Paul Duffin | 13f0271 | 2020-03-06 12:30:43 +0000 | [diff] [blame] | 857 | // This is auto-generated. DO NOT EDIT. | 
 | 858 |  | 
 | 859 | cc_prebuilt_library_shared { | 
| Paul Duffin | 13f0271 | 2020-03-06 12:30:43 +0000 | [diff] [blame] | 860 |     name: "mynativelib", | 
 | 861 |     prefer: false, | 
| Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 862 |     visibility: ["//visibility:public"], | 
| Martin Stjernholm | 1e04109 | 2020-11-03 00:11:09 +0000 | [diff] [blame] | 863 |     apex_available: ["//apex_available:platform"], | 
| Paul Duffin | 0174d8d | 2020-03-11 18:42:08 +0000 | [diff] [blame] | 864 |     stl: "none", | 
| Martin Stjernholm | 89238f4 | 2020-07-10 00:14:03 +0100 | [diff] [blame] | 865 |     compile_multilib: "both", | 
| Paul Duffin | 13f0271 | 2020-03-06 12:30:43 +0000 | [diff] [blame] | 866 |     shared_libs: [ | 
 | 867 |         "myothernativelib", | 
 | 868 |         "libc", | 
 | 869 |     ], | 
 | 870 |     arch: { | 
 | 871 |         arm64: { | 
 | 872 |             srcs: ["arm64/lib/mynativelib.so"], | 
 | 873 |         }, | 
 | 874 |         arm: { | 
 | 875 |             srcs: ["arm/lib/mynativelib.so"], | 
 | 876 |         }, | 
 | 877 |     }, | 
| Paul Duffin | 13f0271 | 2020-03-06 12:30:43 +0000 | [diff] [blame] | 878 | } | 
 | 879 |  | 
 | 880 | cc_prebuilt_library_shared { | 
| Paul Duffin | 13f0271 | 2020-03-06 12:30:43 +0000 | [diff] [blame] | 881 |     name: "myothernativelib", | 
 | 882 |     prefer: false, | 
| Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 883 |     visibility: ["//visibility:public"], | 
| Martin Stjernholm | 1e04109 | 2020-11-03 00:11:09 +0000 | [diff] [blame] | 884 |     apex_available: ["//apex_available:platform"], | 
| Paul Duffin | 0174d8d | 2020-03-11 18:42:08 +0000 | [diff] [blame] | 885 |     stl: "none", | 
| Martin Stjernholm | 89238f4 | 2020-07-10 00:14:03 +0100 | [diff] [blame] | 886 |     compile_multilib: "both", | 
| Paul Duffin | 13f0271 | 2020-03-06 12:30:43 +0000 | [diff] [blame] | 887 |     system_shared_libs: ["libm"], | 
 | 888 |     arch: { | 
 | 889 |         arm64: { | 
 | 890 |             srcs: ["arm64/lib/myothernativelib.so"], | 
 | 891 |         }, | 
 | 892 |         arm: { | 
 | 893 |             srcs: ["arm/lib/myothernativelib.so"], | 
 | 894 |         }, | 
 | 895 |     }, | 
| Paul Duffin | 13f0271 | 2020-03-06 12:30:43 +0000 | [diff] [blame] | 896 | } | 
 | 897 |  | 
 | 898 | cc_prebuilt_library_shared { | 
| Paul Duffin | 13f0271 | 2020-03-06 12:30:43 +0000 | [diff] [blame] | 899 |     name: "mysystemnativelib", | 
 | 900 |     prefer: false, | 
| Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 901 |     visibility: ["//visibility:public"], | 
| Martin Stjernholm | 1e04109 | 2020-11-03 00:11:09 +0000 | [diff] [blame] | 902 |     apex_available: ["//apex_available:platform"], | 
| Paul Duffin | 0174d8d | 2020-03-11 18:42:08 +0000 | [diff] [blame] | 903 |     stl: "none", | 
| Martin Stjernholm | 89238f4 | 2020-07-10 00:14:03 +0100 | [diff] [blame] | 904 |     compile_multilib: "both", | 
| Paul Duffin | 13f0271 | 2020-03-06 12:30:43 +0000 | [diff] [blame] | 905 |     arch: { | 
 | 906 |         arm64: { | 
 | 907 |             srcs: ["arm64/lib/mysystemnativelib.so"], | 
 | 908 |         }, | 
 | 909 |         arm: { | 
 | 910 |             srcs: ["arm/lib/mysystemnativelib.so"], | 
 | 911 |         }, | 
 | 912 |     }, | 
| Paul Duffin | 13f0271 | 2020-03-06 12:30:43 +0000 | [diff] [blame] | 913 | } | 
| Paul Duffin | 13f0271 | 2020-03-06 12:30:43 +0000 | [diff] [blame] | 914 | `), | 
 | 915 | 		checkAllCopyRules(` | 
 | 916 | .intermediates/mynativelib/android_arm64_armv8-a_shared/mynativelib.so -> arm64/lib/mynativelib.so | 
 | 917 | .intermediates/mynativelib/android_arm_armv7-a-neon_shared/mynativelib.so -> arm/lib/mynativelib.so | 
 | 918 | .intermediates/myothernativelib/android_arm64_armv8-a_shared/myothernativelib.so -> arm64/lib/myothernativelib.so | 
 | 919 | .intermediates/myothernativelib/android_arm_armv7-a-neon_shared/myothernativelib.so -> arm/lib/myothernativelib.so | 
 | 920 | .intermediates/mysystemnativelib/android_arm64_armv8-a_shared/mysystemnativelib.so -> arm64/lib/mysystemnativelib.so | 
 | 921 | .intermediates/mysystemnativelib/android_arm_armv7-a-neon_shared/mysystemnativelib.so -> arm/lib/mysystemnativelib.so | 
 | 922 | `), | 
 | 923 | 	) | 
 | 924 | } | 
 | 925 |  | 
| Paul Duffin | 9ab556f | 2019-12-11 18:42:17 +0000 | [diff] [blame] | 926 | func TestHostSnapshotWithCcSharedLibrary(t *testing.T) { | 
| Paul Duffin | d835daa | 2019-11-30 17:49:09 +0000 | [diff] [blame] | 927 | 	result := testSdkWithCc(t, ` | 
| Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 928 | 		sdk { | 
 | 929 | 			name: "mysdk", | 
 | 930 | 			device_supported: false, | 
 | 931 | 			host_supported: true, | 
 | 932 | 			native_shared_libs: ["mynativelib"], | 
 | 933 | 		} | 
 | 934 |  | 
 | 935 | 		cc_library_shared { | 
 | 936 | 			name: "mynativelib", | 
 | 937 | 			device_supported: false, | 
 | 938 | 			host_supported: true, | 
 | 939 | 			srcs: [ | 
 | 940 | 				"Test.cpp", | 
 | 941 | 				"aidl/foo/bar/Test.aidl", | 
 | 942 | 			], | 
| Paul Duffin | 86b02a7 | 2021-02-22 11:50:04 +0000 | [diff] [blame] | 943 | 			export_include_dirs: ["myinclude"], | 
| Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 944 | 			aidl: { | 
 | 945 | 				export_aidl_headers: true, | 
 | 946 | 			}, | 
| Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 947 | 			stl: "none", | 
| Paul Duffin | 0c394f3 | 2020-03-05 14:09:58 +0000 | [diff] [blame] | 948 | 			sdk_version: "minimum", | 
| Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 949 | 		} | 
 | 950 | 	`) | 
 | 951 |  | 
| Paul Duffin | 36474d3 | 2021-03-12 12:19:43 +0000 | [diff] [blame] | 952 | 	CheckSnapshot(t, result, "mysdk", "", | 
| Paul Duffin | b01ac4b | 2022-05-24 20:10:05 +0000 | [diff] [blame] | 953 | 		checkAndroidBpContents(` | 
| Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 954 | // This is auto-generated. DO NOT EDIT. | 
 | 955 |  | 
 | 956 | cc_prebuilt_library_shared { | 
| Paul Duffin | 75b902a | 2021-02-22 12:13:13 +0000 | [diff] [blame] | 957 |     name: "mynativelib", | 
 | 958 |     prefer: false, | 
| Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 959 |     visibility: ["//visibility:public"], | 
| Martin Stjernholm | 1e04109 | 2020-11-03 00:11:09 +0000 | [diff] [blame] | 960 |     apex_available: ["//apex_available:platform"], | 
| Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 961 |     device_supported: false, | 
 | 962 |     host_supported: true, | 
| Paul Duffin | 0c394f3 | 2020-03-05 14:09:58 +0000 | [diff] [blame] | 963 |     sdk_version: "minimum", | 
| Paul Duffin | 0174d8d | 2020-03-11 18:42:08 +0000 | [diff] [blame] | 964 |     stl: "none", | 
| Martin Stjernholm | 89238f4 | 2020-07-10 00:14:03 +0100 | [diff] [blame] | 965 |     compile_multilib: "both", | 
| Paul Duffin | 86b02a7 | 2021-02-22 11:50:04 +0000 | [diff] [blame] | 966 |     export_include_dirs: ["include/myinclude"], | 
| Martin Stjernholm | caa47d7 | 2020-07-11 04:52:24 +0100 | [diff] [blame] | 967 |     target: { | 
 | 968 |         host: { | 
 | 969 |             enabled: false, | 
 | 970 |         }, | 
| Martin Stjernholm | caa47d7 | 2020-07-11 04:52:24 +0100 | [diff] [blame] | 971 |         linux_glibc_x86_64: { | 
| Jiyong Park | 8fe14e6 | 2020-10-19 22:47:34 +0900 | [diff] [blame] | 972 |             enabled: true, | 
| Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 973 |             srcs: ["x86_64/lib/mynativelib.so"], | 
| Paul Duffin | 42dd4e6 | 2021-02-22 11:35:24 +0000 | [diff] [blame] | 974 |             export_include_dirs: ["x86_64/include_gen/mynativelib/linux_glibc_x86_64_shared/gen/aidl"], | 
| Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 975 |         }, | 
| Martin Stjernholm | caa47d7 | 2020-07-11 04:52:24 +0100 | [diff] [blame] | 976 |         linux_glibc_x86: { | 
| Jiyong Park | 8fe14e6 | 2020-10-19 22:47:34 +0900 | [diff] [blame] | 977 |             enabled: true, | 
| Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 978 |             srcs: ["x86/lib/mynativelib.so"], | 
| Paul Duffin | 42dd4e6 | 2021-02-22 11:35:24 +0000 | [diff] [blame] | 979 |             export_include_dirs: ["x86/include_gen/mynativelib/linux_glibc_x86_shared/gen/aidl"], | 
| Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 980 |         }, | 
 | 981 |     }, | 
| Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 982 | } | 
| Paul Duffin | 75b902a | 2021-02-22 12:13:13 +0000 | [diff] [blame] | 983 | `), | 
| Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 984 | 		checkAllCopyRules(` | 
| Paul Duffin | 86b02a7 | 2021-02-22 11:50:04 +0000 | [diff] [blame] | 985 | myinclude/Test.h -> include/myinclude/Test.h | 
| Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 986 | .intermediates/mynativelib/linux_glibc_x86_64_shared/mynativelib.so -> x86_64/lib/mynativelib.so | 
| Paul Duffin | 42dd4e6 | 2021-02-22 11:35:24 +0000 | [diff] [blame] | 987 | .intermediates/mynativelib/linux_glibc_x86_64_shared/gen/aidl/aidl/foo/bar/Test.h -> x86_64/include_gen/mynativelib/linux_glibc_x86_64_shared/gen/aidl/aidl/foo/bar/Test.h | 
 | 988 | .intermediates/mynativelib/linux_glibc_x86_64_shared/gen/aidl/aidl/foo/bar/BnTest.h -> x86_64/include_gen/mynativelib/linux_glibc_x86_64_shared/gen/aidl/aidl/foo/bar/BnTest.h | 
 | 989 | .intermediates/mynativelib/linux_glibc_x86_64_shared/gen/aidl/aidl/foo/bar/BpTest.h -> x86_64/include_gen/mynativelib/linux_glibc_x86_64_shared/gen/aidl/aidl/foo/bar/BpTest.h | 
| Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 990 | .intermediates/mynativelib/linux_glibc_x86_shared/mynativelib.so -> x86/lib/mynativelib.so | 
| Paul Duffin | 42dd4e6 | 2021-02-22 11:35:24 +0000 | [diff] [blame] | 991 | .intermediates/mynativelib/linux_glibc_x86_shared/gen/aidl/aidl/foo/bar/Test.h -> x86/include_gen/mynativelib/linux_glibc_x86_shared/gen/aidl/aidl/foo/bar/Test.h | 
 | 992 | .intermediates/mynativelib/linux_glibc_x86_shared/gen/aidl/aidl/foo/bar/BnTest.h -> x86/include_gen/mynativelib/linux_glibc_x86_shared/gen/aidl/aidl/foo/bar/BnTest.h | 
 | 993 | .intermediates/mynativelib/linux_glibc_x86_shared/gen/aidl/aidl/foo/bar/BpTest.h -> x86/include_gen/mynativelib/linux_glibc_x86_shared/gen/aidl/aidl/foo/bar/BpTest.h | 
| Paul Duffin | a80fdec | 2019-12-03 15:25:00 +0000 | [diff] [blame] | 994 | `), | 
 | 995 | 	) | 
 | 996 | } | 
| Paul Duffin | 9ab556f | 2019-12-11 18:42:17 +0000 | [diff] [blame] | 997 |  | 
| Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 998 | func TestMultipleHostOsTypesSnapshotWithCcSharedLibrary(t *testing.T) { | 
| Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 999 | 	result := testSdkWithCc(t, ` | 
 | 1000 | 		sdk { | 
 | 1001 | 			name: "mysdk", | 
 | 1002 | 			device_supported: false, | 
 | 1003 | 			host_supported: true, | 
 | 1004 | 			native_shared_libs: ["mynativelib"], | 
 | 1005 | 			target: { | 
 | 1006 | 				windows: { | 
 | 1007 | 					enabled: true, | 
 | 1008 | 				}, | 
 | 1009 | 			}, | 
 | 1010 | 		} | 
 | 1011 |  | 
 | 1012 | 		cc_library_shared { | 
 | 1013 | 			name: "mynativelib", | 
 | 1014 | 			device_supported: false, | 
 | 1015 | 			host_supported: true, | 
 | 1016 | 			srcs: [ | 
 | 1017 | 				"Test.cpp", | 
 | 1018 | 			], | 
| Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 1019 | 			stl: "none", | 
 | 1020 | 			target: { | 
 | 1021 | 				windows: { | 
 | 1022 | 					enabled: true, | 
 | 1023 | 				}, | 
 | 1024 | 			}, | 
 | 1025 | 		} | 
 | 1026 | 	`) | 
 | 1027 |  | 
| Paul Duffin | 36474d3 | 2021-03-12 12:19:43 +0000 | [diff] [blame] | 1028 | 	CheckSnapshot(t, result, "mysdk", "", | 
| Paul Duffin | b01ac4b | 2022-05-24 20:10:05 +0000 | [diff] [blame] | 1029 | 		checkAndroidBpContents(` | 
| Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 1030 | // This is auto-generated. DO NOT EDIT. | 
 | 1031 |  | 
 | 1032 | cc_prebuilt_library_shared { | 
| Paul Duffin | 75b902a | 2021-02-22 12:13:13 +0000 | [diff] [blame] | 1033 |     name: "mynativelib", | 
 | 1034 |     prefer: false, | 
| Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 1035 |     visibility: ["//visibility:public"], | 
| Martin Stjernholm | 1e04109 | 2020-11-03 00:11:09 +0000 | [diff] [blame] | 1036 |     apex_available: ["//apex_available:platform"], | 
| Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 1037 |     device_supported: false, | 
 | 1038 |     host_supported: true, | 
| Paul Duffin | 0174d8d | 2020-03-11 18:42:08 +0000 | [diff] [blame] | 1039 |     stl: "none", | 
| Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 1040 |     target: { | 
| Martin Stjernholm | caa47d7 | 2020-07-11 04:52:24 +0100 | [diff] [blame] | 1041 |         host: { | 
 | 1042 |             enabled: false, | 
 | 1043 |         }, | 
| Martin Stjernholm | 89238f4 | 2020-07-10 00:14:03 +0100 | [diff] [blame] | 1044 |         linux_glibc: { | 
 | 1045 |             compile_multilib: "both", | 
 | 1046 |         }, | 
| Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 1047 |         linux_glibc_x86_64: { | 
| Jiyong Park | 8fe14e6 | 2020-10-19 22:47:34 +0900 | [diff] [blame] | 1048 |             enabled: true, | 
| Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 1049 |             srcs: ["linux_glibc/x86_64/lib/mynativelib.so"], | 
 | 1050 |         }, | 
 | 1051 |         linux_glibc_x86: { | 
| Jiyong Park | 8fe14e6 | 2020-10-19 22:47:34 +0900 | [diff] [blame] | 1052 |             enabled: true, | 
| Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 1053 |             srcs: ["linux_glibc/x86/lib/mynativelib.so"], | 
 | 1054 |         }, | 
| Martin Stjernholm | 89238f4 | 2020-07-10 00:14:03 +0100 | [diff] [blame] | 1055 |         windows: { | 
 | 1056 |             compile_multilib: "64", | 
 | 1057 |         }, | 
| Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 1058 |         windows_x86_64: { | 
| Jiyong Park | 8fe14e6 | 2020-10-19 22:47:34 +0900 | [diff] [blame] | 1059 |             enabled: true, | 
| Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 1060 |             srcs: ["windows/x86_64/lib/mynativelib.dll"], | 
 | 1061 |         }, | 
 | 1062 |     }, | 
| Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 1063 | } | 
| Paul Duffin | 75b902a | 2021-02-22 12:13:13 +0000 | [diff] [blame] | 1064 | `), | 
| Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 1065 | 		checkAllCopyRules(` | 
 | 1066 | .intermediates/mynativelib/linux_glibc_x86_64_shared/mynativelib.so -> linux_glibc/x86_64/lib/mynativelib.so | 
 | 1067 | .intermediates/mynativelib/linux_glibc_x86_shared/mynativelib.so -> linux_glibc/x86/lib/mynativelib.so | 
 | 1068 | .intermediates/mynativelib/windows_x86_64_shared/mynativelib.dll -> windows/x86_64/lib/mynativelib.dll | 
 | 1069 | `), | 
 | 1070 | 	) | 
 | 1071 | } | 
 | 1072 |  | 
| Paul Duffin | 9ab556f | 2019-12-11 18:42:17 +0000 | [diff] [blame] | 1073 | func TestSnapshotWithCcStaticLibrary(t *testing.T) { | 
 | 1074 | 	result := testSdkWithCc(t, ` | 
| Paul Duffin | e602918 | 2019-12-16 17:43:48 +0000 | [diff] [blame] | 1075 | 		module_exports { | 
 | 1076 | 			name: "myexports", | 
| Paul Duffin | 9ab556f | 2019-12-11 18:42:17 +0000 | [diff] [blame] | 1077 | 			native_static_libs: ["mynativelib"], | 
 | 1078 | 		} | 
 | 1079 |  | 
 | 1080 | 		cc_library_static { | 
 | 1081 | 			name: "mynativelib", | 
 | 1082 | 			srcs: [ | 
 | 1083 | 				"Test.cpp", | 
 | 1084 | 				"aidl/foo/bar/Test.aidl", | 
 | 1085 | 			], | 
| Paul Duffin | 86b02a7 | 2021-02-22 11:50:04 +0000 | [diff] [blame] | 1086 | 			export_include_dirs: ["myinclude"], | 
| Paul Duffin | 9ab556f | 2019-12-11 18:42:17 +0000 | [diff] [blame] | 1087 | 			aidl: { | 
 | 1088 | 				export_aidl_headers: true, | 
 | 1089 | 			}, | 
| Paul Duffin | 9ab556f | 2019-12-11 18:42:17 +0000 | [diff] [blame] | 1090 | 			stl: "none", | 
 | 1091 | 		} | 
 | 1092 | 	`) | 
 | 1093 |  | 
| Paul Duffin | 36474d3 | 2021-03-12 12:19:43 +0000 | [diff] [blame] | 1094 | 	CheckSnapshot(t, result, "myexports", "", | 
| Paul Duffin | b01ac4b | 2022-05-24 20:10:05 +0000 | [diff] [blame] | 1095 | 		checkAndroidBpContents(` | 
| Paul Duffin | 9ab556f | 2019-12-11 18:42:17 +0000 | [diff] [blame] | 1096 | // This is auto-generated. DO NOT EDIT. | 
 | 1097 |  | 
 | 1098 | cc_prebuilt_library_static { | 
| Paul Duffin | 9ab556f | 2019-12-11 18:42:17 +0000 | [diff] [blame] | 1099 |     name: "mynativelib", | 
 | 1100 |     prefer: false, | 
| Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 1101 |     visibility: ["//visibility:public"], | 
| Martin Stjernholm | 1e04109 | 2020-11-03 00:11:09 +0000 | [diff] [blame] | 1102 |     apex_available: ["//apex_available:platform"], | 
| Paul Duffin | 0174d8d | 2020-03-11 18:42:08 +0000 | [diff] [blame] | 1103 |     stl: "none", | 
| Martin Stjernholm | 89238f4 | 2020-07-10 00:14:03 +0100 | [diff] [blame] | 1104 |     compile_multilib: "both", | 
| Paul Duffin | 86b02a7 | 2021-02-22 11:50:04 +0000 | [diff] [blame] | 1105 |     export_include_dirs: ["include/myinclude"], | 
| Paul Duffin | 9ab556f | 2019-12-11 18:42:17 +0000 | [diff] [blame] | 1106 |     arch: { | 
 | 1107 |         arm64: { | 
 | 1108 |             srcs: ["arm64/lib/mynativelib.a"], | 
| Paul Duffin | 42dd4e6 | 2021-02-22 11:35:24 +0000 | [diff] [blame] | 1109 |             export_include_dirs: ["arm64/include_gen/mynativelib/android_arm64_armv8-a_static/gen/aidl"], | 
| Paul Duffin | 9ab556f | 2019-12-11 18:42:17 +0000 | [diff] [blame] | 1110 |         }, | 
 | 1111 |         arm: { | 
 | 1112 |             srcs: ["arm/lib/mynativelib.a"], | 
| Paul Duffin | 42dd4e6 | 2021-02-22 11:35:24 +0000 | [diff] [blame] | 1113 |             export_include_dirs: ["arm/include_gen/mynativelib/android_arm_armv7-a-neon_static/gen/aidl"], | 
| Paul Duffin | 9ab556f | 2019-12-11 18:42:17 +0000 | [diff] [blame] | 1114 |         }, | 
 | 1115 |     }, | 
| Paul Duffin | 9ab556f | 2019-12-11 18:42:17 +0000 | [diff] [blame] | 1116 | } | 
| Paul Duffin | 9ab556f | 2019-12-11 18:42:17 +0000 | [diff] [blame] | 1117 | `), | 
 | 1118 | 		checkAllCopyRules(` | 
| Paul Duffin | 86b02a7 | 2021-02-22 11:50:04 +0000 | [diff] [blame] | 1119 | myinclude/Test.h -> include/myinclude/Test.h | 
| Colin Cross | 7113d20 | 2019-11-20 16:39:12 -0800 | [diff] [blame] | 1120 | .intermediates/mynativelib/android_arm64_armv8-a_static/mynativelib.a -> arm64/lib/mynativelib.a | 
| Paul Duffin | 42dd4e6 | 2021-02-22 11:35:24 +0000 | [diff] [blame] | 1121 | .intermediates/mynativelib/android_arm64_armv8-a_static/gen/aidl/aidl/foo/bar/Test.h -> arm64/include_gen/mynativelib/android_arm64_armv8-a_static/gen/aidl/aidl/foo/bar/Test.h | 
 | 1122 | .intermediates/mynativelib/android_arm64_armv8-a_static/gen/aidl/aidl/foo/bar/BnTest.h -> arm64/include_gen/mynativelib/android_arm64_armv8-a_static/gen/aidl/aidl/foo/bar/BnTest.h | 
 | 1123 | .intermediates/mynativelib/android_arm64_armv8-a_static/gen/aidl/aidl/foo/bar/BpTest.h -> arm64/include_gen/mynativelib/android_arm64_armv8-a_static/gen/aidl/aidl/foo/bar/BpTest.h | 
| Colin Cross | 7113d20 | 2019-11-20 16:39:12 -0800 | [diff] [blame] | 1124 | .intermediates/mynativelib/android_arm_armv7-a-neon_static/mynativelib.a -> arm/lib/mynativelib.a | 
| Paul Duffin | 42dd4e6 | 2021-02-22 11:35:24 +0000 | [diff] [blame] | 1125 | .intermediates/mynativelib/android_arm_armv7-a-neon_static/gen/aidl/aidl/foo/bar/Test.h -> arm/include_gen/mynativelib/android_arm_armv7-a-neon_static/gen/aidl/aidl/foo/bar/Test.h | 
 | 1126 | .intermediates/mynativelib/android_arm_armv7-a-neon_static/gen/aidl/aidl/foo/bar/BnTest.h -> arm/include_gen/mynativelib/android_arm_armv7-a-neon_static/gen/aidl/aidl/foo/bar/BnTest.h | 
 | 1127 | .intermediates/mynativelib/android_arm_armv7-a-neon_static/gen/aidl/aidl/foo/bar/BpTest.h -> arm/include_gen/mynativelib/android_arm_armv7-a-neon_static/gen/aidl/aidl/foo/bar/BpTest.h | 
| Paul Duffin | 9ab556f | 2019-12-11 18:42:17 +0000 | [diff] [blame] | 1128 | `), | 
 | 1129 | 	) | 
 | 1130 | } | 
 | 1131 |  | 
 | 1132 | func TestHostSnapshotWithCcStaticLibrary(t *testing.T) { | 
| Paul Duffin | 9ab556f | 2019-12-11 18:42:17 +0000 | [diff] [blame] | 1133 | 	result := testSdkWithCc(t, ` | 
| Paul Duffin | e602918 | 2019-12-16 17:43:48 +0000 | [diff] [blame] | 1134 | 		module_exports { | 
 | 1135 | 			name: "myexports", | 
| Paul Duffin | 9ab556f | 2019-12-11 18:42:17 +0000 | [diff] [blame] | 1136 | 			device_supported: false, | 
 | 1137 | 			host_supported: true, | 
 | 1138 | 			native_static_libs: ["mynativelib"], | 
 | 1139 | 		} | 
 | 1140 |  | 
 | 1141 | 		cc_library_static { | 
 | 1142 | 			name: "mynativelib", | 
 | 1143 | 			device_supported: false, | 
 | 1144 | 			host_supported: true, | 
 | 1145 | 			srcs: [ | 
 | 1146 | 				"Test.cpp", | 
 | 1147 | 				"aidl/foo/bar/Test.aidl", | 
 | 1148 | 			], | 
| Paul Duffin | 86b02a7 | 2021-02-22 11:50:04 +0000 | [diff] [blame] | 1149 | 			export_include_dirs: ["myinclude"], | 
| Paul Duffin | 9ab556f | 2019-12-11 18:42:17 +0000 | [diff] [blame] | 1150 | 			aidl: { | 
 | 1151 | 				export_aidl_headers: true, | 
 | 1152 | 			}, | 
| Paul Duffin | 9ab556f | 2019-12-11 18:42:17 +0000 | [diff] [blame] | 1153 | 			stl: "none", | 
 | 1154 | 		} | 
 | 1155 | 	`) | 
 | 1156 |  | 
| Paul Duffin | 36474d3 | 2021-03-12 12:19:43 +0000 | [diff] [blame] | 1157 | 	CheckSnapshot(t, result, "myexports", "", | 
| Paul Duffin | b01ac4b | 2022-05-24 20:10:05 +0000 | [diff] [blame] | 1158 | 		checkAndroidBpContents(` | 
| Paul Duffin | 9ab556f | 2019-12-11 18:42:17 +0000 | [diff] [blame] | 1159 | // This is auto-generated. DO NOT EDIT. | 
 | 1160 |  | 
 | 1161 | cc_prebuilt_library_static { | 
| Paul Duffin | 75b902a | 2021-02-22 12:13:13 +0000 | [diff] [blame] | 1162 |     name: "mynativelib", | 
 | 1163 |     prefer: false, | 
| Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 1164 |     visibility: ["//visibility:public"], | 
| Martin Stjernholm | 1e04109 | 2020-11-03 00:11:09 +0000 | [diff] [blame] | 1165 |     apex_available: ["//apex_available:platform"], | 
| Paul Duffin | 9ab556f | 2019-12-11 18:42:17 +0000 | [diff] [blame] | 1166 |     device_supported: false, | 
 | 1167 |     host_supported: true, | 
| Paul Duffin | 0174d8d | 2020-03-11 18:42:08 +0000 | [diff] [blame] | 1168 |     stl: "none", | 
| Martin Stjernholm | 89238f4 | 2020-07-10 00:14:03 +0100 | [diff] [blame] | 1169 |     compile_multilib: "both", | 
| Paul Duffin | 86b02a7 | 2021-02-22 11:50:04 +0000 | [diff] [blame] | 1170 |     export_include_dirs: ["include/myinclude"], | 
| Martin Stjernholm | caa47d7 | 2020-07-11 04:52:24 +0100 | [diff] [blame] | 1171 |     target: { | 
 | 1172 |         host: { | 
 | 1173 |             enabled: false, | 
 | 1174 |         }, | 
| Martin Stjernholm | caa47d7 | 2020-07-11 04:52:24 +0100 | [diff] [blame] | 1175 |         linux_glibc_x86_64: { | 
| Jiyong Park | 8fe14e6 | 2020-10-19 22:47:34 +0900 | [diff] [blame] | 1176 |             enabled: true, | 
| Paul Duffin | 9ab556f | 2019-12-11 18:42:17 +0000 | [diff] [blame] | 1177 |             srcs: ["x86_64/lib/mynativelib.a"], | 
| Paul Duffin | 42dd4e6 | 2021-02-22 11:35:24 +0000 | [diff] [blame] | 1178 |             export_include_dirs: ["x86_64/include_gen/mynativelib/linux_glibc_x86_64_static/gen/aidl"], | 
| Paul Duffin | 9ab556f | 2019-12-11 18:42:17 +0000 | [diff] [blame] | 1179 |         }, | 
| Martin Stjernholm | caa47d7 | 2020-07-11 04:52:24 +0100 | [diff] [blame] | 1180 |         linux_glibc_x86: { | 
| Jiyong Park | 8fe14e6 | 2020-10-19 22:47:34 +0900 | [diff] [blame] | 1181 |             enabled: true, | 
| Paul Duffin | 9ab556f | 2019-12-11 18:42:17 +0000 | [diff] [blame] | 1182 |             srcs: ["x86/lib/mynativelib.a"], | 
| Paul Duffin | 42dd4e6 | 2021-02-22 11:35:24 +0000 | [diff] [blame] | 1183 |             export_include_dirs: ["x86/include_gen/mynativelib/linux_glibc_x86_static/gen/aidl"], | 
| Paul Duffin | 9ab556f | 2019-12-11 18:42:17 +0000 | [diff] [blame] | 1184 |         }, | 
 | 1185 |     }, | 
| Paul Duffin | 9ab556f | 2019-12-11 18:42:17 +0000 | [diff] [blame] | 1186 | } | 
| Paul Duffin | 75b902a | 2021-02-22 12:13:13 +0000 | [diff] [blame] | 1187 | `), | 
| Paul Duffin | 9ab556f | 2019-12-11 18:42:17 +0000 | [diff] [blame] | 1188 | 		checkAllCopyRules(` | 
| Paul Duffin | 86b02a7 | 2021-02-22 11:50:04 +0000 | [diff] [blame] | 1189 | myinclude/Test.h -> include/myinclude/Test.h | 
| Paul Duffin | 9ab556f | 2019-12-11 18:42:17 +0000 | [diff] [blame] | 1190 | .intermediates/mynativelib/linux_glibc_x86_64_static/mynativelib.a -> x86_64/lib/mynativelib.a | 
| Paul Duffin | 42dd4e6 | 2021-02-22 11:35:24 +0000 | [diff] [blame] | 1191 | .intermediates/mynativelib/linux_glibc_x86_64_static/gen/aidl/aidl/foo/bar/Test.h -> x86_64/include_gen/mynativelib/linux_glibc_x86_64_static/gen/aidl/aidl/foo/bar/Test.h | 
 | 1192 | .intermediates/mynativelib/linux_glibc_x86_64_static/gen/aidl/aidl/foo/bar/BnTest.h -> x86_64/include_gen/mynativelib/linux_glibc_x86_64_static/gen/aidl/aidl/foo/bar/BnTest.h | 
 | 1193 | .intermediates/mynativelib/linux_glibc_x86_64_static/gen/aidl/aidl/foo/bar/BpTest.h -> x86_64/include_gen/mynativelib/linux_glibc_x86_64_static/gen/aidl/aidl/foo/bar/BpTest.h | 
| Paul Duffin | 9ab556f | 2019-12-11 18:42:17 +0000 | [diff] [blame] | 1194 | .intermediates/mynativelib/linux_glibc_x86_static/mynativelib.a -> x86/lib/mynativelib.a | 
| Paul Duffin | 42dd4e6 | 2021-02-22 11:35:24 +0000 | [diff] [blame] | 1195 | .intermediates/mynativelib/linux_glibc_x86_static/gen/aidl/aidl/foo/bar/Test.h -> x86/include_gen/mynativelib/linux_glibc_x86_static/gen/aidl/aidl/foo/bar/Test.h | 
 | 1196 | .intermediates/mynativelib/linux_glibc_x86_static/gen/aidl/aidl/foo/bar/BnTest.h -> x86/include_gen/mynativelib/linux_glibc_x86_static/gen/aidl/aidl/foo/bar/BnTest.h | 
 | 1197 | .intermediates/mynativelib/linux_glibc_x86_static/gen/aidl/aidl/foo/bar/BpTest.h -> x86/include_gen/mynativelib/linux_glibc_x86_static/gen/aidl/aidl/foo/bar/BpTest.h | 
| Paul Duffin | 9ab556f | 2019-12-11 18:42:17 +0000 | [diff] [blame] | 1198 | `), | 
 | 1199 | 	) | 
 | 1200 | } | 
| Paul Duffin | 13ad94f | 2020-02-19 16:19:27 +0000 | [diff] [blame] | 1201 |  | 
| Paul Duffin | 9b76c0b | 2020-03-12 10:24:35 +0000 | [diff] [blame] | 1202 | func TestSnapshotWithCcLibrary(t *testing.T) { | 
 | 1203 | 	result := testSdkWithCc(t, ` | 
 | 1204 | 		module_exports { | 
 | 1205 | 			name: "myexports", | 
 | 1206 | 			native_libs: ["mynativelib"], | 
 | 1207 | 		} | 
 | 1208 |  | 
 | 1209 | 		cc_library { | 
 | 1210 | 			name: "mynativelib", | 
 | 1211 | 			srcs: [ | 
 | 1212 | 				"Test.cpp", | 
 | 1213 | 			], | 
| Paul Duffin | 86b02a7 | 2021-02-22 11:50:04 +0000 | [diff] [blame] | 1214 | 			export_include_dirs: ["myinclude"], | 
| Paul Duffin | 9b76c0b | 2020-03-12 10:24:35 +0000 | [diff] [blame] | 1215 | 			stl: "none", | 
| Paul Duffin | d6abaa7 | 2020-09-07 16:39:22 +0100 | [diff] [blame] | 1216 | 			recovery_available: true, | 
| Paul Duffin | d1edbd4 | 2020-08-13 19:45:31 +0100 | [diff] [blame] | 1217 | 			vendor_available: true, | 
| Paul Duffin | 9b76c0b | 2020-03-12 10:24:35 +0000 | [diff] [blame] | 1218 | 		} | 
 | 1219 | 	`) | 
 | 1220 |  | 
| Paul Duffin | 36474d3 | 2021-03-12 12:19:43 +0000 | [diff] [blame] | 1221 | 	CheckSnapshot(t, result, "myexports", "", | 
| Paul Duffin | b01ac4b | 2022-05-24 20:10:05 +0000 | [diff] [blame] | 1222 | 		checkAndroidBpContents(` | 
| Paul Duffin | 9b76c0b | 2020-03-12 10:24:35 +0000 | [diff] [blame] | 1223 | // This is auto-generated. DO NOT EDIT. | 
 | 1224 |  | 
 | 1225 | cc_prebuilt_library { | 
| Paul Duffin | 75b902a | 2021-02-22 12:13:13 +0000 | [diff] [blame] | 1226 |     name: "mynativelib", | 
 | 1227 |     prefer: false, | 
| Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 1228 |     visibility: ["//visibility:public"], | 
| Martin Stjernholm | 1e04109 | 2020-11-03 00:11:09 +0000 | [diff] [blame] | 1229 |     apex_available: ["//apex_available:platform"], | 
| Paul Duffin | d1edbd4 | 2020-08-13 19:45:31 +0100 | [diff] [blame] | 1230 |     vendor_available: true, | 
| Paul Duffin | 9b76c0b | 2020-03-12 10:24:35 +0000 | [diff] [blame] | 1231 |     stl: "none", | 
| Martin Stjernholm | 89238f4 | 2020-07-10 00:14:03 +0100 | [diff] [blame] | 1232 |     compile_multilib: "both", | 
| Paul Duffin | 86b02a7 | 2021-02-22 11:50:04 +0000 | [diff] [blame] | 1233 |     export_include_dirs: ["include/myinclude"], | 
| Paul Duffin | 9b76c0b | 2020-03-12 10:24:35 +0000 | [diff] [blame] | 1234 |     arch: { | 
 | 1235 |         arm64: { | 
 | 1236 |             static: { | 
 | 1237 |                 srcs: ["arm64/lib/mynativelib.a"], | 
 | 1238 |             }, | 
 | 1239 |             shared: { | 
 | 1240 |                 srcs: ["arm64/lib/mynativelib.so"], | 
 | 1241 |             }, | 
 | 1242 |         }, | 
 | 1243 |         arm: { | 
 | 1244 |             static: { | 
 | 1245 |                 srcs: ["arm/lib/mynativelib.a"], | 
 | 1246 |             }, | 
 | 1247 |             shared: { | 
 | 1248 |                 srcs: ["arm/lib/mynativelib.so"], | 
 | 1249 |             }, | 
 | 1250 |         }, | 
 | 1251 |     }, | 
 | 1252 | } | 
| Paul Duffin | 75b902a | 2021-02-22 12:13:13 +0000 | [diff] [blame] | 1253 | `), | 
| Paul Duffin | 9b76c0b | 2020-03-12 10:24:35 +0000 | [diff] [blame] | 1254 | 		checkAllCopyRules(` | 
| Paul Duffin | 86b02a7 | 2021-02-22 11:50:04 +0000 | [diff] [blame] | 1255 | myinclude/Test.h -> include/myinclude/Test.h | 
| Paul Duffin | 9b76c0b | 2020-03-12 10:24:35 +0000 | [diff] [blame] | 1256 | .intermediates/mynativelib/android_arm64_armv8-a_static/mynativelib.a -> arm64/lib/mynativelib.a | 
 | 1257 | .intermediates/mynativelib/android_arm64_armv8-a_shared/mynativelib.so -> arm64/lib/mynativelib.so | 
 | 1258 | .intermediates/mynativelib/android_arm_armv7-a-neon_static/mynativelib.a -> arm/lib/mynativelib.a | 
| Paul Duffin | 1822a0a | 2021-03-21 12:56:33 +0000 | [diff] [blame] | 1259 | .intermediates/mynativelib/android_arm_armv7-a-neon_shared/mynativelib.so -> arm/lib/mynativelib.so | 
 | 1260 | `), | 
 | 1261 | 		// TODO(b/183315522): Remove this and fix the issue. | 
 | 1262 | 		snapshotTestErrorHandler(checkSnapshotPreferredWithSource, android.FixtureExpectsAtLeastOneErrorMatchingPattern(`\Qunrecognized property "arch.arm.shared.export_include_dirs"\E`)), | 
| Paul Duffin | 9b76c0b | 2020-03-12 10:24:35 +0000 | [diff] [blame] | 1263 | 	) | 
 | 1264 | } | 
 | 1265 |  | 
| Liz Kammer | 96320df | 2022-05-12 20:40:00 -0400 | [diff] [blame] | 1266 | func TestSnapshotSameLibraryWithNativeLibsAndNativeSharedLib(t *testing.T) { | 
 | 1267 | 	result := testSdkWithCc(t, ` | 
 | 1268 | 		module_exports { | 
 | 1269 | 			host_supported: true, | 
 | 1270 | 			name: "myexports", | 
 | 1271 | 			target: { | 
 | 1272 | 				android: { | 
 | 1273 | 						native_shared_libs: [ | 
 | 1274 | 								"mynativelib", | 
 | 1275 | 						], | 
 | 1276 | 				}, | 
 | 1277 | 				not_windows: { | 
 | 1278 | 						native_libs: [ | 
 | 1279 | 								"mynativelib", | 
 | 1280 | 						], | 
 | 1281 | 				}, | 
 | 1282 | 			}, | 
 | 1283 | 		} | 
 | 1284 |  | 
 | 1285 | 		cc_library { | 
 | 1286 | 			name: "mynativelib", | 
 | 1287 | 			host_supported: true, | 
 | 1288 | 			srcs: [ | 
 | 1289 | 				"Test.cpp", | 
 | 1290 | 			], | 
 | 1291 | 			stl: "none", | 
 | 1292 | 			recovery_available: true, | 
 | 1293 | 			vendor_available: true, | 
 | 1294 | 		} | 
 | 1295 | 	`) | 
 | 1296 |  | 
 | 1297 | 	CheckSnapshot(t, result, "myexports", "", | 
| Paul Duffin | b01ac4b | 2022-05-24 20:10:05 +0000 | [diff] [blame] | 1298 | 		checkAndroidBpContents(` | 
| Liz Kammer | 96320df | 2022-05-12 20:40:00 -0400 | [diff] [blame] | 1299 | // This is auto-generated. DO NOT EDIT. | 
 | 1300 |  | 
 | 1301 | cc_prebuilt_library { | 
 | 1302 |     name: "mynativelib", | 
 | 1303 |     prefer: false, | 
 | 1304 |     visibility: ["//visibility:public"], | 
 | 1305 |     apex_available: ["//apex_available:platform"], | 
 | 1306 |     host_supported: true, | 
 | 1307 |     vendor_available: true, | 
 | 1308 |     stl: "none", | 
 | 1309 |     compile_multilib: "both", | 
 | 1310 |     target: { | 
 | 1311 |         host: { | 
 | 1312 |             enabled: false, | 
 | 1313 |         }, | 
 | 1314 |         android_arm64: { | 
 | 1315 |             shared: { | 
 | 1316 |                 srcs: ["android/arm64/lib/mynativelib.so"], | 
 | 1317 |             }, | 
 | 1318 |             static: { | 
 | 1319 |                 enabled: false, | 
 | 1320 |             }, | 
 | 1321 |         }, | 
 | 1322 |         android_arm: { | 
 | 1323 |             shared: { | 
 | 1324 |                 srcs: ["android/arm/lib/mynativelib.so"], | 
 | 1325 |             }, | 
 | 1326 |             static: { | 
 | 1327 |                 enabled: false, | 
 | 1328 |             }, | 
 | 1329 |         }, | 
 | 1330 |         linux_glibc_x86_64: { | 
 | 1331 |             enabled: true, | 
 | 1332 |             static: { | 
 | 1333 |                 srcs: ["linux_glibc/x86_64/lib/mynativelib.a"], | 
 | 1334 |             }, | 
 | 1335 |             shared: { | 
 | 1336 |                 srcs: ["linux_glibc/x86_64/lib/mynativelib.so"], | 
 | 1337 |             }, | 
 | 1338 |         }, | 
 | 1339 |         linux_glibc_x86: { | 
 | 1340 |             enabled: true, | 
 | 1341 |             static: { | 
 | 1342 |                 srcs: ["linux_glibc/x86/lib/mynativelib.a"], | 
 | 1343 |             }, | 
 | 1344 |             shared: { | 
 | 1345 |                 srcs: ["linux_glibc/x86/lib/mynativelib.so"], | 
 | 1346 |             }, | 
 | 1347 |         }, | 
 | 1348 |     }, | 
 | 1349 | } | 
 | 1350 | `), | 
 | 1351 | 		checkAllCopyRules(` | 
 | 1352 | .intermediates/mynativelib/android_arm64_armv8-a_shared/mynativelib.so -> android/arm64/lib/mynativelib.so | 
 | 1353 | .intermediates/mynativelib/android_arm_armv7-a-neon_shared/mynativelib.so -> android/arm/lib/mynativelib.so | 
 | 1354 | .intermediates/mynativelib/linux_glibc_x86_64_static/mynativelib.a -> linux_glibc/x86_64/lib/mynativelib.a | 
 | 1355 | .intermediates/mynativelib/linux_glibc_x86_64_shared/mynativelib.so -> linux_glibc/x86_64/lib/mynativelib.so | 
 | 1356 | .intermediates/mynativelib/linux_glibc_x86_static/mynativelib.a -> linux_glibc/x86/lib/mynativelib.a | 
 | 1357 | .intermediates/mynativelib/linux_glibc_x86_shared/mynativelib.so -> linux_glibc/x86/lib/mynativelib.so | 
 | 1358 | `), | 
 | 1359 | 	) | 
 | 1360 | } | 
 | 1361 |  | 
 | 1362 | func TestSnapshotSameLibraryWithAndroidNativeLibsAndHostNativeSharedLib(t *testing.T) { | 
 | 1363 | 	result := testSdkWithCc(t, ` | 
 | 1364 | 		module_exports { | 
 | 1365 | 			host_supported: true, | 
 | 1366 | 			name: "myexports", | 
 | 1367 | 			target: { | 
 | 1368 | 				android: { | 
 | 1369 | 						native_libs: [ | 
 | 1370 | 								"mynativelib", | 
 | 1371 | 						], | 
 | 1372 | 				}, | 
 | 1373 | 				not_windows: { | 
 | 1374 | 						native_shared_libs: [ | 
 | 1375 | 								"mynativelib", | 
 | 1376 | 						], | 
 | 1377 | 				}, | 
 | 1378 | 			}, | 
 | 1379 | 		} | 
 | 1380 |  | 
 | 1381 | 		cc_library { | 
 | 1382 | 			name: "mynativelib", | 
 | 1383 | 			host_supported: true, | 
 | 1384 | 			srcs: [ | 
 | 1385 | 				"Test.cpp", | 
 | 1386 | 			], | 
 | 1387 | 			stl: "none", | 
 | 1388 | 			recovery_available: true, | 
 | 1389 | 			vendor_available: true, | 
 | 1390 | 		} | 
 | 1391 | 	`) | 
 | 1392 |  | 
 | 1393 | 	CheckSnapshot(t, result, "myexports", "", | 
| Paul Duffin | b01ac4b | 2022-05-24 20:10:05 +0000 | [diff] [blame] | 1394 | 		checkAndroidBpContents(` | 
| Liz Kammer | 96320df | 2022-05-12 20:40:00 -0400 | [diff] [blame] | 1395 | // This is auto-generated. DO NOT EDIT. | 
 | 1396 |  | 
 | 1397 | cc_prebuilt_library { | 
 | 1398 |     name: "mynativelib", | 
 | 1399 |     prefer: false, | 
 | 1400 |     visibility: ["//visibility:public"], | 
 | 1401 |     apex_available: ["//apex_available:platform"], | 
 | 1402 |     host_supported: true, | 
 | 1403 |     vendor_available: true, | 
 | 1404 |     stl: "none", | 
 | 1405 |     compile_multilib: "both", | 
 | 1406 |     target: { | 
 | 1407 |         host: { | 
 | 1408 |             enabled: false, | 
 | 1409 |         }, | 
 | 1410 |         android_arm64: { | 
 | 1411 |             static: { | 
 | 1412 |                 srcs: ["android/arm64/lib/mynativelib.a"], | 
 | 1413 |             }, | 
 | 1414 |             shared: { | 
 | 1415 |                 srcs: ["android/arm64/lib/mynativelib.so"], | 
 | 1416 |             }, | 
 | 1417 |         }, | 
 | 1418 |         android_arm: { | 
 | 1419 |             static: { | 
 | 1420 |                 srcs: ["android/arm/lib/mynativelib.a"], | 
 | 1421 |             }, | 
 | 1422 |             shared: { | 
 | 1423 |                 srcs: ["android/arm/lib/mynativelib.so"], | 
 | 1424 |             }, | 
 | 1425 |         }, | 
 | 1426 |         linux_glibc_x86_64: { | 
 | 1427 |             enabled: true, | 
 | 1428 |             shared: { | 
 | 1429 |                 srcs: ["linux_glibc/x86_64/lib/mynativelib.so"], | 
 | 1430 |             }, | 
 | 1431 |             static: { | 
 | 1432 |                 enabled: false, | 
 | 1433 |             }, | 
 | 1434 |         }, | 
 | 1435 |         linux_glibc_x86: { | 
 | 1436 |             enabled: true, | 
 | 1437 |             shared: { | 
 | 1438 |                 srcs: ["linux_glibc/x86/lib/mynativelib.so"], | 
 | 1439 |             }, | 
 | 1440 |             static: { | 
 | 1441 |                 enabled: false, | 
 | 1442 |             }, | 
 | 1443 |         }, | 
 | 1444 |     }, | 
 | 1445 | } | 
 | 1446 | `), | 
 | 1447 | 		checkAllCopyRules(` | 
 | 1448 | .intermediates/mynativelib/android_arm64_armv8-a_static/mynativelib.a -> android/arm64/lib/mynativelib.a | 
 | 1449 | .intermediates/mynativelib/android_arm64_armv8-a_shared/mynativelib.so -> android/arm64/lib/mynativelib.so | 
 | 1450 | .intermediates/mynativelib/android_arm_armv7-a-neon_static/mynativelib.a -> android/arm/lib/mynativelib.a | 
 | 1451 | .intermediates/mynativelib/android_arm_armv7-a-neon_shared/mynativelib.so -> android/arm/lib/mynativelib.so | 
 | 1452 | .intermediates/mynativelib/linux_glibc_x86_64_shared/mynativelib.so -> linux_glibc/x86_64/lib/mynativelib.so | 
 | 1453 | .intermediates/mynativelib/linux_glibc_x86_shared/mynativelib.so -> linux_glibc/x86/lib/mynativelib.so | 
 | 1454 | `), | 
 | 1455 | 	) | 
 | 1456 | } | 
 | 1457 |  | 
 | 1458 | func TestSnapshotSameLibraryWithNativeStaticLibsAndNativeSharedLib(t *testing.T) { | 
 | 1459 | 	testSdkError(t, "Incompatible member types", ` | 
 | 1460 | 		module_exports { | 
 | 1461 | 			host_supported: true, | 
 | 1462 | 			name: "myexports", | 
 | 1463 | 			target: { | 
 | 1464 | 				android: { | 
 | 1465 | 						native_shared_libs: [ | 
 | 1466 | 								"mynativelib", | 
 | 1467 | 						], | 
 | 1468 | 				}, | 
 | 1469 | 				not_windows: { | 
 | 1470 | 						native_static_libs: [ | 
 | 1471 | 								"mynativelib", | 
 | 1472 | 						], | 
 | 1473 | 				}, | 
 | 1474 | 			}, | 
 | 1475 | 		} | 
 | 1476 |  | 
 | 1477 | 		cc_library { | 
 | 1478 | 			name: "mynativelib", | 
 | 1479 | 			host_supported: true, | 
 | 1480 | 			srcs: [ | 
 | 1481 | 			], | 
 | 1482 | 			stl: "none", | 
 | 1483 | 			recovery_available: true, | 
 | 1484 | 			vendor_available: true, | 
 | 1485 | 		} | 
 | 1486 | 	`) | 
 | 1487 | } | 
 | 1488 |  | 
| Paul Duffin | 13ad94f | 2020-02-19 16:19:27 +0000 | [diff] [blame] | 1489 | func TestHostSnapshotWithMultiLib64(t *testing.T) { | 
| Paul Duffin | 13ad94f | 2020-02-19 16:19:27 +0000 | [diff] [blame] | 1490 | 	result := testSdkWithCc(t, ` | 
 | 1491 | 		module_exports { | 
 | 1492 | 			name: "myexports", | 
 | 1493 | 			device_supported: false, | 
 | 1494 | 			host_supported: true, | 
 | 1495 | 			target: { | 
 | 1496 | 				host: { | 
 | 1497 | 					compile_multilib: "64", | 
 | 1498 | 				}, | 
 | 1499 | 			}, | 
 | 1500 | 			native_static_libs: ["mynativelib"], | 
 | 1501 | 		} | 
 | 1502 |  | 
 | 1503 | 		cc_library_static { | 
 | 1504 | 			name: "mynativelib", | 
 | 1505 | 			device_supported: false, | 
 | 1506 | 			host_supported: true, | 
 | 1507 | 			srcs: [ | 
 | 1508 | 				"Test.cpp", | 
 | 1509 | 				"aidl/foo/bar/Test.aidl", | 
 | 1510 | 			], | 
| Paul Duffin | 86b02a7 | 2021-02-22 11:50:04 +0000 | [diff] [blame] | 1511 | 			export_include_dirs: ["myinclude"], | 
| Paul Duffin | 13ad94f | 2020-02-19 16:19:27 +0000 | [diff] [blame] | 1512 | 			aidl: { | 
 | 1513 | 				export_aidl_headers: true, | 
 | 1514 | 			}, | 
| Paul Duffin | 13ad94f | 2020-02-19 16:19:27 +0000 | [diff] [blame] | 1515 | 			stl: "none", | 
 | 1516 | 		} | 
 | 1517 | 	`) | 
 | 1518 |  | 
| Paul Duffin | 36474d3 | 2021-03-12 12:19:43 +0000 | [diff] [blame] | 1519 | 	CheckSnapshot(t, result, "myexports", "", | 
| Paul Duffin | b01ac4b | 2022-05-24 20:10:05 +0000 | [diff] [blame] | 1520 | 		checkAndroidBpContents(` | 
| Paul Duffin | 13ad94f | 2020-02-19 16:19:27 +0000 | [diff] [blame] | 1521 | // This is auto-generated. DO NOT EDIT. | 
 | 1522 |  | 
 | 1523 | cc_prebuilt_library_static { | 
| Paul Duffin | 75b902a | 2021-02-22 12:13:13 +0000 | [diff] [blame] | 1524 |     name: "mynativelib", | 
 | 1525 |     prefer: false, | 
| Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 1526 |     visibility: ["//visibility:public"], | 
| Martin Stjernholm | 1e04109 | 2020-11-03 00:11:09 +0000 | [diff] [blame] | 1527 |     apex_available: ["//apex_available:platform"], | 
| Paul Duffin | 13ad94f | 2020-02-19 16:19:27 +0000 | [diff] [blame] | 1528 |     device_supported: false, | 
 | 1529 |     host_supported: true, | 
| Paul Duffin | 0174d8d | 2020-03-11 18:42:08 +0000 | [diff] [blame] | 1530 |     stl: "none", | 
| Martin Stjernholm | 89238f4 | 2020-07-10 00:14:03 +0100 | [diff] [blame] | 1531 |     compile_multilib: "64", | 
| Paul Duffin | 7a7d067 | 2021-02-17 12:17:40 +0000 | [diff] [blame] | 1532 |     export_include_dirs: [ | 
 | 1533 |         "include/myinclude", | 
 | 1534 |         "include_gen/mynativelib/linux_glibc_x86_64_static/gen/aidl", | 
 | 1535 |     ], | 
| Martin Stjernholm | caa47d7 | 2020-07-11 04:52:24 +0100 | [diff] [blame] | 1536 |     target: { | 
 | 1537 |         host: { | 
 | 1538 |             enabled: false, | 
 | 1539 |         }, | 
| Martin Stjernholm | caa47d7 | 2020-07-11 04:52:24 +0100 | [diff] [blame] | 1540 |         linux_glibc_x86_64: { | 
| Jiyong Park | 8fe14e6 | 2020-10-19 22:47:34 +0900 | [diff] [blame] | 1541 |             enabled: true, | 
| Paul Duffin | 13ad94f | 2020-02-19 16:19:27 +0000 | [diff] [blame] | 1542 |             srcs: ["x86_64/lib/mynativelib.a"], | 
| Paul Duffin | 13ad94f | 2020-02-19 16:19:27 +0000 | [diff] [blame] | 1543 |         }, | 
 | 1544 |     }, | 
| Paul Duffin | 13ad94f | 2020-02-19 16:19:27 +0000 | [diff] [blame] | 1545 | } | 
| Paul Duffin | 75b902a | 2021-02-22 12:13:13 +0000 | [diff] [blame] | 1546 | `), | 
| Paul Duffin | 13ad94f | 2020-02-19 16:19:27 +0000 | [diff] [blame] | 1547 | 		checkAllCopyRules(` | 
| Paul Duffin | 86b02a7 | 2021-02-22 11:50:04 +0000 | [diff] [blame] | 1548 | myinclude/Test.h -> include/myinclude/Test.h | 
| Paul Duffin | 7a7d067 | 2021-02-17 12:17:40 +0000 | [diff] [blame] | 1549 | .intermediates/mynativelib/linux_glibc_x86_64_static/gen/aidl/aidl/foo/bar/Test.h -> include_gen/mynativelib/linux_glibc_x86_64_static/gen/aidl/aidl/foo/bar/Test.h | 
 | 1550 | .intermediates/mynativelib/linux_glibc_x86_64_static/gen/aidl/aidl/foo/bar/BnTest.h -> include_gen/mynativelib/linux_glibc_x86_64_static/gen/aidl/aidl/foo/bar/BnTest.h | 
 | 1551 | .intermediates/mynativelib/linux_glibc_x86_64_static/gen/aidl/aidl/foo/bar/BpTest.h -> include_gen/mynativelib/linux_glibc_x86_64_static/gen/aidl/aidl/foo/bar/BpTest.h | 
| Paul Duffin | 13ad94f | 2020-02-19 16:19:27 +0000 | [diff] [blame] | 1552 | .intermediates/mynativelib/linux_glibc_x86_64_static/mynativelib.a -> x86_64/lib/mynativelib.a | 
| Paul Duffin | 13ad94f | 2020-02-19 16:19:27 +0000 | [diff] [blame] | 1553 | `), | 
 | 1554 | 	) | 
 | 1555 | } | 
| Paul Duffin | 91756d2 | 2020-02-21 16:29:57 +0000 | [diff] [blame] | 1556 |  | 
 | 1557 | func TestSnapshotWithCcHeadersLibrary(t *testing.T) { | 
 | 1558 | 	result := testSdkWithCc(t, ` | 
 | 1559 | 		sdk { | 
 | 1560 | 			name: "mysdk", | 
 | 1561 | 			native_header_libs: ["mynativeheaders"], | 
 | 1562 | 		} | 
 | 1563 |  | 
 | 1564 | 		cc_library_headers { | 
 | 1565 | 			name: "mynativeheaders", | 
| Paul Duffin | 86b02a7 | 2021-02-22 11:50:04 +0000 | [diff] [blame] | 1566 | 			export_include_dirs: ["myinclude"], | 
| Paul Duffin | 91756d2 | 2020-02-21 16:29:57 +0000 | [diff] [blame] | 1567 | 			stl: "none", | 
 | 1568 | 		} | 
 | 1569 | 	`) | 
 | 1570 |  | 
| Paul Duffin | 36474d3 | 2021-03-12 12:19:43 +0000 | [diff] [blame] | 1571 | 	CheckSnapshot(t, result, "mysdk", "", | 
| Paul Duffin | b01ac4b | 2022-05-24 20:10:05 +0000 | [diff] [blame] | 1572 | 		checkAndroidBpContents(` | 
| Paul Duffin | 91756d2 | 2020-02-21 16:29:57 +0000 | [diff] [blame] | 1573 | // This is auto-generated. DO NOT EDIT. | 
 | 1574 |  | 
 | 1575 | cc_prebuilt_library_headers { | 
| Paul Duffin | 91756d2 | 2020-02-21 16:29:57 +0000 | [diff] [blame] | 1576 |     name: "mynativeheaders", | 
 | 1577 |     prefer: false, | 
| Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 1578 |     visibility: ["//visibility:public"], | 
| Martin Stjernholm | 1e04109 | 2020-11-03 00:11:09 +0000 | [diff] [blame] | 1579 |     apex_available: ["//apex_available:platform"], | 
| Paul Duffin | 91756d2 | 2020-02-21 16:29:57 +0000 | [diff] [blame] | 1580 |     stl: "none", | 
| Martin Stjernholm | 89238f4 | 2020-07-10 00:14:03 +0100 | [diff] [blame] | 1581 |     compile_multilib: "both", | 
| Paul Duffin | 86b02a7 | 2021-02-22 11:50:04 +0000 | [diff] [blame] | 1582 |     export_include_dirs: ["include/myinclude"], | 
| Paul Duffin | 91756d2 | 2020-02-21 16:29:57 +0000 | [diff] [blame] | 1583 | } | 
| Paul Duffin | 91756d2 | 2020-02-21 16:29:57 +0000 | [diff] [blame] | 1584 | `), | 
 | 1585 | 		checkAllCopyRules(` | 
| Paul Duffin | 86b02a7 | 2021-02-22 11:50:04 +0000 | [diff] [blame] | 1586 | myinclude/Test.h -> include/myinclude/Test.h | 
| Paul Duffin | 91756d2 | 2020-02-21 16:29:57 +0000 | [diff] [blame] | 1587 | `), | 
 | 1588 | 	) | 
 | 1589 | } | 
 | 1590 |  | 
| Paul Duffin | 93b750e | 2019-11-19 19:44:10 +0000 | [diff] [blame] | 1591 | func TestSnapshotWithCcHeadersLibraryAndNativeBridgeSupport(t *testing.T) { | 
 | 1592 | 	result := android.GroupFixturePreparers( | 
 | 1593 | 		cc.PrepareForTestWithCcDefaultModules, | 
 | 1594 | 		PrepareForTestWithSdkBuildComponents, | 
 | 1595 | 		ccTestFs.AddToFixture(), | 
 | 1596 | 		prepareForTestWithNativeBridgeTarget, | 
 | 1597 | 	).RunTestWithBp(t, ` | 
 | 1598 | 		sdk { | 
 | 1599 | 			name: "mysdk", | 
 | 1600 | 			native_header_libs: ["mynativeheaders"], | 
 | 1601 | 			traits: { | 
 | 1602 | 				native_bridge_support: ["mynativeheaders"], | 
 | 1603 | 			}, | 
 | 1604 | 		} | 
 | 1605 |  | 
 | 1606 | 		cc_library_headers { | 
 | 1607 | 			name: "mynativeheaders", | 
 | 1608 | 			export_include_dirs: ["myinclude"], | 
 | 1609 | 			stl: "none", | 
 | 1610 | 			system_shared_libs: [], | 
 | 1611 | 			native_bridge_supported: true, | 
 | 1612 | 		} | 
 | 1613 | 	`) | 
 | 1614 |  | 
 | 1615 | 	CheckSnapshot(t, result, "mysdk", "", | 
| Paul Duffin | b01ac4b | 2022-05-24 20:10:05 +0000 | [diff] [blame] | 1616 | 		checkAndroidBpContents(` | 
| Paul Duffin | 93b750e | 2019-11-19 19:44:10 +0000 | [diff] [blame] | 1617 | // This is auto-generated. DO NOT EDIT. | 
 | 1618 |  | 
 | 1619 | cc_prebuilt_library_headers { | 
 | 1620 |     name: "mynativeheaders", | 
 | 1621 |     prefer: false, | 
 | 1622 |     visibility: ["//visibility:public"], | 
 | 1623 |     apex_available: ["//apex_available:platform"], | 
 | 1624 |     native_bridge_supported: true, | 
 | 1625 |     stl: "none", | 
 | 1626 |     compile_multilib: "both", | 
 | 1627 |     system_shared_libs: [], | 
 | 1628 |     export_include_dirs: ["include/myinclude"], | 
 | 1629 | } | 
 | 1630 | `), | 
 | 1631 | 		checkAllCopyRules(` | 
 | 1632 | myinclude/Test.h -> include/myinclude/Test.h | 
 | 1633 | `), | 
 | 1634 | 	) | 
 | 1635 | } | 
 | 1636 |  | 
 | 1637 | // TestSnapshotWithCcHeadersLibrary_DetectsNativeBridgeSpecificProperties verifies that when a | 
 | 1638 | // module that has different output files for a native bridge target requests the native bridge | 
 | 1639 | // variants are copied into the sdk snapshot that it reports an error. | 
 | 1640 | func TestSnapshotWithCcHeadersLibrary_DetectsNativeBridgeSpecificProperties(t *testing.T) { | 
 | 1641 | 	android.GroupFixturePreparers( | 
 | 1642 | 		cc.PrepareForTestWithCcDefaultModules, | 
 | 1643 | 		PrepareForTestWithSdkBuildComponents, | 
 | 1644 | 		ccTestFs.AddToFixture(), | 
 | 1645 | 		prepareForTestWithNativeBridgeTarget, | 
 | 1646 | 	).ExtendWithErrorHandler(android.FixtureExpectsAtLeastOneErrorMatchingPattern( | 
 | 1647 | 		`\QArchitecture variant "arm64_native_bridge" of sdk member "mynativeheaders" has properties distinct from other variants; this is not yet supported. The properties are: | 
 | 1648 |         export_include_dirs: [ | 
 | 1649 |             "arm64_native_bridge/include/myinclude_nativebridge", | 
 | 1650 |             "arm64_native_bridge/include/myinclude", | 
 | 1651 |         ],\E`)). | 
 | 1652 | 		RunTestWithBp(t, ` | 
 | 1653 | 		sdk { | 
 | 1654 | 			name: "mysdk", | 
 | 1655 | 			native_header_libs: ["mynativeheaders"], | 
 | 1656 | 			traits: { | 
 | 1657 | 				native_bridge_support: ["mynativeheaders"], | 
 | 1658 | 			}, | 
 | 1659 | 		} | 
 | 1660 |  | 
 | 1661 | 		cc_library_headers { | 
 | 1662 | 			name: "mynativeheaders", | 
 | 1663 | 			export_include_dirs: ["myinclude"], | 
 | 1664 | 			stl: "none", | 
 | 1665 | 			system_shared_libs: [], | 
 | 1666 | 			native_bridge_supported: true, | 
 | 1667 | 			target: { | 
 | 1668 | 				native_bridge: { | 
 | 1669 | 					export_include_dirs: ["myinclude_nativebridge"], | 
 | 1670 | 				}, | 
 | 1671 | 			}, | 
 | 1672 | 		} | 
 | 1673 | 	`) | 
 | 1674 | } | 
 | 1675 |  | 
| Paul Duffin | 6369622 | 2021-09-06 10:28:34 +0100 | [diff] [blame] | 1676 | func TestSnapshotWithCcHeadersLibraryAndImageVariants(t *testing.T) { | 
 | 1677 | 	testImageVariant := func(t *testing.T, property, trait string) { | 
 | 1678 | 		result := android.GroupFixturePreparers( | 
 | 1679 | 			cc.PrepareForTestWithCcDefaultModules, | 
 | 1680 | 			PrepareForTestWithSdkBuildComponents, | 
 | 1681 | 			ccTestFs.AddToFixture(), | 
 | 1682 | 		).RunTestWithBp(t, fmt.Sprintf(` | 
 | 1683 | 		sdk { | 
 | 1684 | 			name: "mysdk", | 
 | 1685 | 			native_header_libs: ["mynativeheaders"], | 
 | 1686 | 			traits: { | 
 | 1687 | 				%s: ["mynativeheaders"], | 
 | 1688 | 			}, | 
 | 1689 | 		} | 
 | 1690 |  | 
 | 1691 | 		cc_library_headers { | 
 | 1692 | 			name: "mynativeheaders", | 
 | 1693 | 			export_include_dirs: ["myinclude"], | 
 | 1694 | 			stl: "none", | 
 | 1695 | 			system_shared_libs: [], | 
 | 1696 | 			%s: true, | 
 | 1697 | 		} | 
 | 1698 | 	`, trait, property)) | 
 | 1699 |  | 
 | 1700 | 		CheckSnapshot(t, result, "mysdk", "", | 
| Paul Duffin | b01ac4b | 2022-05-24 20:10:05 +0000 | [diff] [blame] | 1701 | 			checkAndroidBpContents(fmt.Sprintf(` | 
| Paul Duffin | 6369622 | 2021-09-06 10:28:34 +0100 | [diff] [blame] | 1702 | // This is auto-generated. DO NOT EDIT. | 
 | 1703 |  | 
 | 1704 | cc_prebuilt_library_headers { | 
 | 1705 |     name: "mynativeheaders", | 
 | 1706 |     prefer: false, | 
 | 1707 |     visibility: ["//visibility:public"], | 
 | 1708 |     apex_available: ["//apex_available:platform"], | 
 | 1709 |     %s: true, | 
 | 1710 |     stl: "none", | 
 | 1711 |     compile_multilib: "both", | 
 | 1712 |     system_shared_libs: [], | 
 | 1713 |     export_include_dirs: ["include/myinclude"], | 
 | 1714 | } | 
 | 1715 | `, property)), | 
 | 1716 | 			checkAllCopyRules(` | 
 | 1717 | myinclude/Test.h -> include/myinclude/Test.h | 
 | 1718 | `), | 
 | 1719 | 		) | 
 | 1720 | 	} | 
 | 1721 |  | 
| Paul Duffin | 12a0a31 | 2021-09-15 17:25:10 +0100 | [diff] [blame] | 1722 | 	t.Run("ramdisk", func(t *testing.T) { | 
 | 1723 | 		testImageVariant(t, "ramdisk_available", "ramdisk_image_required") | 
 | 1724 | 	}) | 
 | 1725 |  | 
| Paul Duffin | 6369622 | 2021-09-06 10:28:34 +0100 | [diff] [blame] | 1726 | 	t.Run("recovery", func(t *testing.T) { | 
 | 1727 | 		testImageVariant(t, "recovery_available", "recovery_image_required") | 
 | 1728 | 	}) | 
 | 1729 | } | 
 | 1730 |  | 
| Paul Duffin | 91756d2 | 2020-02-21 16:29:57 +0000 | [diff] [blame] | 1731 | func TestHostSnapshotWithCcHeadersLibrary(t *testing.T) { | 
| Paul Duffin | 91756d2 | 2020-02-21 16:29:57 +0000 | [diff] [blame] | 1732 | 	result := testSdkWithCc(t, ` | 
 | 1733 | 		sdk { | 
 | 1734 | 			name: "mysdk", | 
 | 1735 | 			device_supported: false, | 
 | 1736 | 			host_supported: true, | 
 | 1737 | 			native_header_libs: ["mynativeheaders"], | 
 | 1738 | 		} | 
 | 1739 |  | 
 | 1740 | 		cc_library_headers { | 
 | 1741 | 			name: "mynativeheaders", | 
 | 1742 | 			device_supported: false, | 
 | 1743 | 			host_supported: true, | 
| Paul Duffin | 86b02a7 | 2021-02-22 11:50:04 +0000 | [diff] [blame] | 1744 | 			export_include_dirs: ["myinclude"], | 
| Paul Duffin | 91756d2 | 2020-02-21 16:29:57 +0000 | [diff] [blame] | 1745 | 			stl: "none", | 
 | 1746 | 		} | 
 | 1747 | 	`) | 
 | 1748 |  | 
| Paul Duffin | 36474d3 | 2021-03-12 12:19:43 +0000 | [diff] [blame] | 1749 | 	CheckSnapshot(t, result, "mysdk", "", | 
| Paul Duffin | b01ac4b | 2022-05-24 20:10:05 +0000 | [diff] [blame] | 1750 | 		checkAndroidBpContents(` | 
| Paul Duffin | 91756d2 | 2020-02-21 16:29:57 +0000 | [diff] [blame] | 1751 | // This is auto-generated. DO NOT EDIT. | 
 | 1752 |  | 
 | 1753 | cc_prebuilt_library_headers { | 
| Paul Duffin | 75b902a | 2021-02-22 12:13:13 +0000 | [diff] [blame] | 1754 |     name: "mynativeheaders", | 
 | 1755 |     prefer: false, | 
| Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 1756 |     visibility: ["//visibility:public"], | 
| Martin Stjernholm | 1e04109 | 2020-11-03 00:11:09 +0000 | [diff] [blame] | 1757 |     apex_available: ["//apex_available:platform"], | 
| Paul Duffin | 91756d2 | 2020-02-21 16:29:57 +0000 | [diff] [blame] | 1758 |     device_supported: false, | 
 | 1759 |     host_supported: true, | 
| Paul Duffin | 91756d2 | 2020-02-21 16:29:57 +0000 | [diff] [blame] | 1760 |     stl: "none", | 
| Martin Stjernholm | 89238f4 | 2020-07-10 00:14:03 +0100 | [diff] [blame] | 1761 |     compile_multilib: "both", | 
| Paul Duffin | 86b02a7 | 2021-02-22 11:50:04 +0000 | [diff] [blame] | 1762 |     export_include_dirs: ["include/myinclude"], | 
| Martin Stjernholm | caa47d7 | 2020-07-11 04:52:24 +0100 | [diff] [blame] | 1763 |     target: { | 
 | 1764 |         host: { | 
 | 1765 |             enabled: false, | 
 | 1766 |         }, | 
| Jiyong Park | 8fe14e6 | 2020-10-19 22:47:34 +0900 | [diff] [blame] | 1767 |         linux_glibc_x86_64: { | 
 | 1768 |             enabled: true, | 
 | 1769 |         }, | 
 | 1770 |         linux_glibc_x86: { | 
| Martin Stjernholm | caa47d7 | 2020-07-11 04:52:24 +0100 | [diff] [blame] | 1771 |             enabled: true, | 
 | 1772 |         }, | 
 | 1773 |     }, | 
| Paul Duffin | 91756d2 | 2020-02-21 16:29:57 +0000 | [diff] [blame] | 1774 | } | 
| Paul Duffin | 75b902a | 2021-02-22 12:13:13 +0000 | [diff] [blame] | 1775 | `), | 
| Paul Duffin | 91756d2 | 2020-02-21 16:29:57 +0000 | [diff] [blame] | 1776 | 		checkAllCopyRules(` | 
| Paul Duffin | 86b02a7 | 2021-02-22 11:50:04 +0000 | [diff] [blame] | 1777 | myinclude/Test.h -> include/myinclude/Test.h | 
| Paul Duffin | 91756d2 | 2020-02-21 16:29:57 +0000 | [diff] [blame] | 1778 | `), | 
 | 1779 | 	) | 
 | 1780 | } | 
| Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 1781 |  | 
 | 1782 | func TestDeviceAndHostSnapshotWithCcHeadersLibrary(t *testing.T) { | 
| Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 1783 | 	result := testSdkWithCc(t, ` | 
 | 1784 | 		sdk { | 
 | 1785 | 			name: "mysdk", | 
 | 1786 | 			host_supported: true, | 
 | 1787 | 			native_header_libs: ["mynativeheaders"], | 
 | 1788 | 		} | 
 | 1789 |  | 
 | 1790 | 		cc_library_headers { | 
 | 1791 | 			name: "mynativeheaders", | 
 | 1792 | 			host_supported: true, | 
| Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 1793 | 			stl: "none", | 
| Paul Duffin | 86b02a7 | 2021-02-22 11:50:04 +0000 | [diff] [blame] | 1794 | 			export_system_include_dirs: ["myinclude"], | 
| Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 1795 | 			target: { | 
 | 1796 | 				android: { | 
| Paul Duffin | 86b02a7 | 2021-02-22 11:50:04 +0000 | [diff] [blame] | 1797 | 					export_include_dirs: ["myinclude-android"], | 
| Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 1798 | 				}, | 
 | 1799 | 				host: { | 
| Paul Duffin | 86b02a7 | 2021-02-22 11:50:04 +0000 | [diff] [blame] | 1800 | 					export_include_dirs: ["myinclude-host"], | 
| Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 1801 | 				}, | 
 | 1802 | 			}, | 
 | 1803 | 		} | 
 | 1804 | 	`) | 
 | 1805 |  | 
| Paul Duffin | 36474d3 | 2021-03-12 12:19:43 +0000 | [diff] [blame] | 1806 | 	CheckSnapshot(t, result, "mysdk", "", | 
| Paul Duffin | b01ac4b | 2022-05-24 20:10:05 +0000 | [diff] [blame] | 1807 | 		checkAndroidBpContents(` | 
| Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 1808 | // This is auto-generated. DO NOT EDIT. | 
 | 1809 |  | 
 | 1810 | cc_prebuilt_library_headers { | 
| Paul Duffin | 75b902a | 2021-02-22 12:13:13 +0000 | [diff] [blame] | 1811 |     name: "mynativeheaders", | 
 | 1812 |     prefer: false, | 
| Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 1813 |     visibility: ["//visibility:public"], | 
| Martin Stjernholm | 1e04109 | 2020-11-03 00:11:09 +0000 | [diff] [blame] | 1814 |     apex_available: ["//apex_available:platform"], | 
| Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 1815 |     host_supported: true, | 
| Paul Duffin | 0174d8d | 2020-03-11 18:42:08 +0000 | [diff] [blame] | 1816 |     stl: "none", | 
| Martin Stjernholm | 89238f4 | 2020-07-10 00:14:03 +0100 | [diff] [blame] | 1817 |     compile_multilib: "both", | 
| Paul Duffin | 86b02a7 | 2021-02-22 11:50:04 +0000 | [diff] [blame] | 1818 |     export_system_include_dirs: ["common_os/include/myinclude"], | 
| Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 1819 |     target: { | 
| Martin Stjernholm | caa47d7 | 2020-07-11 04:52:24 +0100 | [diff] [blame] | 1820 |         host: { | 
 | 1821 |             enabled: false, | 
 | 1822 |         }, | 
| Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 1823 |         android: { | 
| Paul Duffin | 86b02a7 | 2021-02-22 11:50:04 +0000 | [diff] [blame] | 1824 |             export_include_dirs: ["android/include/myinclude-android"], | 
| Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 1825 |         }, | 
 | 1826 |         linux_glibc: { | 
| Paul Duffin | 86b02a7 | 2021-02-22 11:50:04 +0000 | [diff] [blame] | 1827 |             export_include_dirs: ["linux_glibc/include/myinclude-host"], | 
| Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 1828 |         }, | 
| Jiyong Park | 8fe14e6 | 2020-10-19 22:47:34 +0900 | [diff] [blame] | 1829 |         linux_glibc_x86_64: { | 
 | 1830 |             enabled: true, | 
 | 1831 |         }, | 
 | 1832 |         linux_glibc_x86: { | 
 | 1833 |             enabled: true, | 
 | 1834 |         }, | 
| Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 1835 |     }, | 
| Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 1836 | } | 
| Paul Duffin | 75b902a | 2021-02-22 12:13:13 +0000 | [diff] [blame] | 1837 | `), | 
| Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 1838 | 		checkAllCopyRules(` | 
| Paul Duffin | 86b02a7 | 2021-02-22 11:50:04 +0000 | [diff] [blame] | 1839 | myinclude/Test.h -> common_os/include/myinclude/Test.h | 
 | 1840 | myinclude-android/AndroidTest.h -> android/include/myinclude-android/AndroidTest.h | 
 | 1841 | myinclude-host/HostTest.h -> linux_glibc/include/myinclude-host/HostTest.h | 
| Paul Duffin | a04c107 | 2020-03-02 10:16:35 +0000 | [diff] [blame] | 1842 | `), | 
 | 1843 | 	) | 
 | 1844 | } | 
| Martin Stjernholm | 10566a0 | 2020-03-24 01:19:52 +0000 | [diff] [blame] | 1845 |  | 
 | 1846 | func TestSystemSharedLibPropagation(t *testing.T) { | 
 | 1847 | 	result := testSdkWithCc(t, ` | 
 | 1848 | 		sdk { | 
 | 1849 | 			name: "mysdk", | 
| Colin Cross | 6b8f425 | 2021-07-22 11:39:44 -0700 | [diff] [blame] | 1850 | 			native_shared_libs: ["sslnil", "sslempty", "sslnonempty"], | 
| Martin Stjernholm | 10566a0 | 2020-03-24 01:19:52 +0000 | [diff] [blame] | 1851 | 		} | 
 | 1852 |  | 
 | 1853 | 		cc_library { | 
 | 1854 | 			name: "sslnil", | 
 | 1855 | 			host_supported: true, | 
 | 1856 | 		} | 
 | 1857 |  | 
 | 1858 | 		cc_library { | 
 | 1859 | 			name: "sslempty", | 
 | 1860 | 			system_shared_libs: [], | 
 | 1861 | 		} | 
 | 1862 |  | 
 | 1863 | 		cc_library { | 
 | 1864 | 			name: "sslnonempty", | 
 | 1865 | 			system_shared_libs: ["sslnil"], | 
 | 1866 | 		} | 
 | 1867 | 	`) | 
 | 1868 |  | 
| Paul Duffin | 36474d3 | 2021-03-12 12:19:43 +0000 | [diff] [blame] | 1869 | 	CheckSnapshot(t, result, "mysdk", "", | 
| Paul Duffin | b01ac4b | 2022-05-24 20:10:05 +0000 | [diff] [blame] | 1870 | 		checkAndroidBpContents(` | 
| Martin Stjernholm | 10566a0 | 2020-03-24 01:19:52 +0000 | [diff] [blame] | 1871 | // This is auto-generated. DO NOT EDIT. | 
 | 1872 |  | 
 | 1873 | cc_prebuilt_library_shared { | 
| Martin Stjernholm | 10566a0 | 2020-03-24 01:19:52 +0000 | [diff] [blame] | 1874 |     name: "sslnil", | 
 | 1875 |     prefer: false, | 
| Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 1876 |     visibility: ["//visibility:public"], | 
| Martin Stjernholm | 1e04109 | 2020-11-03 00:11:09 +0000 | [diff] [blame] | 1877 |     apex_available: ["//apex_available:platform"], | 
| Martin Stjernholm | 89238f4 | 2020-07-10 00:14:03 +0100 | [diff] [blame] | 1878 |     compile_multilib: "both", | 
| Martin Stjernholm | 10566a0 | 2020-03-24 01:19:52 +0000 | [diff] [blame] | 1879 |     arch: { | 
 | 1880 |         arm64: { | 
 | 1881 |             srcs: ["arm64/lib/sslnil.so"], | 
 | 1882 |         }, | 
 | 1883 |         arm: { | 
 | 1884 |             srcs: ["arm/lib/sslnil.so"], | 
 | 1885 |         }, | 
 | 1886 |     }, | 
 | 1887 | } | 
 | 1888 |  | 
 | 1889 | cc_prebuilt_library_shared { | 
| Martin Stjernholm | 10566a0 | 2020-03-24 01:19:52 +0000 | [diff] [blame] | 1890 |     name: "sslempty", | 
 | 1891 |     prefer: false, | 
| Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 1892 |     visibility: ["//visibility:public"], | 
| Martin Stjernholm | 1e04109 | 2020-11-03 00:11:09 +0000 | [diff] [blame] | 1893 |     apex_available: ["//apex_available:platform"], | 
| Martin Stjernholm | 89238f4 | 2020-07-10 00:14:03 +0100 | [diff] [blame] | 1894 |     compile_multilib: "both", | 
| Martin Stjernholm | 10566a0 | 2020-03-24 01:19:52 +0000 | [diff] [blame] | 1895 |     system_shared_libs: [], | 
 | 1896 |     arch: { | 
 | 1897 |         arm64: { | 
 | 1898 |             srcs: ["arm64/lib/sslempty.so"], | 
 | 1899 |         }, | 
 | 1900 |         arm: { | 
 | 1901 |             srcs: ["arm/lib/sslempty.so"], | 
 | 1902 |         }, | 
 | 1903 |     }, | 
 | 1904 | } | 
 | 1905 |  | 
 | 1906 | cc_prebuilt_library_shared { | 
| Martin Stjernholm | 10566a0 | 2020-03-24 01:19:52 +0000 | [diff] [blame] | 1907 |     name: "sslnonempty", | 
 | 1908 |     prefer: false, | 
| Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 1909 |     visibility: ["//visibility:public"], | 
| Martin Stjernholm | 1e04109 | 2020-11-03 00:11:09 +0000 | [diff] [blame] | 1910 |     apex_available: ["//apex_available:platform"], | 
| Martin Stjernholm | 89238f4 | 2020-07-10 00:14:03 +0100 | [diff] [blame] | 1911 |     compile_multilib: "both", | 
| Martin Stjernholm | 10566a0 | 2020-03-24 01:19:52 +0000 | [diff] [blame] | 1912 |     system_shared_libs: ["sslnil"], | 
 | 1913 |     arch: { | 
 | 1914 |         arm64: { | 
 | 1915 |             srcs: ["arm64/lib/sslnonempty.so"], | 
 | 1916 |         }, | 
 | 1917 |         arm: { | 
 | 1918 |             srcs: ["arm/lib/sslnonempty.so"], | 
 | 1919 |         }, | 
 | 1920 |     }, | 
 | 1921 | } | 
| Colin Cross | 6b8f425 | 2021-07-22 11:39:44 -0700 | [diff] [blame] | 1922 | `)) | 
| Martin Stjernholm | 10566a0 | 2020-03-24 01:19:52 +0000 | [diff] [blame] | 1923 |  | 
 | 1924 | 	result = testSdkWithCc(t, ` | 
 | 1925 | 		sdk { | 
 | 1926 | 			name: "mysdk", | 
 | 1927 | 			host_supported: true, | 
| Colin Cross | 6b8f425 | 2021-07-22 11:39:44 -0700 | [diff] [blame] | 1928 | 			native_shared_libs: ["sslvariants"], | 
| Martin Stjernholm | 10566a0 | 2020-03-24 01:19:52 +0000 | [diff] [blame] | 1929 | 		} | 
 | 1930 |  | 
 | 1931 | 		cc_library { | 
 | 1932 | 			name: "sslvariants", | 
 | 1933 | 			host_supported: true, | 
 | 1934 | 			target: { | 
 | 1935 | 				android: { | 
 | 1936 | 					system_shared_libs: [], | 
 | 1937 | 				}, | 
 | 1938 | 			}, | 
 | 1939 | 		} | 
 | 1940 | 	`) | 
 | 1941 |  | 
| Paul Duffin | 36474d3 | 2021-03-12 12:19:43 +0000 | [diff] [blame] | 1942 | 	CheckSnapshot(t, result, "mysdk", "", | 
| Paul Duffin | b01ac4b | 2022-05-24 20:10:05 +0000 | [diff] [blame] | 1943 | 		checkAndroidBpContents(` | 
| Martin Stjernholm | 10566a0 | 2020-03-24 01:19:52 +0000 | [diff] [blame] | 1944 | // This is auto-generated. DO NOT EDIT. | 
 | 1945 |  | 
 | 1946 | cc_prebuilt_library_shared { | 
| Paul Duffin | 75b902a | 2021-02-22 12:13:13 +0000 | [diff] [blame] | 1947 |     name: "sslvariants", | 
 | 1948 |     prefer: false, | 
| Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 1949 |     visibility: ["//visibility:public"], | 
| Martin Stjernholm | 1e04109 | 2020-11-03 00:11:09 +0000 | [diff] [blame] | 1950 |     apex_available: ["//apex_available:platform"], | 
| Martin Stjernholm | 10566a0 | 2020-03-24 01:19:52 +0000 | [diff] [blame] | 1951 |     host_supported: true, | 
| Martin Stjernholm | 89238f4 | 2020-07-10 00:14:03 +0100 | [diff] [blame] | 1952 |     compile_multilib: "both", | 
| Martin Stjernholm | 10566a0 | 2020-03-24 01:19:52 +0000 | [diff] [blame] | 1953 |     target: { | 
| Martin Stjernholm | caa47d7 | 2020-07-11 04:52:24 +0100 | [diff] [blame] | 1954 |         host: { | 
 | 1955 |             enabled: false, | 
 | 1956 |         }, | 
| Martin Stjernholm | 10566a0 | 2020-03-24 01:19:52 +0000 | [diff] [blame] | 1957 |         android: { | 
 | 1958 |             system_shared_libs: [], | 
 | 1959 |         }, | 
 | 1960 |         android_arm64: { | 
 | 1961 |             srcs: ["android/arm64/lib/sslvariants.so"], | 
 | 1962 |         }, | 
 | 1963 |         android_arm: { | 
 | 1964 |             srcs: ["android/arm/lib/sslvariants.so"], | 
 | 1965 |         }, | 
 | 1966 |         linux_glibc_x86_64: { | 
| Jiyong Park | 8fe14e6 | 2020-10-19 22:47:34 +0900 | [diff] [blame] | 1967 |             enabled: true, | 
| Martin Stjernholm | 10566a0 | 2020-03-24 01:19:52 +0000 | [diff] [blame] | 1968 |             srcs: ["linux_glibc/x86_64/lib/sslvariants.so"], | 
 | 1969 |         }, | 
 | 1970 |         linux_glibc_x86: { | 
| Jiyong Park | 8fe14e6 | 2020-10-19 22:47:34 +0900 | [diff] [blame] | 1971 |             enabled: true, | 
| Martin Stjernholm | 10566a0 | 2020-03-24 01:19:52 +0000 | [diff] [blame] | 1972 |             srcs: ["linux_glibc/x86/lib/sslvariants.so"], | 
 | 1973 |         }, | 
 | 1974 |     }, | 
 | 1975 | } | 
| Paul Duffin | 75b902a | 2021-02-22 12:13:13 +0000 | [diff] [blame] | 1976 | `), | 
| Paul Duffin | b01ac4b | 2022-05-24 20:10:05 +0000 | [diff] [blame] | 1977 | 	) | 
| Martin Stjernholm | 10566a0 | 2020-03-24 01:19:52 +0000 | [diff] [blame] | 1978 | } | 
| Martin Stjernholm | c5dd4f7 | 2020-04-01 20:38:01 +0100 | [diff] [blame] | 1979 |  | 
 | 1980 | func TestStubsLibrary(t *testing.T) { | 
 | 1981 | 	result := testSdkWithCc(t, ` | 
 | 1982 | 		sdk { | 
 | 1983 | 			name: "mysdk", | 
 | 1984 | 			native_shared_libs: ["stubslib"], | 
 | 1985 | 		} | 
 | 1986 |  | 
 | 1987 | 		cc_library { | 
| Martin Stjernholm | cc330d6 | 2020-04-21 20:45:35 +0100 | [diff] [blame] | 1988 | 			name: "internaldep", | 
 | 1989 | 		} | 
 | 1990 |  | 
 | 1991 | 		cc_library { | 
| Martin Stjernholm | c5dd4f7 | 2020-04-01 20:38:01 +0100 | [diff] [blame] | 1992 | 			name: "stubslib", | 
| Martin Stjernholm | cc330d6 | 2020-04-21 20:45:35 +0100 | [diff] [blame] | 1993 | 			shared_libs: ["internaldep"], | 
| Martin Stjernholm | c5dd4f7 | 2020-04-01 20:38:01 +0100 | [diff] [blame] | 1994 | 			stubs: { | 
 | 1995 | 				symbol_file: "some/where/stubslib.map.txt", | 
 | 1996 | 				versions: ["1", "2", "3"], | 
 | 1997 | 			}, | 
 | 1998 | 		} | 
 | 1999 | 	`) | 
 | 2000 |  | 
| Paul Duffin | 36474d3 | 2021-03-12 12:19:43 +0000 | [diff] [blame] | 2001 | 	CheckSnapshot(t, result, "mysdk", "", | 
| Paul Duffin | b01ac4b | 2022-05-24 20:10:05 +0000 | [diff] [blame] | 2002 | 		checkAndroidBpContents(` | 
| Martin Stjernholm | c5dd4f7 | 2020-04-01 20:38:01 +0100 | [diff] [blame] | 2003 | // This is auto-generated. DO NOT EDIT. | 
 | 2004 |  | 
 | 2005 | cc_prebuilt_library_shared { | 
| Martin Stjernholm | c5dd4f7 | 2020-04-01 20:38:01 +0100 | [diff] [blame] | 2006 |     name: "stubslib", | 
 | 2007 |     prefer: false, | 
| Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 2008 |     visibility: ["//visibility:public"], | 
| Martin Stjernholm | 1e04109 | 2020-11-03 00:11:09 +0000 | [diff] [blame] | 2009 |     apex_available: ["//apex_available:platform"], | 
| Martin Stjernholm | 89238f4 | 2020-07-10 00:14:03 +0100 | [diff] [blame] | 2010 |     compile_multilib: "both", | 
| Martin Stjernholm | c5dd4f7 | 2020-04-01 20:38:01 +0100 | [diff] [blame] | 2011 |     stubs: { | 
| Martin Stjernholm | 618b671 | 2020-09-24 16:53:04 +0100 | [diff] [blame] | 2012 |         versions: [ | 
 | 2013 |             "1", | 
 | 2014 |             "2", | 
 | 2015 |             "3", | 
| Jiyong Park | d4a3a13 | 2021-03-17 20:21:35 +0900 | [diff] [blame] | 2016 |             "current", | 
| Martin Stjernholm | 618b671 | 2020-09-24 16:53:04 +0100 | [diff] [blame] | 2017 |         ], | 
| Martin Stjernholm | c5dd4f7 | 2020-04-01 20:38:01 +0100 | [diff] [blame] | 2018 |     }, | 
 | 2019 |     arch: { | 
 | 2020 |         arm64: { | 
 | 2021 |             srcs: ["arm64/lib/stubslib.so"], | 
 | 2022 |         }, | 
 | 2023 |         arm: { | 
 | 2024 |             srcs: ["arm/lib/stubslib.so"], | 
 | 2025 |         }, | 
 | 2026 |     }, | 
 | 2027 | } | 
| Martin Stjernholm | c5dd4f7 | 2020-04-01 20:38:01 +0100 | [diff] [blame] | 2028 | `)) | 
 | 2029 | } | 
| Paul Duffin | 7a1f7f3 | 2020-05-04 15:32:08 +0100 | [diff] [blame] | 2030 |  | 
 | 2031 | func TestDeviceAndHostSnapshotWithStubsLibrary(t *testing.T) { | 
| Paul Duffin | 7a1f7f3 | 2020-05-04 15:32:08 +0100 | [diff] [blame] | 2032 | 	result := testSdkWithCc(t, ` | 
 | 2033 | 		sdk { | 
 | 2034 | 			name: "mysdk", | 
 | 2035 | 			host_supported: true, | 
 | 2036 | 			native_shared_libs: ["stubslib"], | 
 | 2037 | 		} | 
 | 2038 |  | 
 | 2039 | 		cc_library { | 
 | 2040 | 			name: "internaldep", | 
 | 2041 | 			host_supported: true, | 
 | 2042 | 		} | 
 | 2043 |  | 
 | 2044 | 		cc_library { | 
 | 2045 | 			name: "stubslib", | 
 | 2046 | 			host_supported: true, | 
 | 2047 | 			shared_libs: ["internaldep"], | 
 | 2048 | 			stubs: { | 
 | 2049 | 				symbol_file: "some/where/stubslib.map.txt", | 
 | 2050 | 				versions: ["1", "2", "3"], | 
 | 2051 | 			}, | 
 | 2052 | 		} | 
 | 2053 | 	`) | 
 | 2054 |  | 
| Paul Duffin | 36474d3 | 2021-03-12 12:19:43 +0000 | [diff] [blame] | 2055 | 	CheckSnapshot(t, result, "mysdk", "", | 
| Paul Duffin | b01ac4b | 2022-05-24 20:10:05 +0000 | [diff] [blame] | 2056 | 		checkAndroidBpContents(` | 
| Paul Duffin | 7a1f7f3 | 2020-05-04 15:32:08 +0100 | [diff] [blame] | 2057 | // This is auto-generated. DO NOT EDIT. | 
 | 2058 |  | 
 | 2059 | cc_prebuilt_library_shared { | 
| Paul Duffin | 75b902a | 2021-02-22 12:13:13 +0000 | [diff] [blame] | 2060 |     name: "stubslib", | 
 | 2061 |     prefer: false, | 
| Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 2062 |     visibility: ["//visibility:public"], | 
| Martin Stjernholm | 1e04109 | 2020-11-03 00:11:09 +0000 | [diff] [blame] | 2063 |     apex_available: ["//apex_available:platform"], | 
| Paul Duffin | 7a1f7f3 | 2020-05-04 15:32:08 +0100 | [diff] [blame] | 2064 |     host_supported: true, | 
| Martin Stjernholm | 89238f4 | 2020-07-10 00:14:03 +0100 | [diff] [blame] | 2065 |     compile_multilib: "both", | 
| Paul Duffin | 7a1f7f3 | 2020-05-04 15:32:08 +0100 | [diff] [blame] | 2066 |     stubs: { | 
| Martin Stjernholm | 618b671 | 2020-09-24 16:53:04 +0100 | [diff] [blame] | 2067 |         versions: [ | 
 | 2068 |             "1", | 
 | 2069 |             "2", | 
 | 2070 |             "3", | 
| Jiyong Park | d4a3a13 | 2021-03-17 20:21:35 +0900 | [diff] [blame] | 2071 |             "current", | 
| Martin Stjernholm | 618b671 | 2020-09-24 16:53:04 +0100 | [diff] [blame] | 2072 |         ], | 
| Paul Duffin | 7a1f7f3 | 2020-05-04 15:32:08 +0100 | [diff] [blame] | 2073 |     }, | 
 | 2074 |     target: { | 
| Martin Stjernholm | caa47d7 | 2020-07-11 04:52:24 +0100 | [diff] [blame] | 2075 |         host: { | 
 | 2076 |             enabled: false, | 
 | 2077 |         }, | 
| Paul Duffin | 7a1f7f3 | 2020-05-04 15:32:08 +0100 | [diff] [blame] | 2078 |         android_arm64: { | 
 | 2079 |             srcs: ["android/arm64/lib/stubslib.so"], | 
 | 2080 |         }, | 
 | 2081 |         android_arm: { | 
 | 2082 |             srcs: ["android/arm/lib/stubslib.so"], | 
 | 2083 |         }, | 
 | 2084 |         linux_glibc_x86_64: { | 
| Jiyong Park | 8fe14e6 | 2020-10-19 22:47:34 +0900 | [diff] [blame] | 2085 |             enabled: true, | 
| Paul Duffin | 7a1f7f3 | 2020-05-04 15:32:08 +0100 | [diff] [blame] | 2086 |             srcs: ["linux_glibc/x86_64/lib/stubslib.so"], | 
 | 2087 |         }, | 
 | 2088 |         linux_glibc_x86: { | 
| Jiyong Park | 8fe14e6 | 2020-10-19 22:47:34 +0900 | [diff] [blame] | 2089 |             enabled: true, | 
| Paul Duffin | 7a1f7f3 | 2020-05-04 15:32:08 +0100 | [diff] [blame] | 2090 |             srcs: ["linux_glibc/x86/lib/stubslib.so"], | 
 | 2091 |         }, | 
 | 2092 |     }, | 
 | 2093 | } | 
| Paul Duffin | 75b902a | 2021-02-22 12:13:13 +0000 | [diff] [blame] | 2094 | `), | 
| Paul Duffin | b01ac4b | 2022-05-24 20:10:05 +0000 | [diff] [blame] | 2095 | 	) | 
| Paul Duffin | 7a1f7f3 | 2020-05-04 15:32:08 +0100 | [diff] [blame] | 2096 | } | 
| Martin Stjernholm | 47ed352 | 2020-06-17 22:52:25 +0100 | [diff] [blame] | 2097 |  | 
 | 2098 | func TestUniqueHostSoname(t *testing.T) { | 
| Martin Stjernholm | 47ed352 | 2020-06-17 22:52:25 +0100 | [diff] [blame] | 2099 | 	result := testSdkWithCc(t, ` | 
 | 2100 | 		sdk { | 
 | 2101 | 			name: "mysdk", | 
 | 2102 | 			host_supported: true, | 
 | 2103 | 			native_shared_libs: ["mylib"], | 
 | 2104 | 		} | 
 | 2105 |  | 
 | 2106 | 		cc_library { | 
 | 2107 | 			name: "mylib", | 
 | 2108 | 			host_supported: true, | 
 | 2109 | 			unique_host_soname: true, | 
 | 2110 | 		} | 
 | 2111 | 	`) | 
 | 2112 |  | 
| Paul Duffin | 36474d3 | 2021-03-12 12:19:43 +0000 | [diff] [blame] | 2113 | 	CheckSnapshot(t, result, "mysdk", "", | 
| Paul Duffin | b01ac4b | 2022-05-24 20:10:05 +0000 | [diff] [blame] | 2114 | 		checkAndroidBpContents(` | 
| Martin Stjernholm | 47ed352 | 2020-06-17 22:52:25 +0100 | [diff] [blame] | 2115 | // This is auto-generated. DO NOT EDIT. | 
 | 2116 |  | 
 | 2117 | cc_prebuilt_library_shared { | 
| Paul Duffin | 75b902a | 2021-02-22 12:13:13 +0000 | [diff] [blame] | 2118 |     name: "mylib", | 
 | 2119 |     prefer: false, | 
| Paul Duffin | d99d997 | 2020-09-29 16:00:55 +0100 | [diff] [blame] | 2120 |     visibility: ["//visibility:public"], | 
| Martin Stjernholm | 1e04109 | 2020-11-03 00:11:09 +0000 | [diff] [blame] | 2121 |     apex_available: ["//apex_available:platform"], | 
| Martin Stjernholm | 47ed352 | 2020-06-17 22:52:25 +0100 | [diff] [blame] | 2122 |     host_supported: true, | 
| Martin Stjernholm | 47ed352 | 2020-06-17 22:52:25 +0100 | [diff] [blame] | 2123 |     unique_host_soname: true, | 
| Martin Stjernholm | 89238f4 | 2020-07-10 00:14:03 +0100 | [diff] [blame] | 2124 |     compile_multilib: "both", | 
| Martin Stjernholm | 47ed352 | 2020-06-17 22:52:25 +0100 | [diff] [blame] | 2125 |     target: { | 
| Martin Stjernholm | caa47d7 | 2020-07-11 04:52:24 +0100 | [diff] [blame] | 2126 |         host: { | 
 | 2127 |             enabled: false, | 
 | 2128 |         }, | 
| Martin Stjernholm | 47ed352 | 2020-06-17 22:52:25 +0100 | [diff] [blame] | 2129 |         android_arm64: { | 
 | 2130 |             srcs: ["android/arm64/lib/mylib.so"], | 
 | 2131 |         }, | 
 | 2132 |         android_arm: { | 
 | 2133 |             srcs: ["android/arm/lib/mylib.so"], | 
 | 2134 |         }, | 
 | 2135 |         linux_glibc_x86_64: { | 
| Jiyong Park | 8fe14e6 | 2020-10-19 22:47:34 +0900 | [diff] [blame] | 2136 |             enabled: true, | 
| Martin Stjernholm | 47ed352 | 2020-06-17 22:52:25 +0100 | [diff] [blame] | 2137 |             srcs: ["linux_glibc/x86_64/lib/mylib-host.so"], | 
 | 2138 |         }, | 
 | 2139 |         linux_glibc_x86: { | 
| Jiyong Park | 8fe14e6 | 2020-10-19 22:47:34 +0900 | [diff] [blame] | 2140 |             enabled: true, | 
| Martin Stjernholm | 47ed352 | 2020-06-17 22:52:25 +0100 | [diff] [blame] | 2141 |             srcs: ["linux_glibc/x86/lib/mylib-host.so"], | 
 | 2142 |         }, | 
 | 2143 |     }, | 
 | 2144 | } | 
| Paul Duffin | 75b902a | 2021-02-22 12:13:13 +0000 | [diff] [blame] | 2145 | `), | 
| Martin Stjernholm | 47ed352 | 2020-06-17 22:52:25 +0100 | [diff] [blame] | 2146 | 		checkAllCopyRules(` | 
 | 2147 | .intermediates/mylib/android_arm64_armv8-a_shared/mylib.so -> android/arm64/lib/mylib.so | 
 | 2148 | .intermediates/mylib/android_arm_armv7-a-neon_shared/mylib.so -> android/arm/lib/mylib.so | 
 | 2149 | .intermediates/mylib/linux_glibc_x86_64_shared/mylib-host.so -> linux_glibc/x86_64/lib/mylib-host.so | 
 | 2150 | .intermediates/mylib/linux_glibc_x86_shared/mylib-host.so -> linux_glibc/x86/lib/mylib-host.so | 
 | 2151 | `), | 
 | 2152 | 	) | 
 | 2153 | } | 
| Martin Stjernholm | 59e0c7a | 2020-10-28 23:38:33 +0000 | [diff] [blame] | 2154 |  | 
 | 2155 | func TestNoSanitizerMembers(t *testing.T) { | 
 | 2156 | 	result := testSdkWithCc(t, ` | 
 | 2157 | 		sdk { | 
 | 2158 | 			name: "mysdk", | 
 | 2159 | 			native_shared_libs: ["mynativelib"], | 
 | 2160 | 		} | 
 | 2161 |  | 
 | 2162 | 		cc_library_shared { | 
 | 2163 | 			name: "mynativelib", | 
 | 2164 | 			srcs: ["Test.cpp"], | 
| Paul Duffin | 86b02a7 | 2021-02-22 11:50:04 +0000 | [diff] [blame] | 2165 | 			export_include_dirs: ["myinclude"], | 
| Martin Stjernholm | 59e0c7a | 2020-10-28 23:38:33 +0000 | [diff] [blame] | 2166 | 			arch: { | 
 | 2167 | 				arm64: { | 
 | 2168 | 					export_system_include_dirs: ["arm64/include"], | 
 | 2169 | 					sanitize: { | 
 | 2170 | 						hwaddress: true, | 
 | 2171 | 					}, | 
 | 2172 | 				}, | 
 | 2173 | 			}, | 
 | 2174 | 		} | 
 | 2175 | 	`) | 
 | 2176 |  | 
| Paul Duffin | 36474d3 | 2021-03-12 12:19:43 +0000 | [diff] [blame] | 2177 | 	CheckSnapshot(t, result, "mysdk", "", | 
| Paul Duffin | b01ac4b | 2022-05-24 20:10:05 +0000 | [diff] [blame] | 2178 | 		checkAndroidBpContents(` | 
| Martin Stjernholm | 59e0c7a | 2020-10-28 23:38:33 +0000 | [diff] [blame] | 2179 | // This is auto-generated. DO NOT EDIT. | 
 | 2180 |  | 
 | 2181 | cc_prebuilt_library_shared { | 
| Martin Stjernholm | 59e0c7a | 2020-10-28 23:38:33 +0000 | [diff] [blame] | 2182 |     name: "mynativelib", | 
 | 2183 |     prefer: false, | 
 | 2184 |     visibility: ["//visibility:public"], | 
| Martin Stjernholm | 1e04109 | 2020-11-03 00:11:09 +0000 | [diff] [blame] | 2185 |     apex_available: ["//apex_available:platform"], | 
| Martin Stjernholm | 59e0c7a | 2020-10-28 23:38:33 +0000 | [diff] [blame] | 2186 |     compile_multilib: "both", | 
| Paul Duffin | 86b02a7 | 2021-02-22 11:50:04 +0000 | [diff] [blame] | 2187 |     export_include_dirs: ["include/myinclude"], | 
| Martin Stjernholm | 59e0c7a | 2020-10-28 23:38:33 +0000 | [diff] [blame] | 2188 |     arch: { | 
 | 2189 |         arm64: { | 
 | 2190 |             export_system_include_dirs: ["arm64/include/arm64/include"], | 
 | 2191 |         }, | 
 | 2192 |         arm: { | 
 | 2193 |             srcs: ["arm/lib/mynativelib.so"], | 
 | 2194 |         }, | 
 | 2195 |     }, | 
 | 2196 | } | 
| Martin Stjernholm | 59e0c7a | 2020-10-28 23:38:33 +0000 | [diff] [blame] | 2197 | `), | 
 | 2198 | 		checkAllCopyRules(` | 
| Paul Duffin | 86b02a7 | 2021-02-22 11:50:04 +0000 | [diff] [blame] | 2199 | myinclude/Test.h -> include/myinclude/Test.h | 
| Martin Stjernholm | 59e0c7a | 2020-10-28 23:38:33 +0000 | [diff] [blame] | 2200 | arm64/include/Arm64Test.h -> arm64/include/arm64/include/Arm64Test.h | 
| Paul Duffin | 1822a0a | 2021-03-21 12:56:33 +0000 | [diff] [blame] | 2201 | .intermediates/mynativelib/android_arm_armv7-a-neon_shared/mynativelib.so -> arm/lib/mynativelib.so | 
 | 2202 | `), | 
| Martin Stjernholm | 59e0c7a | 2020-10-28 23:38:33 +0000 | [diff] [blame] | 2203 | 	) | 
 | 2204 | } |