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