Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1 | // Copyright 2021 Google LLC |
| 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 main |
| 16 | |
| 17 | import ( |
| 18 | "bytes" |
| 19 | "fmt" |
Colin Cross | d0f05c9 | 2022-01-27 15:40:29 -0800 | [diff] [blame] | 20 | "os" |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 21 | "strings" |
| 22 | "testing" |
Colin Cross | 38a6193 | 2022-01-27 15:26:49 -0800 | [diff] [blame] | 23 | |
| 24 | "android/soong/tools/compliance" |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 25 | ) |
| 26 | |
Colin Cross | d0f05c9 | 2022-01-27 15:40:29 -0800 | [diff] [blame] | 27 | func TestMain(m *testing.M) { |
| 28 | // Change into the parent directory before running the tests |
| 29 | // so they can find the testdata directory. |
| 30 | if err := os.Chdir(".."); err != nil { |
| 31 | fmt.Printf("failed to change to testdata directory: %s\n", err) |
| 32 | os.Exit(1) |
| 33 | } |
| 34 | os.Exit(m.Run()) |
| 35 | } |
| 36 | |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 37 | func Test_plaintext(t *testing.T) { |
| 38 | tests := []struct { |
| 39 | condition string |
| 40 | name string |
| 41 | roots []string |
| 42 | ctx context |
| 43 | expectedOut []string |
| 44 | }{ |
| 45 | { |
| 46 | condition: "firstparty", |
| 47 | name: "apex", |
| 48 | roots: []string{"highest.apex.meta_lic"}, |
| 49 | expectedOut: []string{ |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 50 | "testdata/firstparty/bin/bin1.meta_lic testdata/firstparty/bin/bin1.meta_lic notice", |
| 51 | "testdata/firstparty/bin/bin1.meta_lic testdata/firstparty/lib/liba.so.meta_lic notice", |
| 52 | "testdata/firstparty/bin/bin1.meta_lic testdata/firstparty/lib/libc.a.meta_lic notice", |
| 53 | "testdata/firstparty/bin/bin2.meta_lic testdata/firstparty/bin/bin2.meta_lic notice", |
| 54 | "testdata/firstparty/highest.apex.meta_lic testdata/firstparty/bin/bin1.meta_lic notice", |
| 55 | "testdata/firstparty/highest.apex.meta_lic testdata/firstparty/bin/bin2.meta_lic notice", |
| 56 | "testdata/firstparty/highest.apex.meta_lic testdata/firstparty/highest.apex.meta_lic notice", |
| 57 | "testdata/firstparty/highest.apex.meta_lic testdata/firstparty/lib/liba.so.meta_lic notice", |
| 58 | "testdata/firstparty/highest.apex.meta_lic testdata/firstparty/lib/libb.so.meta_lic notice", |
| 59 | "testdata/firstparty/highest.apex.meta_lic testdata/firstparty/lib/libc.a.meta_lic notice", |
| 60 | "testdata/firstparty/lib/liba.so.meta_lic testdata/firstparty/lib/liba.so.meta_lic notice", |
| 61 | "testdata/firstparty/lib/libb.so.meta_lic testdata/firstparty/lib/libb.so.meta_lic notice", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 62 | }, |
| 63 | }, |
| 64 | { |
| 65 | condition: "firstparty", |
| 66 | name: "apex_trimmed", |
| 67 | roots: []string{"highest.apex.meta_lic"}, |
| 68 | ctx: context{stripPrefix: "testdata/firstparty/"}, |
| 69 | expectedOut: []string{ |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 70 | "bin/bin1.meta_lic bin/bin1.meta_lic notice", |
| 71 | "bin/bin1.meta_lic lib/liba.so.meta_lic notice", |
| 72 | "bin/bin1.meta_lic lib/libc.a.meta_lic notice", |
| 73 | "bin/bin2.meta_lic bin/bin2.meta_lic notice", |
| 74 | "highest.apex.meta_lic bin/bin1.meta_lic notice", |
| 75 | "highest.apex.meta_lic bin/bin2.meta_lic notice", |
| 76 | "highest.apex.meta_lic highest.apex.meta_lic notice", |
| 77 | "highest.apex.meta_lic lib/liba.so.meta_lic notice", |
| 78 | "highest.apex.meta_lic lib/libb.so.meta_lic notice", |
| 79 | "highest.apex.meta_lic lib/libc.a.meta_lic notice", |
| 80 | "lib/liba.so.meta_lic lib/liba.so.meta_lic notice", |
| 81 | "lib/libb.so.meta_lic lib/libb.so.meta_lic notice", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 82 | }, |
| 83 | }, |
| 84 | { |
| 85 | condition: "firstparty", |
| 86 | name: "apex_trimmed_notice", |
| 87 | roots: []string{"highest.apex.meta_lic"}, |
| 88 | ctx: context{ |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 89 | conditions: []compliance.LicenseCondition{compliance.NoticeCondition}, |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 90 | stripPrefix: "testdata/firstparty/", |
| 91 | }, |
| 92 | expectedOut: []string{ |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 93 | "bin/bin1.meta_lic bin/bin1.meta_lic notice", |
| 94 | "bin/bin1.meta_lic lib/liba.so.meta_lic notice", |
| 95 | "bin/bin1.meta_lic lib/libc.a.meta_lic notice", |
| 96 | "bin/bin2.meta_lic bin/bin2.meta_lic notice", |
| 97 | "highest.apex.meta_lic bin/bin1.meta_lic notice", |
| 98 | "highest.apex.meta_lic bin/bin2.meta_lic notice", |
| 99 | "highest.apex.meta_lic highest.apex.meta_lic notice", |
| 100 | "highest.apex.meta_lic lib/liba.so.meta_lic notice", |
| 101 | "highest.apex.meta_lic lib/libb.so.meta_lic notice", |
| 102 | "highest.apex.meta_lic lib/libc.a.meta_lic notice", |
| 103 | "lib/liba.so.meta_lic lib/liba.so.meta_lic notice", |
| 104 | "lib/libb.so.meta_lic lib/libb.so.meta_lic notice", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 105 | }, |
| 106 | }, |
| 107 | { |
| 108 | condition: "firstparty", |
| 109 | name: "apex_trimmed_share", |
| 110 | roots: []string{"highest.apex.meta_lic"}, |
| 111 | ctx: context{ |
Colin Cross | 35f79c3 | 2022-01-27 15:18:52 -0800 | [diff] [blame] | 112 | conditions: compliance.ImpliesShared.AsList(), |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 113 | stripPrefix: "testdata/firstparty/", |
| 114 | }, |
| 115 | expectedOut: []string{}, |
| 116 | }, |
| 117 | { |
| 118 | condition: "firstparty", |
| 119 | name: "apex_trimmed_private", |
| 120 | roots: []string{"highest.apex.meta_lic"}, |
| 121 | ctx: context{ |
Colin Cross | 35f79c3 | 2022-01-27 15:18:52 -0800 | [diff] [blame] | 122 | conditions: compliance.ImpliesPrivate.AsList(), |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 123 | stripPrefix: "testdata/firstparty/", |
| 124 | }, |
| 125 | expectedOut: []string{}, |
| 126 | }, |
| 127 | { |
| 128 | condition: "firstparty", |
| 129 | name: "apex_trimmed_share_private", |
| 130 | roots: []string{"highest.apex.meta_lic"}, |
| 131 | ctx: context{ |
Colin Cross | 35f79c3 | 2022-01-27 15:18:52 -0800 | [diff] [blame] | 132 | conditions: append(compliance.ImpliesPrivate.AsList(), compliance.ImpliesShared.AsList()...), |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 133 | stripPrefix: "testdata/firstparty/", |
| 134 | }, |
| 135 | expectedOut: []string{}, |
| 136 | }, |
| 137 | { |
| 138 | condition: "firstparty", |
| 139 | name: "apex_trimmed_labelled", |
| 140 | roots: []string{"highest.apex.meta_lic"}, |
| 141 | ctx: context{stripPrefix: "testdata/firstparty/", labelConditions: true}, |
| 142 | expectedOut: []string{ |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 143 | "bin/bin1.meta_lic:notice bin/bin1.meta_lic:notice notice", |
| 144 | "bin/bin1.meta_lic:notice lib/liba.so.meta_lic:notice notice", |
| 145 | "bin/bin1.meta_lic:notice lib/libc.a.meta_lic:notice notice", |
| 146 | "bin/bin2.meta_lic:notice bin/bin2.meta_lic:notice notice", |
| 147 | "highest.apex.meta_lic:notice bin/bin1.meta_lic:notice notice", |
| 148 | "highest.apex.meta_lic:notice bin/bin2.meta_lic:notice notice", |
| 149 | "highest.apex.meta_lic:notice highest.apex.meta_lic:notice notice", |
| 150 | "highest.apex.meta_lic:notice lib/liba.so.meta_lic:notice notice", |
| 151 | "highest.apex.meta_lic:notice lib/libb.so.meta_lic:notice notice", |
| 152 | "highest.apex.meta_lic:notice lib/libc.a.meta_lic:notice notice", |
| 153 | "lib/liba.so.meta_lic:notice lib/liba.so.meta_lic:notice notice", |
| 154 | "lib/libb.so.meta_lic:notice lib/libb.so.meta_lic:notice notice", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 155 | }, |
| 156 | }, |
| 157 | { |
| 158 | condition: "firstparty", |
| 159 | name: "container", |
| 160 | roots: []string{"container.zip.meta_lic"}, |
| 161 | expectedOut: []string{ |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 162 | "testdata/firstparty/bin/bin1.meta_lic testdata/firstparty/bin/bin1.meta_lic notice", |
| 163 | "testdata/firstparty/bin/bin1.meta_lic testdata/firstparty/lib/liba.so.meta_lic notice", |
| 164 | "testdata/firstparty/bin/bin1.meta_lic testdata/firstparty/lib/libc.a.meta_lic notice", |
| 165 | "testdata/firstparty/bin/bin2.meta_lic testdata/firstparty/bin/bin2.meta_lic notice", |
| 166 | "testdata/firstparty/container.zip.meta_lic testdata/firstparty/bin/bin1.meta_lic notice", |
| 167 | "testdata/firstparty/container.zip.meta_lic testdata/firstparty/bin/bin2.meta_lic notice", |
| 168 | "testdata/firstparty/container.zip.meta_lic testdata/firstparty/container.zip.meta_lic notice", |
| 169 | "testdata/firstparty/container.zip.meta_lic testdata/firstparty/lib/liba.so.meta_lic notice", |
| 170 | "testdata/firstparty/container.zip.meta_lic testdata/firstparty/lib/libb.so.meta_lic notice", |
| 171 | "testdata/firstparty/container.zip.meta_lic testdata/firstparty/lib/libc.a.meta_lic notice", |
| 172 | "testdata/firstparty/lib/liba.so.meta_lic testdata/firstparty/lib/liba.so.meta_lic notice", |
| 173 | "testdata/firstparty/lib/libb.so.meta_lic testdata/firstparty/lib/libb.so.meta_lic notice", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 174 | }, |
| 175 | }, |
| 176 | { |
| 177 | condition: "firstparty", |
| 178 | name: "application", |
| 179 | roots: []string{"application.meta_lic"}, |
| 180 | expectedOut: []string{ |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 181 | "testdata/firstparty/application.meta_lic testdata/firstparty/application.meta_lic notice", |
| 182 | "testdata/firstparty/application.meta_lic testdata/firstparty/lib/liba.so.meta_lic notice", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 183 | }, |
| 184 | }, |
| 185 | { |
| 186 | condition: "firstparty", |
| 187 | name: "binary", |
| 188 | roots: []string{"bin/bin1.meta_lic"}, |
| 189 | expectedOut: []string{ |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 190 | "testdata/firstparty/bin/bin1.meta_lic testdata/firstparty/bin/bin1.meta_lic notice", |
| 191 | "testdata/firstparty/bin/bin1.meta_lic testdata/firstparty/lib/liba.so.meta_lic notice", |
| 192 | "testdata/firstparty/bin/bin1.meta_lic testdata/firstparty/lib/libc.a.meta_lic notice", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 193 | }, |
| 194 | }, |
| 195 | { |
| 196 | condition: "firstparty", |
| 197 | name: "library", |
| 198 | roots: []string{"lib/libd.so.meta_lic"}, |
| 199 | expectedOut: []string{ |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 200 | "testdata/firstparty/lib/libd.so.meta_lic testdata/firstparty/lib/libd.so.meta_lic notice", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 201 | }, |
| 202 | }, |
| 203 | { |
| 204 | condition: "notice", |
| 205 | name: "apex", |
| 206 | roots: []string{"highest.apex.meta_lic"}, |
| 207 | expectedOut: []string{ |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 208 | "testdata/notice/bin/bin1.meta_lic testdata/notice/bin/bin1.meta_lic notice", |
| 209 | "testdata/notice/bin/bin1.meta_lic testdata/notice/lib/liba.so.meta_lic notice", |
| 210 | "testdata/notice/bin/bin1.meta_lic testdata/notice/lib/libc.a.meta_lic notice", |
| 211 | "testdata/notice/bin/bin2.meta_lic testdata/notice/bin/bin2.meta_lic notice", |
| 212 | "testdata/notice/highest.apex.meta_lic testdata/notice/bin/bin1.meta_lic notice", |
| 213 | "testdata/notice/highest.apex.meta_lic testdata/notice/bin/bin2.meta_lic notice", |
| 214 | "testdata/notice/highest.apex.meta_lic testdata/notice/highest.apex.meta_lic notice", |
| 215 | "testdata/notice/highest.apex.meta_lic testdata/notice/lib/liba.so.meta_lic notice", |
| 216 | "testdata/notice/highest.apex.meta_lic testdata/notice/lib/libb.so.meta_lic notice", |
| 217 | "testdata/notice/highest.apex.meta_lic testdata/notice/lib/libc.a.meta_lic notice", |
| 218 | "testdata/notice/lib/liba.so.meta_lic testdata/notice/lib/liba.so.meta_lic notice", |
| 219 | "testdata/notice/lib/libb.so.meta_lic testdata/notice/lib/libb.so.meta_lic notice", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 220 | }, |
| 221 | }, |
| 222 | { |
| 223 | condition: "notice", |
| 224 | name: "apex_trimmed", |
| 225 | roots: []string{"highest.apex.meta_lic"}, |
| 226 | ctx: context{stripPrefix: "testdata/notice/"}, |
| 227 | expectedOut: []string{ |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 228 | "bin/bin1.meta_lic bin/bin1.meta_lic notice", |
| 229 | "bin/bin1.meta_lic lib/liba.so.meta_lic notice", |
| 230 | "bin/bin1.meta_lic lib/libc.a.meta_lic notice", |
| 231 | "bin/bin2.meta_lic bin/bin2.meta_lic notice", |
| 232 | "highest.apex.meta_lic bin/bin1.meta_lic notice", |
| 233 | "highest.apex.meta_lic bin/bin2.meta_lic notice", |
| 234 | "highest.apex.meta_lic highest.apex.meta_lic notice", |
| 235 | "highest.apex.meta_lic lib/liba.so.meta_lic notice", |
| 236 | "highest.apex.meta_lic lib/libb.so.meta_lic notice", |
| 237 | "highest.apex.meta_lic lib/libc.a.meta_lic notice", |
| 238 | "lib/liba.so.meta_lic lib/liba.so.meta_lic notice", |
| 239 | "lib/libb.so.meta_lic lib/libb.so.meta_lic notice", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 240 | }, |
| 241 | }, |
| 242 | { |
| 243 | condition: "notice", |
| 244 | name: "apex_trimmed_notice", |
| 245 | roots: []string{"highest.apex.meta_lic"}, |
| 246 | ctx: context{ |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 247 | conditions: []compliance.LicenseCondition{compliance.NoticeCondition}, |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 248 | stripPrefix: "testdata/notice/", |
| 249 | }, |
| 250 | expectedOut: []string{ |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 251 | "bin/bin1.meta_lic bin/bin1.meta_lic notice", |
| 252 | "bin/bin1.meta_lic lib/liba.so.meta_lic notice", |
| 253 | "bin/bin1.meta_lic lib/libc.a.meta_lic notice", |
| 254 | "bin/bin2.meta_lic bin/bin2.meta_lic notice", |
| 255 | "highest.apex.meta_lic bin/bin1.meta_lic notice", |
| 256 | "highest.apex.meta_lic bin/bin2.meta_lic notice", |
| 257 | "highest.apex.meta_lic highest.apex.meta_lic notice", |
| 258 | "highest.apex.meta_lic lib/liba.so.meta_lic notice", |
| 259 | "highest.apex.meta_lic lib/libb.so.meta_lic notice", |
| 260 | "highest.apex.meta_lic lib/libc.a.meta_lic notice", |
| 261 | "lib/liba.so.meta_lic lib/liba.so.meta_lic notice", |
| 262 | "lib/libb.so.meta_lic lib/libb.so.meta_lic notice", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 263 | }, |
| 264 | }, |
| 265 | { |
| 266 | condition: "notice", |
| 267 | name: "apex_trimmed_share", |
| 268 | roots: []string{"highest.apex.meta_lic"}, |
| 269 | ctx: context{ |
Colin Cross | 35f79c3 | 2022-01-27 15:18:52 -0800 | [diff] [blame] | 270 | conditions: compliance.ImpliesShared.AsList(), |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 271 | stripPrefix: "testdata/notice/", |
| 272 | }, |
| 273 | expectedOut: []string{}, |
| 274 | }, |
| 275 | { |
| 276 | condition: "notice", |
| 277 | name: "apex_trimmed_private", |
| 278 | roots: []string{"highest.apex.meta_lic"}, |
| 279 | ctx: context{ |
Colin Cross | 35f79c3 | 2022-01-27 15:18:52 -0800 | [diff] [blame] | 280 | conditions: compliance.ImpliesPrivate.AsList(), |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 281 | stripPrefix: "testdata/notice/", |
| 282 | }, |
| 283 | expectedOut: []string{}, |
| 284 | }, |
| 285 | { |
| 286 | condition: "notice", |
| 287 | name: "apex_trimmed_share_private", |
| 288 | roots: []string{"highest.apex.meta_lic"}, |
| 289 | ctx: context{ |
Colin Cross | 35f79c3 | 2022-01-27 15:18:52 -0800 | [diff] [blame] | 290 | conditions: append(compliance.ImpliesShared.AsList(), compliance.ImpliesPrivate.AsList()...), |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 291 | stripPrefix: "testdata/notice/", |
| 292 | }, |
| 293 | expectedOut: []string{}, |
| 294 | }, |
| 295 | { |
| 296 | condition: "notice", |
| 297 | name: "apex_trimmed_labelled", |
| 298 | roots: []string{"highest.apex.meta_lic"}, |
| 299 | ctx: context{stripPrefix: "testdata/notice/", labelConditions: true}, |
| 300 | expectedOut: []string{ |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 301 | "bin/bin1.meta_lic:notice bin/bin1.meta_lic:notice notice", |
| 302 | "bin/bin1.meta_lic:notice lib/liba.so.meta_lic:notice notice", |
| 303 | "bin/bin1.meta_lic:notice lib/libc.a.meta_lic:notice notice", |
| 304 | "bin/bin2.meta_lic:notice bin/bin2.meta_lic:notice notice", |
| 305 | "highest.apex.meta_lic:notice bin/bin1.meta_lic:notice notice", |
| 306 | "highest.apex.meta_lic:notice bin/bin2.meta_lic:notice notice", |
| 307 | "highest.apex.meta_lic:notice highest.apex.meta_lic:notice notice", |
| 308 | "highest.apex.meta_lic:notice lib/liba.so.meta_lic:notice notice", |
| 309 | "highest.apex.meta_lic:notice lib/libb.so.meta_lic:notice notice", |
| 310 | "highest.apex.meta_lic:notice lib/libc.a.meta_lic:notice notice", |
| 311 | "lib/liba.so.meta_lic:notice lib/liba.so.meta_lic:notice notice", |
| 312 | "lib/libb.so.meta_lic:notice lib/libb.so.meta_lic:notice notice", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 313 | }, |
| 314 | }, |
| 315 | { |
| 316 | condition: "notice", |
| 317 | name: "container", |
| 318 | roots: []string{"container.zip.meta_lic"}, |
| 319 | expectedOut: []string{ |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 320 | "testdata/notice/bin/bin1.meta_lic testdata/notice/bin/bin1.meta_lic notice", |
| 321 | "testdata/notice/bin/bin1.meta_lic testdata/notice/lib/liba.so.meta_lic notice", |
| 322 | "testdata/notice/bin/bin1.meta_lic testdata/notice/lib/libc.a.meta_lic notice", |
| 323 | "testdata/notice/bin/bin2.meta_lic testdata/notice/bin/bin2.meta_lic notice", |
| 324 | "testdata/notice/container.zip.meta_lic testdata/notice/bin/bin1.meta_lic notice", |
| 325 | "testdata/notice/container.zip.meta_lic testdata/notice/bin/bin2.meta_lic notice", |
| 326 | "testdata/notice/container.zip.meta_lic testdata/notice/container.zip.meta_lic notice", |
| 327 | "testdata/notice/container.zip.meta_lic testdata/notice/lib/liba.so.meta_lic notice", |
| 328 | "testdata/notice/container.zip.meta_lic testdata/notice/lib/libb.so.meta_lic notice", |
| 329 | "testdata/notice/container.zip.meta_lic testdata/notice/lib/libc.a.meta_lic notice", |
| 330 | "testdata/notice/lib/liba.so.meta_lic testdata/notice/lib/liba.so.meta_lic notice", |
| 331 | "testdata/notice/lib/libb.so.meta_lic testdata/notice/lib/libb.so.meta_lic notice", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 332 | }, |
| 333 | }, |
| 334 | { |
| 335 | condition: "notice", |
| 336 | name: "application", |
| 337 | roots: []string{"application.meta_lic"}, |
| 338 | expectedOut: []string{ |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 339 | "testdata/notice/application.meta_lic testdata/notice/application.meta_lic notice", |
| 340 | "testdata/notice/application.meta_lic testdata/notice/lib/liba.so.meta_lic notice", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 341 | }, |
| 342 | }, |
| 343 | { |
| 344 | condition: "notice", |
| 345 | name: "binary", |
| 346 | roots: []string{"bin/bin1.meta_lic"}, |
| 347 | expectedOut: []string{ |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 348 | "testdata/notice/bin/bin1.meta_lic testdata/notice/bin/bin1.meta_lic notice", |
| 349 | "testdata/notice/bin/bin1.meta_lic testdata/notice/lib/liba.so.meta_lic notice", |
| 350 | "testdata/notice/bin/bin1.meta_lic testdata/notice/lib/libc.a.meta_lic notice", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 351 | }, |
| 352 | }, |
| 353 | { |
| 354 | condition: "notice", |
| 355 | name: "library", |
| 356 | roots: []string{"lib/libd.so.meta_lic"}, |
| 357 | expectedOut: []string{ |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 358 | "testdata/notice/lib/libd.so.meta_lic testdata/notice/lib/libd.so.meta_lic notice", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 359 | }, |
| 360 | }, |
| 361 | { |
| 362 | condition: "reciprocal", |
| 363 | name: "apex", |
| 364 | roots: []string{"highest.apex.meta_lic"}, |
| 365 | expectedOut: []string{ |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 366 | "testdata/reciprocal/bin/bin1.meta_lic testdata/reciprocal/bin/bin1.meta_lic notice", |
| 367 | "testdata/reciprocal/bin/bin1.meta_lic testdata/reciprocal/lib/liba.so.meta_lic reciprocal", |
| 368 | "testdata/reciprocal/bin/bin1.meta_lic testdata/reciprocal/lib/libc.a.meta_lic reciprocal", |
| 369 | "testdata/reciprocal/bin/bin2.meta_lic testdata/reciprocal/bin/bin2.meta_lic notice", |
| 370 | "testdata/reciprocal/highest.apex.meta_lic testdata/reciprocal/bin/bin1.meta_lic notice", |
| 371 | "testdata/reciprocal/highest.apex.meta_lic testdata/reciprocal/bin/bin2.meta_lic notice", |
| 372 | "testdata/reciprocal/highest.apex.meta_lic testdata/reciprocal/highest.apex.meta_lic notice", |
| 373 | "testdata/reciprocal/highest.apex.meta_lic testdata/reciprocal/lib/liba.so.meta_lic reciprocal", |
| 374 | "testdata/reciprocal/highest.apex.meta_lic testdata/reciprocal/lib/libb.so.meta_lic notice", |
| 375 | "testdata/reciprocal/highest.apex.meta_lic testdata/reciprocal/lib/libc.a.meta_lic reciprocal", |
| 376 | "testdata/reciprocal/lib/liba.so.meta_lic testdata/reciprocal/lib/liba.so.meta_lic reciprocal", |
| 377 | "testdata/reciprocal/lib/libb.so.meta_lic testdata/reciprocal/lib/libb.so.meta_lic notice", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 378 | }, |
| 379 | }, |
| 380 | { |
| 381 | condition: "reciprocal", |
| 382 | name: "apex_trimmed", |
| 383 | roots: []string{"highest.apex.meta_lic"}, |
| 384 | ctx: context{stripPrefix: "testdata/reciprocal/"}, |
| 385 | expectedOut: []string{ |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 386 | "bin/bin1.meta_lic bin/bin1.meta_lic notice", |
| 387 | "bin/bin1.meta_lic lib/liba.so.meta_lic reciprocal", |
| 388 | "bin/bin1.meta_lic lib/libc.a.meta_lic reciprocal", |
| 389 | "bin/bin2.meta_lic bin/bin2.meta_lic notice", |
| 390 | "highest.apex.meta_lic bin/bin1.meta_lic notice", |
| 391 | "highest.apex.meta_lic bin/bin2.meta_lic notice", |
| 392 | "highest.apex.meta_lic highest.apex.meta_lic notice", |
| 393 | "highest.apex.meta_lic lib/liba.so.meta_lic reciprocal", |
| 394 | "highest.apex.meta_lic lib/libb.so.meta_lic notice", |
| 395 | "highest.apex.meta_lic lib/libc.a.meta_lic reciprocal", |
| 396 | "lib/liba.so.meta_lic lib/liba.so.meta_lic reciprocal", |
| 397 | "lib/libb.so.meta_lic lib/libb.so.meta_lic notice", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 398 | }, |
| 399 | }, |
| 400 | { |
| 401 | condition: "reciprocal", |
| 402 | name: "apex_trimmed_notice", |
| 403 | roots: []string{"highest.apex.meta_lic"}, |
| 404 | ctx: context{ |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 405 | conditions: []compliance.LicenseCondition{compliance.NoticeCondition}, |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 406 | stripPrefix: "testdata/reciprocal/", |
| 407 | }, |
| 408 | expectedOut: []string{ |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 409 | "bin/bin1.meta_lic bin/bin1.meta_lic notice", |
| 410 | "bin/bin2.meta_lic bin/bin2.meta_lic notice", |
| 411 | "highest.apex.meta_lic bin/bin1.meta_lic notice", |
| 412 | "highest.apex.meta_lic bin/bin2.meta_lic notice", |
| 413 | "highest.apex.meta_lic highest.apex.meta_lic notice", |
| 414 | "highest.apex.meta_lic lib/libb.so.meta_lic notice", |
| 415 | "lib/libb.so.meta_lic lib/libb.so.meta_lic notice", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 416 | }, |
| 417 | }, |
| 418 | { |
| 419 | condition: "reciprocal", |
| 420 | name: "apex_trimmed_share", |
| 421 | roots: []string{"highest.apex.meta_lic"}, |
| 422 | ctx: context{ |
Colin Cross | 35f79c3 | 2022-01-27 15:18:52 -0800 | [diff] [blame] | 423 | conditions: compliance.ImpliesShared.AsList(), |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 424 | stripPrefix: "testdata/reciprocal/", |
| 425 | }, |
| 426 | expectedOut: []string{ |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 427 | "bin/bin1.meta_lic lib/liba.so.meta_lic reciprocal", |
| 428 | "bin/bin1.meta_lic lib/libc.a.meta_lic reciprocal", |
| 429 | "highest.apex.meta_lic lib/liba.so.meta_lic reciprocal", |
| 430 | "highest.apex.meta_lic lib/libc.a.meta_lic reciprocal", |
| 431 | "lib/liba.so.meta_lic lib/liba.so.meta_lic reciprocal", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 432 | }, |
| 433 | }, |
| 434 | { |
| 435 | condition: "reciprocal", |
| 436 | name: "apex_trimmed_private", |
| 437 | roots: []string{"highest.apex.meta_lic"}, |
| 438 | ctx: context{ |
Colin Cross | 35f79c3 | 2022-01-27 15:18:52 -0800 | [diff] [blame] | 439 | conditions: compliance.ImpliesPrivate.AsList(), |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 440 | stripPrefix: "testdata/reciprocal/", |
| 441 | }, |
| 442 | expectedOut: []string{}, |
| 443 | }, |
| 444 | { |
| 445 | condition: "reciprocal", |
| 446 | name: "apex_trimmed_share_private", |
| 447 | roots: []string{"highest.apex.meta_lic"}, |
| 448 | ctx: context{ |
Colin Cross | 35f79c3 | 2022-01-27 15:18:52 -0800 | [diff] [blame] | 449 | conditions: append(compliance.ImpliesShared.AsList(), compliance.ImpliesPrivate.AsList()...), |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 450 | stripPrefix: "testdata/reciprocal/", |
| 451 | }, |
| 452 | expectedOut: []string{ |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 453 | "bin/bin1.meta_lic lib/liba.so.meta_lic reciprocal", |
| 454 | "bin/bin1.meta_lic lib/libc.a.meta_lic reciprocal", |
| 455 | "highest.apex.meta_lic lib/liba.so.meta_lic reciprocal", |
| 456 | "highest.apex.meta_lic lib/libc.a.meta_lic reciprocal", |
| 457 | "lib/liba.so.meta_lic lib/liba.so.meta_lic reciprocal", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 458 | }, |
| 459 | }, |
| 460 | { |
| 461 | condition: "reciprocal", |
| 462 | name: "apex_trimmed_labelled", |
| 463 | roots: []string{"highest.apex.meta_lic"}, |
| 464 | ctx: context{stripPrefix: "testdata/reciprocal/", labelConditions: true}, |
| 465 | expectedOut: []string{ |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 466 | "bin/bin1.meta_lic:notice bin/bin1.meta_lic:notice notice", |
| 467 | "bin/bin1.meta_lic:notice lib/liba.so.meta_lic:reciprocal reciprocal", |
| 468 | "bin/bin1.meta_lic:notice lib/libc.a.meta_lic:reciprocal reciprocal", |
| 469 | "bin/bin2.meta_lic:notice bin/bin2.meta_lic:notice notice", |
| 470 | "highest.apex.meta_lic:notice bin/bin1.meta_lic:notice notice", |
| 471 | "highest.apex.meta_lic:notice bin/bin2.meta_lic:notice notice", |
| 472 | "highest.apex.meta_lic:notice highest.apex.meta_lic:notice notice", |
| 473 | "highest.apex.meta_lic:notice lib/liba.so.meta_lic:reciprocal reciprocal", |
| 474 | "highest.apex.meta_lic:notice lib/libb.so.meta_lic:notice notice", |
| 475 | "highest.apex.meta_lic:notice lib/libc.a.meta_lic:reciprocal reciprocal", |
| 476 | "lib/liba.so.meta_lic:reciprocal lib/liba.so.meta_lic:reciprocal reciprocal", |
| 477 | "lib/libb.so.meta_lic:notice lib/libb.so.meta_lic:notice notice", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 478 | }, |
| 479 | }, |
| 480 | { |
| 481 | condition: "reciprocal", |
| 482 | name: "container", |
| 483 | roots: []string{"container.zip.meta_lic"}, |
| 484 | expectedOut: []string{ |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 485 | "testdata/reciprocal/bin/bin1.meta_lic testdata/reciprocal/bin/bin1.meta_lic notice", |
| 486 | "testdata/reciprocal/bin/bin1.meta_lic testdata/reciprocal/lib/liba.so.meta_lic reciprocal", |
| 487 | "testdata/reciprocal/bin/bin1.meta_lic testdata/reciprocal/lib/libc.a.meta_lic reciprocal", |
| 488 | "testdata/reciprocal/bin/bin2.meta_lic testdata/reciprocal/bin/bin2.meta_lic notice", |
| 489 | "testdata/reciprocal/container.zip.meta_lic testdata/reciprocal/bin/bin1.meta_lic notice", |
| 490 | "testdata/reciprocal/container.zip.meta_lic testdata/reciprocal/bin/bin2.meta_lic notice", |
| 491 | "testdata/reciprocal/container.zip.meta_lic testdata/reciprocal/container.zip.meta_lic notice", |
| 492 | "testdata/reciprocal/container.zip.meta_lic testdata/reciprocal/lib/liba.so.meta_lic reciprocal", |
| 493 | "testdata/reciprocal/container.zip.meta_lic testdata/reciprocal/lib/libb.so.meta_lic notice", |
| 494 | "testdata/reciprocal/container.zip.meta_lic testdata/reciprocal/lib/libc.a.meta_lic reciprocal", |
| 495 | "testdata/reciprocal/lib/liba.so.meta_lic testdata/reciprocal/lib/liba.so.meta_lic reciprocal", |
| 496 | "testdata/reciprocal/lib/libb.so.meta_lic testdata/reciprocal/lib/libb.so.meta_lic notice", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 497 | }, |
| 498 | }, |
| 499 | { |
| 500 | condition: "reciprocal", |
| 501 | name: "application", |
| 502 | roots: []string{"application.meta_lic"}, |
| 503 | expectedOut: []string{ |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 504 | "testdata/reciprocal/application.meta_lic testdata/reciprocal/application.meta_lic notice", |
| 505 | "testdata/reciprocal/application.meta_lic testdata/reciprocal/lib/liba.so.meta_lic reciprocal", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 506 | }, |
| 507 | }, |
| 508 | { |
| 509 | condition: "reciprocal", |
| 510 | name: "binary", |
| 511 | roots: []string{"bin/bin1.meta_lic"}, |
| 512 | expectedOut: []string{ |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 513 | "testdata/reciprocal/bin/bin1.meta_lic testdata/reciprocal/bin/bin1.meta_lic notice", |
| 514 | "testdata/reciprocal/bin/bin1.meta_lic testdata/reciprocal/lib/liba.so.meta_lic reciprocal", |
| 515 | "testdata/reciprocal/bin/bin1.meta_lic testdata/reciprocal/lib/libc.a.meta_lic reciprocal", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 516 | }, |
| 517 | }, |
| 518 | { |
| 519 | condition: "reciprocal", |
| 520 | name: "library", |
| 521 | roots: []string{"lib/libd.so.meta_lic"}, |
| 522 | expectedOut: []string{ |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 523 | "testdata/reciprocal/lib/libd.so.meta_lic testdata/reciprocal/lib/libd.so.meta_lic notice", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 524 | }, |
| 525 | }, |
| 526 | { |
| 527 | condition: "restricted", |
| 528 | name: "apex", |
| 529 | roots: []string{"highest.apex.meta_lic"}, |
| 530 | expectedOut: []string{ |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 531 | "testdata/restricted/bin/bin1.meta_lic testdata/restricted/bin/bin1.meta_lic notice:restricted_allows_dynamic_linking", |
| 532 | "testdata/restricted/bin/bin1.meta_lic testdata/restricted/lib/liba.so.meta_lic restricted_allows_dynamic_linking", |
| 533 | "testdata/restricted/bin/bin1.meta_lic testdata/restricted/lib/libc.a.meta_lic reciprocal:restricted_allows_dynamic_linking", |
| 534 | "testdata/restricted/bin/bin2.meta_lic testdata/restricted/bin/bin2.meta_lic notice:restricted", |
| 535 | "testdata/restricted/bin/bin2.meta_lic testdata/restricted/lib/libb.so.meta_lic restricted", |
| 536 | "testdata/restricted/highest.apex.meta_lic testdata/restricted/bin/bin1.meta_lic notice:restricted_allows_dynamic_linking", |
| 537 | "testdata/restricted/highest.apex.meta_lic testdata/restricted/bin/bin2.meta_lic notice:restricted", |
| 538 | "testdata/restricted/highest.apex.meta_lic testdata/restricted/highest.apex.meta_lic notice:restricted:restricted_allows_dynamic_linking", |
| 539 | "testdata/restricted/highest.apex.meta_lic testdata/restricted/lib/liba.so.meta_lic restricted_allows_dynamic_linking", |
| 540 | "testdata/restricted/highest.apex.meta_lic testdata/restricted/lib/libb.so.meta_lic restricted", |
| 541 | "testdata/restricted/highest.apex.meta_lic testdata/restricted/lib/libc.a.meta_lic reciprocal:restricted_allows_dynamic_linking", |
| 542 | "testdata/restricted/lib/liba.so.meta_lic testdata/restricted/lib/liba.so.meta_lic restricted_allows_dynamic_linking", |
| 543 | "testdata/restricted/lib/libb.so.meta_lic testdata/restricted/lib/libb.so.meta_lic restricted", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 544 | }, |
| 545 | }, |
| 546 | { |
| 547 | condition: "restricted", |
| 548 | name: "apex_trimmed", |
| 549 | roots: []string{"highest.apex.meta_lic"}, |
| 550 | ctx: context{stripPrefix: "testdata/restricted/"}, |
| 551 | expectedOut: []string{ |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 552 | "bin/bin1.meta_lic bin/bin1.meta_lic notice:restricted_allows_dynamic_linking", |
| 553 | "bin/bin1.meta_lic lib/liba.so.meta_lic restricted_allows_dynamic_linking", |
| 554 | "bin/bin1.meta_lic lib/libc.a.meta_lic reciprocal:restricted_allows_dynamic_linking", |
| 555 | "bin/bin2.meta_lic bin/bin2.meta_lic notice:restricted", |
| 556 | "bin/bin2.meta_lic lib/libb.so.meta_lic restricted", |
| 557 | "highest.apex.meta_lic bin/bin1.meta_lic notice:restricted_allows_dynamic_linking", |
| 558 | "highest.apex.meta_lic bin/bin2.meta_lic notice:restricted", |
| 559 | "highest.apex.meta_lic highest.apex.meta_lic notice:restricted:restricted_allows_dynamic_linking", |
| 560 | "highest.apex.meta_lic lib/liba.so.meta_lic restricted_allows_dynamic_linking", |
| 561 | "highest.apex.meta_lic lib/libb.so.meta_lic restricted", |
| 562 | "highest.apex.meta_lic lib/libc.a.meta_lic reciprocal:restricted_allows_dynamic_linking", |
| 563 | "lib/liba.so.meta_lic lib/liba.so.meta_lic restricted_allows_dynamic_linking", |
| 564 | "lib/libb.so.meta_lic lib/libb.so.meta_lic restricted", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 565 | }, |
| 566 | }, |
| 567 | { |
| 568 | condition: "restricted", |
| 569 | name: "apex_trimmed_notice", |
| 570 | roots: []string{"highest.apex.meta_lic"}, |
| 571 | ctx: context{ |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 572 | conditions: []compliance.LicenseCondition{compliance.NoticeCondition}, |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 573 | stripPrefix: "testdata/restricted/", |
| 574 | }, |
| 575 | expectedOut: []string{ |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 576 | "bin/bin1.meta_lic bin/bin1.meta_lic notice", |
| 577 | "bin/bin2.meta_lic bin/bin2.meta_lic notice", |
| 578 | "highest.apex.meta_lic bin/bin1.meta_lic notice", |
| 579 | "highest.apex.meta_lic bin/bin2.meta_lic notice", |
| 580 | "highest.apex.meta_lic highest.apex.meta_lic notice", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 581 | }, |
| 582 | }, |
| 583 | { |
| 584 | condition: "restricted", |
| 585 | name: "apex_trimmed_share", |
| 586 | roots: []string{"highest.apex.meta_lic"}, |
| 587 | ctx: context{ |
Colin Cross | 35f79c3 | 2022-01-27 15:18:52 -0800 | [diff] [blame] | 588 | conditions: compliance.ImpliesShared.AsList(), |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 589 | stripPrefix: "testdata/restricted/", |
| 590 | }, |
| 591 | expectedOut: []string{ |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 592 | "bin/bin1.meta_lic bin/bin1.meta_lic restricted_allows_dynamic_linking", |
| 593 | "bin/bin1.meta_lic lib/liba.so.meta_lic restricted_allows_dynamic_linking", |
| 594 | "bin/bin1.meta_lic lib/libc.a.meta_lic reciprocal:restricted_allows_dynamic_linking", |
| 595 | "bin/bin2.meta_lic bin/bin2.meta_lic restricted", |
| 596 | "bin/bin2.meta_lic lib/libb.so.meta_lic restricted", |
| 597 | "highest.apex.meta_lic bin/bin1.meta_lic restricted_allows_dynamic_linking", |
| 598 | "highest.apex.meta_lic bin/bin2.meta_lic restricted", |
| 599 | "highest.apex.meta_lic highest.apex.meta_lic restricted:restricted_allows_dynamic_linking", |
| 600 | "highest.apex.meta_lic lib/liba.so.meta_lic restricted_allows_dynamic_linking", |
| 601 | "highest.apex.meta_lic lib/libb.so.meta_lic restricted", |
| 602 | "highest.apex.meta_lic lib/libc.a.meta_lic reciprocal:restricted_allows_dynamic_linking", |
| 603 | "lib/liba.so.meta_lic lib/liba.so.meta_lic restricted_allows_dynamic_linking", |
| 604 | "lib/libb.so.meta_lic lib/libb.so.meta_lic restricted", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 605 | }, |
| 606 | }, |
| 607 | { |
| 608 | condition: "restricted", |
| 609 | name: "apex_trimmed_private", |
| 610 | roots: []string{"highest.apex.meta_lic"}, |
| 611 | ctx: context{ |
Colin Cross | 35f79c3 | 2022-01-27 15:18:52 -0800 | [diff] [blame] | 612 | conditions: compliance.ImpliesPrivate.AsList(), |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 613 | stripPrefix: "testdata/restricted/", |
| 614 | }, |
| 615 | expectedOut: []string{}, |
| 616 | }, |
| 617 | { |
| 618 | condition: "restricted", |
| 619 | name: "apex_trimmed_share_private", |
| 620 | roots: []string{"highest.apex.meta_lic"}, |
| 621 | ctx: context{ |
Colin Cross | 35f79c3 | 2022-01-27 15:18:52 -0800 | [diff] [blame] | 622 | conditions: append(compliance.ImpliesShared.AsList(), compliance.ImpliesPrivate.AsList()...), |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 623 | stripPrefix: "testdata/restricted/", |
| 624 | }, |
| 625 | expectedOut: []string{ |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 626 | "bin/bin1.meta_lic bin/bin1.meta_lic restricted_allows_dynamic_linking", |
| 627 | "bin/bin1.meta_lic lib/liba.so.meta_lic restricted_allows_dynamic_linking", |
| 628 | "bin/bin1.meta_lic lib/libc.a.meta_lic reciprocal:restricted_allows_dynamic_linking", |
| 629 | "bin/bin2.meta_lic bin/bin2.meta_lic restricted", |
| 630 | "bin/bin2.meta_lic lib/libb.so.meta_lic restricted", |
| 631 | "highest.apex.meta_lic bin/bin1.meta_lic restricted_allows_dynamic_linking", |
| 632 | "highest.apex.meta_lic bin/bin2.meta_lic restricted", |
| 633 | "highest.apex.meta_lic highest.apex.meta_lic restricted:restricted_allows_dynamic_linking", |
| 634 | "highest.apex.meta_lic lib/liba.so.meta_lic restricted_allows_dynamic_linking", |
| 635 | "highest.apex.meta_lic lib/libb.so.meta_lic restricted", |
| 636 | "highest.apex.meta_lic lib/libc.a.meta_lic reciprocal:restricted_allows_dynamic_linking", |
| 637 | "lib/liba.so.meta_lic lib/liba.so.meta_lic restricted_allows_dynamic_linking", |
| 638 | "lib/libb.so.meta_lic lib/libb.so.meta_lic restricted", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 639 | }, |
| 640 | }, |
| 641 | { |
| 642 | condition: "restricted", |
| 643 | name: "apex_trimmed_labelled", |
| 644 | roots: []string{"highest.apex.meta_lic"}, |
| 645 | ctx: context{stripPrefix: "testdata/restricted/", labelConditions: true}, |
| 646 | expectedOut: []string{ |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 647 | "bin/bin1.meta_lic:notice bin/bin1.meta_lic:notice notice:restricted_allows_dynamic_linking", |
| 648 | "bin/bin1.meta_lic:notice lib/liba.so.meta_lic:restricted_allows_dynamic_linking restricted_allows_dynamic_linking", |
| 649 | "bin/bin1.meta_lic:notice lib/libc.a.meta_lic:reciprocal reciprocal:restricted_allows_dynamic_linking", |
| 650 | "bin/bin2.meta_lic:notice bin/bin2.meta_lic:notice notice:restricted", |
| 651 | "bin/bin2.meta_lic:notice lib/libb.so.meta_lic:restricted restricted", |
| 652 | "highest.apex.meta_lic:notice bin/bin1.meta_lic:notice notice:restricted_allows_dynamic_linking", |
| 653 | "highest.apex.meta_lic:notice bin/bin2.meta_lic:notice notice:restricted", |
| 654 | "highest.apex.meta_lic:notice highest.apex.meta_lic:notice notice:restricted:restricted_allows_dynamic_linking", |
| 655 | "highest.apex.meta_lic:notice lib/liba.so.meta_lic:restricted_allows_dynamic_linking restricted_allows_dynamic_linking", |
| 656 | "highest.apex.meta_lic:notice lib/libb.so.meta_lic:restricted restricted", |
| 657 | "highest.apex.meta_lic:notice lib/libc.a.meta_lic:reciprocal reciprocal:restricted_allows_dynamic_linking", |
| 658 | "lib/liba.so.meta_lic:restricted_allows_dynamic_linking lib/liba.so.meta_lic:restricted_allows_dynamic_linking restricted_allows_dynamic_linking", |
| 659 | "lib/libb.so.meta_lic:restricted lib/libb.so.meta_lic:restricted restricted", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 660 | }, |
| 661 | }, |
| 662 | { |
| 663 | condition: "restricted", |
| 664 | name: "container", |
| 665 | roots: []string{"container.zip.meta_lic"}, |
| 666 | expectedOut: []string{ |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 667 | "testdata/restricted/bin/bin1.meta_lic testdata/restricted/bin/bin1.meta_lic notice:restricted_allows_dynamic_linking", |
| 668 | "testdata/restricted/bin/bin1.meta_lic testdata/restricted/lib/liba.so.meta_lic restricted_allows_dynamic_linking", |
| 669 | "testdata/restricted/bin/bin1.meta_lic testdata/restricted/lib/libc.a.meta_lic reciprocal:restricted_allows_dynamic_linking", |
| 670 | "testdata/restricted/bin/bin2.meta_lic testdata/restricted/bin/bin2.meta_lic notice:restricted", |
| 671 | "testdata/restricted/bin/bin2.meta_lic testdata/restricted/lib/libb.so.meta_lic restricted", |
| 672 | "testdata/restricted/container.zip.meta_lic testdata/restricted/bin/bin1.meta_lic notice:restricted_allows_dynamic_linking", |
| 673 | "testdata/restricted/container.zip.meta_lic testdata/restricted/bin/bin2.meta_lic notice:restricted", |
| 674 | "testdata/restricted/container.zip.meta_lic testdata/restricted/container.zip.meta_lic notice:restricted:restricted_allows_dynamic_linking", |
| 675 | "testdata/restricted/container.zip.meta_lic testdata/restricted/lib/liba.so.meta_lic restricted_allows_dynamic_linking", |
| 676 | "testdata/restricted/container.zip.meta_lic testdata/restricted/lib/libb.so.meta_lic restricted", |
| 677 | "testdata/restricted/container.zip.meta_lic testdata/restricted/lib/libc.a.meta_lic reciprocal:restricted_allows_dynamic_linking", |
| 678 | "testdata/restricted/lib/liba.so.meta_lic testdata/restricted/lib/liba.so.meta_lic restricted_allows_dynamic_linking", |
| 679 | "testdata/restricted/lib/libb.so.meta_lic testdata/restricted/lib/libb.so.meta_lic restricted", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 680 | }, |
| 681 | }, |
| 682 | { |
| 683 | condition: "restricted", |
| 684 | name: "application", |
| 685 | roots: []string{"application.meta_lic"}, |
| 686 | expectedOut: []string{ |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 687 | "testdata/restricted/application.meta_lic testdata/restricted/application.meta_lic notice:restricted:restricted_allows_dynamic_linking", |
| 688 | "testdata/restricted/application.meta_lic testdata/restricted/lib/liba.so.meta_lic restricted:restricted_allows_dynamic_linking", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 689 | }, |
| 690 | }, |
| 691 | { |
| 692 | condition: "restricted", |
| 693 | name: "binary", |
| 694 | roots: []string{"bin/bin1.meta_lic"}, |
| 695 | expectedOut: []string{ |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 696 | "testdata/restricted/bin/bin1.meta_lic testdata/restricted/bin/bin1.meta_lic notice:restricted_allows_dynamic_linking", |
| 697 | "testdata/restricted/bin/bin1.meta_lic testdata/restricted/lib/liba.so.meta_lic restricted_allows_dynamic_linking", |
| 698 | "testdata/restricted/bin/bin1.meta_lic testdata/restricted/lib/libc.a.meta_lic reciprocal:restricted_allows_dynamic_linking", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 699 | }, |
| 700 | }, |
| 701 | { |
| 702 | condition: "restricted", |
| 703 | name: "library", |
| 704 | roots: []string{"lib/libd.so.meta_lic"}, |
| 705 | expectedOut: []string{ |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 706 | "testdata/restricted/lib/libd.so.meta_lic testdata/restricted/lib/libd.so.meta_lic notice", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 707 | }, |
| 708 | }, |
| 709 | { |
| 710 | condition: "proprietary", |
| 711 | name: "apex", |
| 712 | roots: []string{"highest.apex.meta_lic"}, |
| 713 | expectedOut: []string{ |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 714 | "testdata/proprietary/bin/bin1.meta_lic testdata/proprietary/bin/bin1.meta_lic notice", |
| 715 | "testdata/proprietary/bin/bin1.meta_lic testdata/proprietary/lib/liba.so.meta_lic proprietary:by_exception_only", |
| 716 | "testdata/proprietary/bin/bin1.meta_lic testdata/proprietary/lib/libc.a.meta_lic proprietary:by_exception_only", |
| 717 | "testdata/proprietary/bin/bin2.meta_lic testdata/proprietary/bin/bin2.meta_lic restricted:proprietary:by_exception_only", |
| 718 | "testdata/proprietary/bin/bin2.meta_lic testdata/proprietary/lib/libb.so.meta_lic restricted", |
| 719 | "testdata/proprietary/highest.apex.meta_lic testdata/proprietary/bin/bin1.meta_lic notice", |
| 720 | "testdata/proprietary/highest.apex.meta_lic testdata/proprietary/bin/bin2.meta_lic restricted:proprietary:by_exception_only", |
| 721 | "testdata/proprietary/highest.apex.meta_lic testdata/proprietary/highest.apex.meta_lic notice:restricted", |
| 722 | "testdata/proprietary/highest.apex.meta_lic testdata/proprietary/lib/liba.so.meta_lic proprietary:by_exception_only", |
| 723 | "testdata/proprietary/highest.apex.meta_lic testdata/proprietary/lib/libb.so.meta_lic restricted", |
| 724 | "testdata/proprietary/highest.apex.meta_lic testdata/proprietary/lib/libc.a.meta_lic proprietary:by_exception_only", |
| 725 | "testdata/proprietary/lib/liba.so.meta_lic testdata/proprietary/lib/liba.so.meta_lic proprietary:by_exception_only", |
| 726 | "testdata/proprietary/lib/libb.so.meta_lic testdata/proprietary/lib/libb.so.meta_lic restricted", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 727 | }, |
| 728 | }, |
| 729 | { |
| 730 | condition: "proprietary", |
| 731 | name: "apex_trimmed", |
| 732 | roots: []string{"highest.apex.meta_lic"}, |
| 733 | ctx: context{stripPrefix: "testdata/proprietary/"}, |
| 734 | expectedOut: []string{ |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 735 | "bin/bin1.meta_lic bin/bin1.meta_lic notice", |
| 736 | "bin/bin1.meta_lic lib/liba.so.meta_lic proprietary:by_exception_only", |
| 737 | "bin/bin1.meta_lic lib/libc.a.meta_lic proprietary:by_exception_only", |
| 738 | "bin/bin2.meta_lic bin/bin2.meta_lic restricted:proprietary:by_exception_only", |
| 739 | "bin/bin2.meta_lic lib/libb.so.meta_lic restricted", |
| 740 | "highest.apex.meta_lic bin/bin1.meta_lic notice", |
| 741 | "highest.apex.meta_lic bin/bin2.meta_lic restricted:proprietary:by_exception_only", |
| 742 | "highest.apex.meta_lic highest.apex.meta_lic notice:restricted", |
| 743 | "highest.apex.meta_lic lib/liba.so.meta_lic proprietary:by_exception_only", |
| 744 | "highest.apex.meta_lic lib/libb.so.meta_lic restricted", |
| 745 | "highest.apex.meta_lic lib/libc.a.meta_lic proprietary:by_exception_only", |
| 746 | "lib/liba.so.meta_lic lib/liba.so.meta_lic proprietary:by_exception_only", |
| 747 | "lib/libb.so.meta_lic lib/libb.so.meta_lic restricted", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 748 | }, |
| 749 | }, |
| 750 | { |
| 751 | condition: "proprietary", |
| 752 | name: "apex_trimmed_notice", |
| 753 | roots: []string{"highest.apex.meta_lic"}, |
| 754 | ctx: context{ |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 755 | conditions: []compliance.LicenseCondition{compliance.NoticeCondition}, |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 756 | stripPrefix: "testdata/proprietary/", |
| 757 | }, |
| 758 | expectedOut: []string{ |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 759 | "bin/bin1.meta_lic bin/bin1.meta_lic notice", |
| 760 | "highest.apex.meta_lic bin/bin1.meta_lic notice", |
| 761 | "highest.apex.meta_lic highest.apex.meta_lic notice", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 762 | }, |
| 763 | }, |
| 764 | { |
| 765 | condition: "proprietary", |
| 766 | name: "apex_trimmed_share", |
| 767 | roots: []string{"highest.apex.meta_lic"}, |
| 768 | ctx: context{ |
Colin Cross | 35f79c3 | 2022-01-27 15:18:52 -0800 | [diff] [blame] | 769 | conditions: compliance.ImpliesShared.AsList(), |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 770 | stripPrefix: "testdata/proprietary/", |
| 771 | }, |
| 772 | expectedOut: []string{ |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 773 | "bin/bin2.meta_lic bin/bin2.meta_lic restricted", |
| 774 | "bin/bin2.meta_lic lib/libb.so.meta_lic restricted", |
| 775 | "highest.apex.meta_lic bin/bin2.meta_lic restricted", |
| 776 | "highest.apex.meta_lic highest.apex.meta_lic restricted", |
| 777 | "highest.apex.meta_lic lib/libb.so.meta_lic restricted", |
| 778 | "lib/libb.so.meta_lic lib/libb.so.meta_lic restricted", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 779 | }, |
| 780 | }, |
| 781 | { |
| 782 | condition: "proprietary", |
| 783 | name: "apex_trimmed_private", |
| 784 | roots: []string{"highest.apex.meta_lic"}, |
| 785 | ctx: context{ |
Colin Cross | 35f79c3 | 2022-01-27 15:18:52 -0800 | [diff] [blame] | 786 | conditions: compliance.ImpliesPrivate.AsList(), |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 787 | stripPrefix: "testdata/proprietary/", |
| 788 | }, |
| 789 | expectedOut: []string{ |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 790 | "bin/bin1.meta_lic lib/liba.so.meta_lic proprietary", |
| 791 | "bin/bin1.meta_lic lib/libc.a.meta_lic proprietary", |
| 792 | "bin/bin2.meta_lic bin/bin2.meta_lic proprietary", |
| 793 | "highest.apex.meta_lic bin/bin2.meta_lic proprietary", |
| 794 | "highest.apex.meta_lic lib/liba.so.meta_lic proprietary", |
| 795 | "highest.apex.meta_lic lib/libc.a.meta_lic proprietary", |
| 796 | "lib/liba.so.meta_lic lib/liba.so.meta_lic proprietary", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 797 | }, |
| 798 | }, |
| 799 | { |
| 800 | condition: "proprietary", |
| 801 | name: "apex_trimmed_share_private", |
| 802 | roots: []string{"highest.apex.meta_lic"}, |
| 803 | ctx: context{ |
Colin Cross | 35f79c3 | 2022-01-27 15:18:52 -0800 | [diff] [blame] | 804 | conditions: append(compliance.ImpliesShared.AsList(), compliance.ImpliesPrivate.AsList()...), |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 805 | stripPrefix: "testdata/proprietary/", |
| 806 | }, |
| 807 | expectedOut: []string{ |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 808 | "bin/bin1.meta_lic lib/liba.so.meta_lic proprietary", |
| 809 | "bin/bin1.meta_lic lib/libc.a.meta_lic proprietary", |
| 810 | "bin/bin2.meta_lic bin/bin2.meta_lic restricted:proprietary", |
| 811 | "bin/bin2.meta_lic lib/libb.so.meta_lic restricted", |
| 812 | "highest.apex.meta_lic bin/bin2.meta_lic restricted:proprietary", |
| 813 | "highest.apex.meta_lic highest.apex.meta_lic restricted", |
| 814 | "highest.apex.meta_lic lib/liba.so.meta_lic proprietary", |
| 815 | "highest.apex.meta_lic lib/libb.so.meta_lic restricted", |
| 816 | "highest.apex.meta_lic lib/libc.a.meta_lic proprietary", |
| 817 | "lib/liba.so.meta_lic lib/liba.so.meta_lic proprietary", |
| 818 | "lib/libb.so.meta_lic lib/libb.so.meta_lic restricted", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 819 | }, |
| 820 | }, |
| 821 | { |
| 822 | condition: "proprietary", |
| 823 | name: "apex_trimmed_labelled", |
| 824 | roots: []string{"highest.apex.meta_lic"}, |
| 825 | ctx: context{stripPrefix: "testdata/proprietary/", labelConditions: true}, |
| 826 | expectedOut: []string{ |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 827 | "bin/bin1.meta_lic:notice bin/bin1.meta_lic:notice notice", |
| 828 | "bin/bin1.meta_lic:notice lib/liba.so.meta_lic:proprietary:by_exception_only proprietary:by_exception_only", |
| 829 | "bin/bin1.meta_lic:notice lib/libc.a.meta_lic:proprietary:by_exception_only proprietary:by_exception_only", |
| 830 | "bin/bin2.meta_lic:proprietary:by_exception_only bin/bin2.meta_lic:proprietary:by_exception_only restricted:proprietary:by_exception_only", |
| 831 | "bin/bin2.meta_lic:proprietary:by_exception_only lib/libb.so.meta_lic:restricted restricted", |
| 832 | "highest.apex.meta_lic:notice bin/bin1.meta_lic:notice notice", |
| 833 | "highest.apex.meta_lic:notice bin/bin2.meta_lic:proprietary:by_exception_only restricted:proprietary:by_exception_only", |
| 834 | "highest.apex.meta_lic:notice highest.apex.meta_lic:notice notice:restricted", |
| 835 | "highest.apex.meta_lic:notice lib/liba.so.meta_lic:proprietary:by_exception_only proprietary:by_exception_only", |
| 836 | "highest.apex.meta_lic:notice lib/libb.so.meta_lic:restricted restricted", |
| 837 | "highest.apex.meta_lic:notice lib/libc.a.meta_lic:proprietary:by_exception_only proprietary:by_exception_only", |
| 838 | "lib/liba.so.meta_lic:proprietary:by_exception_only lib/liba.so.meta_lic:proprietary:by_exception_only proprietary:by_exception_only", |
| 839 | "lib/libb.so.meta_lic:restricted lib/libb.so.meta_lic:restricted restricted", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 840 | }, |
| 841 | }, |
| 842 | { |
| 843 | condition: "proprietary", |
| 844 | name: "container", |
| 845 | roots: []string{"container.zip.meta_lic"}, |
| 846 | expectedOut: []string{ |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 847 | "testdata/proprietary/bin/bin1.meta_lic testdata/proprietary/bin/bin1.meta_lic notice", |
| 848 | "testdata/proprietary/bin/bin1.meta_lic testdata/proprietary/lib/liba.so.meta_lic proprietary:by_exception_only", |
| 849 | "testdata/proprietary/bin/bin1.meta_lic testdata/proprietary/lib/libc.a.meta_lic proprietary:by_exception_only", |
| 850 | "testdata/proprietary/bin/bin2.meta_lic testdata/proprietary/bin/bin2.meta_lic restricted:proprietary:by_exception_only", |
| 851 | "testdata/proprietary/bin/bin2.meta_lic testdata/proprietary/lib/libb.so.meta_lic restricted", |
| 852 | "testdata/proprietary/container.zip.meta_lic testdata/proprietary/bin/bin1.meta_lic notice", |
| 853 | "testdata/proprietary/container.zip.meta_lic testdata/proprietary/bin/bin2.meta_lic restricted:proprietary:by_exception_only", |
| 854 | "testdata/proprietary/container.zip.meta_lic testdata/proprietary/container.zip.meta_lic notice:restricted", |
| 855 | "testdata/proprietary/container.zip.meta_lic testdata/proprietary/lib/liba.so.meta_lic proprietary:by_exception_only", |
| 856 | "testdata/proprietary/container.zip.meta_lic testdata/proprietary/lib/libb.so.meta_lic restricted", |
| 857 | "testdata/proprietary/container.zip.meta_lic testdata/proprietary/lib/libc.a.meta_lic proprietary:by_exception_only", |
| 858 | "testdata/proprietary/lib/liba.so.meta_lic testdata/proprietary/lib/liba.so.meta_lic proprietary:by_exception_only", |
| 859 | "testdata/proprietary/lib/libb.so.meta_lic testdata/proprietary/lib/libb.so.meta_lic restricted", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 860 | }, |
| 861 | }, |
| 862 | { |
| 863 | condition: "proprietary", |
| 864 | name: "application", |
| 865 | roots: []string{"application.meta_lic"}, |
| 866 | expectedOut: []string{ |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 867 | "testdata/proprietary/application.meta_lic testdata/proprietary/application.meta_lic notice:restricted", |
| 868 | "testdata/proprietary/application.meta_lic testdata/proprietary/lib/liba.so.meta_lic restricted:proprietary:by_exception_only", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 869 | }, |
| 870 | }, |
| 871 | { |
| 872 | condition: "proprietary", |
| 873 | name: "binary", |
| 874 | roots: []string{"bin/bin1.meta_lic"}, |
| 875 | expectedOut: []string{ |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 876 | "testdata/proprietary/bin/bin1.meta_lic testdata/proprietary/bin/bin1.meta_lic notice", |
| 877 | "testdata/proprietary/bin/bin1.meta_lic testdata/proprietary/lib/liba.so.meta_lic proprietary:by_exception_only", |
| 878 | "testdata/proprietary/bin/bin1.meta_lic testdata/proprietary/lib/libc.a.meta_lic proprietary:by_exception_only", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 879 | }, |
| 880 | }, |
| 881 | { |
| 882 | condition: "proprietary", |
| 883 | name: "library", |
| 884 | roots: []string{"lib/libd.so.meta_lic"}, |
| 885 | expectedOut: []string{ |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 886 | "testdata/proprietary/lib/libd.so.meta_lic testdata/proprietary/lib/libd.so.meta_lic notice", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 887 | }, |
| 888 | }, |
| 889 | } |
| 890 | for _, tt := range tests { |
| 891 | t.Run(tt.condition+" "+tt.name, func(t *testing.T) { |
| 892 | expectedOut := &bytes.Buffer{} |
| 893 | for _, eo := range tt.expectedOut { |
| 894 | expectedOut.WriteString(eo) |
| 895 | expectedOut.WriteString("\n") |
| 896 | } |
| 897 | |
| 898 | stdout := &bytes.Buffer{} |
| 899 | stderr := &bytes.Buffer{} |
| 900 | |
| 901 | rootFiles := make([]string, 0, len(tt.roots)) |
| 902 | for _, r := range tt.roots { |
| 903 | rootFiles = append(rootFiles, "testdata/"+tt.condition+"/"+r) |
| 904 | } |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 905 | _, err := dumpResolutions(&tt.ctx, stdout, stderr, rootFiles...) |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 906 | if err != nil { |
| 907 | t.Fatalf("dumpresolutions: error = %v, stderr = %v", err, stderr) |
| 908 | return |
| 909 | } |
| 910 | if stderr.Len() > 0 { |
| 911 | t.Errorf("dumpresolutions: gotStderr = %v, want none", stderr) |
| 912 | } |
| 913 | out := stdout.String() |
| 914 | expected := expectedOut.String() |
| 915 | if out != expected { |
| 916 | outList := strings.Split(out, "\n") |
| 917 | expectedList := strings.Split(expected, "\n") |
| 918 | startLine := 0 |
| 919 | for len(outList) > startLine && len(expectedList) > startLine && outList[startLine] == expectedList[startLine] { |
| 920 | startLine++ |
| 921 | } |
Bob Badour | 91af68b | 2022-01-31 13:11:11 -0800 | [diff] [blame^] | 922 | t.Errorf("dumpresoliutions: gotStdout = %v, want %v, somewhere near line %d Stdout = %v, want %v", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 923 | out, expected, startLine+1, outList[startLine], expectedList[startLine]) |
| 924 | } |
| 925 | }) |
| 926 | } |
| 927 | } |
| 928 | |
| 929 | type testContext struct { |
| 930 | nextNode int |
| 931 | nodes map[string]string |
| 932 | } |
| 933 | |
| 934 | type matcher interface { |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 935 | matchString(*testContext, *compliance.LicenseGraph) string |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 936 | typeString() string |
| 937 | } |
| 938 | |
| 939 | type targetMatcher struct { |
| 940 | target string |
| 941 | conditions []string |
| 942 | } |
| 943 | |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 944 | // newTestCondition constructs a test license condition in the license graph. |
Colin Cross | 35f79c3 | 2022-01-27 15:18:52 -0800 | [diff] [blame] | 945 | func newTestCondition(lg *compliance.LicenseGraph, conditionName ...string) compliance.LicenseConditionSet { |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 946 | cs := compliance.NewLicenseConditionSet() |
| 947 | for _, name := range conditionName { |
| 948 | cs = cs.Plus(compliance.RecognizedConditionNames[name]) |
| 949 | } |
| 950 | if cs.IsEmpty() && len(conditionName) != 0 { |
| 951 | panic(fmt.Errorf("attempt to create unrecognized condition: %q", conditionName)) |
| 952 | } |
| 953 | return cs |
| 954 | } |
| 955 | |
| 956 | func (tm *targetMatcher) matchString(ctx *testContext, lg *compliance.LicenseGraph) string { |
| 957 | cs := newTestCondition(lg, tm.conditions...) |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 958 | m := tm.target |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 959 | if !cs.IsEmpty() { |
| 960 | m += "\\n" + strings.Join(cs.Names(), "\\n") |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 961 | } |
| 962 | m = ctx.nodes[tm.target] + " [label=\"" + m + "\"];" |
| 963 | return m |
| 964 | } |
| 965 | |
| 966 | func (tm *targetMatcher) typeString() string { |
| 967 | return "target" |
| 968 | } |
| 969 | |
| 970 | type resolutionMatcher struct { |
| 971 | appliesTo string |
| 972 | actsOn string |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 973 | conditions []string |
| 974 | } |
| 975 | |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 976 | func (rm *resolutionMatcher) matchString(ctx *testContext, lg *compliance.LicenseGraph) string { |
| 977 | cs := newTestCondition(lg, rm.conditions...) |
| 978 | return ctx.nodes[rm.appliesTo] + " -> " + ctx.nodes[rm.actsOn] + |
| 979 | " [label=\"" + strings.Join(cs.Names(), "\\n") + "\"];" |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 980 | } |
| 981 | |
| 982 | func (rm *resolutionMatcher) typeString() string { |
| 983 | return "resolution" |
| 984 | } |
| 985 | |
| 986 | type getMatcher func(*testContext) matcher |
| 987 | |
| 988 | func matchTarget(target string, conditions ...string) getMatcher { |
| 989 | return func(ctx *testContext) matcher { |
| 990 | ctx.nodes[target] = fmt.Sprintf("n%d", ctx.nextNode) |
| 991 | ctx.nextNode++ |
| 992 | return &targetMatcher{target, append([]string{}, conditions...)} |
| 993 | } |
| 994 | } |
| 995 | |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 996 | func matchResolution(appliesTo, actsOn string, conditions ...string) getMatcher { |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 997 | return func(ctx *testContext) matcher { |
| 998 | if _, ok := ctx.nodes[appliesTo]; !ok { |
| 999 | ctx.nodes[appliesTo] = fmt.Sprintf("unknown%d", ctx.nextNode) |
| 1000 | ctx.nextNode++ |
| 1001 | } |
| 1002 | if _, ok := ctx.nodes[actsOn]; !ok { |
| 1003 | ctx.nodes[actsOn] = fmt.Sprintf("unknown%d", ctx.nextNode) |
| 1004 | ctx.nextNode++ |
| 1005 | } |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 1006 | return &resolutionMatcher{appliesTo, actsOn, append([]string{}, conditions...)} |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1007 | } |
| 1008 | } |
| 1009 | |
| 1010 | func Test_graphviz(t *testing.T) { |
| 1011 | tests := []struct { |
| 1012 | condition string |
| 1013 | name string |
| 1014 | roots []string |
| 1015 | ctx context |
| 1016 | expectedOut []getMatcher |
| 1017 | }{ |
| 1018 | { |
| 1019 | condition: "firstparty", |
| 1020 | name: "apex", |
| 1021 | roots: []string{"highest.apex.meta_lic"}, |
| 1022 | expectedOut: []getMatcher{ |
| 1023 | matchTarget("testdata/firstparty/bin/bin1.meta_lic"), |
| 1024 | matchTarget("testdata/firstparty/lib/liba.so.meta_lic"), |
| 1025 | matchTarget("testdata/firstparty/lib/libc.a.meta_lic"), |
| 1026 | matchTarget("testdata/firstparty/bin/bin2.meta_lic"), |
| 1027 | matchTarget("testdata/firstparty/highest.apex.meta_lic"), |
| 1028 | matchTarget("testdata/firstparty/lib/libb.so.meta_lic"), |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1029 | matchResolution( |
| 1030 | "testdata/firstparty/bin/bin1.meta_lic", |
| 1031 | "testdata/firstparty/bin/bin1.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1032 | "notice"), |
| 1033 | matchResolution( |
| 1034 | "testdata/firstparty/bin/bin1.meta_lic", |
| 1035 | "testdata/firstparty/lib/liba.so.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1036 | "notice"), |
| 1037 | matchResolution( |
| 1038 | "testdata/firstparty/bin/bin1.meta_lic", |
| 1039 | "testdata/firstparty/lib/libc.a.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1040 | "notice"), |
| 1041 | matchResolution( |
| 1042 | "testdata/firstparty/bin/bin2.meta_lic", |
| 1043 | "testdata/firstparty/bin/bin2.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1044 | "notice"), |
| 1045 | matchResolution( |
| 1046 | "testdata/firstparty/highest.apex.meta_lic", |
| 1047 | "testdata/firstparty/bin/bin1.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1048 | "notice"), |
| 1049 | matchResolution( |
| 1050 | "testdata/firstparty/highest.apex.meta_lic", |
| 1051 | "testdata/firstparty/bin/bin2.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1052 | "notice"), |
| 1053 | matchResolution( |
| 1054 | "testdata/firstparty/highest.apex.meta_lic", |
| 1055 | "testdata/firstparty/highest.apex.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1056 | "notice"), |
| 1057 | matchResolution( |
| 1058 | "testdata/firstparty/highest.apex.meta_lic", |
| 1059 | "testdata/firstparty/lib/liba.so.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1060 | "notice"), |
| 1061 | matchResolution( |
| 1062 | "testdata/firstparty/highest.apex.meta_lic", |
| 1063 | "testdata/firstparty/lib/libb.so.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1064 | "notice"), |
| 1065 | matchResolution( |
| 1066 | "testdata/firstparty/highest.apex.meta_lic", |
| 1067 | "testdata/firstparty/lib/libc.a.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1068 | "notice"), |
| 1069 | matchResolution( |
| 1070 | "testdata/firstparty/lib/liba.so.meta_lic", |
| 1071 | "testdata/firstparty/lib/liba.so.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1072 | "notice"), |
| 1073 | matchResolution( |
| 1074 | "testdata/firstparty/lib/libb.so.meta_lic", |
| 1075 | "testdata/firstparty/lib/libb.so.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1076 | "notice"), |
| 1077 | }, |
| 1078 | }, |
| 1079 | { |
| 1080 | condition: "firstparty", |
| 1081 | name: "apex_trimmed", |
| 1082 | roots: []string{"highest.apex.meta_lic"}, |
| 1083 | ctx: context{stripPrefix: "testdata/firstparty/"}, |
| 1084 | expectedOut: []getMatcher{ |
| 1085 | matchTarget("bin/bin1.meta_lic"), |
| 1086 | matchTarget("lib/liba.so.meta_lic"), |
| 1087 | matchTarget("lib/libc.a.meta_lic"), |
| 1088 | matchTarget("bin/bin2.meta_lic"), |
| 1089 | matchTarget("highest.apex.meta_lic"), |
| 1090 | matchTarget("lib/libb.so.meta_lic"), |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1091 | matchResolution( |
| 1092 | "bin/bin1.meta_lic", |
| 1093 | "bin/bin1.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1094 | "notice"), |
| 1095 | matchResolution( |
| 1096 | "bin/bin1.meta_lic", |
| 1097 | "lib/liba.so.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1098 | "notice"), |
| 1099 | matchResolution( |
| 1100 | "bin/bin1.meta_lic", |
| 1101 | "lib/libc.a.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1102 | "notice"), |
| 1103 | matchResolution( |
| 1104 | "bin/bin2.meta_lic", |
| 1105 | "bin/bin2.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1106 | "notice"), |
| 1107 | matchResolution( |
| 1108 | "highest.apex.meta_lic", |
| 1109 | "bin/bin1.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1110 | "notice"), |
| 1111 | matchResolution( |
| 1112 | "highest.apex.meta_lic", |
| 1113 | "bin/bin2.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1114 | "notice"), |
| 1115 | matchResolution( |
| 1116 | "highest.apex.meta_lic", |
| 1117 | "highest.apex.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1118 | "notice"), |
| 1119 | matchResolution( |
| 1120 | "highest.apex.meta_lic", |
| 1121 | "lib/liba.so.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1122 | "notice"), |
| 1123 | matchResolution( |
| 1124 | "highest.apex.meta_lic", |
| 1125 | "lib/libb.so.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1126 | "notice"), |
| 1127 | matchResolution( |
| 1128 | "highest.apex.meta_lic", |
| 1129 | "lib/libc.a.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1130 | "notice"), |
| 1131 | matchResolution( |
| 1132 | "lib/liba.so.meta_lic", |
| 1133 | "lib/liba.so.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1134 | "notice"), |
| 1135 | matchResolution( |
| 1136 | "lib/libb.so.meta_lic", |
| 1137 | "lib/libb.so.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1138 | "notice"), |
| 1139 | }, |
| 1140 | }, |
| 1141 | { |
| 1142 | condition: "firstparty", |
| 1143 | name: "apex_trimmed_notice", |
| 1144 | roots: []string{"highest.apex.meta_lic"}, |
| 1145 | ctx: context{ |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 1146 | conditions: []compliance.LicenseCondition{compliance.NoticeCondition}, |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1147 | stripPrefix: "testdata/firstparty/", |
| 1148 | }, |
| 1149 | expectedOut: []getMatcher{ |
| 1150 | matchTarget("bin/bin1.meta_lic"), |
| 1151 | matchTarget("lib/liba.so.meta_lic"), |
| 1152 | matchTarget("lib/libc.a.meta_lic"), |
| 1153 | matchTarget("bin/bin2.meta_lic"), |
| 1154 | matchTarget("highest.apex.meta_lic"), |
| 1155 | matchTarget("lib/libb.so.meta_lic"), |
| 1156 | matchResolution( |
| 1157 | "bin/bin1.meta_lic", |
| 1158 | "bin/bin1.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1159 | "notice"), |
| 1160 | matchResolution( |
| 1161 | "bin/bin1.meta_lic", |
| 1162 | "lib/liba.so.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1163 | "notice"), |
| 1164 | matchResolution( |
| 1165 | "bin/bin1.meta_lic", |
| 1166 | "lib/libc.a.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1167 | "notice"), |
| 1168 | matchResolution( |
| 1169 | "bin/bin2.meta_lic", |
| 1170 | "bin/bin2.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1171 | "notice"), |
| 1172 | matchResolution( |
| 1173 | "highest.apex.meta_lic", |
| 1174 | "bin/bin1.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1175 | "notice"), |
| 1176 | matchResolution( |
| 1177 | "highest.apex.meta_lic", |
| 1178 | "bin/bin2.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1179 | "notice"), |
| 1180 | matchResolution( |
| 1181 | "highest.apex.meta_lic", |
| 1182 | "highest.apex.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1183 | "notice"), |
| 1184 | matchResolution( |
| 1185 | "highest.apex.meta_lic", |
| 1186 | "lib/liba.so.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1187 | "notice"), |
| 1188 | matchResolution( |
| 1189 | "highest.apex.meta_lic", |
| 1190 | "lib/libb.so.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1191 | "notice"), |
| 1192 | matchResolution( |
| 1193 | "highest.apex.meta_lic", |
| 1194 | "lib/libc.a.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1195 | "notice"), |
| 1196 | matchResolution( |
| 1197 | "lib/liba.so.meta_lic", |
| 1198 | "lib/liba.so.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1199 | "notice"), |
| 1200 | matchResolution( |
| 1201 | "lib/libb.so.meta_lic", |
| 1202 | "lib/libb.so.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1203 | "notice"), |
| 1204 | }, |
| 1205 | }, |
| 1206 | { |
| 1207 | condition: "firstparty", |
| 1208 | name: "apex_trimmed_share", |
| 1209 | roots: []string{"highest.apex.meta_lic"}, |
| 1210 | ctx: context{ |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 1211 | conditions: compliance.ImpliesShared.AsList(), |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1212 | stripPrefix: "testdata/firstparty/", |
| 1213 | }, |
| 1214 | expectedOut: []getMatcher{}, |
| 1215 | }, |
| 1216 | { |
| 1217 | condition: "firstparty", |
| 1218 | name: "apex_trimmed_private", |
| 1219 | roots: []string{"highest.apex.meta_lic"}, |
| 1220 | ctx: context{ |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 1221 | conditions: compliance.ImpliesPrivate.AsList(), |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1222 | stripPrefix: "testdata/firstparty/", |
| 1223 | }, |
| 1224 | expectedOut: []getMatcher{}, |
| 1225 | }, |
| 1226 | { |
| 1227 | condition: "firstparty", |
| 1228 | name: "apex_trimmed_share_private", |
| 1229 | roots: []string{"highest.apex.meta_lic"}, |
| 1230 | ctx: context{ |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 1231 | conditions: compliance.ImpliesShared.Union(compliance.ImpliesPrivate).AsList(), |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1232 | stripPrefix: "testdata/firstparty/", |
| 1233 | }, |
| 1234 | expectedOut: []getMatcher{}, |
| 1235 | }, |
| 1236 | { |
| 1237 | condition: "firstparty", |
| 1238 | name: "apex_trimmed_labelled", |
| 1239 | roots: []string{"highest.apex.meta_lic"}, |
| 1240 | ctx: context{stripPrefix: "testdata/firstparty/", labelConditions: true}, |
| 1241 | expectedOut: []getMatcher{ |
| 1242 | matchTarget("bin/bin1.meta_lic", "notice"), |
| 1243 | matchTarget("lib/liba.so.meta_lic", "notice"), |
| 1244 | matchTarget("lib/libc.a.meta_lic", "notice"), |
| 1245 | matchTarget("bin/bin2.meta_lic", "notice"), |
| 1246 | matchTarget("highest.apex.meta_lic", "notice"), |
| 1247 | matchTarget("lib/libb.so.meta_lic", "notice"), |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1248 | matchResolution( |
| 1249 | "bin/bin1.meta_lic", |
| 1250 | "bin/bin1.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1251 | "notice"), |
| 1252 | matchResolution( |
| 1253 | "bin/bin1.meta_lic", |
| 1254 | "lib/liba.so.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1255 | "notice"), |
| 1256 | matchResolution( |
| 1257 | "bin/bin1.meta_lic", |
| 1258 | "lib/libc.a.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1259 | "notice"), |
| 1260 | matchResolution( |
| 1261 | "bin/bin2.meta_lic", |
| 1262 | "bin/bin2.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1263 | "notice"), |
| 1264 | matchResolution( |
| 1265 | "highest.apex.meta_lic", |
| 1266 | "bin/bin1.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1267 | "notice"), |
| 1268 | matchResolution( |
| 1269 | "highest.apex.meta_lic", |
| 1270 | "bin/bin2.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1271 | "notice"), |
| 1272 | matchResolution( |
| 1273 | "highest.apex.meta_lic", |
| 1274 | "highest.apex.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1275 | "notice"), |
| 1276 | matchResolution( |
| 1277 | "highest.apex.meta_lic", |
| 1278 | "lib/liba.so.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1279 | "notice"), |
| 1280 | matchResolution( |
| 1281 | "highest.apex.meta_lic", |
| 1282 | "lib/libb.so.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1283 | "notice"), |
| 1284 | matchResolution( |
| 1285 | "highest.apex.meta_lic", |
| 1286 | "lib/libc.a.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1287 | "notice"), |
| 1288 | matchResolution( |
| 1289 | "lib/liba.so.meta_lic", |
| 1290 | "lib/liba.so.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1291 | "notice"), |
| 1292 | matchResolution( |
| 1293 | "lib/libb.so.meta_lic", |
| 1294 | "lib/libb.so.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1295 | "notice"), |
| 1296 | }, |
| 1297 | }, |
| 1298 | { |
| 1299 | condition: "firstparty", |
| 1300 | name: "container", |
| 1301 | roots: []string{"container.zip.meta_lic"}, |
| 1302 | expectedOut: []getMatcher{ |
| 1303 | matchTarget("testdata/firstparty/bin/bin1.meta_lic"), |
| 1304 | matchTarget("testdata/firstparty/lib/liba.so.meta_lic"), |
| 1305 | matchTarget("testdata/firstparty/lib/libc.a.meta_lic"), |
| 1306 | matchTarget("testdata/firstparty/bin/bin2.meta_lic"), |
| 1307 | matchTarget("testdata/firstparty/container.zip.meta_lic"), |
| 1308 | matchTarget("testdata/firstparty/lib/libb.so.meta_lic"), |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1309 | matchResolution( |
| 1310 | "testdata/firstparty/bin/bin1.meta_lic", |
| 1311 | "testdata/firstparty/bin/bin1.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1312 | "notice"), |
| 1313 | matchResolution( |
| 1314 | "testdata/firstparty/bin/bin1.meta_lic", |
| 1315 | "testdata/firstparty/lib/liba.so.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1316 | "notice"), |
| 1317 | matchResolution( |
| 1318 | "testdata/firstparty/bin/bin1.meta_lic", |
| 1319 | "testdata/firstparty/lib/libc.a.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1320 | "notice"), |
| 1321 | matchResolution( |
| 1322 | "testdata/firstparty/bin/bin2.meta_lic", |
| 1323 | "testdata/firstparty/bin/bin2.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1324 | "notice"), |
| 1325 | matchResolution( |
| 1326 | "testdata/firstparty/container.zip.meta_lic", |
| 1327 | "testdata/firstparty/bin/bin1.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1328 | "notice"), |
| 1329 | matchResolution( |
| 1330 | "testdata/firstparty/container.zip.meta_lic", |
| 1331 | "testdata/firstparty/bin/bin2.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1332 | "notice"), |
| 1333 | matchResolution( |
| 1334 | "testdata/firstparty/container.zip.meta_lic", |
| 1335 | "testdata/firstparty/container.zip.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1336 | "notice"), |
| 1337 | matchResolution( |
| 1338 | "testdata/firstparty/container.zip.meta_lic", |
| 1339 | "testdata/firstparty/lib/liba.so.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1340 | "notice"), |
| 1341 | matchResolution( |
| 1342 | "testdata/firstparty/container.zip.meta_lic", |
| 1343 | "testdata/firstparty/lib/libb.so.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1344 | "notice"), |
| 1345 | matchResolution( |
| 1346 | "testdata/firstparty/container.zip.meta_lic", |
| 1347 | "testdata/firstparty/lib/libc.a.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1348 | "notice"), |
| 1349 | matchResolution( |
| 1350 | "testdata/firstparty/lib/liba.so.meta_lic", |
| 1351 | "testdata/firstparty/lib/liba.so.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1352 | "notice"), |
| 1353 | matchResolution( |
| 1354 | "testdata/firstparty/lib/libb.so.meta_lic", |
| 1355 | "testdata/firstparty/lib/libb.so.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1356 | "notice"), |
| 1357 | }, |
| 1358 | }, |
| 1359 | { |
| 1360 | condition: "firstparty", |
| 1361 | name: "application", |
| 1362 | roots: []string{"application.meta_lic"}, |
| 1363 | expectedOut: []getMatcher{ |
| 1364 | matchTarget("testdata/firstparty/application.meta_lic"), |
| 1365 | matchTarget("testdata/firstparty/lib/liba.so.meta_lic"), |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1366 | matchResolution( |
| 1367 | "testdata/firstparty/application.meta_lic", |
| 1368 | "testdata/firstparty/application.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1369 | "notice"), |
| 1370 | matchResolution( |
| 1371 | "testdata/firstparty/application.meta_lic", |
| 1372 | "testdata/firstparty/lib/liba.so.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1373 | "notice"), |
| 1374 | }, |
| 1375 | }, |
| 1376 | { |
| 1377 | condition: "firstparty", |
| 1378 | name: "binary", |
| 1379 | roots: []string{"bin/bin1.meta_lic"}, |
| 1380 | expectedOut: []getMatcher{ |
| 1381 | matchTarget("testdata/firstparty/bin/bin1.meta_lic"), |
| 1382 | matchTarget("testdata/firstparty/lib/liba.so.meta_lic"), |
| 1383 | matchTarget("testdata/firstparty/lib/libc.a.meta_lic"), |
| 1384 | matchResolution( |
| 1385 | "testdata/firstparty/bin/bin1.meta_lic", |
| 1386 | "testdata/firstparty/bin/bin1.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1387 | "notice"), |
| 1388 | matchResolution( |
| 1389 | "testdata/firstparty/bin/bin1.meta_lic", |
| 1390 | "testdata/firstparty/lib/liba.so.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1391 | "notice"), |
| 1392 | matchResolution( |
| 1393 | "testdata/firstparty/bin/bin1.meta_lic", |
| 1394 | "testdata/firstparty/lib/libc.a.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1395 | "notice"), |
| 1396 | }, |
| 1397 | }, |
| 1398 | { |
| 1399 | condition: "firstparty", |
| 1400 | name: "library", |
| 1401 | roots: []string{"lib/libd.so.meta_lic"}, |
| 1402 | expectedOut: []getMatcher{ |
| 1403 | matchTarget("testdata/firstparty/lib/libd.so.meta_lic"), |
| 1404 | matchResolution( |
| 1405 | "testdata/firstparty/lib/libd.so.meta_lic", |
| 1406 | "testdata/firstparty/lib/libd.so.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1407 | "notice"), |
| 1408 | }, |
| 1409 | }, |
| 1410 | { |
| 1411 | condition: "notice", |
| 1412 | name: "apex", |
| 1413 | roots: []string{"highest.apex.meta_lic"}, |
| 1414 | expectedOut: []getMatcher{ |
| 1415 | matchTarget("testdata/notice/bin/bin1.meta_lic"), |
| 1416 | matchTarget("testdata/notice/lib/liba.so.meta_lic"), |
| 1417 | matchTarget("testdata/notice/lib/libc.a.meta_lic"), |
| 1418 | matchTarget("testdata/notice/bin/bin2.meta_lic"), |
| 1419 | matchTarget("testdata/notice/highest.apex.meta_lic"), |
| 1420 | matchTarget("testdata/notice/lib/libb.so.meta_lic"), |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1421 | matchResolution( |
| 1422 | "testdata/notice/bin/bin1.meta_lic", |
| 1423 | "testdata/notice/bin/bin1.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1424 | "notice"), |
| 1425 | matchResolution( |
| 1426 | "testdata/notice/bin/bin1.meta_lic", |
| 1427 | "testdata/notice/lib/liba.so.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1428 | "notice"), |
| 1429 | matchResolution( |
| 1430 | "testdata/notice/bin/bin1.meta_lic", |
| 1431 | "testdata/notice/lib/libc.a.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1432 | "notice"), |
| 1433 | matchResolution( |
| 1434 | "testdata/notice/bin/bin2.meta_lic", |
| 1435 | "testdata/notice/bin/bin2.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1436 | "notice"), |
| 1437 | matchResolution( |
| 1438 | "testdata/notice/highest.apex.meta_lic", |
| 1439 | "testdata/notice/bin/bin1.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1440 | "notice"), |
| 1441 | matchResolution( |
| 1442 | "testdata/notice/highest.apex.meta_lic", |
| 1443 | "testdata/notice/bin/bin2.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1444 | "notice"), |
| 1445 | matchResolution( |
| 1446 | "testdata/notice/highest.apex.meta_lic", |
| 1447 | "testdata/notice/highest.apex.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1448 | "notice"), |
| 1449 | matchResolution( |
| 1450 | "testdata/notice/highest.apex.meta_lic", |
| 1451 | "testdata/notice/lib/liba.so.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1452 | "notice"), |
| 1453 | matchResolution( |
| 1454 | "testdata/notice/highest.apex.meta_lic", |
| 1455 | "testdata/notice/lib/libb.so.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1456 | "notice"), |
| 1457 | matchResolution( |
| 1458 | "testdata/notice/highest.apex.meta_lic", |
| 1459 | "testdata/notice/lib/libc.a.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1460 | "notice"), |
| 1461 | matchResolution( |
| 1462 | "testdata/notice/lib/liba.so.meta_lic", |
| 1463 | "testdata/notice/lib/liba.so.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1464 | "notice"), |
| 1465 | matchResolution( |
| 1466 | "testdata/notice/lib/libb.so.meta_lic", |
| 1467 | "testdata/notice/lib/libb.so.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1468 | "notice"), |
| 1469 | }, |
| 1470 | }, |
| 1471 | { |
| 1472 | condition: "notice", |
| 1473 | name: "apex_trimmed", |
| 1474 | roots: []string{"highest.apex.meta_lic"}, |
| 1475 | ctx: context{stripPrefix: "testdata/notice/"}, |
| 1476 | expectedOut: []getMatcher{ |
| 1477 | matchTarget("bin/bin1.meta_lic"), |
| 1478 | matchTarget("lib/liba.so.meta_lic"), |
| 1479 | matchTarget("lib/libc.a.meta_lic"), |
| 1480 | matchTarget("bin/bin2.meta_lic"), |
| 1481 | matchTarget("highest.apex.meta_lic"), |
| 1482 | matchTarget("lib/libb.so.meta_lic"), |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1483 | matchResolution( |
| 1484 | "bin/bin1.meta_lic", |
| 1485 | "bin/bin1.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1486 | "notice"), |
| 1487 | matchResolution( |
| 1488 | "bin/bin1.meta_lic", |
| 1489 | "lib/liba.so.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1490 | "notice"), |
| 1491 | matchResolution( |
| 1492 | "bin/bin1.meta_lic", |
| 1493 | "lib/libc.a.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1494 | "notice"), |
| 1495 | matchResolution( |
| 1496 | "bin/bin2.meta_lic", |
| 1497 | "bin/bin2.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1498 | "notice"), |
| 1499 | matchResolution( |
| 1500 | "highest.apex.meta_lic", |
| 1501 | "bin/bin1.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1502 | "notice"), |
| 1503 | matchResolution( |
| 1504 | "highest.apex.meta_lic", |
| 1505 | "bin/bin2.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1506 | "notice"), |
| 1507 | matchResolution( |
| 1508 | "highest.apex.meta_lic", |
| 1509 | "highest.apex.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1510 | "notice"), |
| 1511 | matchResolution( |
| 1512 | "highest.apex.meta_lic", |
| 1513 | "lib/liba.so.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1514 | "notice"), |
| 1515 | matchResolution( |
| 1516 | "highest.apex.meta_lic", |
| 1517 | "lib/libb.so.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1518 | "notice"), |
| 1519 | matchResolution( |
| 1520 | "highest.apex.meta_lic", |
| 1521 | "lib/libc.a.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1522 | "notice"), |
| 1523 | matchResolution( |
| 1524 | "lib/liba.so.meta_lic", |
| 1525 | "lib/liba.so.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1526 | "notice"), |
| 1527 | matchResolution( |
| 1528 | "lib/libb.so.meta_lic", |
| 1529 | "lib/libb.so.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1530 | "notice"), |
| 1531 | }, |
| 1532 | }, |
| 1533 | { |
| 1534 | condition: "notice", |
| 1535 | name: "apex_trimmed_notice", |
| 1536 | roots: []string{"highest.apex.meta_lic"}, |
| 1537 | ctx: context{ |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 1538 | conditions: []compliance.LicenseCondition{compliance.NoticeCondition}, |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1539 | stripPrefix: "testdata/notice/", |
| 1540 | }, |
| 1541 | expectedOut: []getMatcher{ |
| 1542 | matchTarget("bin/bin1.meta_lic"), |
| 1543 | matchTarget("lib/liba.so.meta_lic"), |
| 1544 | matchTarget("lib/libc.a.meta_lic"), |
| 1545 | matchTarget("bin/bin2.meta_lic"), |
| 1546 | matchTarget("highest.apex.meta_lic"), |
| 1547 | matchTarget("lib/libb.so.meta_lic"), |
| 1548 | matchResolution( |
| 1549 | "bin/bin1.meta_lic", |
| 1550 | "bin/bin1.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1551 | "notice"), |
| 1552 | matchResolution( |
| 1553 | "bin/bin1.meta_lic", |
| 1554 | "lib/liba.so.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1555 | "notice"), |
| 1556 | matchResolution( |
| 1557 | "bin/bin1.meta_lic", |
| 1558 | "lib/libc.a.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1559 | "notice"), |
| 1560 | matchResolution( |
| 1561 | "bin/bin2.meta_lic", |
| 1562 | "bin/bin2.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1563 | "notice"), |
| 1564 | matchResolution( |
| 1565 | "highest.apex.meta_lic", |
| 1566 | "bin/bin1.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1567 | "notice"), |
| 1568 | matchResolution( |
| 1569 | "highest.apex.meta_lic", |
| 1570 | "bin/bin2.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1571 | "notice"), |
| 1572 | matchResolution( |
| 1573 | "highest.apex.meta_lic", |
| 1574 | "highest.apex.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1575 | "notice"), |
| 1576 | matchResolution( |
| 1577 | "highest.apex.meta_lic", |
| 1578 | "lib/liba.so.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1579 | "notice"), |
| 1580 | matchResolution( |
| 1581 | "highest.apex.meta_lic", |
| 1582 | "lib/libb.so.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1583 | "notice"), |
| 1584 | matchResolution( |
| 1585 | "highest.apex.meta_lic", |
| 1586 | "lib/libc.a.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1587 | "notice"), |
| 1588 | matchResolution( |
| 1589 | "lib/liba.so.meta_lic", |
| 1590 | "lib/liba.so.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1591 | "notice"), |
| 1592 | matchResolution( |
| 1593 | "lib/libb.so.meta_lic", |
| 1594 | "lib/libb.so.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1595 | "notice"), |
| 1596 | }, |
| 1597 | }, |
| 1598 | { |
| 1599 | condition: "notice", |
| 1600 | name: "apex_trimmed_share", |
| 1601 | roots: []string{"highest.apex.meta_lic"}, |
| 1602 | ctx: context{ |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 1603 | conditions: compliance.ImpliesShared.AsList(), |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1604 | stripPrefix: "testdata/notice/", |
| 1605 | }, |
| 1606 | expectedOut: []getMatcher{}, |
| 1607 | }, |
| 1608 | { |
| 1609 | condition: "notice", |
| 1610 | name: "apex_trimmed_private", |
| 1611 | roots: []string{"highest.apex.meta_lic"}, |
| 1612 | ctx: context{ |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 1613 | conditions: compliance.ImpliesPrivate.AsList(), |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1614 | stripPrefix: "testdata/notice/", |
| 1615 | }, |
| 1616 | expectedOut: []getMatcher{}, |
| 1617 | }, |
| 1618 | { |
| 1619 | condition: "notice", |
| 1620 | name: "apex_trimmed_share_private", |
| 1621 | roots: []string{"highest.apex.meta_lic"}, |
| 1622 | ctx: context{ |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 1623 | conditions: compliance.ImpliesShared.Union(compliance.ImpliesPrivate).AsList(), |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1624 | stripPrefix: "testdata/notice/", |
| 1625 | }, |
| 1626 | expectedOut: []getMatcher{}, |
| 1627 | }, |
| 1628 | { |
| 1629 | condition: "notice", |
| 1630 | name: "apex_trimmed_labelled", |
| 1631 | roots: []string{"highest.apex.meta_lic"}, |
| 1632 | ctx: context{stripPrefix: "testdata/notice/", labelConditions: true}, |
| 1633 | expectedOut: []getMatcher{ |
| 1634 | matchTarget("bin/bin1.meta_lic", "notice"), |
| 1635 | matchTarget("lib/liba.so.meta_lic", "notice"), |
| 1636 | matchTarget("lib/libc.a.meta_lic", "notice"), |
| 1637 | matchTarget("bin/bin2.meta_lic", "notice"), |
| 1638 | matchTarget("highest.apex.meta_lic", "notice"), |
| 1639 | matchTarget("lib/libb.so.meta_lic", "notice"), |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1640 | matchResolution( |
| 1641 | "bin/bin1.meta_lic", |
| 1642 | "bin/bin1.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1643 | "notice"), |
| 1644 | matchResolution( |
| 1645 | "bin/bin1.meta_lic", |
| 1646 | "lib/liba.so.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1647 | "notice"), |
| 1648 | matchResolution( |
| 1649 | "bin/bin1.meta_lic", |
| 1650 | "lib/libc.a.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1651 | "notice"), |
| 1652 | matchResolution( |
| 1653 | "bin/bin2.meta_lic", |
| 1654 | "bin/bin2.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1655 | "notice"), |
| 1656 | matchResolution( |
| 1657 | "highest.apex.meta_lic", |
| 1658 | "bin/bin1.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1659 | "notice"), |
| 1660 | matchResolution( |
| 1661 | "highest.apex.meta_lic", |
| 1662 | "bin/bin2.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1663 | "notice"), |
| 1664 | matchResolution( |
| 1665 | "highest.apex.meta_lic", |
| 1666 | "highest.apex.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1667 | "notice"), |
| 1668 | matchResolution( |
| 1669 | "highest.apex.meta_lic", |
| 1670 | "lib/liba.so.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1671 | "notice"), |
| 1672 | matchResolution( |
| 1673 | "highest.apex.meta_lic", |
| 1674 | "lib/libb.so.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1675 | "notice"), |
| 1676 | matchResolution( |
| 1677 | "highest.apex.meta_lic", |
| 1678 | "lib/libc.a.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1679 | "notice"), |
| 1680 | matchResolution( |
| 1681 | "lib/liba.so.meta_lic", |
| 1682 | "lib/liba.so.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1683 | "notice"), |
| 1684 | matchResolution( |
| 1685 | "lib/libb.so.meta_lic", |
| 1686 | "lib/libb.so.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1687 | "notice"), |
| 1688 | }, |
| 1689 | }, |
| 1690 | { |
| 1691 | condition: "notice", |
| 1692 | name: "container", |
| 1693 | roots: []string{"container.zip.meta_lic"}, |
| 1694 | expectedOut: []getMatcher{ |
| 1695 | matchTarget("testdata/notice/bin/bin1.meta_lic"), |
| 1696 | matchTarget("testdata/notice/lib/liba.so.meta_lic"), |
| 1697 | matchTarget("testdata/notice/lib/libc.a.meta_lic"), |
| 1698 | matchTarget("testdata/notice/bin/bin2.meta_lic"), |
| 1699 | matchTarget("testdata/notice/container.zip.meta_lic"), |
| 1700 | matchTarget("testdata/notice/lib/libb.so.meta_lic"), |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1701 | matchResolution( |
| 1702 | "testdata/notice/bin/bin1.meta_lic", |
| 1703 | "testdata/notice/bin/bin1.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1704 | "notice"), |
| 1705 | matchResolution( |
| 1706 | "testdata/notice/bin/bin1.meta_lic", |
| 1707 | "testdata/notice/lib/liba.so.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1708 | "notice"), |
| 1709 | matchResolution( |
| 1710 | "testdata/notice/bin/bin1.meta_lic", |
| 1711 | "testdata/notice/lib/libc.a.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1712 | "notice"), |
| 1713 | matchResolution( |
| 1714 | "testdata/notice/bin/bin2.meta_lic", |
| 1715 | "testdata/notice/bin/bin2.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1716 | "notice"), |
| 1717 | matchResolution( |
| 1718 | "testdata/notice/container.zip.meta_lic", |
| 1719 | "testdata/notice/bin/bin1.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1720 | "notice"), |
| 1721 | matchResolution( |
| 1722 | "testdata/notice/container.zip.meta_lic", |
| 1723 | "testdata/notice/bin/bin2.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1724 | "notice"), |
| 1725 | matchResolution( |
| 1726 | "testdata/notice/container.zip.meta_lic", |
| 1727 | "testdata/notice/container.zip.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1728 | "notice"), |
| 1729 | matchResolution( |
| 1730 | "testdata/notice/container.zip.meta_lic", |
| 1731 | "testdata/notice/lib/liba.so.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1732 | "notice"), |
| 1733 | matchResolution( |
| 1734 | "testdata/notice/container.zip.meta_lic", |
| 1735 | "testdata/notice/lib/libb.so.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1736 | "notice"), |
| 1737 | matchResolution( |
| 1738 | "testdata/notice/container.zip.meta_lic", |
| 1739 | "testdata/notice/lib/libc.a.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1740 | "notice"), |
| 1741 | matchResolution( |
| 1742 | "testdata/notice/lib/liba.so.meta_lic", |
| 1743 | "testdata/notice/lib/liba.so.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1744 | "notice"), |
| 1745 | matchResolution( |
| 1746 | "testdata/notice/lib/libb.so.meta_lic", |
| 1747 | "testdata/notice/lib/libb.so.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1748 | "notice"), |
| 1749 | }, |
| 1750 | }, |
| 1751 | { |
| 1752 | condition: "notice", |
| 1753 | name: "application", |
| 1754 | roots: []string{"application.meta_lic"}, |
| 1755 | expectedOut: []getMatcher{ |
| 1756 | matchTarget("testdata/notice/application.meta_lic"), |
| 1757 | matchTarget("testdata/notice/lib/liba.so.meta_lic"), |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1758 | matchResolution( |
| 1759 | "testdata/notice/application.meta_lic", |
| 1760 | "testdata/notice/application.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1761 | "notice"), |
| 1762 | matchResolution( |
| 1763 | "testdata/notice/application.meta_lic", |
| 1764 | "testdata/notice/lib/liba.so.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1765 | "notice"), |
| 1766 | }, |
| 1767 | }, |
| 1768 | { |
| 1769 | condition: "notice", |
| 1770 | name: "binary", |
| 1771 | roots: []string{"bin/bin1.meta_lic"}, |
| 1772 | expectedOut: []getMatcher{ |
| 1773 | matchTarget("testdata/notice/bin/bin1.meta_lic"), |
| 1774 | matchTarget("testdata/notice/lib/liba.so.meta_lic"), |
| 1775 | matchTarget("testdata/notice/lib/libc.a.meta_lic"), |
| 1776 | matchResolution( |
| 1777 | "testdata/notice/bin/bin1.meta_lic", |
| 1778 | "testdata/notice/bin/bin1.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1779 | "notice"), |
| 1780 | matchResolution( |
| 1781 | "testdata/notice/bin/bin1.meta_lic", |
| 1782 | "testdata/notice/lib/liba.so.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1783 | "notice"), |
| 1784 | matchResolution( |
| 1785 | "testdata/notice/bin/bin1.meta_lic", |
| 1786 | "testdata/notice/lib/libc.a.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1787 | "notice"), |
| 1788 | }, |
| 1789 | }, |
| 1790 | { |
| 1791 | condition: "notice", |
| 1792 | name: "library", |
| 1793 | roots: []string{"lib/libd.so.meta_lic"}, |
| 1794 | expectedOut: []getMatcher{ |
| 1795 | matchTarget("testdata/notice/lib/libd.so.meta_lic"), |
| 1796 | matchResolution( |
| 1797 | "testdata/notice/lib/libd.so.meta_lic", |
| 1798 | "testdata/notice/lib/libd.so.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1799 | "notice"), |
| 1800 | }, |
| 1801 | }, |
| 1802 | { |
| 1803 | condition: "reciprocal", |
| 1804 | name: "apex", |
| 1805 | roots: []string{"highest.apex.meta_lic"}, |
| 1806 | expectedOut: []getMatcher{ |
| 1807 | matchTarget("testdata/reciprocal/bin/bin1.meta_lic"), |
| 1808 | matchTarget("testdata/reciprocal/lib/liba.so.meta_lic"), |
| 1809 | matchTarget("testdata/reciprocal/lib/libc.a.meta_lic"), |
| 1810 | matchTarget("testdata/reciprocal/bin/bin2.meta_lic"), |
| 1811 | matchTarget("testdata/reciprocal/highest.apex.meta_lic"), |
| 1812 | matchTarget("testdata/reciprocal/lib/libb.so.meta_lic"), |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1813 | matchResolution( |
| 1814 | "testdata/reciprocal/bin/bin1.meta_lic", |
| 1815 | "testdata/reciprocal/bin/bin1.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1816 | "notice"), |
| 1817 | matchResolution( |
| 1818 | "testdata/reciprocal/bin/bin1.meta_lic", |
| 1819 | "testdata/reciprocal/lib/liba.so.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1820 | "reciprocal"), |
| 1821 | matchResolution( |
| 1822 | "testdata/reciprocal/bin/bin1.meta_lic", |
| 1823 | "testdata/reciprocal/lib/libc.a.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1824 | "reciprocal"), |
| 1825 | matchResolution( |
| 1826 | "testdata/reciprocal/bin/bin2.meta_lic", |
| 1827 | "testdata/reciprocal/bin/bin2.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1828 | "notice"), |
| 1829 | matchResolution( |
| 1830 | "testdata/reciprocal/highest.apex.meta_lic", |
| 1831 | "testdata/reciprocal/bin/bin1.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1832 | "notice"), |
| 1833 | matchResolution( |
| 1834 | "testdata/reciprocal/highest.apex.meta_lic", |
| 1835 | "testdata/reciprocal/bin/bin2.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1836 | "notice"), |
| 1837 | matchResolution( |
| 1838 | "testdata/reciprocal/highest.apex.meta_lic", |
| 1839 | "testdata/reciprocal/highest.apex.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1840 | "notice"), |
| 1841 | matchResolution( |
| 1842 | "testdata/reciprocal/highest.apex.meta_lic", |
| 1843 | "testdata/reciprocal/lib/liba.so.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1844 | "reciprocal"), |
| 1845 | matchResolution( |
| 1846 | "testdata/reciprocal/highest.apex.meta_lic", |
| 1847 | "testdata/reciprocal/lib/libb.so.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1848 | "notice"), |
| 1849 | matchResolution( |
| 1850 | "testdata/reciprocal/highest.apex.meta_lic", |
| 1851 | "testdata/reciprocal/lib/libc.a.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1852 | "reciprocal"), |
| 1853 | matchResolution( |
| 1854 | "testdata/reciprocal/lib/liba.so.meta_lic", |
| 1855 | "testdata/reciprocal/lib/liba.so.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1856 | "reciprocal"), |
| 1857 | matchResolution( |
| 1858 | "testdata/reciprocal/lib/libb.so.meta_lic", |
| 1859 | "testdata/reciprocal/lib/libb.so.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1860 | "notice"), |
| 1861 | }, |
| 1862 | }, |
| 1863 | { |
| 1864 | condition: "reciprocal", |
| 1865 | name: "apex_trimmed", |
| 1866 | roots: []string{"highest.apex.meta_lic"}, |
| 1867 | ctx: context{stripPrefix: "testdata/reciprocal/"}, |
| 1868 | expectedOut: []getMatcher{ |
| 1869 | matchTarget("bin/bin1.meta_lic"), |
| 1870 | matchTarget("lib/liba.so.meta_lic"), |
| 1871 | matchTarget("lib/libc.a.meta_lic"), |
| 1872 | matchTarget("bin/bin2.meta_lic"), |
| 1873 | matchTarget("highest.apex.meta_lic"), |
| 1874 | matchTarget("lib/libb.so.meta_lic"), |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1875 | matchResolution( |
| 1876 | "bin/bin1.meta_lic", |
| 1877 | "bin/bin1.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1878 | "notice"), |
| 1879 | matchResolution( |
| 1880 | "bin/bin1.meta_lic", |
| 1881 | "lib/liba.so.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1882 | "reciprocal"), |
| 1883 | matchResolution( |
| 1884 | "bin/bin1.meta_lic", |
| 1885 | "lib/libc.a.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1886 | "reciprocal"), |
| 1887 | matchResolution( |
| 1888 | "bin/bin2.meta_lic", |
| 1889 | "bin/bin2.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1890 | "notice"), |
| 1891 | matchResolution( |
| 1892 | "highest.apex.meta_lic", |
| 1893 | "bin/bin1.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1894 | "notice"), |
| 1895 | matchResolution( |
| 1896 | "highest.apex.meta_lic", |
| 1897 | "bin/bin2.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1898 | "notice"), |
| 1899 | matchResolution( |
| 1900 | "highest.apex.meta_lic", |
| 1901 | "highest.apex.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1902 | "notice"), |
| 1903 | matchResolution( |
| 1904 | "highest.apex.meta_lic", |
| 1905 | "lib/liba.so.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1906 | "reciprocal"), |
| 1907 | matchResolution( |
| 1908 | "highest.apex.meta_lic", |
| 1909 | "lib/libb.so.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1910 | "notice"), |
| 1911 | matchResolution( |
| 1912 | "highest.apex.meta_lic", |
| 1913 | "lib/libc.a.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1914 | "reciprocal"), |
| 1915 | matchResolution( |
| 1916 | "lib/liba.so.meta_lic", |
| 1917 | "lib/liba.so.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1918 | "reciprocal"), |
| 1919 | matchResolution( |
| 1920 | "lib/libb.so.meta_lic", |
| 1921 | "lib/libb.so.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1922 | "notice"), |
| 1923 | }, |
| 1924 | }, |
| 1925 | { |
| 1926 | condition: "reciprocal", |
| 1927 | name: "apex_trimmed_notice", |
| 1928 | roots: []string{"highest.apex.meta_lic"}, |
| 1929 | ctx: context{ |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 1930 | conditions: []compliance.LicenseCondition{compliance.NoticeCondition}, |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1931 | stripPrefix: "testdata/reciprocal/", |
| 1932 | }, |
| 1933 | expectedOut: []getMatcher{ |
| 1934 | matchTarget("bin/bin1.meta_lic"), |
| 1935 | matchTarget("bin/bin2.meta_lic"), |
| 1936 | matchTarget("highest.apex.meta_lic"), |
| 1937 | matchTarget("lib/libb.so.meta_lic"), |
| 1938 | matchResolution( |
| 1939 | "bin/bin1.meta_lic", |
| 1940 | "bin/bin1.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1941 | "notice"), |
| 1942 | matchResolution( |
| 1943 | "bin/bin2.meta_lic", |
| 1944 | "bin/bin2.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1945 | "notice"), |
| 1946 | matchResolution( |
| 1947 | "highest.apex.meta_lic", |
| 1948 | "bin/bin1.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1949 | "notice"), |
| 1950 | matchResolution( |
| 1951 | "highest.apex.meta_lic", |
| 1952 | "bin/bin2.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1953 | "notice"), |
| 1954 | matchResolution( |
| 1955 | "highest.apex.meta_lic", |
| 1956 | "highest.apex.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1957 | "notice"), |
| 1958 | matchResolution( |
| 1959 | "highest.apex.meta_lic", |
| 1960 | "lib/libb.so.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1961 | "notice"), |
| 1962 | matchResolution( |
| 1963 | "lib/libb.so.meta_lic", |
| 1964 | "lib/libb.so.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1965 | "notice"), |
| 1966 | }, |
| 1967 | }, |
| 1968 | { |
| 1969 | condition: "reciprocal", |
| 1970 | name: "apex_trimmed_share", |
| 1971 | roots: []string{"highest.apex.meta_lic"}, |
| 1972 | ctx: context{ |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 1973 | conditions: compliance.ImpliesShared.AsList(), |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1974 | stripPrefix: "testdata/reciprocal/", |
| 1975 | }, |
| 1976 | expectedOut: []getMatcher{ |
| 1977 | matchTarget("bin/bin1.meta_lic"), |
| 1978 | matchTarget("lib/liba.so.meta_lic"), |
| 1979 | matchTarget("lib/libc.a.meta_lic"), |
| 1980 | matchTarget("highest.apex.meta_lic"), |
| 1981 | matchResolution( |
| 1982 | "bin/bin1.meta_lic", |
| 1983 | "lib/liba.so.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1984 | "reciprocal"), |
| 1985 | matchResolution( |
| 1986 | "bin/bin1.meta_lic", |
| 1987 | "lib/libc.a.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1988 | "reciprocal"), |
| 1989 | matchResolution( |
| 1990 | "highest.apex.meta_lic", |
| 1991 | "lib/liba.so.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1992 | "reciprocal"), |
| 1993 | matchResolution( |
| 1994 | "highest.apex.meta_lic", |
| 1995 | "lib/libc.a.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 1996 | "reciprocal"), |
| 1997 | matchResolution( |
| 1998 | "lib/liba.so.meta_lic", |
| 1999 | "lib/liba.so.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2000 | "reciprocal"), |
| 2001 | }, |
| 2002 | }, |
| 2003 | { |
| 2004 | condition: "reciprocal", |
| 2005 | name: "apex_trimmed_private", |
| 2006 | roots: []string{"highest.apex.meta_lic"}, |
| 2007 | ctx: context{ |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 2008 | conditions: compliance.ImpliesPrivate.AsList(), |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2009 | stripPrefix: "testdata/reciprocal/", |
| 2010 | }, |
| 2011 | expectedOut: []getMatcher{}, |
| 2012 | }, |
| 2013 | { |
| 2014 | condition: "reciprocal", |
| 2015 | name: "apex_trimmed_share_private", |
| 2016 | roots: []string{"highest.apex.meta_lic"}, |
| 2017 | ctx: context{ |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 2018 | conditions: compliance.ImpliesShared.Union(compliance.ImpliesPrivate).AsList(), |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2019 | stripPrefix: "testdata/reciprocal/", |
| 2020 | }, |
| 2021 | expectedOut: []getMatcher{ |
| 2022 | matchTarget("bin/bin1.meta_lic"), |
| 2023 | matchTarget("lib/liba.so.meta_lic"), |
| 2024 | matchTarget("lib/libc.a.meta_lic"), |
| 2025 | matchTarget("highest.apex.meta_lic"), |
| 2026 | matchResolution( |
| 2027 | "bin/bin1.meta_lic", |
| 2028 | "lib/liba.so.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2029 | "reciprocal"), |
| 2030 | matchResolution( |
| 2031 | "bin/bin1.meta_lic", |
| 2032 | "lib/libc.a.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2033 | "reciprocal"), |
| 2034 | matchResolution( |
| 2035 | "highest.apex.meta_lic", |
| 2036 | "lib/liba.so.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2037 | "reciprocal"), |
| 2038 | matchResolution( |
| 2039 | "highest.apex.meta_lic", |
| 2040 | "lib/libc.a.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2041 | "reciprocal"), |
| 2042 | matchResolution( |
| 2043 | "lib/liba.so.meta_lic", |
| 2044 | "lib/liba.so.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2045 | "reciprocal"), |
| 2046 | }, |
| 2047 | }, |
| 2048 | { |
| 2049 | condition: "reciprocal", |
| 2050 | name: "apex_trimmed_labelled", |
| 2051 | roots: []string{"highest.apex.meta_lic"}, |
| 2052 | ctx: context{stripPrefix: "testdata/reciprocal/", labelConditions: true}, |
| 2053 | expectedOut: []getMatcher{ |
| 2054 | matchTarget("bin/bin1.meta_lic", "notice"), |
| 2055 | matchTarget("lib/liba.so.meta_lic", "reciprocal"), |
| 2056 | matchTarget("lib/libc.a.meta_lic", "reciprocal"), |
| 2057 | matchTarget("bin/bin2.meta_lic", "notice"), |
| 2058 | matchTarget("highest.apex.meta_lic", "notice"), |
| 2059 | matchTarget("lib/libb.so.meta_lic", "notice"), |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2060 | matchResolution( |
| 2061 | "bin/bin1.meta_lic", |
| 2062 | "bin/bin1.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2063 | "notice"), |
| 2064 | matchResolution( |
| 2065 | "bin/bin1.meta_lic", |
| 2066 | "lib/liba.so.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2067 | "reciprocal"), |
| 2068 | matchResolution( |
| 2069 | "bin/bin1.meta_lic", |
| 2070 | "lib/libc.a.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2071 | "reciprocal"), |
| 2072 | matchResolution( |
| 2073 | "bin/bin2.meta_lic", |
| 2074 | "bin/bin2.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2075 | "notice"), |
| 2076 | matchResolution( |
| 2077 | "highest.apex.meta_lic", |
| 2078 | "bin/bin1.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2079 | "notice"), |
| 2080 | matchResolution( |
| 2081 | "highest.apex.meta_lic", |
| 2082 | "bin/bin2.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2083 | "notice"), |
| 2084 | matchResolution( |
| 2085 | "highest.apex.meta_lic", |
| 2086 | "highest.apex.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2087 | "notice"), |
| 2088 | matchResolution( |
| 2089 | "highest.apex.meta_lic", |
| 2090 | "lib/liba.so.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2091 | "reciprocal"), |
| 2092 | matchResolution( |
| 2093 | "highest.apex.meta_lic", |
| 2094 | "lib/libb.so.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2095 | "notice"), |
| 2096 | matchResolution( |
| 2097 | "highest.apex.meta_lic", |
| 2098 | "lib/libc.a.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2099 | "reciprocal"), |
| 2100 | matchResolution( |
| 2101 | "lib/liba.so.meta_lic", |
| 2102 | "lib/liba.so.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2103 | "reciprocal"), |
| 2104 | matchResolution( |
| 2105 | "lib/libb.so.meta_lic", |
| 2106 | "lib/libb.so.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2107 | "notice"), |
| 2108 | }, |
| 2109 | }, |
| 2110 | { |
| 2111 | condition: "reciprocal", |
| 2112 | name: "container", |
| 2113 | roots: []string{"container.zip.meta_lic"}, |
| 2114 | expectedOut: []getMatcher{ |
| 2115 | matchTarget("testdata/reciprocal/bin/bin1.meta_lic"), |
| 2116 | matchTarget("testdata/reciprocal/lib/liba.so.meta_lic"), |
| 2117 | matchTarget("testdata/reciprocal/lib/libc.a.meta_lic"), |
| 2118 | matchTarget("testdata/reciprocal/bin/bin2.meta_lic"), |
| 2119 | matchTarget("testdata/reciprocal/container.zip.meta_lic"), |
| 2120 | matchTarget("testdata/reciprocal/lib/libb.so.meta_lic"), |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2121 | matchResolution( |
| 2122 | "testdata/reciprocal/bin/bin1.meta_lic", |
| 2123 | "testdata/reciprocal/bin/bin1.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2124 | "notice"), |
| 2125 | matchResolution( |
| 2126 | "testdata/reciprocal/bin/bin1.meta_lic", |
| 2127 | "testdata/reciprocal/lib/liba.so.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2128 | "reciprocal"), |
| 2129 | matchResolution( |
| 2130 | "testdata/reciprocal/bin/bin1.meta_lic", |
| 2131 | "testdata/reciprocal/lib/libc.a.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2132 | "reciprocal"), |
| 2133 | matchResolution( |
| 2134 | "testdata/reciprocal/bin/bin2.meta_lic", |
| 2135 | "testdata/reciprocal/bin/bin2.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2136 | "notice"), |
| 2137 | matchResolution( |
| 2138 | "testdata/reciprocal/container.zip.meta_lic", |
| 2139 | "testdata/reciprocal/bin/bin1.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2140 | "notice"), |
| 2141 | matchResolution( |
| 2142 | "testdata/reciprocal/container.zip.meta_lic", |
| 2143 | "testdata/reciprocal/bin/bin2.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2144 | "notice"), |
| 2145 | matchResolution( |
| 2146 | "testdata/reciprocal/container.zip.meta_lic", |
| 2147 | "testdata/reciprocal/container.zip.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2148 | "notice"), |
| 2149 | matchResolution( |
| 2150 | "testdata/reciprocal/container.zip.meta_lic", |
| 2151 | "testdata/reciprocal/lib/liba.so.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2152 | "reciprocal"), |
| 2153 | matchResolution( |
| 2154 | "testdata/reciprocal/container.zip.meta_lic", |
| 2155 | "testdata/reciprocal/lib/libb.so.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2156 | "notice"), |
| 2157 | matchResolution( |
| 2158 | "testdata/reciprocal/container.zip.meta_lic", |
| 2159 | "testdata/reciprocal/lib/libc.a.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2160 | "reciprocal"), |
| 2161 | matchResolution( |
| 2162 | "testdata/reciprocal/lib/liba.so.meta_lic", |
| 2163 | "testdata/reciprocal/lib/liba.so.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2164 | "reciprocal"), |
| 2165 | matchResolution( |
| 2166 | "testdata/reciprocal/lib/libb.so.meta_lic", |
| 2167 | "testdata/reciprocal/lib/libb.so.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2168 | "notice"), |
| 2169 | }, |
| 2170 | }, |
| 2171 | { |
| 2172 | condition: "reciprocal", |
| 2173 | name: "application", |
| 2174 | roots: []string{"application.meta_lic"}, |
| 2175 | expectedOut: []getMatcher{ |
| 2176 | matchTarget("testdata/reciprocal/application.meta_lic"), |
| 2177 | matchTarget("testdata/reciprocal/lib/liba.so.meta_lic"), |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2178 | matchResolution( |
| 2179 | "testdata/reciprocal/application.meta_lic", |
| 2180 | "testdata/reciprocal/application.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2181 | "notice"), |
| 2182 | matchResolution( |
| 2183 | "testdata/reciprocal/application.meta_lic", |
| 2184 | "testdata/reciprocal/lib/liba.so.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2185 | "reciprocal"), |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2186 | }, |
| 2187 | }, |
| 2188 | { |
| 2189 | condition: "reciprocal", |
| 2190 | name: "binary", |
| 2191 | roots: []string{"bin/bin1.meta_lic"}, |
| 2192 | expectedOut: []getMatcher{ |
| 2193 | matchTarget("testdata/reciprocal/bin/bin1.meta_lic"), |
| 2194 | matchTarget("testdata/reciprocal/lib/liba.so.meta_lic"), |
| 2195 | matchTarget("testdata/reciprocal/lib/libc.a.meta_lic"), |
| 2196 | matchResolution( |
| 2197 | "testdata/reciprocal/bin/bin1.meta_lic", |
| 2198 | "testdata/reciprocal/bin/bin1.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2199 | "notice"), |
| 2200 | matchResolution( |
| 2201 | "testdata/reciprocal/bin/bin1.meta_lic", |
| 2202 | "testdata/reciprocal/lib/liba.so.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2203 | "reciprocal"), |
| 2204 | matchResolution( |
| 2205 | "testdata/reciprocal/bin/bin1.meta_lic", |
| 2206 | "testdata/reciprocal/lib/libc.a.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2207 | "reciprocal"), |
| 2208 | }, |
| 2209 | }, |
| 2210 | { |
| 2211 | condition: "reciprocal", |
| 2212 | name: "library", |
| 2213 | roots: []string{"lib/libd.so.meta_lic"}, |
| 2214 | expectedOut: []getMatcher{ |
| 2215 | matchTarget("testdata/reciprocal/lib/libd.so.meta_lic"), |
| 2216 | matchResolution( |
| 2217 | "testdata/reciprocal/lib/libd.so.meta_lic", |
| 2218 | "testdata/reciprocal/lib/libd.so.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2219 | "notice"), |
| 2220 | }, |
| 2221 | }, |
| 2222 | { |
| 2223 | condition: "restricted", |
| 2224 | name: "apex", |
| 2225 | roots: []string{"highest.apex.meta_lic"}, |
| 2226 | expectedOut: []getMatcher{ |
| 2227 | matchTarget("testdata/restricted/bin/bin1.meta_lic"), |
| 2228 | matchTarget("testdata/restricted/lib/liba.so.meta_lic"), |
| 2229 | matchTarget("testdata/restricted/lib/libc.a.meta_lic"), |
| 2230 | matchTarget("testdata/restricted/bin/bin2.meta_lic"), |
| 2231 | matchTarget("testdata/restricted/lib/libb.so.meta_lic"), |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2232 | matchTarget("testdata/restricted/highest.apex.meta_lic"), |
| 2233 | matchResolution( |
| 2234 | "testdata/restricted/bin/bin1.meta_lic", |
| 2235 | "testdata/restricted/bin/bin1.meta_lic", |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 2236 | "restricted_allows_dynamic_linking", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2237 | "notice"), |
| 2238 | matchResolution( |
| 2239 | "testdata/restricted/bin/bin1.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2240 | "testdata/restricted/lib/liba.so.meta_lic", |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 2241 | "restricted_allows_dynamic_linking"), |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2242 | matchResolution( |
| 2243 | "testdata/restricted/bin/bin1.meta_lic", |
| 2244 | "testdata/restricted/lib/libc.a.meta_lic", |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 2245 | "reciprocal", |
| 2246 | "restricted_allows_dynamic_linking"), |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2247 | matchResolution( |
| 2248 | "testdata/restricted/bin/bin2.meta_lic", |
| 2249 | "testdata/restricted/bin/bin2.meta_lic", |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 2250 | "restricted", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2251 | "notice"), |
| 2252 | matchResolution( |
| 2253 | "testdata/restricted/bin/bin2.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2254 | "testdata/restricted/lib/libb.so.meta_lic", |
| 2255 | "restricted"), |
| 2256 | matchResolution( |
| 2257 | "testdata/restricted/highest.apex.meta_lic", |
| 2258 | "testdata/restricted/bin/bin1.meta_lic", |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 2259 | "restricted_allows_dynamic_linking", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2260 | "notice"), |
| 2261 | matchResolution( |
| 2262 | "testdata/restricted/highest.apex.meta_lic", |
| 2263 | "testdata/restricted/bin/bin2.meta_lic", |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 2264 | "restricted", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2265 | "notice"), |
| 2266 | matchResolution( |
| 2267 | "testdata/restricted/highest.apex.meta_lic", |
| 2268 | "testdata/restricted/highest.apex.meta_lic", |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 2269 | "restricted", |
| 2270 | "restricted_allows_dynamic_linking", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2271 | "notice"), |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 2272 | matchResolution( |
| 2273 | "testdata/restricted/highest.apex.meta_lic", |
| 2274 | "testdata/restricted/lib/liba.so.meta_lic", |
| 2275 | "restricted_allows_dynamic_linking"), |
| 2276 | matchResolution( |
| 2277 | "testdata/restricted/highest.apex.meta_lic", |
| 2278 | "testdata/restricted/lib/libb.so.meta_lic", |
| 2279 | "restricted"), |
| 2280 | matchResolution( |
| 2281 | "testdata/restricted/highest.apex.meta_lic", |
| 2282 | "testdata/restricted/lib/libc.a.meta_lic", |
| 2283 | "reciprocal", |
| 2284 | "restricted_allows_dynamic_linking"), |
| 2285 | matchResolution( |
| 2286 | "testdata/restricted/lib/liba.so.meta_lic", |
| 2287 | "testdata/restricted/lib/liba.so.meta_lic", |
| 2288 | "restricted_allows_dynamic_linking"), |
| 2289 | matchResolution( |
| 2290 | "testdata/restricted/lib/libb.so.meta_lic", |
| 2291 | "testdata/restricted/lib/libb.so.meta_lic", |
| 2292 | "restricted"), |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2293 | }, |
| 2294 | }, |
| 2295 | { |
| 2296 | condition: "restricted", |
| 2297 | name: "apex_trimmed", |
| 2298 | roots: []string{"highest.apex.meta_lic"}, |
| 2299 | ctx: context{stripPrefix: "testdata/restricted/"}, |
| 2300 | expectedOut: []getMatcher{ |
| 2301 | matchTarget("bin/bin1.meta_lic"), |
| 2302 | matchTarget("lib/liba.so.meta_lic"), |
| 2303 | matchTarget("lib/libc.a.meta_lic"), |
| 2304 | matchTarget("bin/bin2.meta_lic"), |
| 2305 | matchTarget("lib/libb.so.meta_lic"), |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2306 | matchTarget("highest.apex.meta_lic"), |
| 2307 | matchResolution( |
| 2308 | "bin/bin1.meta_lic", |
| 2309 | "bin/bin1.meta_lic", |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 2310 | "restricted_allows_dynamic_linking", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2311 | "notice"), |
| 2312 | matchResolution( |
| 2313 | "bin/bin1.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2314 | "lib/liba.so.meta_lic", |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 2315 | "restricted_allows_dynamic_linking"), |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2316 | matchResolution( |
| 2317 | "bin/bin1.meta_lic", |
| 2318 | "lib/libc.a.meta_lic", |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 2319 | "reciprocal", |
| 2320 | "restricted_allows_dynamic_linking"), |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2321 | matchResolution( |
| 2322 | "bin/bin2.meta_lic", |
| 2323 | "bin/bin2.meta_lic", |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 2324 | "restricted", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2325 | "notice"), |
| 2326 | matchResolution( |
| 2327 | "bin/bin2.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2328 | "lib/libb.so.meta_lic", |
| 2329 | "restricted"), |
| 2330 | matchResolution( |
| 2331 | "highest.apex.meta_lic", |
| 2332 | "bin/bin1.meta_lic", |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 2333 | "restricted_allows_dynamic_linking", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2334 | "notice"), |
| 2335 | matchResolution( |
| 2336 | "highest.apex.meta_lic", |
| 2337 | "bin/bin2.meta_lic", |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 2338 | "restricted", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2339 | "notice"), |
| 2340 | matchResolution( |
| 2341 | "highest.apex.meta_lic", |
| 2342 | "highest.apex.meta_lic", |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 2343 | "restricted", |
| 2344 | "restricted_allows_dynamic_linking", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2345 | "notice"), |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 2346 | matchResolution( |
| 2347 | "highest.apex.meta_lic", |
| 2348 | "lib/liba.so.meta_lic", |
| 2349 | "restricted_allows_dynamic_linking"), |
| 2350 | matchResolution( |
| 2351 | "highest.apex.meta_lic", |
| 2352 | "lib/libb.so.meta_lic", |
| 2353 | "restricted"), |
| 2354 | matchResolution( |
| 2355 | "highest.apex.meta_lic", |
| 2356 | "lib/libc.a.meta_lic", |
| 2357 | "reciprocal", |
| 2358 | "restricted_allows_dynamic_linking"), |
| 2359 | matchResolution( |
| 2360 | "lib/liba.so.meta_lic", |
| 2361 | "lib/liba.so.meta_lic", |
| 2362 | "restricted_allows_dynamic_linking"), |
| 2363 | matchResolution( |
| 2364 | "lib/libb.so.meta_lic", |
| 2365 | "lib/libb.so.meta_lic", |
| 2366 | "restricted"), |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2367 | }, |
| 2368 | }, |
| 2369 | { |
| 2370 | condition: "restricted", |
| 2371 | name: "apex_trimmed_notice", |
| 2372 | roots: []string{"highest.apex.meta_lic"}, |
| 2373 | ctx: context{ |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 2374 | conditions: []compliance.LicenseCondition{compliance.NoticeCondition}, |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2375 | stripPrefix: "testdata/restricted/", |
| 2376 | }, |
| 2377 | expectedOut: []getMatcher{ |
| 2378 | matchTarget("bin/bin1.meta_lic"), |
| 2379 | matchTarget("bin/bin2.meta_lic"), |
| 2380 | matchTarget("highest.apex.meta_lic"), |
| 2381 | matchResolution( |
| 2382 | "bin/bin1.meta_lic", |
| 2383 | "bin/bin1.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2384 | "notice"), |
| 2385 | matchResolution( |
| 2386 | "bin/bin2.meta_lic", |
| 2387 | "bin/bin2.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2388 | "notice"), |
| 2389 | matchResolution( |
| 2390 | "highest.apex.meta_lic", |
| 2391 | "bin/bin1.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2392 | "notice"), |
| 2393 | matchResolution( |
| 2394 | "highest.apex.meta_lic", |
| 2395 | "bin/bin2.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2396 | "notice"), |
| 2397 | matchResolution( |
| 2398 | "highest.apex.meta_lic", |
| 2399 | "highest.apex.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2400 | "notice"), |
| 2401 | }, |
| 2402 | }, |
| 2403 | { |
| 2404 | condition: "restricted", |
| 2405 | name: "apex_trimmed_share", |
| 2406 | roots: []string{"highest.apex.meta_lic"}, |
| 2407 | ctx: context{ |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 2408 | conditions: compliance.ImpliesShared.AsList(), |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2409 | stripPrefix: "testdata/restricted/", |
| 2410 | }, |
| 2411 | expectedOut: []getMatcher{ |
| 2412 | matchTarget("bin/bin1.meta_lic"), |
| 2413 | matchTarget("lib/liba.so.meta_lic"), |
| 2414 | matchTarget("lib/libc.a.meta_lic"), |
| 2415 | matchTarget("bin/bin2.meta_lic"), |
| 2416 | matchTarget("lib/libb.so.meta_lic"), |
| 2417 | matchTarget("highest.apex.meta_lic"), |
| 2418 | matchResolution( |
| 2419 | "bin/bin1.meta_lic", |
| 2420 | "bin/bin1.meta_lic", |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 2421 | "restricted_allows_dynamic_linking"), |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2422 | matchResolution( |
| 2423 | "bin/bin1.meta_lic", |
| 2424 | "lib/liba.so.meta_lic", |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 2425 | "restricted_allows_dynamic_linking"), |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2426 | matchResolution( |
| 2427 | "bin/bin1.meta_lic", |
| 2428 | "lib/libc.a.meta_lic", |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 2429 | "reciprocal", |
| 2430 | "restricted_allows_dynamic_linking"), |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2431 | matchResolution( |
| 2432 | "bin/bin2.meta_lic", |
| 2433 | "bin/bin2.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2434 | "restricted"), |
| 2435 | matchResolution( |
| 2436 | "bin/bin2.meta_lic", |
| 2437 | "lib/libb.so.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2438 | "restricted"), |
| 2439 | matchResolution( |
| 2440 | "highest.apex.meta_lic", |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 2441 | "bin/bin1.meta_lic", |
| 2442 | "restricted_allows_dynamic_linking"), |
| 2443 | matchResolution( |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2444 | "highest.apex.meta_lic", |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 2445 | "bin/bin2.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2446 | "restricted"), |
| 2447 | matchResolution( |
| 2448 | "highest.apex.meta_lic", |
| 2449 | "highest.apex.meta_lic", |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 2450 | "restricted", |
| 2451 | "restricted_allows_dynamic_linking"), |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2452 | matchResolution( |
| 2453 | "highest.apex.meta_lic", |
| 2454 | "lib/liba.so.meta_lic", |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 2455 | "restricted_allows_dynamic_linking"), |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2456 | matchResolution( |
| 2457 | "highest.apex.meta_lic", |
| 2458 | "lib/libb.so.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2459 | "restricted"), |
| 2460 | matchResolution( |
| 2461 | "highest.apex.meta_lic", |
| 2462 | "lib/libc.a.meta_lic", |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 2463 | "reciprocal", |
| 2464 | "restricted_allows_dynamic_linking"), |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2465 | matchResolution( |
| 2466 | "lib/liba.so.meta_lic", |
| 2467 | "lib/liba.so.meta_lic", |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 2468 | "restricted_allows_dynamic_linking"), |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2469 | matchResolution( |
| 2470 | "lib/libb.so.meta_lic", |
| 2471 | "lib/libb.so.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2472 | "restricted"), |
| 2473 | }, |
| 2474 | }, |
| 2475 | { |
| 2476 | condition: "restricted", |
| 2477 | name: "apex_trimmed_private", |
| 2478 | roots: []string{"highest.apex.meta_lic"}, |
| 2479 | ctx: context{ |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 2480 | conditions: compliance.ImpliesPrivate.AsList(), |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2481 | stripPrefix: "testdata/restricted/", |
| 2482 | }, |
| 2483 | expectedOut: []getMatcher{}, |
| 2484 | }, |
| 2485 | { |
| 2486 | condition: "restricted", |
| 2487 | name: "apex_trimmed_share_private", |
| 2488 | roots: []string{"highest.apex.meta_lic"}, |
| 2489 | ctx: context{ |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 2490 | conditions: compliance.ImpliesShared.Union(compliance.ImpliesPrivate).AsList(), |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2491 | stripPrefix: "testdata/restricted/", |
| 2492 | }, |
| 2493 | expectedOut: []getMatcher{ |
| 2494 | matchTarget("bin/bin1.meta_lic"), |
| 2495 | matchTarget("lib/liba.so.meta_lic"), |
| 2496 | matchTarget("lib/libc.a.meta_lic"), |
| 2497 | matchTarget("bin/bin2.meta_lic"), |
| 2498 | matchTarget("lib/libb.so.meta_lic"), |
| 2499 | matchTarget("highest.apex.meta_lic"), |
| 2500 | matchResolution( |
| 2501 | "bin/bin1.meta_lic", |
| 2502 | "bin/bin1.meta_lic", |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 2503 | "restricted_allows_dynamic_linking"), |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2504 | matchResolution( |
| 2505 | "bin/bin1.meta_lic", |
| 2506 | "lib/liba.so.meta_lic", |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 2507 | "restricted_allows_dynamic_linking"), |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2508 | matchResolution( |
| 2509 | "bin/bin1.meta_lic", |
| 2510 | "lib/libc.a.meta_lic", |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 2511 | "reciprocal", |
| 2512 | "restricted_allows_dynamic_linking"), |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2513 | matchResolution( |
| 2514 | "bin/bin2.meta_lic", |
| 2515 | "bin/bin2.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2516 | "restricted"), |
| 2517 | matchResolution( |
| 2518 | "bin/bin2.meta_lic", |
| 2519 | "lib/libb.so.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2520 | "restricted"), |
| 2521 | matchResolution( |
| 2522 | "highest.apex.meta_lic", |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 2523 | "bin/bin1.meta_lic", |
| 2524 | "restricted_allows_dynamic_linking"), |
| 2525 | matchResolution( |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2526 | "highest.apex.meta_lic", |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 2527 | "bin/bin2.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2528 | "restricted"), |
| 2529 | matchResolution( |
| 2530 | "highest.apex.meta_lic", |
| 2531 | "highest.apex.meta_lic", |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 2532 | "restricted", |
| 2533 | "restricted_allows_dynamic_linking"), |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2534 | matchResolution( |
| 2535 | "highest.apex.meta_lic", |
| 2536 | "lib/liba.so.meta_lic", |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 2537 | "restricted_allows_dynamic_linking"), |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2538 | matchResolution( |
| 2539 | "highest.apex.meta_lic", |
| 2540 | "lib/libb.so.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2541 | "restricted"), |
| 2542 | matchResolution( |
| 2543 | "highest.apex.meta_lic", |
| 2544 | "lib/libc.a.meta_lic", |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 2545 | "reciprocal", |
| 2546 | "restricted_allows_dynamic_linking"), |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2547 | matchResolution( |
| 2548 | "lib/liba.so.meta_lic", |
| 2549 | "lib/liba.so.meta_lic", |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 2550 | "restricted_allows_dynamic_linking"), |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2551 | matchResolution( |
| 2552 | "lib/libb.so.meta_lic", |
| 2553 | "lib/libb.so.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2554 | "restricted"), |
| 2555 | }, |
| 2556 | }, |
| 2557 | { |
| 2558 | condition: "restricted", |
| 2559 | name: "apex_trimmed_labelled", |
| 2560 | roots: []string{"highest.apex.meta_lic"}, |
| 2561 | ctx: context{stripPrefix: "testdata/restricted/", labelConditions: true}, |
| 2562 | expectedOut: []getMatcher{ |
| 2563 | matchTarget("bin/bin1.meta_lic", "notice"), |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 2564 | matchTarget("lib/liba.so.meta_lic", "restricted_allows_dynamic_linking"), |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2565 | matchTarget("lib/libc.a.meta_lic", "reciprocal"), |
| 2566 | matchTarget("bin/bin2.meta_lic", "notice"), |
| 2567 | matchTarget("lib/libb.so.meta_lic", "restricted"), |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2568 | matchTarget("highest.apex.meta_lic", "notice"), |
| 2569 | matchResolution( |
| 2570 | "bin/bin1.meta_lic", |
| 2571 | "bin/bin1.meta_lic", |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 2572 | "restricted_allows_dynamic_linking", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2573 | "notice"), |
| 2574 | matchResolution( |
| 2575 | "bin/bin1.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2576 | "lib/liba.so.meta_lic", |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 2577 | "restricted_allows_dynamic_linking"), |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2578 | matchResolution( |
| 2579 | "bin/bin1.meta_lic", |
| 2580 | "lib/libc.a.meta_lic", |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 2581 | "reciprocal", |
| 2582 | "restricted_allows_dynamic_linking"), |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2583 | matchResolution( |
| 2584 | "bin/bin2.meta_lic", |
| 2585 | "bin/bin2.meta_lic", |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 2586 | "restricted", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2587 | "notice"), |
| 2588 | matchResolution( |
| 2589 | "bin/bin2.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2590 | "lib/libb.so.meta_lic", |
| 2591 | "restricted"), |
| 2592 | matchResolution( |
| 2593 | "highest.apex.meta_lic", |
| 2594 | "bin/bin1.meta_lic", |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 2595 | "restricted_allows_dynamic_linking", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2596 | "notice"), |
| 2597 | matchResolution( |
| 2598 | "highest.apex.meta_lic", |
| 2599 | "bin/bin2.meta_lic", |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 2600 | "restricted", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2601 | "notice"), |
| 2602 | matchResolution( |
| 2603 | "highest.apex.meta_lic", |
| 2604 | "highest.apex.meta_lic", |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 2605 | "restricted", |
| 2606 | "restricted_allows_dynamic_linking", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2607 | "notice"), |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 2608 | matchResolution( |
| 2609 | "highest.apex.meta_lic", |
| 2610 | "lib/liba.so.meta_lic", |
| 2611 | "restricted_allows_dynamic_linking"), |
| 2612 | matchResolution( |
| 2613 | "highest.apex.meta_lic", |
| 2614 | "lib/libb.so.meta_lic", |
| 2615 | "restricted"), |
| 2616 | matchResolution( |
| 2617 | "highest.apex.meta_lic", |
| 2618 | "lib/libc.a.meta_lic", |
| 2619 | "reciprocal", |
| 2620 | "restricted_allows_dynamic_linking"), |
| 2621 | matchResolution( |
| 2622 | "lib/liba.so.meta_lic", |
| 2623 | "lib/liba.so.meta_lic", |
| 2624 | "restricted_allows_dynamic_linking"), |
| 2625 | matchResolution( |
| 2626 | "lib/libb.so.meta_lic", |
| 2627 | "lib/libb.so.meta_lic", |
| 2628 | "restricted"), |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2629 | }, |
| 2630 | }, |
| 2631 | { |
| 2632 | condition: "restricted", |
| 2633 | name: "container", |
| 2634 | roots: []string{"container.zip.meta_lic"}, |
| 2635 | expectedOut: []getMatcher{ |
| 2636 | matchTarget("testdata/restricted/bin/bin1.meta_lic"), |
| 2637 | matchTarget("testdata/restricted/lib/liba.so.meta_lic"), |
| 2638 | matchTarget("testdata/restricted/lib/libc.a.meta_lic"), |
| 2639 | matchTarget("testdata/restricted/bin/bin2.meta_lic"), |
| 2640 | matchTarget("testdata/restricted/lib/libb.so.meta_lic"), |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2641 | matchTarget("testdata/restricted/container.zip.meta_lic"), |
| 2642 | matchResolution( |
| 2643 | "testdata/restricted/bin/bin1.meta_lic", |
| 2644 | "testdata/restricted/bin/bin1.meta_lic", |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 2645 | "restricted_allows_dynamic_linking", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2646 | "notice"), |
| 2647 | matchResolution( |
| 2648 | "testdata/restricted/bin/bin1.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2649 | "testdata/restricted/lib/liba.so.meta_lic", |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 2650 | "restricted_allows_dynamic_linking"), |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2651 | matchResolution( |
| 2652 | "testdata/restricted/bin/bin1.meta_lic", |
| 2653 | "testdata/restricted/lib/libc.a.meta_lic", |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 2654 | "reciprocal", |
| 2655 | "restricted_allows_dynamic_linking"), |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2656 | matchResolution( |
| 2657 | "testdata/restricted/bin/bin2.meta_lic", |
| 2658 | "testdata/restricted/bin/bin2.meta_lic", |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 2659 | "restricted", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2660 | "notice"), |
| 2661 | matchResolution( |
| 2662 | "testdata/restricted/bin/bin2.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2663 | "testdata/restricted/lib/libb.so.meta_lic", |
| 2664 | "restricted"), |
| 2665 | matchResolution( |
| 2666 | "testdata/restricted/container.zip.meta_lic", |
| 2667 | "testdata/restricted/bin/bin1.meta_lic", |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 2668 | "restricted_allows_dynamic_linking", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2669 | "notice"), |
| 2670 | matchResolution( |
| 2671 | "testdata/restricted/container.zip.meta_lic", |
| 2672 | "testdata/restricted/bin/bin2.meta_lic", |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 2673 | "restricted", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2674 | "notice"), |
| 2675 | matchResolution( |
| 2676 | "testdata/restricted/container.zip.meta_lic", |
| 2677 | "testdata/restricted/container.zip.meta_lic", |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 2678 | "restricted", |
| 2679 | "restricted_allows_dynamic_linking", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2680 | "notice"), |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 2681 | matchResolution( |
| 2682 | "testdata/restricted/container.zip.meta_lic", |
| 2683 | "testdata/restricted/lib/liba.so.meta_lic", |
| 2684 | "restricted_allows_dynamic_linking"), |
| 2685 | matchResolution( |
| 2686 | "testdata/restricted/container.zip.meta_lic", |
| 2687 | "testdata/restricted/lib/libb.so.meta_lic", |
| 2688 | "restricted"), |
| 2689 | matchResolution( |
| 2690 | "testdata/restricted/container.zip.meta_lic", |
| 2691 | "testdata/restricted/lib/libc.a.meta_lic", |
| 2692 | "reciprocal", |
| 2693 | "restricted_allows_dynamic_linking"), |
| 2694 | matchResolution( |
| 2695 | "testdata/restricted/lib/liba.so.meta_lic", |
| 2696 | "testdata/restricted/lib/liba.so.meta_lic", |
| 2697 | "restricted_allows_dynamic_linking"), |
| 2698 | matchResolution( |
| 2699 | "testdata/restricted/lib/libb.so.meta_lic", |
| 2700 | "testdata/restricted/lib/libb.so.meta_lic", |
| 2701 | "restricted"), |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2702 | }, |
| 2703 | }, |
| 2704 | { |
| 2705 | condition: "restricted", |
| 2706 | name: "application", |
| 2707 | roots: []string{"application.meta_lic"}, |
| 2708 | expectedOut: []getMatcher{ |
| 2709 | matchTarget("testdata/restricted/application.meta_lic"), |
| 2710 | matchTarget("testdata/restricted/lib/liba.so.meta_lic"), |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2711 | matchResolution( |
| 2712 | "testdata/restricted/application.meta_lic", |
| 2713 | "testdata/restricted/application.meta_lic", |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 2714 | "restricted", |
| 2715 | "restricted_allows_dynamic_linking", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2716 | "notice"), |
| 2717 | matchResolution( |
| 2718 | "testdata/restricted/application.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2719 | "testdata/restricted/lib/liba.so.meta_lic", |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 2720 | "restricted_allows_dynamic_linking", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2721 | "restricted"), |
| 2722 | }, |
| 2723 | }, |
| 2724 | { |
| 2725 | condition: "restricted", |
| 2726 | name: "binary", |
| 2727 | roots: []string{"bin/bin1.meta_lic"}, |
| 2728 | expectedOut: []getMatcher{ |
| 2729 | matchTarget("testdata/restricted/bin/bin1.meta_lic"), |
| 2730 | matchTarget("testdata/restricted/lib/liba.so.meta_lic"), |
| 2731 | matchTarget("testdata/restricted/lib/libc.a.meta_lic"), |
| 2732 | matchResolution( |
| 2733 | "testdata/restricted/bin/bin1.meta_lic", |
| 2734 | "testdata/restricted/bin/bin1.meta_lic", |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 2735 | "restricted_allows_dynamic_linking", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2736 | "notice"), |
| 2737 | matchResolution( |
| 2738 | "testdata/restricted/bin/bin1.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2739 | "testdata/restricted/lib/liba.so.meta_lic", |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 2740 | "restricted_allows_dynamic_linking"), |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2741 | matchResolution( |
| 2742 | "testdata/restricted/bin/bin1.meta_lic", |
| 2743 | "testdata/restricted/lib/libc.a.meta_lic", |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 2744 | "restricted_allows_dynamic_linking", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2745 | "reciprocal"), |
| 2746 | }, |
| 2747 | }, |
| 2748 | { |
| 2749 | condition: "restricted", |
| 2750 | name: "library", |
| 2751 | roots: []string{"lib/libd.so.meta_lic"}, |
| 2752 | expectedOut: []getMatcher{ |
| 2753 | matchTarget("testdata/restricted/lib/libd.so.meta_lic"), |
| 2754 | matchResolution( |
| 2755 | "testdata/restricted/lib/libd.so.meta_lic", |
| 2756 | "testdata/restricted/lib/libd.so.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2757 | "notice"), |
| 2758 | }, |
| 2759 | }, |
| 2760 | { |
| 2761 | condition: "proprietary", |
| 2762 | name: "apex", |
| 2763 | roots: []string{"highest.apex.meta_lic"}, |
| 2764 | expectedOut: []getMatcher{ |
| 2765 | matchTarget("testdata/proprietary/bin/bin1.meta_lic"), |
| 2766 | matchTarget("testdata/proprietary/lib/liba.so.meta_lic"), |
| 2767 | matchTarget("testdata/proprietary/lib/libc.a.meta_lic"), |
| 2768 | matchTarget("testdata/proprietary/bin/bin2.meta_lic"), |
| 2769 | matchTarget("testdata/proprietary/lib/libb.so.meta_lic"), |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2770 | matchTarget("testdata/proprietary/highest.apex.meta_lic"), |
| 2771 | matchResolution( |
| 2772 | "testdata/proprietary/bin/bin1.meta_lic", |
| 2773 | "testdata/proprietary/bin/bin1.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2774 | "notice"), |
| 2775 | matchResolution( |
| 2776 | "testdata/proprietary/bin/bin1.meta_lic", |
| 2777 | "testdata/proprietary/lib/liba.so.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2778 | "by_exception_only", |
| 2779 | "proprietary"), |
| 2780 | matchResolution( |
| 2781 | "testdata/proprietary/bin/bin1.meta_lic", |
| 2782 | "testdata/proprietary/lib/libc.a.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2783 | "by_exception_only", |
| 2784 | "proprietary"), |
| 2785 | matchResolution( |
| 2786 | "testdata/proprietary/bin/bin2.meta_lic", |
| 2787 | "testdata/proprietary/bin/bin2.meta_lic", |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 2788 | "restricted", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2789 | "by_exception_only", |
| 2790 | "proprietary"), |
| 2791 | matchResolution( |
| 2792 | "testdata/proprietary/bin/bin2.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2793 | "testdata/proprietary/lib/libb.so.meta_lic", |
| 2794 | "restricted"), |
| 2795 | matchResolution( |
| 2796 | "testdata/proprietary/highest.apex.meta_lic", |
| 2797 | "testdata/proprietary/bin/bin1.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2798 | "notice"), |
| 2799 | matchResolution( |
| 2800 | "testdata/proprietary/highest.apex.meta_lic", |
| 2801 | "testdata/proprietary/bin/bin2.meta_lic", |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 2802 | "restricted", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2803 | "by_exception_only", |
| 2804 | "proprietary"), |
| 2805 | matchResolution( |
| 2806 | "testdata/proprietary/highest.apex.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2807 | "testdata/proprietary/highest.apex.meta_lic", |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 2808 | "restricted", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2809 | "notice"), |
| 2810 | matchResolution( |
| 2811 | "testdata/proprietary/highest.apex.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2812 | "testdata/proprietary/lib/liba.so.meta_lic", |
| 2813 | "by_exception_only", |
| 2814 | "proprietary"), |
| 2815 | matchResolution( |
| 2816 | "testdata/proprietary/highest.apex.meta_lic", |
| 2817 | "testdata/proprietary/lib/libb.so.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2818 | "restricted"), |
| 2819 | matchResolution( |
| 2820 | "testdata/proprietary/highest.apex.meta_lic", |
| 2821 | "testdata/proprietary/lib/libc.a.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2822 | "by_exception_only", |
| 2823 | "proprietary"), |
| 2824 | matchResolution( |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2825 | "testdata/proprietary/lib/liba.so.meta_lic", |
| 2826 | "testdata/proprietary/lib/liba.so.meta_lic", |
| 2827 | "by_exception_only", |
| 2828 | "proprietary"), |
| 2829 | matchResolution( |
| 2830 | "testdata/proprietary/lib/libb.so.meta_lic", |
| 2831 | "testdata/proprietary/lib/libb.so.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2832 | "restricted"), |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2833 | }, |
| 2834 | }, |
| 2835 | { |
| 2836 | condition: "proprietary", |
| 2837 | name: "apex_trimmed", |
| 2838 | roots: []string{"highest.apex.meta_lic"}, |
| 2839 | ctx: context{stripPrefix: "testdata/proprietary/"}, |
| 2840 | expectedOut: []getMatcher{ |
| 2841 | matchTarget("bin/bin1.meta_lic"), |
| 2842 | matchTarget("lib/liba.so.meta_lic"), |
| 2843 | matchTarget("lib/libc.a.meta_lic"), |
| 2844 | matchTarget("bin/bin2.meta_lic"), |
| 2845 | matchTarget("lib/libb.so.meta_lic"), |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2846 | matchTarget("highest.apex.meta_lic"), |
| 2847 | matchResolution( |
| 2848 | "bin/bin1.meta_lic", |
| 2849 | "bin/bin1.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2850 | "notice"), |
| 2851 | matchResolution( |
| 2852 | "bin/bin1.meta_lic", |
| 2853 | "lib/liba.so.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2854 | "by_exception_only", |
| 2855 | "proprietary"), |
| 2856 | matchResolution( |
| 2857 | "bin/bin1.meta_lic", |
| 2858 | "lib/libc.a.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2859 | "by_exception_only", |
| 2860 | "proprietary"), |
| 2861 | matchResolution( |
| 2862 | "bin/bin2.meta_lic", |
| 2863 | "bin/bin2.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2864 | "by_exception_only", |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 2865 | "restricted", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2866 | "proprietary"), |
| 2867 | matchResolution( |
| 2868 | "bin/bin2.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2869 | "lib/libb.so.meta_lic", |
| 2870 | "restricted"), |
| 2871 | matchResolution( |
| 2872 | "highest.apex.meta_lic", |
| 2873 | "bin/bin1.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2874 | "notice"), |
| 2875 | matchResolution( |
| 2876 | "highest.apex.meta_lic", |
| 2877 | "bin/bin2.meta_lic", |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 2878 | "restricted", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2879 | "by_exception_only", |
| 2880 | "proprietary"), |
| 2881 | matchResolution( |
| 2882 | "highest.apex.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2883 | "highest.apex.meta_lic", |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 2884 | "restricted", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2885 | "notice"), |
| 2886 | matchResolution( |
| 2887 | "highest.apex.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2888 | "lib/liba.so.meta_lic", |
| 2889 | "by_exception_only", |
| 2890 | "proprietary"), |
| 2891 | matchResolution( |
| 2892 | "highest.apex.meta_lic", |
| 2893 | "lib/libb.so.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2894 | "restricted"), |
| 2895 | matchResolution( |
| 2896 | "highest.apex.meta_lic", |
| 2897 | "lib/libc.a.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2898 | "by_exception_only", |
| 2899 | "proprietary"), |
| 2900 | matchResolution( |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2901 | "lib/liba.so.meta_lic", |
| 2902 | "lib/liba.so.meta_lic", |
| 2903 | "by_exception_only", |
| 2904 | "proprietary"), |
| 2905 | matchResolution( |
| 2906 | "lib/libb.so.meta_lic", |
| 2907 | "lib/libb.so.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2908 | "restricted"), |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2909 | }, |
| 2910 | }, |
| 2911 | { |
| 2912 | condition: "proprietary", |
| 2913 | name: "apex_trimmed_notice", |
| 2914 | roots: []string{"highest.apex.meta_lic"}, |
| 2915 | ctx: context{ |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 2916 | conditions: []compliance.LicenseCondition{compliance.NoticeCondition}, |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2917 | stripPrefix: "testdata/proprietary/", |
| 2918 | }, |
| 2919 | expectedOut: []getMatcher{ |
| 2920 | matchTarget("bin/bin1.meta_lic"), |
| 2921 | matchTarget("highest.apex.meta_lic"), |
| 2922 | matchResolution( |
| 2923 | "bin/bin1.meta_lic", |
| 2924 | "bin/bin1.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2925 | "notice"), |
| 2926 | matchResolution( |
| 2927 | "highest.apex.meta_lic", |
| 2928 | "bin/bin1.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2929 | "notice"), |
| 2930 | matchResolution( |
| 2931 | "highest.apex.meta_lic", |
| 2932 | "highest.apex.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2933 | "notice"), |
| 2934 | }, |
| 2935 | }, |
| 2936 | { |
| 2937 | condition: "proprietary", |
| 2938 | name: "apex_trimmed_share", |
| 2939 | roots: []string{"highest.apex.meta_lic"}, |
| 2940 | ctx: context{ |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 2941 | conditions: compliance.ImpliesShared.AsList(), |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2942 | stripPrefix: "testdata/proprietary/", |
| 2943 | }, |
| 2944 | expectedOut: []getMatcher{ |
| 2945 | matchTarget("bin/bin2.meta_lic"), |
| 2946 | matchTarget("lib/libb.so.meta_lic"), |
| 2947 | matchTarget("highest.apex.meta_lic"), |
| 2948 | matchResolution( |
| 2949 | "bin/bin2.meta_lic", |
| 2950 | "bin/bin2.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2951 | "restricted"), |
| 2952 | matchResolution( |
| 2953 | "bin/bin2.meta_lic", |
| 2954 | "lib/libb.so.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2955 | "restricted"), |
| 2956 | matchResolution( |
| 2957 | "highest.apex.meta_lic", |
| 2958 | "bin/bin2.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2959 | "restricted"), |
| 2960 | matchResolution( |
| 2961 | "highest.apex.meta_lic", |
| 2962 | "highest.apex.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2963 | "restricted"), |
| 2964 | matchResolution( |
| 2965 | "highest.apex.meta_lic", |
| 2966 | "lib/libb.so.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2967 | "restricted"), |
| 2968 | matchResolution( |
| 2969 | "lib/libb.so.meta_lic", |
| 2970 | "lib/libb.so.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2971 | "restricted"), |
| 2972 | }, |
| 2973 | }, |
| 2974 | { |
| 2975 | condition: "proprietary", |
| 2976 | name: "apex_trimmed_private", |
| 2977 | roots: []string{"highest.apex.meta_lic"}, |
| 2978 | ctx: context{ |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 2979 | conditions: compliance.ImpliesPrivate.AsList(), |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2980 | stripPrefix: "testdata/proprietary/", |
| 2981 | }, |
| 2982 | expectedOut: []getMatcher{ |
| 2983 | matchTarget("bin/bin1.meta_lic"), |
| 2984 | matchTarget("lib/liba.so.meta_lic"), |
| 2985 | matchTarget("lib/libc.a.meta_lic"), |
| 2986 | matchTarget("bin/bin2.meta_lic"), |
| 2987 | matchTarget("highest.apex.meta_lic"), |
| 2988 | matchResolution( |
| 2989 | "bin/bin1.meta_lic", |
| 2990 | "lib/liba.so.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2991 | "proprietary"), |
| 2992 | matchResolution( |
| 2993 | "bin/bin1.meta_lic", |
| 2994 | "lib/libc.a.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2995 | "proprietary"), |
| 2996 | matchResolution( |
| 2997 | "bin/bin2.meta_lic", |
| 2998 | "bin/bin2.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 2999 | "proprietary"), |
| 3000 | matchResolution( |
| 3001 | "highest.apex.meta_lic", |
| 3002 | "bin/bin2.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 3003 | "proprietary"), |
| 3004 | matchResolution( |
| 3005 | "highest.apex.meta_lic", |
| 3006 | "lib/liba.so.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 3007 | "proprietary"), |
| 3008 | matchResolution( |
| 3009 | "highest.apex.meta_lic", |
| 3010 | "lib/libc.a.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 3011 | "proprietary"), |
| 3012 | matchResolution( |
| 3013 | "lib/liba.so.meta_lic", |
| 3014 | "lib/liba.so.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 3015 | "proprietary"), |
| 3016 | }, |
| 3017 | }, |
| 3018 | { |
| 3019 | condition: "proprietary", |
| 3020 | name: "apex_trimmed_share_private", |
| 3021 | roots: []string{"highest.apex.meta_lic"}, |
| 3022 | ctx: context{ |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 3023 | conditions: compliance.ImpliesShared.Union(compliance.ImpliesPrivate).AsList(), |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 3024 | stripPrefix: "testdata/proprietary/", |
| 3025 | }, |
| 3026 | expectedOut: []getMatcher{ |
| 3027 | matchTarget("bin/bin1.meta_lic"), |
| 3028 | matchTarget("lib/liba.so.meta_lic"), |
| 3029 | matchTarget("lib/libc.a.meta_lic"), |
| 3030 | matchTarget("bin/bin2.meta_lic"), |
| 3031 | matchTarget("lib/libb.so.meta_lic"), |
| 3032 | matchTarget("highest.apex.meta_lic"), |
| 3033 | matchResolution( |
| 3034 | "bin/bin1.meta_lic", |
| 3035 | "lib/liba.so.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 3036 | "proprietary"), |
| 3037 | matchResolution( |
| 3038 | "bin/bin1.meta_lic", |
| 3039 | "lib/libc.a.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 3040 | "proprietary"), |
| 3041 | matchResolution( |
| 3042 | "bin/bin2.meta_lic", |
| 3043 | "bin/bin2.meta_lic", |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 3044 | "restricted", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 3045 | "proprietary"), |
| 3046 | matchResolution( |
| 3047 | "bin/bin2.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 3048 | "lib/libb.so.meta_lic", |
| 3049 | "restricted"), |
| 3050 | matchResolution( |
| 3051 | "highest.apex.meta_lic", |
| 3052 | "bin/bin2.meta_lic", |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 3053 | "restricted", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 3054 | "proprietary"), |
| 3055 | matchResolution( |
| 3056 | "highest.apex.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 3057 | "highest.apex.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 3058 | "restricted"), |
| 3059 | matchResolution( |
| 3060 | "highest.apex.meta_lic", |
| 3061 | "lib/liba.so.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 3062 | "proprietary"), |
| 3063 | matchResolution( |
| 3064 | "highest.apex.meta_lic", |
| 3065 | "lib/libb.so.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 3066 | "restricted"), |
| 3067 | matchResolution( |
| 3068 | "highest.apex.meta_lic", |
| 3069 | "lib/libc.a.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 3070 | "proprietary"), |
| 3071 | matchResolution( |
| 3072 | "lib/liba.so.meta_lic", |
| 3073 | "lib/liba.so.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 3074 | "proprietary"), |
| 3075 | matchResolution( |
| 3076 | "lib/libb.so.meta_lic", |
| 3077 | "lib/libb.so.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 3078 | "restricted"), |
| 3079 | }, |
| 3080 | }, |
| 3081 | { |
| 3082 | condition: "proprietary", |
| 3083 | name: "apex_trimmed_labelled", |
| 3084 | roots: []string{"highest.apex.meta_lic"}, |
| 3085 | ctx: context{stripPrefix: "testdata/proprietary/", labelConditions: true}, |
| 3086 | expectedOut: []getMatcher{ |
| 3087 | matchTarget("bin/bin1.meta_lic", "notice"), |
| 3088 | matchTarget("lib/liba.so.meta_lic", "by_exception_only", "proprietary"), |
| 3089 | matchTarget("lib/libc.a.meta_lic", "by_exception_only", "proprietary"), |
| 3090 | matchTarget("bin/bin2.meta_lic", "by_exception_only", "proprietary"), |
| 3091 | matchTarget("lib/libb.so.meta_lic", "restricted"), |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 3092 | matchTarget("highest.apex.meta_lic", "notice"), |
| 3093 | matchResolution( |
| 3094 | "bin/bin1.meta_lic", |
| 3095 | "bin/bin1.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 3096 | "notice"), |
| 3097 | matchResolution( |
| 3098 | "bin/bin1.meta_lic", |
| 3099 | "lib/liba.so.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 3100 | "by_exception_only", |
| 3101 | "proprietary"), |
| 3102 | matchResolution( |
| 3103 | "bin/bin1.meta_lic", |
| 3104 | "lib/libc.a.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 3105 | "by_exception_only", |
| 3106 | "proprietary"), |
| 3107 | matchResolution( |
| 3108 | "bin/bin2.meta_lic", |
| 3109 | "bin/bin2.meta_lic", |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 3110 | "restricted", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 3111 | "by_exception_only", |
| 3112 | "proprietary"), |
| 3113 | matchResolution( |
| 3114 | "bin/bin2.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 3115 | "lib/libb.so.meta_lic", |
| 3116 | "restricted"), |
| 3117 | matchResolution( |
| 3118 | "highest.apex.meta_lic", |
| 3119 | "bin/bin1.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 3120 | "notice"), |
| 3121 | matchResolution( |
| 3122 | "highest.apex.meta_lic", |
| 3123 | "bin/bin2.meta_lic", |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 3124 | "restricted", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 3125 | "by_exception_only", |
| 3126 | "proprietary"), |
| 3127 | matchResolution( |
| 3128 | "highest.apex.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 3129 | "highest.apex.meta_lic", |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 3130 | "restricted", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 3131 | "notice"), |
| 3132 | matchResolution( |
| 3133 | "highest.apex.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 3134 | "lib/liba.so.meta_lic", |
| 3135 | "by_exception_only", |
| 3136 | "proprietary"), |
| 3137 | matchResolution( |
| 3138 | "highest.apex.meta_lic", |
| 3139 | "lib/libb.so.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 3140 | "restricted"), |
| 3141 | matchResolution( |
| 3142 | "highest.apex.meta_lic", |
| 3143 | "lib/libc.a.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 3144 | "by_exception_only", |
| 3145 | "proprietary"), |
| 3146 | matchResolution( |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 3147 | "lib/liba.so.meta_lic", |
| 3148 | "lib/liba.so.meta_lic", |
| 3149 | "by_exception_only", |
| 3150 | "proprietary"), |
| 3151 | matchResolution( |
| 3152 | "lib/libb.so.meta_lic", |
| 3153 | "lib/libb.so.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 3154 | "restricted"), |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 3155 | }, |
| 3156 | }, |
| 3157 | { |
| 3158 | condition: "proprietary", |
| 3159 | name: "container", |
| 3160 | roots: []string{"container.zip.meta_lic"}, |
| 3161 | expectedOut: []getMatcher{ |
| 3162 | matchTarget("testdata/proprietary/bin/bin1.meta_lic"), |
| 3163 | matchTarget("testdata/proprietary/lib/liba.so.meta_lic"), |
| 3164 | matchTarget("testdata/proprietary/lib/libc.a.meta_lic"), |
| 3165 | matchTarget("testdata/proprietary/bin/bin2.meta_lic"), |
| 3166 | matchTarget("testdata/proprietary/lib/libb.so.meta_lic"), |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 3167 | matchTarget("testdata/proprietary/container.zip.meta_lic"), |
| 3168 | matchResolution( |
| 3169 | "testdata/proprietary/bin/bin1.meta_lic", |
| 3170 | "testdata/proprietary/bin/bin1.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 3171 | "notice"), |
| 3172 | matchResolution( |
| 3173 | "testdata/proprietary/bin/bin1.meta_lic", |
| 3174 | "testdata/proprietary/lib/liba.so.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 3175 | "by_exception_only", |
| 3176 | "proprietary"), |
| 3177 | matchResolution( |
| 3178 | "testdata/proprietary/bin/bin1.meta_lic", |
| 3179 | "testdata/proprietary/lib/libc.a.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 3180 | "by_exception_only", |
| 3181 | "proprietary"), |
| 3182 | matchResolution( |
| 3183 | "testdata/proprietary/bin/bin2.meta_lic", |
| 3184 | "testdata/proprietary/bin/bin2.meta_lic", |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 3185 | "restricted", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 3186 | "by_exception_only", |
| 3187 | "proprietary"), |
| 3188 | matchResolution( |
| 3189 | "testdata/proprietary/bin/bin2.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 3190 | "testdata/proprietary/lib/libb.so.meta_lic", |
| 3191 | "restricted"), |
| 3192 | matchResolution( |
| 3193 | "testdata/proprietary/container.zip.meta_lic", |
| 3194 | "testdata/proprietary/bin/bin1.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 3195 | "notice"), |
| 3196 | matchResolution( |
| 3197 | "testdata/proprietary/container.zip.meta_lic", |
| 3198 | "testdata/proprietary/bin/bin2.meta_lic", |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 3199 | "restricted", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 3200 | "by_exception_only", |
| 3201 | "proprietary"), |
| 3202 | matchResolution( |
| 3203 | "testdata/proprietary/container.zip.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 3204 | "testdata/proprietary/container.zip.meta_lic", |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 3205 | "restricted", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 3206 | "notice"), |
| 3207 | matchResolution( |
| 3208 | "testdata/proprietary/container.zip.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 3209 | "testdata/proprietary/lib/liba.so.meta_lic", |
| 3210 | "by_exception_only", |
| 3211 | "proprietary"), |
| 3212 | matchResolution( |
| 3213 | "testdata/proprietary/container.zip.meta_lic", |
| 3214 | "testdata/proprietary/lib/libb.so.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 3215 | "restricted"), |
| 3216 | matchResolution( |
| 3217 | "testdata/proprietary/container.zip.meta_lic", |
| 3218 | "testdata/proprietary/lib/libc.a.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 3219 | "by_exception_only", |
| 3220 | "proprietary"), |
| 3221 | matchResolution( |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 3222 | "testdata/proprietary/lib/liba.so.meta_lic", |
| 3223 | "testdata/proprietary/lib/liba.so.meta_lic", |
| 3224 | "by_exception_only", |
| 3225 | "proprietary"), |
| 3226 | matchResolution( |
| 3227 | "testdata/proprietary/lib/libb.so.meta_lic", |
| 3228 | "testdata/proprietary/lib/libb.so.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 3229 | "restricted"), |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 3230 | }, |
| 3231 | }, |
| 3232 | { |
| 3233 | condition: "proprietary", |
| 3234 | name: "application", |
| 3235 | roots: []string{"application.meta_lic"}, |
| 3236 | expectedOut: []getMatcher{ |
| 3237 | matchTarget("testdata/proprietary/application.meta_lic"), |
| 3238 | matchTarget("testdata/proprietary/lib/liba.so.meta_lic"), |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 3239 | matchResolution( |
| 3240 | "testdata/proprietary/application.meta_lic", |
| 3241 | "testdata/proprietary/application.meta_lic", |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 3242 | "notice", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 3243 | "restricted"), |
| 3244 | matchResolution( |
| 3245 | "testdata/proprietary/application.meta_lic", |
| 3246 | "testdata/proprietary/lib/liba.so.meta_lic", |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 3247 | "restricted", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 3248 | "by_exception_only", |
| 3249 | "proprietary"), |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 3250 | }, |
| 3251 | }, |
| 3252 | { |
| 3253 | condition: "proprietary", |
| 3254 | name: "binary", |
| 3255 | roots: []string{"bin/bin1.meta_lic"}, |
| 3256 | expectedOut: []getMatcher{ |
| 3257 | matchTarget("testdata/proprietary/bin/bin1.meta_lic"), |
| 3258 | matchTarget("testdata/proprietary/lib/liba.so.meta_lic"), |
| 3259 | matchTarget("testdata/proprietary/lib/libc.a.meta_lic"), |
| 3260 | matchResolution( |
| 3261 | "testdata/proprietary/bin/bin1.meta_lic", |
| 3262 | "testdata/proprietary/bin/bin1.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 3263 | "notice"), |
| 3264 | matchResolution( |
| 3265 | "testdata/proprietary/bin/bin1.meta_lic", |
| 3266 | "testdata/proprietary/lib/liba.so.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 3267 | "by_exception_only", |
| 3268 | "proprietary"), |
| 3269 | matchResolution( |
| 3270 | "testdata/proprietary/bin/bin1.meta_lic", |
| 3271 | "testdata/proprietary/lib/libc.a.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 3272 | "by_exception_only", |
| 3273 | "proprietary"), |
| 3274 | }, |
| 3275 | }, |
| 3276 | { |
| 3277 | condition: "proprietary", |
| 3278 | name: "library", |
| 3279 | roots: []string{"lib/libd.so.meta_lic"}, |
| 3280 | expectedOut: []getMatcher{ |
| 3281 | matchTarget("testdata/proprietary/lib/libd.so.meta_lic"), |
| 3282 | matchResolution( |
| 3283 | "testdata/proprietary/lib/libd.so.meta_lic", |
| 3284 | "testdata/proprietary/lib/libd.so.meta_lic", |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 3285 | "notice"), |
| 3286 | }, |
| 3287 | }, |
| 3288 | } |
| 3289 | for _, tt := range tests { |
| 3290 | t.Run(tt.condition+" "+tt.name, func(t *testing.T) { |
| 3291 | ctx := &testContext{0, make(map[string]string)} |
| 3292 | |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 3293 | stdout := &bytes.Buffer{} |
| 3294 | stderr := &bytes.Buffer{} |
| 3295 | |
| 3296 | rootFiles := make([]string, 0, len(tt.roots)) |
| 3297 | for _, r := range tt.roots { |
| 3298 | rootFiles = append(rootFiles, "testdata/"+tt.condition+"/"+r) |
| 3299 | } |
| 3300 | tt.ctx.graphViz = true |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 3301 | lg, err := dumpResolutions(&tt.ctx, stdout, stderr, rootFiles...) |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 3302 | if err != nil { |
| 3303 | t.Fatalf("dumpresolutions: error = %v, stderr = %v", err, stderr) |
| 3304 | return |
| 3305 | } |
| 3306 | if stderr.Len() > 0 { |
| 3307 | t.Errorf("dumpresolutions: gotStderr = %v, want none", stderr) |
| 3308 | } |
Bob Badour | 103eb0f | 2022-01-10 13:50:57 -0800 | [diff] [blame] | 3309 | |
| 3310 | expectedOut := &bytes.Buffer{} |
| 3311 | for _, eo := range tt.expectedOut { |
| 3312 | m := eo(ctx) |
| 3313 | expectedOut.WriteString(m.matchString(ctx, lg)) |
| 3314 | expectedOut.WriteString("\n") |
| 3315 | } |
| 3316 | |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 3317 | outList := strings.Split(stdout.String(), "\n") |
| 3318 | outLine := 0 |
| 3319 | if outList[outLine] != "strict digraph {" { |
Colin Cross | 179ec3e | 2022-01-27 15:47:09 -0800 | [diff] [blame] | 3320 | t.Errorf("dumpresolutions: got 1st line %v, want strict digraph {", outList[outLine]) |
Bob Badour | 1ded0a1 | 2021-12-03 17:16:14 -0800 | [diff] [blame] | 3321 | } |
| 3322 | outLine++ |
| 3323 | if strings.HasPrefix(strings.TrimLeft(outList[outLine], " \t"), "rankdir") { |
| 3324 | outLine++ |
| 3325 | } |
| 3326 | endOut := len(outList) |
| 3327 | for endOut > 0 && strings.TrimLeft(outList[endOut-1], " \t") == "" { |
| 3328 | endOut-- |
| 3329 | } |
| 3330 | if outList[endOut-1] != "}" { |
| 3331 | t.Errorf("dumpresolutions: got last line %v, want }", outList[endOut-1]) |
| 3332 | } |
| 3333 | endOut-- |
| 3334 | if strings.HasPrefix(strings.TrimLeft(outList[endOut-1], " \t"), "{rank=same") { |
| 3335 | endOut-- |
| 3336 | } |
| 3337 | expectedList := strings.Split(expectedOut.String(), "\n") |
| 3338 | for len(expectedList) > 0 && expectedList[len(expectedList)-1] == "" { |
| 3339 | expectedList = expectedList[0 : len(expectedList)-1] |
| 3340 | } |
| 3341 | matchLine := 0 |
| 3342 | |
| 3343 | for outLine < endOut && matchLine < len(expectedList) && strings.TrimLeft(outList[outLine], " \t") == expectedList[matchLine] { |
| 3344 | outLine++ |
| 3345 | matchLine++ |
| 3346 | } |
| 3347 | if outLine < endOut || matchLine < len(expectedList) { |
| 3348 | if outLine >= endOut { |
| 3349 | t.Errorf("dumpresolutions: missing lines at end of graph, want %d lines %v", len(expectedList)-matchLine, strings.Join(expectedList[matchLine:], "\n")) |
| 3350 | } else if matchLine >= len(expectedList) { |
| 3351 | t.Errorf("dumpresolutions: unexpected lines at end of graph starting line %d, got %v, want nothing", outLine+1, strings.Join(outList[outLine:], "\n")) |
| 3352 | } else { |
| 3353 | t.Errorf("dumpresolutions: at line %d, got %v, want %v", outLine+1, strings.Join(outList[outLine:], "\n"), strings.Join(expectedList[matchLine:], "\n")) |
| 3354 | } |
| 3355 | } |
| 3356 | }) |
| 3357 | } |
| 3358 | } |