1*9e94795aSAndroid Build Coastguard Worker// Copyright 2021 Google LLC 2*9e94795aSAndroid Build Coastguard Worker// 3*9e94795aSAndroid Build Coastguard Worker// Licensed under the Apache License, Version 2.0 (the "License"); 4*9e94795aSAndroid Build Coastguard Worker// you may not use this file except in compliance with the License. 5*9e94795aSAndroid Build Coastguard Worker// You may obtain a copy of the License at 6*9e94795aSAndroid Build Coastguard Worker// 7*9e94795aSAndroid Build Coastguard Worker// http://www.apache.org/licenses/LICENSE-2.0 8*9e94795aSAndroid Build Coastguard Worker// 9*9e94795aSAndroid Build Coastguard Worker// Unless required by applicable law or agreed to in writing, software 10*9e94795aSAndroid Build Coastguard Worker// distributed under the License is distributed on an "AS IS" BASIS, 11*9e94795aSAndroid Build Coastguard Worker// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12*9e94795aSAndroid Build Coastguard Worker// See the License for the specific language governing permissions and 13*9e94795aSAndroid Build Coastguard Worker// limitations under the License. 14*9e94795aSAndroid Build Coastguard Worker 15*9e94795aSAndroid Build Coastguard Workerpackage compliance 16*9e94795aSAndroid Build Coastguard Worker 17*9e94795aSAndroid Build Coastguard Workerimport ( 18*9e94795aSAndroid Build Coastguard Worker "bytes" 19*9e94795aSAndroid Build Coastguard Worker "fmt" 20*9e94795aSAndroid Build Coastguard Worker "os" 21*9e94795aSAndroid Build Coastguard Worker "strings" 22*9e94795aSAndroid Build Coastguard Worker "testing" 23*9e94795aSAndroid Build Coastguard Worker) 24*9e94795aSAndroid Build Coastguard Worker 25*9e94795aSAndroid Build Coastguard Workerfunc TestMain(m *testing.M) { 26*9e94795aSAndroid Build Coastguard Worker // Change into the cmd directory before running the tests 27*9e94795aSAndroid Build Coastguard Worker // so they can find the testdata directory. 28*9e94795aSAndroid Build Coastguard Worker if err := os.Chdir("cmd"); err != nil { 29*9e94795aSAndroid Build Coastguard Worker fmt.Printf("failed to change to testdata directory: %s\n", err) 30*9e94795aSAndroid Build Coastguard Worker os.Exit(1) 31*9e94795aSAndroid Build Coastguard Worker } 32*9e94795aSAndroid Build Coastguard Worker os.Exit(m.Run()) 33*9e94795aSAndroid Build Coastguard Worker} 34*9e94795aSAndroid Build Coastguard Worker 35*9e94795aSAndroid Build Coastguard Workerfunc TestWalkResolutionsForCondition(t *testing.T) { 36*9e94795aSAndroid Build Coastguard Worker tests := []struct { 37*9e94795aSAndroid Build Coastguard Worker name string 38*9e94795aSAndroid Build Coastguard Worker condition LicenseConditionSet 39*9e94795aSAndroid Build Coastguard Worker roots []string 40*9e94795aSAndroid Build Coastguard Worker edges []annotated 41*9e94795aSAndroid Build Coastguard Worker expectedResolutions []res 42*9e94795aSAndroid Build Coastguard Worker }{ 43*9e94795aSAndroid Build Coastguard Worker { 44*9e94795aSAndroid Build Coastguard Worker name: "firstparty", 45*9e94795aSAndroid Build Coastguard Worker condition: ImpliesNotice, 46*9e94795aSAndroid Build Coastguard Worker roots: []string{"apacheBin.meta_lic"}, 47*9e94795aSAndroid Build Coastguard Worker edges: []annotated{ 48*9e94795aSAndroid Build Coastguard Worker {"apacheBin.meta_lic", "apacheLib.meta_lic", []string{"static"}}, 49*9e94795aSAndroid Build Coastguard Worker }, 50*9e94795aSAndroid Build Coastguard Worker expectedResolutions: []res{ 51*9e94795aSAndroid Build Coastguard Worker {"apacheBin.meta_lic", "apacheBin.meta_lic", "notice"}, 52*9e94795aSAndroid Build Coastguard Worker {"apacheBin.meta_lic", "apacheLib.meta_lic", "notice"}, 53*9e94795aSAndroid Build Coastguard Worker }, 54*9e94795aSAndroid Build Coastguard Worker }, 55*9e94795aSAndroid Build Coastguard Worker { 56*9e94795aSAndroid Build Coastguard Worker name: "notice", 57*9e94795aSAndroid Build Coastguard Worker condition: ImpliesNotice, 58*9e94795aSAndroid Build Coastguard Worker roots: []string{"mitBin.meta_lic"}, 59*9e94795aSAndroid Build Coastguard Worker edges: []annotated{ 60*9e94795aSAndroid Build Coastguard Worker {"mitBin.meta_lic", "mitLib.meta_lic", []string{"static"}}, 61*9e94795aSAndroid Build Coastguard Worker }, 62*9e94795aSAndroid Build Coastguard Worker expectedResolutions: []res{ 63*9e94795aSAndroid Build Coastguard Worker {"mitBin.meta_lic", "mitBin.meta_lic", "notice"}, 64*9e94795aSAndroid Build Coastguard Worker {"mitBin.meta_lic", "mitLib.meta_lic", "notice"}, 65*9e94795aSAndroid Build Coastguard Worker }, 66*9e94795aSAndroid Build Coastguard Worker }, 67*9e94795aSAndroid Build Coastguard Worker { 68*9e94795aSAndroid Build Coastguard Worker name: "fponlgplnotice", 69*9e94795aSAndroid Build Coastguard Worker condition: ImpliesNotice, 70*9e94795aSAndroid Build Coastguard Worker roots: []string{"apacheBin.meta_lic"}, 71*9e94795aSAndroid Build Coastguard Worker edges: []annotated{ 72*9e94795aSAndroid Build Coastguard Worker {"apacheBin.meta_lic", "lgplLib.meta_lic", []string{"static"}}, 73*9e94795aSAndroid Build Coastguard Worker }, 74*9e94795aSAndroid Build Coastguard Worker expectedResolutions: []res{ 75*9e94795aSAndroid Build Coastguard Worker {"apacheBin.meta_lic", "apacheBin.meta_lic", "notice|restricted_if_statically_linked"}, 76*9e94795aSAndroid Build Coastguard Worker {"apacheBin.meta_lic", "lgplLib.meta_lic", "restricted_if_statically_linked"}, 77*9e94795aSAndroid Build Coastguard Worker }, 78*9e94795aSAndroid Build Coastguard Worker }, 79*9e94795aSAndroid Build Coastguard Worker { 80*9e94795aSAndroid Build Coastguard Worker name: "fponlgpldynamicnotice", 81*9e94795aSAndroid Build Coastguard Worker condition: ImpliesNotice, 82*9e94795aSAndroid Build Coastguard Worker roots: []string{"apacheBin.meta_lic"}, 83*9e94795aSAndroid Build Coastguard Worker edges: []annotated{ 84*9e94795aSAndroid Build Coastguard Worker {"apacheBin.meta_lic", "lgplLib.meta_lic", []string{"dynamic"}}, 85*9e94795aSAndroid Build Coastguard Worker }, 86*9e94795aSAndroid Build Coastguard Worker expectedResolutions: []res{ 87*9e94795aSAndroid Build Coastguard Worker {"apacheBin.meta_lic", "apacheBin.meta_lic", "notice"}, 88*9e94795aSAndroid Build Coastguard Worker }, 89*9e94795aSAndroid Build Coastguard Worker }, 90*9e94795aSAndroid Build Coastguard Worker { 91*9e94795aSAndroid Build Coastguard Worker name: "independentmodulenotice", 92*9e94795aSAndroid Build Coastguard Worker condition: ImpliesNotice, 93*9e94795aSAndroid Build Coastguard Worker roots: []string{"apacheBin.meta_lic"}, 94*9e94795aSAndroid Build Coastguard Worker edges: []annotated{ 95*9e94795aSAndroid Build Coastguard Worker {"apacheBin.meta_lic", "gplWithClasspathException.meta_lic", []string{"dynamic"}}, 96*9e94795aSAndroid Build Coastguard Worker }, 97*9e94795aSAndroid Build Coastguard Worker expectedResolutions: []res{ 98*9e94795aSAndroid Build Coastguard Worker {"apacheBin.meta_lic", "apacheBin.meta_lic", "notice"}, 99*9e94795aSAndroid Build Coastguard Worker }, 100*9e94795aSAndroid Build Coastguard Worker }, 101*9e94795aSAndroid Build Coastguard Worker { 102*9e94795aSAndroid Build Coastguard Worker name: "independentmodulerestricted", 103*9e94795aSAndroid Build Coastguard Worker condition: ImpliesRestricted, 104*9e94795aSAndroid Build Coastguard Worker roots: []string{"apacheBin.meta_lic"}, 105*9e94795aSAndroid Build Coastguard Worker edges: []annotated{ 106*9e94795aSAndroid Build Coastguard Worker {"apacheBin.meta_lic", "gplWithClasspathException.meta_lic", []string{"dynamic"}}, 107*9e94795aSAndroid Build Coastguard Worker }, 108*9e94795aSAndroid Build Coastguard Worker expectedResolutions: []res{}, 109*9e94795aSAndroid Build Coastguard Worker }, 110*9e94795aSAndroid Build Coastguard Worker { 111*9e94795aSAndroid Build Coastguard Worker name: "independentmodulestaticnotice", 112*9e94795aSAndroid Build Coastguard Worker condition: ImpliesNotice, 113*9e94795aSAndroid Build Coastguard Worker roots: []string{"apacheBin.meta_lic"}, 114*9e94795aSAndroid Build Coastguard Worker edges: []annotated{ 115*9e94795aSAndroid Build Coastguard Worker {"apacheBin.meta_lic", "gplWithClasspathException.meta_lic", []string{"static"}}, 116*9e94795aSAndroid Build Coastguard Worker }, 117*9e94795aSAndroid Build Coastguard Worker expectedResolutions: []res{ 118*9e94795aSAndroid Build Coastguard Worker {"apacheBin.meta_lic", "apacheBin.meta_lic", "notice"}, 119*9e94795aSAndroid Build Coastguard Worker {"apacheBin.meta_lic", "gplWithClasspathException.meta_lic", "permissive"}, 120*9e94795aSAndroid Build Coastguard Worker }, 121*9e94795aSAndroid Build Coastguard Worker }, 122*9e94795aSAndroid Build Coastguard Worker { 123*9e94795aSAndroid Build Coastguard Worker name: "independentmodulestaticrestricted", 124*9e94795aSAndroid Build Coastguard Worker condition: ImpliesRestricted, 125*9e94795aSAndroid Build Coastguard Worker roots: []string{"apacheBin.meta_lic"}, 126*9e94795aSAndroid Build Coastguard Worker edges: []annotated{ 127*9e94795aSAndroid Build Coastguard Worker {"apacheBin.meta_lic", "gplWithClasspathException.meta_lic", []string{"static"}}, 128*9e94795aSAndroid Build Coastguard Worker }, 129*9e94795aSAndroid Build Coastguard Worker expectedResolutions: []res{}, 130*9e94795aSAndroid Build Coastguard Worker }, 131*9e94795aSAndroid Build Coastguard Worker { 132*9e94795aSAndroid Build Coastguard Worker name: "dependentmodulenotice", 133*9e94795aSAndroid Build Coastguard Worker condition: ImpliesNotice, 134*9e94795aSAndroid Build Coastguard Worker roots: []string{"dependentModule.meta_lic"}, 135*9e94795aSAndroid Build Coastguard Worker edges: []annotated{ 136*9e94795aSAndroid Build Coastguard Worker {"dependentModule.meta_lic", "gplWithClasspathException.meta_lic", []string{"dynamic"}}, 137*9e94795aSAndroid Build Coastguard Worker }, 138*9e94795aSAndroid Build Coastguard Worker expectedResolutions: []res{ 139*9e94795aSAndroid Build Coastguard Worker {"dependentModule.meta_lic", "dependentModule.meta_lic", "notice"}, 140*9e94795aSAndroid Build Coastguard Worker }, 141*9e94795aSAndroid Build Coastguard Worker }, 142*9e94795aSAndroid Build Coastguard Worker { 143*9e94795aSAndroid Build Coastguard Worker name: "dependentmodulerestricted", 144*9e94795aSAndroid Build Coastguard Worker condition: ImpliesRestricted, 145*9e94795aSAndroid Build Coastguard Worker roots: []string{"dependentModule.meta_lic"}, 146*9e94795aSAndroid Build Coastguard Worker edges: []annotated{ 147*9e94795aSAndroid Build Coastguard Worker {"dependentModule.meta_lic", "gplWithClasspathException.meta_lic", []string{"dynamic"}}, 148*9e94795aSAndroid Build Coastguard Worker }, 149*9e94795aSAndroid Build Coastguard Worker expectedResolutions: []res{}, 150*9e94795aSAndroid Build Coastguard Worker }, 151*9e94795aSAndroid Build Coastguard Worker { 152*9e94795aSAndroid Build Coastguard Worker name: "lgplonfpnotice", 153*9e94795aSAndroid Build Coastguard Worker condition: ImpliesNotice, 154*9e94795aSAndroid Build Coastguard Worker roots: []string{"lgplBin.meta_lic"}, 155*9e94795aSAndroid Build Coastguard Worker edges: []annotated{ 156*9e94795aSAndroid Build Coastguard Worker {"lgplBin.meta_lic", "apacheLib.meta_lic", []string{"static"}}, 157*9e94795aSAndroid Build Coastguard Worker }, 158*9e94795aSAndroid Build Coastguard Worker expectedResolutions: []res{ 159*9e94795aSAndroid Build Coastguard Worker {"lgplBin.meta_lic", "lgplBin.meta_lic", "restricted_if_statically_linked"}, 160*9e94795aSAndroid Build Coastguard Worker {"lgplBin.meta_lic", "apacheLib.meta_lic", "notice|restricted_if_statically_linked"}, 161*9e94795aSAndroid Build Coastguard Worker }, 162*9e94795aSAndroid Build Coastguard Worker }, 163*9e94795aSAndroid Build Coastguard Worker { 164*9e94795aSAndroid Build Coastguard Worker name: "lgplonfprestricted", 165*9e94795aSAndroid Build Coastguard Worker condition: ImpliesRestricted, 166*9e94795aSAndroid Build Coastguard Worker roots: []string{"lgplBin.meta_lic"}, 167*9e94795aSAndroid Build Coastguard Worker edges: []annotated{ 168*9e94795aSAndroid Build Coastguard Worker {"lgplBin.meta_lic", "apacheLib.meta_lic", []string{"static"}}, 169*9e94795aSAndroid Build Coastguard Worker }, 170*9e94795aSAndroid Build Coastguard Worker expectedResolutions: []res{ 171*9e94795aSAndroid Build Coastguard Worker {"lgplBin.meta_lic", "lgplBin.meta_lic", "restricted_if_statically_linked"}, 172*9e94795aSAndroid Build Coastguard Worker {"lgplBin.meta_lic", "apacheLib.meta_lic", "restricted_if_statically_linked"}, 173*9e94795aSAndroid Build Coastguard Worker }, 174*9e94795aSAndroid Build Coastguard Worker }, 175*9e94795aSAndroid Build Coastguard Worker { 176*9e94795aSAndroid Build Coastguard Worker name: "lgplonfpdynamicnotice", 177*9e94795aSAndroid Build Coastguard Worker condition: ImpliesNotice, 178*9e94795aSAndroid Build Coastguard Worker roots: []string{"lgplBin.meta_lic"}, 179*9e94795aSAndroid Build Coastguard Worker edges: []annotated{ 180*9e94795aSAndroid Build Coastguard Worker {"lgplBin.meta_lic", "apacheLib.meta_lic", []string{"dynamic"}}, 181*9e94795aSAndroid Build Coastguard Worker }, 182*9e94795aSAndroid Build Coastguard Worker expectedResolutions: []res{ 183*9e94795aSAndroid Build Coastguard Worker {"lgplBin.meta_lic", "lgplBin.meta_lic", "restricted_if_statically_linked"}, 184*9e94795aSAndroid Build Coastguard Worker }, 185*9e94795aSAndroid Build Coastguard Worker }, 186*9e94795aSAndroid Build Coastguard Worker { 187*9e94795aSAndroid Build Coastguard Worker name: "lgplonfpdynamicrestricted", 188*9e94795aSAndroid Build Coastguard Worker condition: ImpliesRestricted, 189*9e94795aSAndroid Build Coastguard Worker roots: []string{"lgplBin.meta_lic"}, 190*9e94795aSAndroid Build Coastguard Worker edges: []annotated{ 191*9e94795aSAndroid Build Coastguard Worker {"lgplBin.meta_lic", "apacheLib.meta_lic", []string{"dynamic"}}, 192*9e94795aSAndroid Build Coastguard Worker }, 193*9e94795aSAndroid Build Coastguard Worker expectedResolutions: []res{ 194*9e94795aSAndroid Build Coastguard Worker {"lgplBin.meta_lic", "lgplBin.meta_lic", "restricted_if_statically_linked"}, 195*9e94795aSAndroid Build Coastguard Worker }, 196*9e94795aSAndroid Build Coastguard Worker }, 197*9e94795aSAndroid Build Coastguard Worker { 198*9e94795aSAndroid Build Coastguard Worker name: "gplonfpnotice", 199*9e94795aSAndroid Build Coastguard Worker condition: ImpliesNotice, 200*9e94795aSAndroid Build Coastguard Worker roots: []string{"gplBin.meta_lic"}, 201*9e94795aSAndroid Build Coastguard Worker edges: []annotated{ 202*9e94795aSAndroid Build Coastguard Worker {"gplBin.meta_lic", "apacheLib.meta_lic", []string{"static"}}, 203*9e94795aSAndroid Build Coastguard Worker }, 204*9e94795aSAndroid Build Coastguard Worker expectedResolutions: []res{ 205*9e94795aSAndroid Build Coastguard Worker {"gplBin.meta_lic", "gplBin.meta_lic", "restricted"}, 206*9e94795aSAndroid Build Coastguard Worker {"gplBin.meta_lic", "apacheLib.meta_lic", "notice|restricted"}, 207*9e94795aSAndroid Build Coastguard Worker }, 208*9e94795aSAndroid Build Coastguard Worker }, 209*9e94795aSAndroid Build Coastguard Worker { 210*9e94795aSAndroid Build Coastguard Worker name: "gplonfprestricted", 211*9e94795aSAndroid Build Coastguard Worker condition: ImpliesRestricted, 212*9e94795aSAndroid Build Coastguard Worker roots: []string{"gplBin.meta_lic"}, 213*9e94795aSAndroid Build Coastguard Worker edges: []annotated{ 214*9e94795aSAndroid Build Coastguard Worker {"gplBin.meta_lic", "apacheLib.meta_lic", []string{"static"}}, 215*9e94795aSAndroid Build Coastguard Worker }, 216*9e94795aSAndroid Build Coastguard Worker expectedResolutions: []res{ 217*9e94795aSAndroid Build Coastguard Worker {"gplBin.meta_lic", "gplBin.meta_lic", "restricted"}, 218*9e94795aSAndroid Build Coastguard Worker {"gplBin.meta_lic", "apacheLib.meta_lic", "restricted"}, 219*9e94795aSAndroid Build Coastguard Worker }, 220*9e94795aSAndroid Build Coastguard Worker }, 221*9e94795aSAndroid Build Coastguard Worker { 222*9e94795aSAndroid Build Coastguard Worker name: "gplcontainernotice", 223*9e94795aSAndroid Build Coastguard Worker condition: ImpliesNotice, 224*9e94795aSAndroid Build Coastguard Worker roots: []string{"gplContainer.meta_lic"}, 225*9e94795aSAndroid Build Coastguard Worker edges: []annotated{ 226*9e94795aSAndroid Build Coastguard Worker {"gplContainer.meta_lic", "apacheLib.meta_lic", []string{"static"}}, 227*9e94795aSAndroid Build Coastguard Worker }, 228*9e94795aSAndroid Build Coastguard Worker expectedResolutions: []res{ 229*9e94795aSAndroid Build Coastguard Worker {"gplContainer.meta_lic", "gplContainer.meta_lic", "restricted"}, 230*9e94795aSAndroid Build Coastguard Worker {"gplContainer.meta_lic", "apacheLib.meta_lic", "notice|restricted"}, 231*9e94795aSAndroid Build Coastguard Worker {"apacheLib.meta_lic", "apacheLib.meta_lic", "notice|restricted"}, 232*9e94795aSAndroid Build Coastguard Worker }, 233*9e94795aSAndroid Build Coastguard Worker }, 234*9e94795aSAndroid Build Coastguard Worker { 235*9e94795aSAndroid Build Coastguard Worker name: "gplcontainerrestricted", 236*9e94795aSAndroid Build Coastguard Worker condition: ImpliesRestricted, 237*9e94795aSAndroid Build Coastguard Worker roots: []string{"gplContainer.meta_lic"}, 238*9e94795aSAndroid Build Coastguard Worker edges: []annotated{ 239*9e94795aSAndroid Build Coastguard Worker {"gplContainer.meta_lic", "apacheLib.meta_lic", []string{"static"}}, 240*9e94795aSAndroid Build Coastguard Worker }, 241*9e94795aSAndroid Build Coastguard Worker expectedResolutions: []res{ 242*9e94795aSAndroid Build Coastguard Worker {"gplContainer.meta_lic", "gplContainer.meta_lic", "restricted"}, 243*9e94795aSAndroid Build Coastguard Worker {"gplContainer.meta_lic", "apacheLib.meta_lic", "restricted"}, 244*9e94795aSAndroid Build Coastguard Worker {"apacheLib.meta_lic", "apacheLib.meta_lic", "restricted"}, 245*9e94795aSAndroid Build Coastguard Worker }, 246*9e94795aSAndroid Build Coastguard Worker }, 247*9e94795aSAndroid Build Coastguard Worker { 248*9e94795aSAndroid Build Coastguard Worker name: "gploncontainernotice", 249*9e94795aSAndroid Build Coastguard Worker condition: ImpliesNotice, 250*9e94795aSAndroid Build Coastguard Worker roots: []string{"apacheContainer.meta_lic"}, 251*9e94795aSAndroid Build Coastguard Worker edges: []annotated{ 252*9e94795aSAndroid Build Coastguard Worker {"apacheContainer.meta_lic", "apacheLib.meta_lic", []string{"static"}}, 253*9e94795aSAndroid Build Coastguard Worker {"apacheContainer.meta_lic", "gplLib.meta_lic", []string{"static"}}, 254*9e94795aSAndroid Build Coastguard Worker }, 255*9e94795aSAndroid Build Coastguard Worker expectedResolutions: []res{ 256*9e94795aSAndroid Build Coastguard Worker {"apacheContainer.meta_lic", "apacheContainer.meta_lic", "notice|restricted"}, 257*9e94795aSAndroid Build Coastguard Worker {"apacheContainer.meta_lic", "apacheLib.meta_lic", "notice"}, 258*9e94795aSAndroid Build Coastguard Worker {"apacheContainer.meta_lic", "gplLib.meta_lic", "restricted"}, 259*9e94795aSAndroid Build Coastguard Worker {"apacheLib.meta_lic", "apacheLib.meta_lic", "notice"}, 260*9e94795aSAndroid Build Coastguard Worker {"gplLib.meta_lic", "gplLib.meta_lic", "restricted"}, 261*9e94795aSAndroid Build Coastguard Worker }, 262*9e94795aSAndroid Build Coastguard Worker }, 263*9e94795aSAndroid Build Coastguard Worker { 264*9e94795aSAndroid Build Coastguard Worker name: "gploncontainerrestricted", 265*9e94795aSAndroid Build Coastguard Worker condition: ImpliesRestricted, 266*9e94795aSAndroid Build Coastguard Worker roots: []string{"apacheContainer.meta_lic"}, 267*9e94795aSAndroid Build Coastguard Worker edges: []annotated{ 268*9e94795aSAndroid Build Coastguard Worker {"apacheContainer.meta_lic", "apacheLib.meta_lic", []string{"static"}}, 269*9e94795aSAndroid Build Coastguard Worker {"apacheContainer.meta_lic", "gplLib.meta_lic", []string{"static"}}, 270*9e94795aSAndroid Build Coastguard Worker }, 271*9e94795aSAndroid Build Coastguard Worker expectedResolutions: []res{ 272*9e94795aSAndroid Build Coastguard Worker {"apacheContainer.meta_lic", "apacheContainer.meta_lic", "restricted"}, 273*9e94795aSAndroid Build Coastguard Worker {"apacheContainer.meta_lic", "gplLib.meta_lic", "restricted"}, 274*9e94795aSAndroid Build Coastguard Worker {"gplLib.meta_lic", "gplLib.meta_lic", "restricted"}, 275*9e94795aSAndroid Build Coastguard Worker }, 276*9e94795aSAndroid Build Coastguard Worker }, 277*9e94795aSAndroid Build Coastguard Worker { 278*9e94795aSAndroid Build Coastguard Worker name: "gplonbinnotice", 279*9e94795aSAndroid Build Coastguard Worker condition: ImpliesNotice, 280*9e94795aSAndroid Build Coastguard Worker roots: []string{"apacheBin.meta_lic"}, 281*9e94795aSAndroid Build Coastguard Worker edges: []annotated{ 282*9e94795aSAndroid Build Coastguard Worker {"apacheBin.meta_lic", "apacheLib.meta_lic", []string{"static"}}, 283*9e94795aSAndroid Build Coastguard Worker {"apacheBin.meta_lic", "gplLib.meta_lic", []string{"static"}}, 284*9e94795aSAndroid Build Coastguard Worker }, 285*9e94795aSAndroid Build Coastguard Worker expectedResolutions: []res{ 286*9e94795aSAndroid Build Coastguard Worker {"apacheBin.meta_lic", "apacheBin.meta_lic", "notice|restricted"}, 287*9e94795aSAndroid Build Coastguard Worker {"apacheBin.meta_lic", "apacheLib.meta_lic", "notice|restricted"}, 288*9e94795aSAndroid Build Coastguard Worker {"apacheBin.meta_lic", "gplLib.meta_lic", "restricted"}, 289*9e94795aSAndroid Build Coastguard Worker }, 290*9e94795aSAndroid Build Coastguard Worker }, 291*9e94795aSAndroid Build Coastguard Worker { 292*9e94795aSAndroid Build Coastguard Worker name: "gplonbinrestricted", 293*9e94795aSAndroid Build Coastguard Worker condition: ImpliesRestricted, 294*9e94795aSAndroid Build Coastguard Worker roots: []string{"apacheBin.meta_lic"}, 295*9e94795aSAndroid Build Coastguard Worker edges: []annotated{ 296*9e94795aSAndroid Build Coastguard Worker {"apacheBin.meta_lic", "apacheLib.meta_lic", []string{"static"}}, 297*9e94795aSAndroid Build Coastguard Worker {"apacheBin.meta_lic", "gplLib.meta_lic", []string{"static"}}, 298*9e94795aSAndroid Build Coastguard Worker }, 299*9e94795aSAndroid Build Coastguard Worker expectedResolutions: []res{ 300*9e94795aSAndroid Build Coastguard Worker {"apacheBin.meta_lic", "apacheBin.meta_lic", "restricted"}, 301*9e94795aSAndroid Build Coastguard Worker {"apacheBin.meta_lic", "apacheLib.meta_lic", "restricted"}, 302*9e94795aSAndroid Build Coastguard Worker {"apacheBin.meta_lic", "gplLib.meta_lic", "restricted"}, 303*9e94795aSAndroid Build Coastguard Worker }, 304*9e94795aSAndroid Build Coastguard Worker }, 305*9e94795aSAndroid Build Coastguard Worker { 306*9e94795aSAndroid Build Coastguard Worker name: "gplonfpdynamicnotice", 307*9e94795aSAndroid Build Coastguard Worker condition: ImpliesNotice, 308*9e94795aSAndroid Build Coastguard Worker roots: []string{"gplBin.meta_lic"}, 309*9e94795aSAndroid Build Coastguard Worker edges: []annotated{ 310*9e94795aSAndroid Build Coastguard Worker {"gplBin.meta_lic", "apacheLib.meta_lic", []string{"dynamic"}}, 311*9e94795aSAndroid Build Coastguard Worker }, 312*9e94795aSAndroid Build Coastguard Worker expectedResolutions: []res{ 313*9e94795aSAndroid Build Coastguard Worker {"gplBin.meta_lic", "gplBin.meta_lic", "restricted"}, 314*9e94795aSAndroid Build Coastguard Worker }, 315*9e94795aSAndroid Build Coastguard Worker }, 316*9e94795aSAndroid Build Coastguard Worker { 317*9e94795aSAndroid Build Coastguard Worker name: "gplonfpdynamicrestricted", 318*9e94795aSAndroid Build Coastguard Worker condition: ImpliesRestricted, 319*9e94795aSAndroid Build Coastguard Worker roots: []string{"gplBin.meta_lic"}, 320*9e94795aSAndroid Build Coastguard Worker edges: []annotated{ 321*9e94795aSAndroid Build Coastguard Worker {"gplBin.meta_lic", "apacheLib.meta_lic", []string{"dynamic"}}, 322*9e94795aSAndroid Build Coastguard Worker }, 323*9e94795aSAndroid Build Coastguard Worker expectedResolutions: []res{ 324*9e94795aSAndroid Build Coastguard Worker {"gplBin.meta_lic", "gplBin.meta_lic", "restricted"}, 325*9e94795aSAndroid Build Coastguard Worker }, 326*9e94795aSAndroid Build Coastguard Worker }, 327*9e94795aSAndroid Build Coastguard Worker { 328*9e94795aSAndroid Build Coastguard Worker name: "gplonfpdynamicrestrictedshipped", 329*9e94795aSAndroid Build Coastguard Worker condition: ImpliesRestricted, 330*9e94795aSAndroid Build Coastguard Worker roots: []string{"gplBin.meta_lic", "apacheLib.meta_lic"}, 331*9e94795aSAndroid Build Coastguard Worker edges: []annotated{ 332*9e94795aSAndroid Build Coastguard Worker {"gplBin.meta_lic", "apacheLib.meta_lic", []string{"dynamic"}}, 333*9e94795aSAndroid Build Coastguard Worker }, 334*9e94795aSAndroid Build Coastguard Worker expectedResolutions: []res{ 335*9e94795aSAndroid Build Coastguard Worker {"gplBin.meta_lic", "gplBin.meta_lic", "restricted"}, 336*9e94795aSAndroid Build Coastguard Worker {"gplBin.meta_lic", "apacheLib.meta_lic", "restricted"}, 337*9e94795aSAndroid Build Coastguard Worker {"apacheLib.meta_lic", "apacheLib.meta_lic", "restricted"}, 338*9e94795aSAndroid Build Coastguard Worker }, 339*9e94795aSAndroid Build Coastguard Worker }, 340*9e94795aSAndroid Build Coastguard Worker { 341*9e94795aSAndroid Build Coastguard Worker name: "independentmodulereversenotice", 342*9e94795aSAndroid Build Coastguard Worker condition: ImpliesNotice, 343*9e94795aSAndroid Build Coastguard Worker roots: []string{"gplWithClasspathException.meta_lic"}, 344*9e94795aSAndroid Build Coastguard Worker edges: []annotated{ 345*9e94795aSAndroid Build Coastguard Worker {"gplWithClasspathException.meta_lic", "apacheBin.meta_lic", []string{"dynamic"}}, 346*9e94795aSAndroid Build Coastguard Worker }, 347*9e94795aSAndroid Build Coastguard Worker expectedResolutions: []res{ 348*9e94795aSAndroid Build Coastguard Worker {"gplWithClasspathException.meta_lic", "gplWithClasspathException.meta_lic", "permissive"}, 349*9e94795aSAndroid Build Coastguard Worker }, 350*9e94795aSAndroid Build Coastguard Worker }, 351*9e94795aSAndroid Build Coastguard Worker { 352*9e94795aSAndroid Build Coastguard Worker name: "independentmodulereverserestricted", 353*9e94795aSAndroid Build Coastguard Worker condition: ImpliesRestricted, 354*9e94795aSAndroid Build Coastguard Worker roots: []string{"gplWithClasspathException.meta_lic"}, 355*9e94795aSAndroid Build Coastguard Worker edges: []annotated{ 356*9e94795aSAndroid Build Coastguard Worker {"gplWithClasspathException.meta_lic", "apacheBin.meta_lic", []string{"dynamic"}}, 357*9e94795aSAndroid Build Coastguard Worker }, 358*9e94795aSAndroid Build Coastguard Worker expectedResolutions: []res{}, 359*9e94795aSAndroid Build Coastguard Worker }, 360*9e94795aSAndroid Build Coastguard Worker { 361*9e94795aSAndroid Build Coastguard Worker name: "independentmodulereverserestrictedshipped", 362*9e94795aSAndroid Build Coastguard Worker condition: ImpliesRestricted, 363*9e94795aSAndroid Build Coastguard Worker roots: []string{"gplWithClasspathException.meta_lic", "apacheBin.meta_lic"}, 364*9e94795aSAndroid Build Coastguard Worker edges: []annotated{ 365*9e94795aSAndroid Build Coastguard Worker {"gplWithClasspathException.meta_lic", "apacheBin.meta_lic", []string{"dynamic"}}, 366*9e94795aSAndroid Build Coastguard Worker }, 367*9e94795aSAndroid Build Coastguard Worker expectedResolutions: []res{}, 368*9e94795aSAndroid Build Coastguard Worker }, 369*9e94795aSAndroid Build Coastguard Worker { 370*9e94795aSAndroid Build Coastguard Worker name: "independentmodulereversestaticnotice", 371*9e94795aSAndroid Build Coastguard Worker condition: ImpliesNotice, 372*9e94795aSAndroid Build Coastguard Worker roots: []string{"gplWithClasspathException.meta_lic"}, 373*9e94795aSAndroid Build Coastguard Worker edges: []annotated{ 374*9e94795aSAndroid Build Coastguard Worker {"gplWithClasspathException.meta_lic", "apacheBin.meta_lic", []string{"static"}}, 375*9e94795aSAndroid Build Coastguard Worker }, 376*9e94795aSAndroid Build Coastguard Worker expectedResolutions: []res{ 377*9e94795aSAndroid Build Coastguard Worker {"gplWithClasspathException.meta_lic", "gplWithClasspathException.meta_lic", "permissive"}, 378*9e94795aSAndroid Build Coastguard Worker {"gplWithClasspathException.meta_lic", "apacheBin.meta_lic", "notice"}, 379*9e94795aSAndroid Build Coastguard Worker }, 380*9e94795aSAndroid Build Coastguard Worker }, 381*9e94795aSAndroid Build Coastguard Worker { 382*9e94795aSAndroid Build Coastguard Worker name: "independentmodulereversestaticrestricted", 383*9e94795aSAndroid Build Coastguard Worker condition: ImpliesRestricted, 384*9e94795aSAndroid Build Coastguard Worker roots: []string{"gplWithClasspathException.meta_lic"}, 385*9e94795aSAndroid Build Coastguard Worker edges: []annotated{ 386*9e94795aSAndroid Build Coastguard Worker {"gplWithClasspathException.meta_lic", "apacheBin.meta_lic", []string{"static"}}, 387*9e94795aSAndroid Build Coastguard Worker }, 388*9e94795aSAndroid Build Coastguard Worker expectedResolutions: []res{}, 389*9e94795aSAndroid Build Coastguard Worker }, 390*9e94795aSAndroid Build Coastguard Worker { 391*9e94795aSAndroid Build Coastguard Worker name: "dependentmodulereversenotice", 392*9e94795aSAndroid Build Coastguard Worker condition: ImpliesNotice, 393*9e94795aSAndroid Build Coastguard Worker roots: []string{"gplWithClasspathException.meta_lic"}, 394*9e94795aSAndroid Build Coastguard Worker edges: []annotated{ 395*9e94795aSAndroid Build Coastguard Worker {"gplWithClasspathException.meta_lic", "dependentModule.meta_lic", []string{"dynamic"}}, 396*9e94795aSAndroid Build Coastguard Worker }, 397*9e94795aSAndroid Build Coastguard Worker expectedResolutions: []res{ 398*9e94795aSAndroid Build Coastguard Worker {"gplWithClasspathException.meta_lic", "gplWithClasspathException.meta_lic", "permissive"}, 399*9e94795aSAndroid Build Coastguard Worker }, 400*9e94795aSAndroid Build Coastguard Worker }, 401*9e94795aSAndroid Build Coastguard Worker { 402*9e94795aSAndroid Build Coastguard Worker name: "dependentmodulereverserestricted", 403*9e94795aSAndroid Build Coastguard Worker condition: ImpliesRestricted, 404*9e94795aSAndroid Build Coastguard Worker roots: []string{"gplWithClasspathException.meta_lic"}, 405*9e94795aSAndroid Build Coastguard Worker edges: []annotated{ 406*9e94795aSAndroid Build Coastguard Worker {"gplWithClasspathException.meta_lic", "dependentModule.meta_lic", []string{"dynamic"}}, 407*9e94795aSAndroid Build Coastguard Worker }, 408*9e94795aSAndroid Build Coastguard Worker expectedResolutions: []res{}, 409*9e94795aSAndroid Build Coastguard Worker }, 410*9e94795aSAndroid Build Coastguard Worker { 411*9e94795aSAndroid Build Coastguard Worker name: "dependentmodulereverserestrictedshipped", 412*9e94795aSAndroid Build Coastguard Worker condition: ImpliesRestricted, 413*9e94795aSAndroid Build Coastguard Worker roots: []string{"gplWithClasspathException.meta_lic", "dependentModule.meta_lic"}, 414*9e94795aSAndroid Build Coastguard Worker edges: []annotated{ 415*9e94795aSAndroid Build Coastguard Worker {"gplWithClasspathException.meta_lic", "dependentModule.meta_lic", []string{"dynamic"}}, 416*9e94795aSAndroid Build Coastguard Worker }, 417*9e94795aSAndroid Build Coastguard Worker expectedResolutions: []res{}, 418*9e94795aSAndroid Build Coastguard Worker }, 419*9e94795aSAndroid Build Coastguard Worker { 420*9e94795aSAndroid Build Coastguard Worker name: "ponrnotice", 421*9e94795aSAndroid Build Coastguard Worker condition: ImpliesNotice, 422*9e94795aSAndroid Build Coastguard Worker roots: []string{"proprietary.meta_lic"}, 423*9e94795aSAndroid Build Coastguard Worker edges: []annotated{ 424*9e94795aSAndroid Build Coastguard Worker {"proprietary.meta_lic", "gplLib.meta_lic", []string{"static"}}, 425*9e94795aSAndroid Build Coastguard Worker }, 426*9e94795aSAndroid Build Coastguard Worker expectedResolutions: []res{ 427*9e94795aSAndroid Build Coastguard Worker {"proprietary.meta_lic", "proprietary.meta_lic", "restricted|proprietary"}, 428*9e94795aSAndroid Build Coastguard Worker {"proprietary.meta_lic", "gplLib.meta_lic", "restricted"}, 429*9e94795aSAndroid Build Coastguard Worker }, 430*9e94795aSAndroid Build Coastguard Worker }, 431*9e94795aSAndroid Build Coastguard Worker { 432*9e94795aSAndroid Build Coastguard Worker name: "ponrrestricted", 433*9e94795aSAndroid Build Coastguard Worker condition: ImpliesRestricted, 434*9e94795aSAndroid Build Coastguard Worker roots: []string{"proprietary.meta_lic"}, 435*9e94795aSAndroid Build Coastguard Worker edges: []annotated{ 436*9e94795aSAndroid Build Coastguard Worker {"proprietary.meta_lic", "gplLib.meta_lic", []string{"static"}}, 437*9e94795aSAndroid Build Coastguard Worker }, 438*9e94795aSAndroid Build Coastguard Worker expectedResolutions: []res{ 439*9e94795aSAndroid Build Coastguard Worker {"proprietary.meta_lic", "gplLib.meta_lic", "restricted"}, 440*9e94795aSAndroid Build Coastguard Worker {"proprietary.meta_lic", "proprietary.meta_lic", "restricted"}, 441*9e94795aSAndroid Build Coastguard Worker }, 442*9e94795aSAndroid Build Coastguard Worker }, 443*9e94795aSAndroid Build Coastguard Worker { 444*9e94795aSAndroid Build Coastguard Worker name: "ponrproprietary", 445*9e94795aSAndroid Build Coastguard Worker condition: ImpliesProprietary, 446*9e94795aSAndroid Build Coastguard Worker roots: []string{"proprietary.meta_lic"}, 447*9e94795aSAndroid Build Coastguard Worker edges: []annotated{ 448*9e94795aSAndroid Build Coastguard Worker {"proprietary.meta_lic", "gplLib.meta_lic", []string{"static"}}, 449*9e94795aSAndroid Build Coastguard Worker }, 450*9e94795aSAndroid Build Coastguard Worker expectedResolutions: []res{ 451*9e94795aSAndroid Build Coastguard Worker {"proprietary.meta_lic", "proprietary.meta_lic", "proprietary"}, 452*9e94795aSAndroid Build Coastguard Worker }, 453*9e94795aSAndroid Build Coastguard Worker }, 454*9e94795aSAndroid Build Coastguard Worker { 455*9e94795aSAndroid Build Coastguard Worker name: "ronpnotice", 456*9e94795aSAndroid Build Coastguard Worker condition: ImpliesNotice, 457*9e94795aSAndroid Build Coastguard Worker roots: []string{"gplBin.meta_lic"}, 458*9e94795aSAndroid Build Coastguard Worker edges: []annotated{ 459*9e94795aSAndroid Build Coastguard Worker {"gplBin.meta_lic", "proprietary.meta_lic", []string{"static"}}, 460*9e94795aSAndroid Build Coastguard Worker }, 461*9e94795aSAndroid Build Coastguard Worker expectedResolutions: []res{ 462*9e94795aSAndroid Build Coastguard Worker {"gplBin.meta_lic", "gplBin.meta_lic", "restricted"}, 463*9e94795aSAndroid Build Coastguard Worker {"gplBin.meta_lic", "proprietary.meta_lic", "restricted|proprietary"}, 464*9e94795aSAndroid Build Coastguard Worker }, 465*9e94795aSAndroid Build Coastguard Worker }, 466*9e94795aSAndroid Build Coastguard Worker { 467*9e94795aSAndroid Build Coastguard Worker name: "ronprestricted", 468*9e94795aSAndroid Build Coastguard Worker condition: ImpliesRestricted, 469*9e94795aSAndroid Build Coastguard Worker roots: []string{"gplBin.meta_lic"}, 470*9e94795aSAndroid Build Coastguard Worker edges: []annotated{ 471*9e94795aSAndroid Build Coastguard Worker {"gplBin.meta_lic", "proprietary.meta_lic", []string{"static"}}, 472*9e94795aSAndroid Build Coastguard Worker }, 473*9e94795aSAndroid Build Coastguard Worker expectedResolutions: []res{ 474*9e94795aSAndroid Build Coastguard Worker {"gplBin.meta_lic", "gplBin.meta_lic", "restricted"}, 475*9e94795aSAndroid Build Coastguard Worker {"gplBin.meta_lic", "proprietary.meta_lic", "restricted"}, 476*9e94795aSAndroid Build Coastguard Worker }, 477*9e94795aSAndroid Build Coastguard Worker }, 478*9e94795aSAndroid Build Coastguard Worker { 479*9e94795aSAndroid Build Coastguard Worker name: "ronpproprietary", 480*9e94795aSAndroid Build Coastguard Worker condition: ImpliesProprietary, 481*9e94795aSAndroid Build Coastguard Worker roots: []string{"gplBin.meta_lic"}, 482*9e94795aSAndroid Build Coastguard Worker edges: []annotated{ 483*9e94795aSAndroid Build Coastguard Worker {"gplBin.meta_lic", "proprietary.meta_lic", []string{"static"}}, 484*9e94795aSAndroid Build Coastguard Worker }, 485*9e94795aSAndroid Build Coastguard Worker expectedResolutions: []res{ 486*9e94795aSAndroid Build Coastguard Worker {"gplBin.meta_lic", "proprietary.meta_lic", "proprietary"}, 487*9e94795aSAndroid Build Coastguard Worker }, 488*9e94795aSAndroid Build Coastguard Worker }, 489*9e94795aSAndroid Build Coastguard Worker { 490*9e94795aSAndroid Build Coastguard Worker name: "noticeonb_e_onotice", 491*9e94795aSAndroid Build Coastguard Worker condition: ImpliesNotice, 492*9e94795aSAndroid Build Coastguard Worker roots: []string{"mitBin.meta_lic"}, 493*9e94795aSAndroid Build Coastguard Worker edges: []annotated{ 494*9e94795aSAndroid Build Coastguard Worker {"mitBin.meta_lic", "by_exception.meta_lic", []string{"static"}}, 495*9e94795aSAndroid Build Coastguard Worker }, 496*9e94795aSAndroid Build Coastguard Worker expectedResolutions: []res{ 497*9e94795aSAndroid Build Coastguard Worker {"mitBin.meta_lic", "mitBin.meta_lic", "notice"}, 498*9e94795aSAndroid Build Coastguard Worker {"mitBin.meta_lic", "by_exception.meta_lic", "by_exception_only"}, 499*9e94795aSAndroid Build Coastguard Worker }, 500*9e94795aSAndroid Build Coastguard Worker }, 501*9e94795aSAndroid Build Coastguard Worker { 502*9e94795aSAndroid Build Coastguard Worker name: "noticeonb_e_orestricted", 503*9e94795aSAndroid Build Coastguard Worker condition: ImpliesRestricted, 504*9e94795aSAndroid Build Coastguard Worker roots: []string{"mitBin.meta_lic"}, 505*9e94795aSAndroid Build Coastguard Worker edges: []annotated{ 506*9e94795aSAndroid Build Coastguard Worker {"mitBin.meta_lic", "by_exception.meta_lic", []string{"static"}}, 507*9e94795aSAndroid Build Coastguard Worker }, 508*9e94795aSAndroid Build Coastguard Worker expectedResolutions: []res{}, 509*9e94795aSAndroid Build Coastguard Worker }, 510*9e94795aSAndroid Build Coastguard Worker { 511*9e94795aSAndroid Build Coastguard Worker name: "noticeonb_e_ob_e_o", 512*9e94795aSAndroid Build Coastguard Worker condition: ImpliesByExceptionOnly, 513*9e94795aSAndroid Build Coastguard Worker roots: []string{"mitBin.meta_lic"}, 514*9e94795aSAndroid Build Coastguard Worker edges: []annotated{ 515*9e94795aSAndroid Build Coastguard Worker {"mitBin.meta_lic", "by_exception.meta_lic", []string{"static"}}, 516*9e94795aSAndroid Build Coastguard Worker }, 517*9e94795aSAndroid Build Coastguard Worker expectedResolutions: []res{ 518*9e94795aSAndroid Build Coastguard Worker {"mitBin.meta_lic", "by_exception.meta_lic", "by_exception_only"}, 519*9e94795aSAndroid Build Coastguard Worker }, 520*9e94795aSAndroid Build Coastguard Worker }, 521*9e94795aSAndroid Build Coastguard Worker { 522*9e94795aSAndroid Build Coastguard Worker name: "b_e_oonnoticenotice", 523*9e94795aSAndroid Build Coastguard Worker condition: ImpliesNotice, 524*9e94795aSAndroid Build Coastguard Worker roots: []string{"by_exception.meta_lic"}, 525*9e94795aSAndroid Build Coastguard Worker edges: []annotated{ 526*9e94795aSAndroid Build Coastguard Worker {"by_exception.meta_lic", "mitLib.meta_lic", []string{"static"}}, 527*9e94795aSAndroid Build Coastguard Worker }, 528*9e94795aSAndroid Build Coastguard Worker expectedResolutions: []res{ 529*9e94795aSAndroid Build Coastguard Worker {"by_exception.meta_lic", "by_exception.meta_lic", "by_exception_only"}, 530*9e94795aSAndroid Build Coastguard Worker {"by_exception.meta_lic", "mitLib.meta_lic", "notice"}, 531*9e94795aSAndroid Build Coastguard Worker }, 532*9e94795aSAndroid Build Coastguard Worker }, 533*9e94795aSAndroid Build Coastguard Worker { 534*9e94795aSAndroid Build Coastguard Worker name: "b_e_oonnoticerestricted", 535*9e94795aSAndroid Build Coastguard Worker condition: ImpliesRestricted, 536*9e94795aSAndroid Build Coastguard Worker roots: []string{"by_exception.meta_lic"}, 537*9e94795aSAndroid Build Coastguard Worker edges: []annotated{ 538*9e94795aSAndroid Build Coastguard Worker {"by_exception.meta_lic", "mitLib.meta_lic", []string{"static"}}, 539*9e94795aSAndroid Build Coastguard Worker }, 540*9e94795aSAndroid Build Coastguard Worker expectedResolutions: []res{}, 541*9e94795aSAndroid Build Coastguard Worker }, 542*9e94795aSAndroid Build Coastguard Worker { 543*9e94795aSAndroid Build Coastguard Worker name: "b_e_oonnoticeb_e_o", 544*9e94795aSAndroid Build Coastguard Worker condition: ImpliesByExceptionOnly, 545*9e94795aSAndroid Build Coastguard Worker roots: []string{"by_exception.meta_lic"}, 546*9e94795aSAndroid Build Coastguard Worker edges: []annotated{ 547*9e94795aSAndroid Build Coastguard Worker {"by_exception.meta_lic", "mitLib.meta_lic", []string{"static"}}, 548*9e94795aSAndroid Build Coastguard Worker }, 549*9e94795aSAndroid Build Coastguard Worker expectedResolutions: []res{ 550*9e94795aSAndroid Build Coastguard Worker {"by_exception.meta_lic", "by_exception.meta_lic", "by_exception_only"}, 551*9e94795aSAndroid Build Coastguard Worker }, 552*9e94795aSAndroid Build Coastguard Worker }, 553*9e94795aSAndroid Build Coastguard Worker { 554*9e94795aSAndroid Build Coastguard Worker name: "noticeonrecipnotice", 555*9e94795aSAndroid Build Coastguard Worker condition: ImpliesNotice, 556*9e94795aSAndroid Build Coastguard Worker roots: []string{"mitBin.meta_lic"}, 557*9e94795aSAndroid Build Coastguard Worker edges: []annotated{ 558*9e94795aSAndroid Build Coastguard Worker {"mitBin.meta_lic", "mplLib.meta_lic", []string{"static"}}, 559*9e94795aSAndroid Build Coastguard Worker }, 560*9e94795aSAndroid Build Coastguard Worker expectedResolutions: []res{ 561*9e94795aSAndroid Build Coastguard Worker {"mitBin.meta_lic", "mitBin.meta_lic", "notice"}, 562*9e94795aSAndroid Build Coastguard Worker {"mitBin.meta_lic", "mplLib.meta_lic", "reciprocal"}, 563*9e94795aSAndroid Build Coastguard Worker }, 564*9e94795aSAndroid Build Coastguard Worker }, 565*9e94795aSAndroid Build Coastguard Worker { 566*9e94795aSAndroid Build Coastguard Worker name: "noticeonreciprecip", 567*9e94795aSAndroid Build Coastguard Worker condition: ImpliesReciprocal, 568*9e94795aSAndroid Build Coastguard Worker roots: []string{"mitBin.meta_lic"}, 569*9e94795aSAndroid Build Coastguard Worker edges: []annotated{ 570*9e94795aSAndroid Build Coastguard Worker {"mitBin.meta_lic", "mplLib.meta_lic", []string{"static"}}, 571*9e94795aSAndroid Build Coastguard Worker }, 572*9e94795aSAndroid Build Coastguard Worker expectedResolutions: []res{ 573*9e94795aSAndroid Build Coastguard Worker {"mitBin.meta_lic", "mplLib.meta_lic", "reciprocal"}, 574*9e94795aSAndroid Build Coastguard Worker }, 575*9e94795aSAndroid Build Coastguard Worker }, 576*9e94795aSAndroid Build Coastguard Worker { 577*9e94795aSAndroid Build Coastguard Worker name: "reciponnoticenotice", 578*9e94795aSAndroid Build Coastguard Worker condition: ImpliesNotice, 579*9e94795aSAndroid Build Coastguard Worker roots: []string{"mplBin.meta_lic"}, 580*9e94795aSAndroid Build Coastguard Worker edges: []annotated{ 581*9e94795aSAndroid Build Coastguard Worker {"mplBin.meta_lic", "mitLib.meta_lic", []string{"static"}}, 582*9e94795aSAndroid Build Coastguard Worker }, 583*9e94795aSAndroid Build Coastguard Worker expectedResolutions: []res{ 584*9e94795aSAndroid Build Coastguard Worker {"mplBin.meta_lic", "mplBin.meta_lic", "reciprocal"}, 585*9e94795aSAndroid Build Coastguard Worker {"mplBin.meta_lic", "mitLib.meta_lic", "notice"}, 586*9e94795aSAndroid Build Coastguard Worker }, 587*9e94795aSAndroid Build Coastguard Worker }, 588*9e94795aSAndroid Build Coastguard Worker { 589*9e94795aSAndroid Build Coastguard Worker name: "reciponnoticerecip", 590*9e94795aSAndroid Build Coastguard Worker condition: ImpliesReciprocal, 591*9e94795aSAndroid Build Coastguard Worker roots: []string{"mplBin.meta_lic"}, 592*9e94795aSAndroid Build Coastguard Worker edges: []annotated{ 593*9e94795aSAndroid Build Coastguard Worker {"mplBin.meta_lic", "mitLib.meta_lic", []string{"static"}}, 594*9e94795aSAndroid Build Coastguard Worker }, 595*9e94795aSAndroid Build Coastguard Worker expectedResolutions: []res{ 596*9e94795aSAndroid Build Coastguard Worker {"mplBin.meta_lic", "mplBin.meta_lic", "reciprocal"}, 597*9e94795aSAndroid Build Coastguard Worker }, 598*9e94795aSAndroid Build Coastguard Worker }, 599*9e94795aSAndroid Build Coastguard Worker } 600*9e94795aSAndroid Build Coastguard Worker for _, tt := range tests { 601*9e94795aSAndroid Build Coastguard Worker t.Run(tt.name, func(t *testing.T) { 602*9e94795aSAndroid Build Coastguard Worker stderr := &bytes.Buffer{} 603*9e94795aSAndroid Build Coastguard Worker lg, err := toGraph(stderr, tt.roots, tt.edges) 604*9e94795aSAndroid Build Coastguard Worker if err != nil { 605*9e94795aSAndroid Build Coastguard Worker t.Errorf("unexpected test data error: got %s, want no error", err) 606*9e94795aSAndroid Build Coastguard Worker return 607*9e94795aSAndroid Build Coastguard Worker } 608*9e94795aSAndroid Build Coastguard Worker expectedRs := toResolutionSet(lg, tt.expectedResolutions) 609*9e94795aSAndroid Build Coastguard Worker ResolveTopDownConditions(lg) 610*9e94795aSAndroid Build Coastguard Worker actualRs := WalkResolutionsForCondition(lg, tt.condition) 611*9e94795aSAndroid Build Coastguard Worker checkResolves(actualRs, expectedRs, t) 612*9e94795aSAndroid Build Coastguard Worker }) 613*9e94795aSAndroid Build Coastguard Worker } 614*9e94795aSAndroid Build Coastguard Worker} 615*9e94795aSAndroid Build Coastguard Worker 616*9e94795aSAndroid Build Coastguard Workerfunc TestWalkActionsForCondition(t *testing.T) { 617*9e94795aSAndroid Build Coastguard Worker tests := []struct { 618*9e94795aSAndroid Build Coastguard Worker name string 619*9e94795aSAndroid Build Coastguard Worker condition LicenseConditionSet 620*9e94795aSAndroid Build Coastguard Worker roots []string 621*9e94795aSAndroid Build Coastguard Worker edges []annotated 622*9e94795aSAndroid Build Coastguard Worker expectedActions []act 623*9e94795aSAndroid Build Coastguard Worker }{ 624*9e94795aSAndroid Build Coastguard Worker { 625*9e94795aSAndroid Build Coastguard Worker name: "firstparty", 626*9e94795aSAndroid Build Coastguard Worker condition: ImpliesNotice, 627*9e94795aSAndroid Build Coastguard Worker roots: []string{"apacheBin.meta_lic"}, 628*9e94795aSAndroid Build Coastguard Worker edges: []annotated{ 629*9e94795aSAndroid Build Coastguard Worker {"apacheBin.meta_lic", "apacheLib.meta_lic", []string{"static"}}, 630*9e94795aSAndroid Build Coastguard Worker }, 631*9e94795aSAndroid Build Coastguard Worker expectedActions: []act{ 632*9e94795aSAndroid Build Coastguard Worker {"apacheBin.meta_lic", "notice"}, 633*9e94795aSAndroid Build Coastguard Worker {"apacheLib.meta_lic", "notice"}, 634*9e94795aSAndroid Build Coastguard Worker }, 635*9e94795aSAndroid Build Coastguard Worker }, 636*9e94795aSAndroid Build Coastguard Worker { 637*9e94795aSAndroid Build Coastguard Worker name: "notice", 638*9e94795aSAndroid Build Coastguard Worker condition: ImpliesNotice, 639*9e94795aSAndroid Build Coastguard Worker roots: []string{"mitBin.meta_lic"}, 640*9e94795aSAndroid Build Coastguard Worker edges: []annotated{ 641*9e94795aSAndroid Build Coastguard Worker {"mitBin.meta_lic", "mitLib.meta_lic", []string{"static"}}, 642*9e94795aSAndroid Build Coastguard Worker }, 643*9e94795aSAndroid Build Coastguard Worker expectedActions: []act{ 644*9e94795aSAndroid Build Coastguard Worker {"mitBin.meta_lic", "notice"}, 645*9e94795aSAndroid Build Coastguard Worker {"mitLib.meta_lic", "notice"}, 646*9e94795aSAndroid Build Coastguard Worker }, 647*9e94795aSAndroid Build Coastguard Worker }, 648*9e94795aSAndroid Build Coastguard Worker { 649*9e94795aSAndroid Build Coastguard Worker name: "fponlgplnotice", 650*9e94795aSAndroid Build Coastguard Worker condition: ImpliesNotice, 651*9e94795aSAndroid Build Coastguard Worker roots: []string{"apacheBin.meta_lic"}, 652*9e94795aSAndroid Build Coastguard Worker edges: []annotated{ 653*9e94795aSAndroid Build Coastguard Worker {"apacheBin.meta_lic", "lgplLib.meta_lic", []string{"static"}}, 654*9e94795aSAndroid Build Coastguard Worker }, 655*9e94795aSAndroid Build Coastguard Worker expectedActions: []act{ 656*9e94795aSAndroid Build Coastguard Worker {"apacheBin.meta_lic", "notice"}, 657*9e94795aSAndroid Build Coastguard Worker {"lgplLib.meta_lic", "restricted_if_statically_linked"}, 658*9e94795aSAndroid Build Coastguard Worker }, 659*9e94795aSAndroid Build Coastguard Worker }, 660*9e94795aSAndroid Build Coastguard Worker { 661*9e94795aSAndroid Build Coastguard Worker name: "fponlgpldynamicnotice", 662*9e94795aSAndroid Build Coastguard Worker condition: ImpliesNotice, 663*9e94795aSAndroid Build Coastguard Worker roots: []string{"apacheBin.meta_lic"}, 664*9e94795aSAndroid Build Coastguard Worker edges: []annotated{ 665*9e94795aSAndroid Build Coastguard Worker {"apacheBin.meta_lic", "lgplLib.meta_lic", []string{"dynamic"}}, 666*9e94795aSAndroid Build Coastguard Worker }, 667*9e94795aSAndroid Build Coastguard Worker expectedActions: []act{ 668*9e94795aSAndroid Build Coastguard Worker {"apacheBin.meta_lic", "notice"}, 669*9e94795aSAndroid Build Coastguard Worker }, 670*9e94795aSAndroid Build Coastguard Worker }, 671*9e94795aSAndroid Build Coastguard Worker { 672*9e94795aSAndroid Build Coastguard Worker name: "independentmodulenotice", 673*9e94795aSAndroid Build Coastguard Worker condition: ImpliesNotice, 674*9e94795aSAndroid Build Coastguard Worker roots: []string{"apacheBin.meta_lic"}, 675*9e94795aSAndroid Build Coastguard Worker edges: []annotated{ 676*9e94795aSAndroid Build Coastguard Worker {"apacheBin.meta_lic", "gplWithClasspathException.meta_lic", []string{"dynamic"}}, 677*9e94795aSAndroid Build Coastguard Worker }, 678*9e94795aSAndroid Build Coastguard Worker expectedActions: []act{ 679*9e94795aSAndroid Build Coastguard Worker {"apacheBin.meta_lic", "notice"}, 680*9e94795aSAndroid Build Coastguard Worker }, 681*9e94795aSAndroid Build Coastguard Worker }, 682*9e94795aSAndroid Build Coastguard Worker { 683*9e94795aSAndroid Build Coastguard Worker name: "independentmodulerestricted", 684*9e94795aSAndroid Build Coastguard Worker condition: ImpliesRestricted, 685*9e94795aSAndroid Build Coastguard Worker roots: []string{"apacheBin.meta_lic"}, 686*9e94795aSAndroid Build Coastguard Worker edges: []annotated{ 687*9e94795aSAndroid Build Coastguard Worker {"apacheBin.meta_lic", "gplWithClasspathException.meta_lic", []string{"dynamic"}}, 688*9e94795aSAndroid Build Coastguard Worker }, 689*9e94795aSAndroid Build Coastguard Worker expectedActions: []act{}, 690*9e94795aSAndroid Build Coastguard Worker }, 691*9e94795aSAndroid Build Coastguard Worker { 692*9e94795aSAndroid Build Coastguard Worker name: "independentmodulestaticnotice", 693*9e94795aSAndroid Build Coastguard Worker condition: ImpliesNotice, 694*9e94795aSAndroid Build Coastguard Worker roots: []string{"apacheBin.meta_lic"}, 695*9e94795aSAndroid Build Coastguard Worker edges: []annotated{ 696*9e94795aSAndroid Build Coastguard Worker {"apacheBin.meta_lic", "gplWithClasspathException.meta_lic", []string{"static"}}, 697*9e94795aSAndroid Build Coastguard Worker }, 698*9e94795aSAndroid Build Coastguard Worker expectedActions: []act{ 699*9e94795aSAndroid Build Coastguard Worker {"apacheBin.meta_lic", "notice"}, 700*9e94795aSAndroid Build Coastguard Worker {"gplWithClasspathException.meta_lic", "permissive"}, 701*9e94795aSAndroid Build Coastguard Worker }, 702*9e94795aSAndroid Build Coastguard Worker }, 703*9e94795aSAndroid Build Coastguard Worker { 704*9e94795aSAndroid Build Coastguard Worker name: "independentmodulestaticrestricted", 705*9e94795aSAndroid Build Coastguard Worker condition: ImpliesRestricted, 706*9e94795aSAndroid Build Coastguard Worker roots: []string{"apacheBin.meta_lic"}, 707*9e94795aSAndroid Build Coastguard Worker edges: []annotated{ 708*9e94795aSAndroid Build Coastguard Worker {"apacheBin.meta_lic", "gplWithClasspathException.meta_lic", []string{"static"}}, 709*9e94795aSAndroid Build Coastguard Worker }, 710*9e94795aSAndroid Build Coastguard Worker expectedActions: []act{}, 711*9e94795aSAndroid Build Coastguard Worker }, 712*9e94795aSAndroid Build Coastguard Worker { 713*9e94795aSAndroid Build Coastguard Worker name: "dependentmodulenotice", 714*9e94795aSAndroid Build Coastguard Worker condition: ImpliesNotice, 715*9e94795aSAndroid Build Coastguard Worker roots: []string{"dependentModule.meta_lic"}, 716*9e94795aSAndroid Build Coastguard Worker edges: []annotated{ 717*9e94795aSAndroid Build Coastguard Worker {"dependentModule.meta_lic", "gplWithClasspathException.meta_lic", []string{"dynamic"}}, 718*9e94795aSAndroid Build Coastguard Worker }, 719*9e94795aSAndroid Build Coastguard Worker expectedActions: []act{ 720*9e94795aSAndroid Build Coastguard Worker {"dependentModule.meta_lic", "notice"}, 721*9e94795aSAndroid Build Coastguard Worker }, 722*9e94795aSAndroid Build Coastguard Worker }, 723*9e94795aSAndroid Build Coastguard Worker { 724*9e94795aSAndroid Build Coastguard Worker name: "dependentmodulerestricted", 725*9e94795aSAndroid Build Coastguard Worker condition: ImpliesRestricted, 726*9e94795aSAndroid Build Coastguard Worker roots: []string{"dependentModule.meta_lic"}, 727*9e94795aSAndroid Build Coastguard Worker edges: []annotated{ 728*9e94795aSAndroid Build Coastguard Worker {"dependentModule.meta_lic", "gplWithClasspathException.meta_lic", []string{"dynamic"}}, 729*9e94795aSAndroid Build Coastguard Worker }, 730*9e94795aSAndroid Build Coastguard Worker expectedActions: []act{}, 731*9e94795aSAndroid Build Coastguard Worker }, 732*9e94795aSAndroid Build Coastguard Worker { 733*9e94795aSAndroid Build Coastguard Worker name: "lgplonfpnotice", 734*9e94795aSAndroid Build Coastguard Worker condition: ImpliesNotice, 735*9e94795aSAndroid Build Coastguard Worker roots: []string{"lgplBin.meta_lic"}, 736*9e94795aSAndroid Build Coastguard Worker edges: []annotated{ 737*9e94795aSAndroid Build Coastguard Worker {"lgplBin.meta_lic", "apacheLib.meta_lic", []string{"static"}}, 738*9e94795aSAndroid Build Coastguard Worker }, 739*9e94795aSAndroid Build Coastguard Worker expectedActions: []act{ 740*9e94795aSAndroid Build Coastguard Worker {"lgplBin.meta_lic", "restricted_if_statically_linked"}, 741*9e94795aSAndroid Build Coastguard Worker {"apacheLib.meta_lic", "notice|restricted_if_statically_linked"}, 742*9e94795aSAndroid Build Coastguard Worker }, 743*9e94795aSAndroid Build Coastguard Worker }, 744*9e94795aSAndroid Build Coastguard Worker { 745*9e94795aSAndroid Build Coastguard Worker name: "lgplonfprestricted", 746*9e94795aSAndroid Build Coastguard Worker condition: ImpliesRestricted, 747*9e94795aSAndroid Build Coastguard Worker roots: []string{"lgplBin.meta_lic"}, 748*9e94795aSAndroid Build Coastguard Worker edges: []annotated{ 749*9e94795aSAndroid Build Coastguard Worker {"lgplBin.meta_lic", "apacheLib.meta_lic", []string{"static"}}, 750*9e94795aSAndroid Build Coastguard Worker }, 751*9e94795aSAndroid Build Coastguard Worker expectedActions: []act{ 752*9e94795aSAndroid Build Coastguard Worker {"lgplBin.meta_lic", "restricted_if_statically_linked"}, 753*9e94795aSAndroid Build Coastguard Worker {"apacheLib.meta_lic", "restricted_if_statically_linked"}, 754*9e94795aSAndroid Build Coastguard Worker }, 755*9e94795aSAndroid Build Coastguard Worker }, 756*9e94795aSAndroid Build Coastguard Worker { 757*9e94795aSAndroid Build Coastguard Worker name: "lgplonfpdynamicnotice", 758*9e94795aSAndroid Build Coastguard Worker condition: ImpliesNotice, 759*9e94795aSAndroid Build Coastguard Worker roots: []string{"lgplBin.meta_lic"}, 760*9e94795aSAndroid Build Coastguard Worker edges: []annotated{ 761*9e94795aSAndroid Build Coastguard Worker {"lgplBin.meta_lic", "apacheLib.meta_lic", []string{"dynamic"}}, 762*9e94795aSAndroid Build Coastguard Worker }, 763*9e94795aSAndroid Build Coastguard Worker expectedActions: []act{ 764*9e94795aSAndroid Build Coastguard Worker {"lgplBin.meta_lic", "restricted_if_statically_linked"}, 765*9e94795aSAndroid Build Coastguard Worker }, 766*9e94795aSAndroid Build Coastguard Worker }, 767*9e94795aSAndroid Build Coastguard Worker { 768*9e94795aSAndroid Build Coastguard Worker name: "lgplonfpdynamicrestricted", 769*9e94795aSAndroid Build Coastguard Worker condition: ImpliesRestricted, 770*9e94795aSAndroid Build Coastguard Worker roots: []string{"lgplBin.meta_lic"}, 771*9e94795aSAndroid Build Coastguard Worker edges: []annotated{ 772*9e94795aSAndroid Build Coastguard Worker {"lgplBin.meta_lic", "apacheLib.meta_lic", []string{"dynamic"}}, 773*9e94795aSAndroid Build Coastguard Worker }, 774*9e94795aSAndroid Build Coastguard Worker expectedActions: []act{ 775*9e94795aSAndroid Build Coastguard Worker {"lgplBin.meta_lic", "restricted_if_statically_linked"}, 776*9e94795aSAndroid Build Coastguard Worker }, 777*9e94795aSAndroid Build Coastguard Worker }, 778*9e94795aSAndroid Build Coastguard Worker { 779*9e94795aSAndroid Build Coastguard Worker name: "gplonfpnotice", 780*9e94795aSAndroid Build Coastguard Worker condition: ImpliesNotice, 781*9e94795aSAndroid Build Coastguard Worker roots: []string{"gplBin.meta_lic"}, 782*9e94795aSAndroid Build Coastguard Worker edges: []annotated{ 783*9e94795aSAndroid Build Coastguard Worker {"gplBin.meta_lic", "apacheLib.meta_lic", []string{"static"}}, 784*9e94795aSAndroid Build Coastguard Worker }, 785*9e94795aSAndroid Build Coastguard Worker expectedActions: []act{ 786*9e94795aSAndroid Build Coastguard Worker {"gplBin.meta_lic", "restricted"}, 787*9e94795aSAndroid Build Coastguard Worker {"apacheLib.meta_lic", "notice|restricted"}, 788*9e94795aSAndroid Build Coastguard Worker }, 789*9e94795aSAndroid Build Coastguard Worker }, 790*9e94795aSAndroid Build Coastguard Worker { 791*9e94795aSAndroid Build Coastguard Worker name: "gplonfprestricted", 792*9e94795aSAndroid Build Coastguard Worker condition: ImpliesRestricted, 793*9e94795aSAndroid Build Coastguard Worker roots: []string{"gplBin.meta_lic"}, 794*9e94795aSAndroid Build Coastguard Worker edges: []annotated{ 795*9e94795aSAndroid Build Coastguard Worker {"gplBin.meta_lic", "apacheLib.meta_lic", []string{"static"}}, 796*9e94795aSAndroid Build Coastguard Worker }, 797*9e94795aSAndroid Build Coastguard Worker expectedActions: []act{ 798*9e94795aSAndroid Build Coastguard Worker {"gplBin.meta_lic", "restricted"}, 799*9e94795aSAndroid Build Coastguard Worker {"apacheLib.meta_lic", "restricted"}, 800*9e94795aSAndroid Build Coastguard Worker }, 801*9e94795aSAndroid Build Coastguard Worker }, 802*9e94795aSAndroid Build Coastguard Worker { 803*9e94795aSAndroid Build Coastguard Worker name: "gplcontainernotice", 804*9e94795aSAndroid Build Coastguard Worker condition: ImpliesNotice, 805*9e94795aSAndroid Build Coastguard Worker roots: []string{"gplContainer.meta_lic"}, 806*9e94795aSAndroid Build Coastguard Worker edges: []annotated{ 807*9e94795aSAndroid Build Coastguard Worker {"gplContainer.meta_lic", "apacheLib.meta_lic", []string{"static"}}, 808*9e94795aSAndroid Build Coastguard Worker }, 809*9e94795aSAndroid Build Coastguard Worker expectedActions: []act{ 810*9e94795aSAndroid Build Coastguard Worker {"gplContainer.meta_lic", "restricted"}, 811*9e94795aSAndroid Build Coastguard Worker {"apacheLib.meta_lic", "notice|restricted"}, 812*9e94795aSAndroid Build Coastguard Worker }, 813*9e94795aSAndroid Build Coastguard Worker }, 814*9e94795aSAndroid Build Coastguard Worker { 815*9e94795aSAndroid Build Coastguard Worker name: "gplcontainerrestricted", 816*9e94795aSAndroid Build Coastguard Worker condition: ImpliesRestricted, 817*9e94795aSAndroid Build Coastguard Worker roots: []string{"gplContainer.meta_lic"}, 818*9e94795aSAndroid Build Coastguard Worker edges: []annotated{ 819*9e94795aSAndroid Build Coastguard Worker {"gplContainer.meta_lic", "apacheLib.meta_lic", []string{"static"}}, 820*9e94795aSAndroid Build Coastguard Worker }, 821*9e94795aSAndroid Build Coastguard Worker expectedActions: []act{ 822*9e94795aSAndroid Build Coastguard Worker {"gplContainer.meta_lic", "restricted"}, 823*9e94795aSAndroid Build Coastguard Worker {"apacheLib.meta_lic", "restricted"}, 824*9e94795aSAndroid Build Coastguard Worker }, 825*9e94795aSAndroid Build Coastguard Worker }, 826*9e94795aSAndroid Build Coastguard Worker { 827*9e94795aSAndroid Build Coastguard Worker name: "gploncontainernotice", 828*9e94795aSAndroid Build Coastguard Worker condition: ImpliesNotice, 829*9e94795aSAndroid Build Coastguard Worker roots: []string{"apacheContainer.meta_lic"}, 830*9e94795aSAndroid Build Coastguard Worker edges: []annotated{ 831*9e94795aSAndroid Build Coastguard Worker {"apacheContainer.meta_lic", "apacheLib.meta_lic", []string{"static"}}, 832*9e94795aSAndroid Build Coastguard Worker {"apacheContainer.meta_lic", "gplLib.meta_lic", []string{"static"}}, 833*9e94795aSAndroid Build Coastguard Worker }, 834*9e94795aSAndroid Build Coastguard Worker expectedActions: []act{ 835*9e94795aSAndroid Build Coastguard Worker {"apacheContainer.meta_lic", "notice|restricted"}, 836*9e94795aSAndroid Build Coastguard Worker {"apacheLib.meta_lic", "notice"}, 837*9e94795aSAndroid Build Coastguard Worker {"gplLib.meta_lic", "restricted"}, 838*9e94795aSAndroid Build Coastguard Worker }, 839*9e94795aSAndroid Build Coastguard Worker }, 840*9e94795aSAndroid Build Coastguard Worker { 841*9e94795aSAndroid Build Coastguard Worker name: "gploncontainerrestricted", 842*9e94795aSAndroid Build Coastguard Worker condition: ImpliesRestricted, 843*9e94795aSAndroid Build Coastguard Worker roots: []string{"apacheContainer.meta_lic"}, 844*9e94795aSAndroid Build Coastguard Worker edges: []annotated{ 845*9e94795aSAndroid Build Coastguard Worker {"apacheContainer.meta_lic", "apacheLib.meta_lic", []string{"static"}}, 846*9e94795aSAndroid Build Coastguard Worker {"apacheContainer.meta_lic", "gplLib.meta_lic", []string{"static"}}, 847*9e94795aSAndroid Build Coastguard Worker }, 848*9e94795aSAndroid Build Coastguard Worker expectedActions: []act{ 849*9e94795aSAndroid Build Coastguard Worker {"apacheContainer.meta_lic", "restricted"}, 850*9e94795aSAndroid Build Coastguard Worker {"gplLib.meta_lic", "restricted"}, 851*9e94795aSAndroid Build Coastguard Worker }, 852*9e94795aSAndroid Build Coastguard Worker }, 853*9e94795aSAndroid Build Coastguard Worker { 854*9e94795aSAndroid Build Coastguard Worker name: "gplonbinnotice", 855*9e94795aSAndroid Build Coastguard Worker condition: ImpliesNotice, 856*9e94795aSAndroid Build Coastguard Worker roots: []string{"apacheBin.meta_lic"}, 857*9e94795aSAndroid Build Coastguard Worker edges: []annotated{ 858*9e94795aSAndroid Build Coastguard Worker {"apacheBin.meta_lic", "apacheLib.meta_lic", []string{"static"}}, 859*9e94795aSAndroid Build Coastguard Worker {"apacheBin.meta_lic", "gplLib.meta_lic", []string{"static"}}, 860*9e94795aSAndroid Build Coastguard Worker }, 861*9e94795aSAndroid Build Coastguard Worker expectedActions: []act{ 862*9e94795aSAndroid Build Coastguard Worker {"apacheBin.meta_lic", "notice|restricted"}, 863*9e94795aSAndroid Build Coastguard Worker {"apacheLib.meta_lic", "notice|restricted"}, 864*9e94795aSAndroid Build Coastguard Worker {"gplLib.meta_lic", "restricted"}, 865*9e94795aSAndroid Build Coastguard Worker }, 866*9e94795aSAndroid Build Coastguard Worker }, 867*9e94795aSAndroid Build Coastguard Worker { 868*9e94795aSAndroid Build Coastguard Worker name: "gplonbinrestricted", 869*9e94795aSAndroid Build Coastguard Worker condition: ImpliesRestricted, 870*9e94795aSAndroid Build Coastguard Worker roots: []string{"apacheBin.meta_lic"}, 871*9e94795aSAndroid Build Coastguard Worker edges: []annotated{ 872*9e94795aSAndroid Build Coastguard Worker {"apacheBin.meta_lic", "apacheLib.meta_lic", []string{"static"}}, 873*9e94795aSAndroid Build Coastguard Worker {"apacheBin.meta_lic", "gplLib.meta_lic", []string{"static"}}, 874*9e94795aSAndroid Build Coastguard Worker }, 875*9e94795aSAndroid Build Coastguard Worker expectedActions: []act{ 876*9e94795aSAndroid Build Coastguard Worker {"apacheBin.meta_lic", "restricted"}, 877*9e94795aSAndroid Build Coastguard Worker {"apacheLib.meta_lic", "restricted"}, 878*9e94795aSAndroid Build Coastguard Worker {"gplLib.meta_lic", "restricted"}, 879*9e94795aSAndroid Build Coastguard Worker }, 880*9e94795aSAndroid Build Coastguard Worker }, 881*9e94795aSAndroid Build Coastguard Worker { 882*9e94795aSAndroid Build Coastguard Worker name: "gplonfpdynamicnotice", 883*9e94795aSAndroid Build Coastguard Worker condition: ImpliesNotice, 884*9e94795aSAndroid Build Coastguard Worker roots: []string{"gplBin.meta_lic"}, 885*9e94795aSAndroid Build Coastguard Worker edges: []annotated{ 886*9e94795aSAndroid Build Coastguard Worker {"gplBin.meta_lic", "apacheLib.meta_lic", []string{"dynamic"}}, 887*9e94795aSAndroid Build Coastguard Worker }, 888*9e94795aSAndroid Build Coastguard Worker expectedActions: []act{ 889*9e94795aSAndroid Build Coastguard Worker {"gplBin.meta_lic", "restricted"}, 890*9e94795aSAndroid Build Coastguard Worker }, 891*9e94795aSAndroid Build Coastguard Worker }, 892*9e94795aSAndroid Build Coastguard Worker { 893*9e94795aSAndroid Build Coastguard Worker name: "gplonfpdynamicrestricted", 894*9e94795aSAndroid Build Coastguard Worker condition: ImpliesRestricted, 895*9e94795aSAndroid Build Coastguard Worker roots: []string{"gplBin.meta_lic"}, 896*9e94795aSAndroid Build Coastguard Worker edges: []annotated{ 897*9e94795aSAndroid Build Coastguard Worker {"gplBin.meta_lic", "apacheLib.meta_lic", []string{"dynamic"}}, 898*9e94795aSAndroid Build Coastguard Worker }, 899*9e94795aSAndroid Build Coastguard Worker expectedActions: []act{ 900*9e94795aSAndroid Build Coastguard Worker {"gplBin.meta_lic", "restricted"}, 901*9e94795aSAndroid Build Coastguard Worker }, 902*9e94795aSAndroid Build Coastguard Worker }, 903*9e94795aSAndroid Build Coastguard Worker { 904*9e94795aSAndroid Build Coastguard Worker name: "gplonfpdynamicrestrictedshipped", 905*9e94795aSAndroid Build Coastguard Worker condition: ImpliesRestricted, 906*9e94795aSAndroid Build Coastguard Worker roots: []string{"gplBin.meta_lic", "apacheLib.meta_lic"}, 907*9e94795aSAndroid Build Coastguard Worker edges: []annotated{ 908*9e94795aSAndroid Build Coastguard Worker {"gplBin.meta_lic", "apacheLib.meta_lic", []string{"dynamic"}}, 909*9e94795aSAndroid Build Coastguard Worker }, 910*9e94795aSAndroid Build Coastguard Worker expectedActions: []act{ 911*9e94795aSAndroid Build Coastguard Worker {"gplBin.meta_lic", "restricted"}, 912*9e94795aSAndroid Build Coastguard Worker {"apacheLib.meta_lic", "restricted"}, 913*9e94795aSAndroid Build Coastguard Worker }, 914*9e94795aSAndroid Build Coastguard Worker }, 915*9e94795aSAndroid Build Coastguard Worker { 916*9e94795aSAndroid Build Coastguard Worker name: "independentmodulereversenotice", 917*9e94795aSAndroid Build Coastguard Worker condition: ImpliesNotice, 918*9e94795aSAndroid Build Coastguard Worker roots: []string{"gplWithClasspathException.meta_lic"}, 919*9e94795aSAndroid Build Coastguard Worker edges: []annotated{ 920*9e94795aSAndroid Build Coastguard Worker {"gplWithClasspathException.meta_lic", "apacheBin.meta_lic", []string{"dynamic"}}, 921*9e94795aSAndroid Build Coastguard Worker }, 922*9e94795aSAndroid Build Coastguard Worker expectedActions: []act{ 923*9e94795aSAndroid Build Coastguard Worker {"gplWithClasspathException.meta_lic", "permissive"}, 924*9e94795aSAndroid Build Coastguard Worker }, 925*9e94795aSAndroid Build Coastguard Worker }, 926*9e94795aSAndroid Build Coastguard Worker { 927*9e94795aSAndroid Build Coastguard Worker name: "independentmodulereverserestricted", 928*9e94795aSAndroid Build Coastguard Worker condition: ImpliesRestricted, 929*9e94795aSAndroid Build Coastguard Worker roots: []string{"gplWithClasspathException.meta_lic"}, 930*9e94795aSAndroid Build Coastguard Worker edges: []annotated{ 931*9e94795aSAndroid Build Coastguard Worker {"gplWithClasspathException.meta_lic", "apacheBin.meta_lic", []string{"dynamic"}}, 932*9e94795aSAndroid Build Coastguard Worker }, 933*9e94795aSAndroid Build Coastguard Worker expectedActions: []act{}, 934*9e94795aSAndroid Build Coastguard Worker }, 935*9e94795aSAndroid Build Coastguard Worker { 936*9e94795aSAndroid Build Coastguard Worker name: "independentmodulereverserestrictedshipped", 937*9e94795aSAndroid Build Coastguard Worker condition: ImpliesRestricted, 938*9e94795aSAndroid Build Coastguard Worker roots: []string{"gplWithClasspathException.meta_lic", "apacheBin.meta_lic"}, 939*9e94795aSAndroid Build Coastguard Worker edges: []annotated{ 940*9e94795aSAndroid Build Coastguard Worker {"gplWithClasspathException.meta_lic", "apacheBin.meta_lic", []string{"dynamic"}}, 941*9e94795aSAndroid Build Coastguard Worker }, 942*9e94795aSAndroid Build Coastguard Worker expectedActions: []act{}, 943*9e94795aSAndroid Build Coastguard Worker }, 944*9e94795aSAndroid Build Coastguard Worker { 945*9e94795aSAndroid Build Coastguard Worker name: "independentmodulereversestaticnotice", 946*9e94795aSAndroid Build Coastguard Worker condition: ImpliesNotice, 947*9e94795aSAndroid Build Coastguard Worker roots: []string{"gplWithClasspathException.meta_lic"}, 948*9e94795aSAndroid Build Coastguard Worker edges: []annotated{ 949*9e94795aSAndroid Build Coastguard Worker {"gplWithClasspathException.meta_lic", "apacheBin.meta_lic", []string{"static"}}, 950*9e94795aSAndroid Build Coastguard Worker }, 951*9e94795aSAndroid Build Coastguard Worker expectedActions: []act{ 952*9e94795aSAndroid Build Coastguard Worker {"gplWithClasspathException.meta_lic", "permissive"}, 953*9e94795aSAndroid Build Coastguard Worker {"apacheBin.meta_lic", "notice"}, 954*9e94795aSAndroid Build Coastguard Worker }, 955*9e94795aSAndroid Build Coastguard Worker }, 956*9e94795aSAndroid Build Coastguard Worker { 957*9e94795aSAndroid Build Coastguard Worker name: "independentmodulereversestaticrestricted", 958*9e94795aSAndroid Build Coastguard Worker condition: ImpliesRestricted, 959*9e94795aSAndroid Build Coastguard Worker roots: []string{"gplWithClasspathException.meta_lic"}, 960*9e94795aSAndroid Build Coastguard Worker edges: []annotated{ 961*9e94795aSAndroid Build Coastguard Worker {"gplWithClasspathException.meta_lic", "apacheBin.meta_lic", []string{"static"}}, 962*9e94795aSAndroid Build Coastguard Worker }, 963*9e94795aSAndroid Build Coastguard Worker expectedActions: []act{}, 964*9e94795aSAndroid Build Coastguard Worker }, 965*9e94795aSAndroid Build Coastguard Worker { 966*9e94795aSAndroid Build Coastguard Worker name: "dependentmodulereversenotice", 967*9e94795aSAndroid Build Coastguard Worker condition: ImpliesNotice, 968*9e94795aSAndroid Build Coastguard Worker roots: []string{"gplWithClasspathException.meta_lic"}, 969*9e94795aSAndroid Build Coastguard Worker edges: []annotated{ 970*9e94795aSAndroid Build Coastguard Worker {"gplWithClasspathException.meta_lic", "dependentModule.meta_lic", []string{"dynamic"}}, 971*9e94795aSAndroid Build Coastguard Worker }, 972*9e94795aSAndroid Build Coastguard Worker expectedActions: []act{ 973*9e94795aSAndroid Build Coastguard Worker {"gplWithClasspathException.meta_lic", "permissive"}, 974*9e94795aSAndroid Build Coastguard Worker }, 975*9e94795aSAndroid Build Coastguard Worker }, 976*9e94795aSAndroid Build Coastguard Worker { 977*9e94795aSAndroid Build Coastguard Worker name: "dependentmodulereverserestricted", 978*9e94795aSAndroid Build Coastguard Worker condition: ImpliesRestricted, 979*9e94795aSAndroid Build Coastguard Worker roots: []string{"gplWithClasspathException.meta_lic"}, 980*9e94795aSAndroid Build Coastguard Worker edges: []annotated{ 981*9e94795aSAndroid Build Coastguard Worker {"gplWithClasspathException.meta_lic", "dependentModule.meta_lic", []string{"dynamic"}}, 982*9e94795aSAndroid Build Coastguard Worker }, 983*9e94795aSAndroid Build Coastguard Worker expectedActions: []act{}, 984*9e94795aSAndroid Build Coastguard Worker }, 985*9e94795aSAndroid Build Coastguard Worker { 986*9e94795aSAndroid Build Coastguard Worker name: "dependentmodulereverserestrictedshipped", 987*9e94795aSAndroid Build Coastguard Worker condition: ImpliesRestricted, 988*9e94795aSAndroid Build Coastguard Worker roots: []string{"gplWithClasspathException.meta_lic", "dependentModule.meta_lic"}, 989*9e94795aSAndroid Build Coastguard Worker edges: []annotated{ 990*9e94795aSAndroid Build Coastguard Worker {"gplWithClasspathException.meta_lic", "dependentModule.meta_lic", []string{"dynamic"}}, 991*9e94795aSAndroid Build Coastguard Worker }, 992*9e94795aSAndroid Build Coastguard Worker expectedActions: []act{}, 993*9e94795aSAndroid Build Coastguard Worker }, 994*9e94795aSAndroid Build Coastguard Worker { 995*9e94795aSAndroid Build Coastguard Worker name: "ponrnotice", 996*9e94795aSAndroid Build Coastguard Worker condition: ImpliesNotice, 997*9e94795aSAndroid Build Coastguard Worker roots: []string{"proprietary.meta_lic"}, 998*9e94795aSAndroid Build Coastguard Worker edges: []annotated{ 999*9e94795aSAndroid Build Coastguard Worker {"proprietary.meta_lic", "gplLib.meta_lic", []string{"static"}}, 1000*9e94795aSAndroid Build Coastguard Worker }, 1001*9e94795aSAndroid Build Coastguard Worker expectedActions: []act{ 1002*9e94795aSAndroid Build Coastguard Worker {"proprietary.meta_lic", "restricted|proprietary"}, 1003*9e94795aSAndroid Build Coastguard Worker {"gplLib.meta_lic", "restricted"}, 1004*9e94795aSAndroid Build Coastguard Worker }, 1005*9e94795aSAndroid Build Coastguard Worker }, 1006*9e94795aSAndroid Build Coastguard Worker { 1007*9e94795aSAndroid Build Coastguard Worker name: "ponrrestricted", 1008*9e94795aSAndroid Build Coastguard Worker condition: ImpliesRestricted, 1009*9e94795aSAndroid Build Coastguard Worker roots: []string{"proprietary.meta_lic"}, 1010*9e94795aSAndroid Build Coastguard Worker edges: []annotated{ 1011*9e94795aSAndroid Build Coastguard Worker {"proprietary.meta_lic", "gplLib.meta_lic", []string{"static"}}, 1012*9e94795aSAndroid Build Coastguard Worker }, 1013*9e94795aSAndroid Build Coastguard Worker expectedActions: []act{ 1014*9e94795aSAndroid Build Coastguard Worker {"gplLib.meta_lic", "restricted"}, 1015*9e94795aSAndroid Build Coastguard Worker {"proprietary.meta_lic", "restricted"}, 1016*9e94795aSAndroid Build Coastguard Worker }, 1017*9e94795aSAndroid Build Coastguard Worker }, 1018*9e94795aSAndroid Build Coastguard Worker { 1019*9e94795aSAndroid Build Coastguard Worker name: "ponrproprietary", 1020*9e94795aSAndroid Build Coastguard Worker condition: ImpliesProprietary, 1021*9e94795aSAndroid Build Coastguard Worker roots: []string{"proprietary.meta_lic"}, 1022*9e94795aSAndroid Build Coastguard Worker edges: []annotated{ 1023*9e94795aSAndroid Build Coastguard Worker {"proprietary.meta_lic", "gplLib.meta_lic", []string{"static"}}, 1024*9e94795aSAndroid Build Coastguard Worker }, 1025*9e94795aSAndroid Build Coastguard Worker expectedActions: []act{ 1026*9e94795aSAndroid Build Coastguard Worker {"proprietary.meta_lic", "proprietary"}, 1027*9e94795aSAndroid Build Coastguard Worker }, 1028*9e94795aSAndroid Build Coastguard Worker }, 1029*9e94795aSAndroid Build Coastguard Worker { 1030*9e94795aSAndroid Build Coastguard Worker name: "ronpnotice", 1031*9e94795aSAndroid Build Coastguard Worker condition: ImpliesNotice, 1032*9e94795aSAndroid Build Coastguard Worker roots: []string{"gplBin.meta_lic"}, 1033*9e94795aSAndroid Build Coastguard Worker edges: []annotated{ 1034*9e94795aSAndroid Build Coastguard Worker {"gplBin.meta_lic", "proprietary.meta_lic", []string{"static"}}, 1035*9e94795aSAndroid Build Coastguard Worker }, 1036*9e94795aSAndroid Build Coastguard Worker expectedActions: []act{ 1037*9e94795aSAndroid Build Coastguard Worker {"gplBin.meta_lic", "restricted"}, 1038*9e94795aSAndroid Build Coastguard Worker {"proprietary.meta_lic", "restricted|proprietary"}, 1039*9e94795aSAndroid Build Coastguard Worker }, 1040*9e94795aSAndroid Build Coastguard Worker }, 1041*9e94795aSAndroid Build Coastguard Worker { 1042*9e94795aSAndroid Build Coastguard Worker name: "ronprestricted", 1043*9e94795aSAndroid Build Coastguard Worker condition: ImpliesRestricted, 1044*9e94795aSAndroid Build Coastguard Worker roots: []string{"gplBin.meta_lic"}, 1045*9e94795aSAndroid Build Coastguard Worker edges: []annotated{ 1046*9e94795aSAndroid Build Coastguard Worker {"gplBin.meta_lic", "proprietary.meta_lic", []string{"static"}}, 1047*9e94795aSAndroid Build Coastguard Worker }, 1048*9e94795aSAndroid Build Coastguard Worker expectedActions: []act{ 1049*9e94795aSAndroid Build Coastguard Worker {"gplBin.meta_lic", "restricted"}, 1050*9e94795aSAndroid Build Coastguard Worker {"proprietary.meta_lic", "restricted"}, 1051*9e94795aSAndroid Build Coastguard Worker }, 1052*9e94795aSAndroid Build Coastguard Worker }, 1053*9e94795aSAndroid Build Coastguard Worker { 1054*9e94795aSAndroid Build Coastguard Worker name: "ronpproprietary", 1055*9e94795aSAndroid Build Coastguard Worker condition: ImpliesProprietary, 1056*9e94795aSAndroid Build Coastguard Worker roots: []string{"gplBin.meta_lic"}, 1057*9e94795aSAndroid Build Coastguard Worker edges: []annotated{ 1058*9e94795aSAndroid Build Coastguard Worker {"gplBin.meta_lic", "proprietary.meta_lic", []string{"static"}}, 1059*9e94795aSAndroid Build Coastguard Worker }, 1060*9e94795aSAndroid Build Coastguard Worker expectedActions: []act{ 1061*9e94795aSAndroid Build Coastguard Worker {"proprietary.meta_lic", "proprietary"}, 1062*9e94795aSAndroid Build Coastguard Worker }, 1063*9e94795aSAndroid Build Coastguard Worker }, 1064*9e94795aSAndroid Build Coastguard Worker { 1065*9e94795aSAndroid Build Coastguard Worker name: "noticeonb_e_onotice", 1066*9e94795aSAndroid Build Coastguard Worker condition: ImpliesNotice, 1067*9e94795aSAndroid Build Coastguard Worker roots: []string{"mitBin.meta_lic"}, 1068*9e94795aSAndroid Build Coastguard Worker edges: []annotated{ 1069*9e94795aSAndroid Build Coastguard Worker {"mitBin.meta_lic", "by_exception.meta_lic", []string{"static"}}, 1070*9e94795aSAndroid Build Coastguard Worker }, 1071*9e94795aSAndroid Build Coastguard Worker expectedActions: []act{ 1072*9e94795aSAndroid Build Coastguard Worker {"mitBin.meta_lic", "notice"}, 1073*9e94795aSAndroid Build Coastguard Worker {"by_exception.meta_lic", "by_exception_only"}, 1074*9e94795aSAndroid Build Coastguard Worker }, 1075*9e94795aSAndroid Build Coastguard Worker }, 1076*9e94795aSAndroid Build Coastguard Worker { 1077*9e94795aSAndroid Build Coastguard Worker name: "noticeonb_e_orestricted", 1078*9e94795aSAndroid Build Coastguard Worker condition: ImpliesRestricted, 1079*9e94795aSAndroid Build Coastguard Worker roots: []string{"mitBin.meta_lic"}, 1080*9e94795aSAndroid Build Coastguard Worker edges: []annotated{ 1081*9e94795aSAndroid Build Coastguard Worker {"mitBin.meta_lic", "by_exception.meta_lic", []string{"static"}}, 1082*9e94795aSAndroid Build Coastguard Worker }, 1083*9e94795aSAndroid Build Coastguard Worker expectedActions: []act{}, 1084*9e94795aSAndroid Build Coastguard Worker }, 1085*9e94795aSAndroid Build Coastguard Worker { 1086*9e94795aSAndroid Build Coastguard Worker name: "noticeonb_e_ob_e_o", 1087*9e94795aSAndroid Build Coastguard Worker condition: ImpliesByExceptionOnly, 1088*9e94795aSAndroid Build Coastguard Worker roots: []string{"mitBin.meta_lic"}, 1089*9e94795aSAndroid Build Coastguard Worker edges: []annotated{ 1090*9e94795aSAndroid Build Coastguard Worker {"mitBin.meta_lic", "by_exception.meta_lic", []string{"static"}}, 1091*9e94795aSAndroid Build Coastguard Worker }, 1092*9e94795aSAndroid Build Coastguard Worker expectedActions: []act{ 1093*9e94795aSAndroid Build Coastguard Worker {"by_exception.meta_lic", "by_exception_only"}, 1094*9e94795aSAndroid Build Coastguard Worker }, 1095*9e94795aSAndroid Build Coastguard Worker }, 1096*9e94795aSAndroid Build Coastguard Worker { 1097*9e94795aSAndroid Build Coastguard Worker name: "b_e_oonnoticenotice", 1098*9e94795aSAndroid Build Coastguard Worker condition: ImpliesNotice, 1099*9e94795aSAndroid Build Coastguard Worker roots: []string{"by_exception.meta_lic"}, 1100*9e94795aSAndroid Build Coastguard Worker edges: []annotated{ 1101*9e94795aSAndroid Build Coastguard Worker {"by_exception.meta_lic", "mitLib.meta_lic", []string{"static"}}, 1102*9e94795aSAndroid Build Coastguard Worker }, 1103*9e94795aSAndroid Build Coastguard Worker expectedActions: []act{ 1104*9e94795aSAndroid Build Coastguard Worker {"by_exception.meta_lic", "by_exception_only"}, 1105*9e94795aSAndroid Build Coastguard Worker {"mitLib.meta_lic", "notice"}, 1106*9e94795aSAndroid Build Coastguard Worker }, 1107*9e94795aSAndroid Build Coastguard Worker }, 1108*9e94795aSAndroid Build Coastguard Worker { 1109*9e94795aSAndroid Build Coastguard Worker name: "b_e_oonnoticerestricted", 1110*9e94795aSAndroid Build Coastguard Worker condition: ImpliesRestricted, 1111*9e94795aSAndroid Build Coastguard Worker roots: []string{"by_exception.meta_lic"}, 1112*9e94795aSAndroid Build Coastguard Worker edges: []annotated{ 1113*9e94795aSAndroid Build Coastguard Worker {"by_exception.meta_lic", "mitLib.meta_lic", []string{"static"}}, 1114*9e94795aSAndroid Build Coastguard Worker }, 1115*9e94795aSAndroid Build Coastguard Worker expectedActions: []act{}, 1116*9e94795aSAndroid Build Coastguard Worker }, 1117*9e94795aSAndroid Build Coastguard Worker { 1118*9e94795aSAndroid Build Coastguard Worker name: "b_e_oonnoticeb_e_o", 1119*9e94795aSAndroid Build Coastguard Worker condition: ImpliesByExceptionOnly, 1120*9e94795aSAndroid Build Coastguard Worker roots: []string{"by_exception.meta_lic"}, 1121*9e94795aSAndroid Build Coastguard Worker edges: []annotated{ 1122*9e94795aSAndroid Build Coastguard Worker {"by_exception.meta_lic", "mitLib.meta_lic", []string{"static"}}, 1123*9e94795aSAndroid Build Coastguard Worker }, 1124*9e94795aSAndroid Build Coastguard Worker expectedActions: []act{ 1125*9e94795aSAndroid Build Coastguard Worker {"by_exception.meta_lic", "by_exception_only"}, 1126*9e94795aSAndroid Build Coastguard Worker }, 1127*9e94795aSAndroid Build Coastguard Worker }, 1128*9e94795aSAndroid Build Coastguard Worker { 1129*9e94795aSAndroid Build Coastguard Worker name: "noticeonrecipnotice", 1130*9e94795aSAndroid Build Coastguard Worker condition: ImpliesNotice, 1131*9e94795aSAndroid Build Coastguard Worker roots: []string{"mitBin.meta_lic"}, 1132*9e94795aSAndroid Build Coastguard Worker edges: []annotated{ 1133*9e94795aSAndroid Build Coastguard Worker {"mitBin.meta_lic", "mplLib.meta_lic", []string{"static"}}, 1134*9e94795aSAndroid Build Coastguard Worker }, 1135*9e94795aSAndroid Build Coastguard Worker expectedActions: []act{ 1136*9e94795aSAndroid Build Coastguard Worker {"mitBin.meta_lic", "notice"}, 1137*9e94795aSAndroid Build Coastguard Worker {"mplLib.meta_lic", "reciprocal"}, 1138*9e94795aSAndroid Build Coastguard Worker }, 1139*9e94795aSAndroid Build Coastguard Worker }, 1140*9e94795aSAndroid Build Coastguard Worker { 1141*9e94795aSAndroid Build Coastguard Worker name: "noticeonreciprecip", 1142*9e94795aSAndroid Build Coastguard Worker condition: ImpliesReciprocal, 1143*9e94795aSAndroid Build Coastguard Worker roots: []string{"mitBin.meta_lic"}, 1144*9e94795aSAndroid Build Coastguard Worker edges: []annotated{ 1145*9e94795aSAndroid Build Coastguard Worker {"mitBin.meta_lic", "mplLib.meta_lic", []string{"static"}}, 1146*9e94795aSAndroid Build Coastguard Worker }, 1147*9e94795aSAndroid Build Coastguard Worker expectedActions: []act{ 1148*9e94795aSAndroid Build Coastguard Worker {"mplLib.meta_lic", "reciprocal"}, 1149*9e94795aSAndroid Build Coastguard Worker }, 1150*9e94795aSAndroid Build Coastguard Worker }, 1151*9e94795aSAndroid Build Coastguard Worker { 1152*9e94795aSAndroid Build Coastguard Worker name: "reciponnoticenotice", 1153*9e94795aSAndroid Build Coastguard Worker condition: ImpliesNotice, 1154*9e94795aSAndroid Build Coastguard Worker roots: []string{"mplBin.meta_lic"}, 1155*9e94795aSAndroid Build Coastguard Worker edges: []annotated{ 1156*9e94795aSAndroid Build Coastguard Worker {"mplBin.meta_lic", "mitLib.meta_lic", []string{"static"}}, 1157*9e94795aSAndroid Build Coastguard Worker }, 1158*9e94795aSAndroid Build Coastguard Worker expectedActions: []act{ 1159*9e94795aSAndroid Build Coastguard Worker {"mplBin.meta_lic", "reciprocal"}, 1160*9e94795aSAndroid Build Coastguard Worker {"mitLib.meta_lic", "notice"}, 1161*9e94795aSAndroid Build Coastguard Worker }, 1162*9e94795aSAndroid Build Coastguard Worker }, 1163*9e94795aSAndroid Build Coastguard Worker { 1164*9e94795aSAndroid Build Coastguard Worker name: "reciponnoticerecip", 1165*9e94795aSAndroid Build Coastguard Worker condition: ImpliesReciprocal, 1166*9e94795aSAndroid Build Coastguard Worker roots: []string{"mplBin.meta_lic"}, 1167*9e94795aSAndroid Build Coastguard Worker edges: []annotated{ 1168*9e94795aSAndroid Build Coastguard Worker {"mplBin.meta_lic", "mitLib.meta_lic", []string{"static"}}, 1169*9e94795aSAndroid Build Coastguard Worker }, 1170*9e94795aSAndroid Build Coastguard Worker expectedActions: []act{ 1171*9e94795aSAndroid Build Coastguard Worker {"mplBin.meta_lic", "reciprocal"}, 1172*9e94795aSAndroid Build Coastguard Worker }, 1173*9e94795aSAndroid Build Coastguard Worker }, 1174*9e94795aSAndroid Build Coastguard Worker { 1175*9e94795aSAndroid Build Coastguard Worker name: "regress-walk-twice", 1176*9e94795aSAndroid Build Coastguard Worker condition: ImpliesShared, 1177*9e94795aSAndroid Build Coastguard Worker roots: []string{"mitBin.meta_lic", "apacheBin.meta_lic", "gplLib.meta_lic"}, 1178*9e94795aSAndroid Build Coastguard Worker edges: []annotated{ 1179*9e94795aSAndroid Build Coastguard Worker {"apacheBin.meta_lic", "mitLib.meta_lic", []string{"dynamic"}}, 1180*9e94795aSAndroid Build Coastguard Worker {"apacheBin.meta_lic", "gplLib.meta_lic", []string{"dynamic"}}, 1181*9e94795aSAndroid Build Coastguard Worker {"mitBin.meta_lic", "mitLib.meta_lic", []string{"static"}}, 1182*9e94795aSAndroid Build Coastguard Worker {"mitBin.meta_lic", "lgplLib.meta_lic", []string{"static"}}, 1183*9e94795aSAndroid Build Coastguard Worker }, 1184*9e94795aSAndroid Build Coastguard Worker expectedActions: []act{ 1185*9e94795aSAndroid Build Coastguard Worker {"apacheBin.meta_lic", "restricted"}, 1186*9e94795aSAndroid Build Coastguard Worker {"mitLib.meta_lic", "restricted|restricted_if_statically_linked"}, 1187*9e94795aSAndroid Build Coastguard Worker {"gplLib.meta_lic", "restricted"}, 1188*9e94795aSAndroid Build Coastguard Worker {"mitBin.meta_lic", "restricted_if_statically_linked"}, 1189*9e94795aSAndroid Build Coastguard Worker {"lgplLib.meta_lic", "restricted_if_statically_linked"}, 1190*9e94795aSAndroid Build Coastguard Worker }, 1191*9e94795aSAndroid Build Coastguard Worker }, 1192*9e94795aSAndroid Build Coastguard Worker } 1193*9e94795aSAndroid Build Coastguard Worker for _, tt := range tests { 1194*9e94795aSAndroid Build Coastguard Worker t.Run(tt.name, func(t *testing.T) { 1195*9e94795aSAndroid Build Coastguard Worker stderr := &bytes.Buffer{} 1196*9e94795aSAndroid Build Coastguard Worker lg, err := toGraph(stderr, tt.roots, tt.edges) 1197*9e94795aSAndroid Build Coastguard Worker if err != nil { 1198*9e94795aSAndroid Build Coastguard Worker t.Errorf("unexpected test data error: got %s, want no error", err) 1199*9e94795aSAndroid Build Coastguard Worker return 1200*9e94795aSAndroid Build Coastguard Worker } 1201*9e94795aSAndroid Build Coastguard Worker expectedAs := toActionSet(lg, tt.expectedActions) 1202*9e94795aSAndroid Build Coastguard Worker ResolveTopDownConditions(lg) 1203*9e94795aSAndroid Build Coastguard Worker actualAs := WalkActionsForCondition(lg, tt.condition) 1204*9e94795aSAndroid Build Coastguard Worker checkResolvesActions(lg, actualAs, expectedAs, t) 1205*9e94795aSAndroid Build Coastguard Worker }) 1206*9e94795aSAndroid Build Coastguard Worker } 1207*9e94795aSAndroid Build Coastguard Worker} 1208*9e94795aSAndroid Build Coastguard Worker 1209*9e94795aSAndroid Build Coastguard Workerfunc TestWalkTopDownBreadthFirst(t *testing.T) { 1210*9e94795aSAndroid Build Coastguard Worker tests := []struct { 1211*9e94795aSAndroid Build Coastguard Worker name string 1212*9e94795aSAndroid Build Coastguard Worker roots []string 1213*9e94795aSAndroid Build Coastguard Worker edges []annotated 1214*9e94795aSAndroid Build Coastguard Worker expectedResult []string 1215*9e94795aSAndroid Build Coastguard Worker }{ 1216*9e94795aSAndroid Build Coastguard Worker { 1217*9e94795aSAndroid Build Coastguard Worker name: "bin/bin1", 1218*9e94795aSAndroid Build Coastguard Worker roots: []string{"bin/bin1.meta_lic"}, 1219*9e94795aSAndroid Build Coastguard Worker expectedResult: []string{ 1220*9e94795aSAndroid Build Coastguard Worker "testdata/notice/bin/bin1.meta_lic", 1221*9e94795aSAndroid Build Coastguard Worker "testdata/notice/lib/liba.so.meta_lic", 1222*9e94795aSAndroid Build Coastguard Worker "testdata/notice/lib/libc.a.meta_lic", 1223*9e94795aSAndroid Build Coastguard Worker }, 1224*9e94795aSAndroid Build Coastguard Worker }, 1225*9e94795aSAndroid Build Coastguard Worker { 1226*9e94795aSAndroid Build Coastguard Worker name: "bin/bin2", 1227*9e94795aSAndroid Build Coastguard Worker roots: []string{"bin/bin2.meta_lic"}, 1228*9e94795aSAndroid Build Coastguard Worker expectedResult: []string{ 1229*9e94795aSAndroid Build Coastguard Worker "testdata/notice/bin/bin2.meta_lic", 1230*9e94795aSAndroid Build Coastguard Worker "testdata/notice/lib/libb.so.meta_lic", 1231*9e94795aSAndroid Build Coastguard Worker "testdata/notice/lib/libd.so.meta_lic", 1232*9e94795aSAndroid Build Coastguard Worker }, 1233*9e94795aSAndroid Build Coastguard Worker }, 1234*9e94795aSAndroid Build Coastguard Worker { 1235*9e94795aSAndroid Build Coastguard Worker name: "bin/bin3", 1236*9e94795aSAndroid Build Coastguard Worker roots: []string{"bin/bin3.meta_lic"}, 1237*9e94795aSAndroid Build Coastguard Worker expectedResult: []string{ 1238*9e94795aSAndroid Build Coastguard Worker "testdata/notice/bin/bin3.meta_lic", 1239*9e94795aSAndroid Build Coastguard Worker }, 1240*9e94795aSAndroid Build Coastguard Worker }, 1241*9e94795aSAndroid Build Coastguard Worker { 1242*9e94795aSAndroid Build Coastguard Worker name: "lib/liba.so", 1243*9e94795aSAndroid Build Coastguard Worker roots: []string{"lib/liba.so.meta_lic"}, 1244*9e94795aSAndroid Build Coastguard Worker expectedResult: []string{ 1245*9e94795aSAndroid Build Coastguard Worker "testdata/notice/lib/liba.so.meta_lic", 1246*9e94795aSAndroid Build Coastguard Worker }, 1247*9e94795aSAndroid Build Coastguard Worker }, 1248*9e94795aSAndroid Build Coastguard Worker { 1249*9e94795aSAndroid Build Coastguard Worker name: "lib/libb.so", 1250*9e94795aSAndroid Build Coastguard Worker roots: []string{"lib/libb.so.meta_lic"}, 1251*9e94795aSAndroid Build Coastguard Worker expectedResult: []string{ 1252*9e94795aSAndroid Build Coastguard Worker "testdata/notice/lib/libb.so.meta_lic", 1253*9e94795aSAndroid Build Coastguard Worker }, 1254*9e94795aSAndroid Build Coastguard Worker }, 1255*9e94795aSAndroid Build Coastguard Worker { 1256*9e94795aSAndroid Build Coastguard Worker name: "lib/libc.so", 1257*9e94795aSAndroid Build Coastguard Worker roots: []string{"lib/libc.a.meta_lic"}, 1258*9e94795aSAndroid Build Coastguard Worker expectedResult: []string{ 1259*9e94795aSAndroid Build Coastguard Worker "testdata/notice/lib/libc.a.meta_lic", 1260*9e94795aSAndroid Build Coastguard Worker }, 1261*9e94795aSAndroid Build Coastguard Worker }, 1262*9e94795aSAndroid Build Coastguard Worker { 1263*9e94795aSAndroid Build Coastguard Worker name: "lib/libd.so", 1264*9e94795aSAndroid Build Coastguard Worker roots: []string{"lib/libd.so.meta_lic"}, 1265*9e94795aSAndroid Build Coastguard Worker expectedResult: []string{ 1266*9e94795aSAndroid Build Coastguard Worker "testdata/notice/lib/libd.so.meta_lic", 1267*9e94795aSAndroid Build Coastguard Worker }, 1268*9e94795aSAndroid Build Coastguard Worker }, 1269*9e94795aSAndroid Build Coastguard Worker { 1270*9e94795aSAndroid Build Coastguard Worker name: "highest.apex", 1271*9e94795aSAndroid Build Coastguard Worker roots: []string{"highest.apex.meta_lic"}, 1272*9e94795aSAndroid Build Coastguard Worker expectedResult: []string{ 1273*9e94795aSAndroid Build Coastguard Worker "testdata/notice/highest.apex.meta_lic", 1274*9e94795aSAndroid Build Coastguard Worker "testdata/notice/bin/bin1.meta_lic", 1275*9e94795aSAndroid Build Coastguard Worker "testdata/notice/bin/bin2.meta_lic", 1276*9e94795aSAndroid Build Coastguard Worker "testdata/notice/lib/liba.so.meta_lic", 1277*9e94795aSAndroid Build Coastguard Worker "testdata/notice/lib/libb.so.meta_lic", 1278*9e94795aSAndroid Build Coastguard Worker "testdata/notice/lib/liba.so.meta_lic", 1279*9e94795aSAndroid Build Coastguard Worker "testdata/notice/lib/libc.a.meta_lic", 1280*9e94795aSAndroid Build Coastguard Worker "testdata/notice/lib/libb.so.meta_lic", 1281*9e94795aSAndroid Build Coastguard Worker "testdata/notice/lib/libd.so.meta_lic", 1282*9e94795aSAndroid Build Coastguard Worker }, 1283*9e94795aSAndroid Build Coastguard Worker }, 1284*9e94795aSAndroid Build Coastguard Worker { 1285*9e94795aSAndroid Build Coastguard Worker name: "container.zip", 1286*9e94795aSAndroid Build Coastguard Worker roots: []string{"container.zip.meta_lic"}, 1287*9e94795aSAndroid Build Coastguard Worker expectedResult: []string{ 1288*9e94795aSAndroid Build Coastguard Worker "testdata/notice/container.zip.meta_lic", 1289*9e94795aSAndroid Build Coastguard Worker "testdata/notice/bin/bin1.meta_lic", 1290*9e94795aSAndroid Build Coastguard Worker "testdata/notice/bin/bin2.meta_lic", 1291*9e94795aSAndroid Build Coastguard Worker "testdata/notice/lib/liba.so.meta_lic", 1292*9e94795aSAndroid Build Coastguard Worker "testdata/notice/lib/libb.so.meta_lic", 1293*9e94795aSAndroid Build Coastguard Worker "testdata/notice/lib/liba.so.meta_lic", 1294*9e94795aSAndroid Build Coastguard Worker "testdata/notice/lib/libc.a.meta_lic", 1295*9e94795aSAndroid Build Coastguard Worker "testdata/notice/lib/libb.so.meta_lic", 1296*9e94795aSAndroid Build Coastguard Worker "testdata/notice/lib/libd.so.meta_lic", 1297*9e94795aSAndroid Build Coastguard Worker }, 1298*9e94795aSAndroid Build Coastguard Worker }, 1299*9e94795aSAndroid Build Coastguard Worker { 1300*9e94795aSAndroid Build Coastguard Worker name: "application", 1301*9e94795aSAndroid Build Coastguard Worker roots: []string{"application.meta_lic"}, 1302*9e94795aSAndroid Build Coastguard Worker expectedResult: []string{ 1303*9e94795aSAndroid Build Coastguard Worker "testdata/notice/application.meta_lic", 1304*9e94795aSAndroid Build Coastguard Worker "testdata/notice/bin/bin3.meta_lic", 1305*9e94795aSAndroid Build Coastguard Worker "testdata/notice/lib/liba.so.meta_lic", 1306*9e94795aSAndroid Build Coastguard Worker "testdata/notice/lib/libb.so.meta_lic", 1307*9e94795aSAndroid Build Coastguard Worker }, 1308*9e94795aSAndroid Build Coastguard Worker }, 1309*9e94795aSAndroid Build Coastguard Worker { 1310*9e94795aSAndroid Build Coastguard Worker name: "bin/bin1&lib/liba", 1311*9e94795aSAndroid Build Coastguard Worker roots: []string{"bin/bin1.meta_lic","lib/liba.so.meta_lic"}, 1312*9e94795aSAndroid Build Coastguard Worker expectedResult: []string{ 1313*9e94795aSAndroid Build Coastguard Worker "testdata/notice/bin/bin1.meta_lic", 1314*9e94795aSAndroid Build Coastguard Worker "testdata/notice/lib/liba.so.meta_lic", 1315*9e94795aSAndroid Build Coastguard Worker "testdata/notice/lib/liba.so.meta_lic", 1316*9e94795aSAndroid Build Coastguard Worker "testdata/notice/lib/libc.a.meta_lic", 1317*9e94795aSAndroid Build Coastguard Worker }, 1318*9e94795aSAndroid Build Coastguard Worker }, 1319*9e94795aSAndroid Build Coastguard Worker { 1320*9e94795aSAndroid Build Coastguard Worker name: "bin/bin2&lib/libd", 1321*9e94795aSAndroid Build Coastguard Worker roots: []string{"bin/bin2.meta_lic", "lib/libd.so.meta_lic"}, 1322*9e94795aSAndroid Build Coastguard Worker expectedResult: []string{ 1323*9e94795aSAndroid Build Coastguard Worker "testdata/notice/bin/bin2.meta_lic", 1324*9e94795aSAndroid Build Coastguard Worker "testdata/notice/lib/libd.so.meta_lic", 1325*9e94795aSAndroid Build Coastguard Worker "testdata/notice/lib/libb.so.meta_lic", 1326*9e94795aSAndroid Build Coastguard Worker "testdata/notice/lib/libd.so.meta_lic", 1327*9e94795aSAndroid Build Coastguard Worker }, 1328*9e94795aSAndroid Build Coastguard Worker }, 1329*9e94795aSAndroid Build Coastguard Worker { 1330*9e94795aSAndroid Build Coastguard Worker name: "application&bin/bin3", 1331*9e94795aSAndroid Build Coastguard Worker roots: []string{"application.meta_lic", "bin/bin3.meta_lic"}, 1332*9e94795aSAndroid Build Coastguard Worker expectedResult: []string{ 1333*9e94795aSAndroid Build Coastguard Worker "testdata/notice/application.meta_lic", 1334*9e94795aSAndroid Build Coastguard Worker "testdata/notice/bin/bin3.meta_lic", 1335*9e94795aSAndroid Build Coastguard Worker "testdata/notice/bin/bin3.meta_lic", 1336*9e94795aSAndroid Build Coastguard Worker "testdata/notice/lib/liba.so.meta_lic", 1337*9e94795aSAndroid Build Coastguard Worker "testdata/notice/lib/libb.so.meta_lic", 1338*9e94795aSAndroid Build Coastguard Worker }, 1339*9e94795aSAndroid Build Coastguard Worker }, 1340*9e94795aSAndroid Build Coastguard Worker { 1341*9e94795aSAndroid Build Coastguard Worker name: "highest.apex&container.zip", 1342*9e94795aSAndroid Build Coastguard Worker roots: []string{"highest.apex.meta_lic", "container.zip.meta_lic"}, 1343*9e94795aSAndroid Build Coastguard Worker expectedResult: []string{ 1344*9e94795aSAndroid Build Coastguard Worker "testdata/notice/highest.apex.meta_lic", 1345*9e94795aSAndroid Build Coastguard Worker "testdata/notice/container.zip.meta_lic", 1346*9e94795aSAndroid Build Coastguard Worker "testdata/notice/bin/bin1.meta_lic", 1347*9e94795aSAndroid Build Coastguard Worker "testdata/notice/bin/bin2.meta_lic", 1348*9e94795aSAndroid Build Coastguard Worker "testdata/notice/lib/liba.so.meta_lic", 1349*9e94795aSAndroid Build Coastguard Worker "testdata/notice/lib/libb.so.meta_lic", 1350*9e94795aSAndroid Build Coastguard Worker "testdata/notice/lib/liba.so.meta_lic", 1351*9e94795aSAndroid Build Coastguard Worker "testdata/notice/lib/libc.a.meta_lic", 1352*9e94795aSAndroid Build Coastguard Worker "testdata/notice/lib/libb.so.meta_lic", 1353*9e94795aSAndroid Build Coastguard Worker "testdata/notice/lib/libd.so.meta_lic", 1354*9e94795aSAndroid Build Coastguard Worker "testdata/notice/bin/bin1.meta_lic", 1355*9e94795aSAndroid Build Coastguard Worker "testdata/notice/bin/bin2.meta_lic", 1356*9e94795aSAndroid Build Coastguard Worker "testdata/notice/lib/liba.so.meta_lic", 1357*9e94795aSAndroid Build Coastguard Worker "testdata/notice/lib/libb.so.meta_lic", 1358*9e94795aSAndroid Build Coastguard Worker "testdata/notice/lib/liba.so.meta_lic", 1359*9e94795aSAndroid Build Coastguard Worker "testdata/notice/lib/libc.a.meta_lic", 1360*9e94795aSAndroid Build Coastguard Worker "testdata/notice/lib/libb.so.meta_lic", 1361*9e94795aSAndroid Build Coastguard Worker "testdata/notice/lib/libd.so.meta_lic", 1362*9e94795aSAndroid Build Coastguard Worker }, 1363*9e94795aSAndroid Build Coastguard Worker }, 1364*9e94795aSAndroid Build Coastguard Worker } 1365*9e94795aSAndroid Build Coastguard Worker 1366*9e94795aSAndroid Build Coastguard Worker for _, tt := range tests { 1367*9e94795aSAndroid Build Coastguard Worker t.Run(tt.name, func(t *testing.T) { 1368*9e94795aSAndroid Build Coastguard Worker stderr := &bytes.Buffer{} 1369*9e94795aSAndroid Build Coastguard Worker actualOut := &bytes.Buffer{} 1370*9e94795aSAndroid Build Coastguard Worker 1371*9e94795aSAndroid Build Coastguard Worker rootFiles := make([]string, 0, len(tt.roots)) 1372*9e94795aSAndroid Build Coastguard Worker for _, r := range tt.roots { 1373*9e94795aSAndroid Build Coastguard Worker rootFiles = append(rootFiles, "testdata/notice/"+r) 1374*9e94795aSAndroid Build Coastguard Worker } 1375*9e94795aSAndroid Build Coastguard Worker 1376*9e94795aSAndroid Build Coastguard Worker lg, err := ReadLicenseGraph(GetFS(""), stderr, rootFiles) 1377*9e94795aSAndroid Build Coastguard Worker 1378*9e94795aSAndroid Build Coastguard Worker if err != nil { 1379*9e94795aSAndroid Build Coastguard Worker t.Errorf("unexpected test data error: got %s, want no error", err) 1380*9e94795aSAndroid Build Coastguard Worker return 1381*9e94795aSAndroid Build Coastguard Worker } 1382*9e94795aSAndroid Build Coastguard Worker 1383*9e94795aSAndroid Build Coastguard Worker expectedRst := tt.expectedResult 1384*9e94795aSAndroid Build Coastguard Worker 1385*9e94795aSAndroid Build Coastguard Worker WalkTopDownBreadthFirst(nil, lg, func(lg *LicenseGraph, tn *TargetNode, path TargetEdgePath) bool { 1386*9e94795aSAndroid Build Coastguard Worker fmt.Fprintln(actualOut, tn.Name()) 1387*9e94795aSAndroid Build Coastguard Worker return true 1388*9e94795aSAndroid Build Coastguard Worker }) 1389*9e94795aSAndroid Build Coastguard Worker 1390*9e94795aSAndroid Build Coastguard Worker actualRst := strings.Split(actualOut.String(), "\n") 1391*9e94795aSAndroid Build Coastguard Worker 1392*9e94795aSAndroid Build Coastguard Worker if len(actualRst) > 0 { 1393*9e94795aSAndroid Build Coastguard Worker actualRst = actualRst[:len(actualRst)-1] 1394*9e94795aSAndroid Build Coastguard Worker } 1395*9e94795aSAndroid Build Coastguard Worker 1396*9e94795aSAndroid Build Coastguard Worker t.Logf("actual nodes visited: %s", actualOut.String()) 1397*9e94795aSAndroid Build Coastguard Worker t.Logf("expected nodes visited: %s", strings.Join(expectedRst, "\n")) 1398*9e94795aSAndroid Build Coastguard Worker 1399*9e94795aSAndroid Build Coastguard Worker if len(actualRst) != len(expectedRst) { 1400*9e94795aSAndroid Build Coastguard Worker t.Errorf("WalkTopDownBreadthFirst: number of visited nodes is different: got %d, want %d", len(actualRst), len(expectedRst)) 1401*9e94795aSAndroid Build Coastguard Worker } 1402*9e94795aSAndroid Build Coastguard Worker 1403*9e94795aSAndroid Build Coastguard Worker for i := 0; i < len(actualRst) && i < len(expectedRst); i++ { 1404*9e94795aSAndroid Build Coastguard Worker if actualRst[i] != expectedRst[i] { 1405*9e94795aSAndroid Build Coastguard Worker t.Errorf("WalkTopDownBreadthFirst: lines differ at index %d: got %q, want %q", i, actualRst[i], expectedRst[i]) 1406*9e94795aSAndroid Build Coastguard Worker break 1407*9e94795aSAndroid Build Coastguard Worker } 1408*9e94795aSAndroid Build Coastguard Worker } 1409*9e94795aSAndroid Build Coastguard Worker 1410*9e94795aSAndroid Build Coastguard Worker if len(actualRst) < len(expectedRst) { 1411*9e94795aSAndroid Build Coastguard Worker t.Errorf("WalkTopDownBreadthFirst: extra lines at %d: got %q, want nothing", len(actualRst), expectedRst[len(actualRst)]) 1412*9e94795aSAndroid Build Coastguard Worker } 1413*9e94795aSAndroid Build Coastguard Worker 1414*9e94795aSAndroid Build Coastguard Worker if len(expectedRst) < len(actualRst) { 1415*9e94795aSAndroid Build Coastguard Worker t.Errorf("WalkTopDownBreadthFirst: missing lines at %d: got nothing, want %q", len(expectedRst), actualRst[len(expectedRst)]) 1416*9e94795aSAndroid Build Coastguard Worker } 1417*9e94795aSAndroid Build Coastguard Worker }) 1418*9e94795aSAndroid Build Coastguard Worker } 1419*9e94795aSAndroid Build Coastguard Worker} 1420*9e94795aSAndroid Build Coastguard Worker 1421*9e94795aSAndroid Build Coastguard Workerfunc TestWalkTopDownBreadthFirstWithoutDuplicates(t *testing.T) { 1422*9e94795aSAndroid Build Coastguard Worker tests := []struct { 1423*9e94795aSAndroid Build Coastguard Worker name string 1424*9e94795aSAndroid Build Coastguard Worker roots []string 1425*9e94795aSAndroid Build Coastguard Worker edges []annotated 1426*9e94795aSAndroid Build Coastguard Worker expectedResult []string 1427*9e94795aSAndroid Build Coastguard Worker }{ 1428*9e94795aSAndroid Build Coastguard Worker { 1429*9e94795aSAndroid Build Coastguard Worker name: "bin/bin1", 1430*9e94795aSAndroid Build Coastguard Worker roots: []string{"bin/bin1.meta_lic"}, 1431*9e94795aSAndroid Build Coastguard Worker expectedResult: []string{ 1432*9e94795aSAndroid Build Coastguard Worker "testdata/notice/bin/bin1.meta_lic", 1433*9e94795aSAndroid Build Coastguard Worker "testdata/notice/lib/liba.so.meta_lic", 1434*9e94795aSAndroid Build Coastguard Worker "testdata/notice/lib/libc.a.meta_lic", 1435*9e94795aSAndroid Build Coastguard Worker }, 1436*9e94795aSAndroid Build Coastguard Worker }, 1437*9e94795aSAndroid Build Coastguard Worker { 1438*9e94795aSAndroid Build Coastguard Worker name: "bin/bin2", 1439*9e94795aSAndroid Build Coastguard Worker roots: []string{"bin/bin2.meta_lic"}, 1440*9e94795aSAndroid Build Coastguard Worker expectedResult: []string{ 1441*9e94795aSAndroid Build Coastguard Worker "testdata/notice/bin/bin2.meta_lic", 1442*9e94795aSAndroid Build Coastguard Worker "testdata/notice/lib/libb.so.meta_lic", 1443*9e94795aSAndroid Build Coastguard Worker "testdata/notice/lib/libd.so.meta_lic", 1444*9e94795aSAndroid Build Coastguard Worker }, 1445*9e94795aSAndroid Build Coastguard Worker }, 1446*9e94795aSAndroid Build Coastguard Worker { 1447*9e94795aSAndroid Build Coastguard Worker name: "bin/bin3", 1448*9e94795aSAndroid Build Coastguard Worker roots: []string{"bin/bin3.meta_lic"}, 1449*9e94795aSAndroid Build Coastguard Worker expectedResult: []string{ 1450*9e94795aSAndroid Build Coastguard Worker "testdata/notice/bin/bin3.meta_lic", 1451*9e94795aSAndroid Build Coastguard Worker }, 1452*9e94795aSAndroid Build Coastguard Worker }, 1453*9e94795aSAndroid Build Coastguard Worker { 1454*9e94795aSAndroid Build Coastguard Worker name: "lib/liba.so", 1455*9e94795aSAndroid Build Coastguard Worker roots: []string{"lib/liba.so.meta_lic"}, 1456*9e94795aSAndroid Build Coastguard Worker expectedResult: []string{ 1457*9e94795aSAndroid Build Coastguard Worker "testdata/notice/lib/liba.so.meta_lic", 1458*9e94795aSAndroid Build Coastguard Worker }, 1459*9e94795aSAndroid Build Coastguard Worker }, 1460*9e94795aSAndroid Build Coastguard Worker { 1461*9e94795aSAndroid Build Coastguard Worker name: "lib/libb.so", 1462*9e94795aSAndroid Build Coastguard Worker roots: []string{"lib/libb.so.meta_lic"}, 1463*9e94795aSAndroid Build Coastguard Worker expectedResult: []string{ 1464*9e94795aSAndroid Build Coastguard Worker "testdata/notice/lib/libb.so.meta_lic", 1465*9e94795aSAndroid Build Coastguard Worker }, 1466*9e94795aSAndroid Build Coastguard Worker }, 1467*9e94795aSAndroid Build Coastguard Worker { 1468*9e94795aSAndroid Build Coastguard Worker name: "lib/libc.so", 1469*9e94795aSAndroid Build Coastguard Worker roots: []string{"lib/libc.a.meta_lic"}, 1470*9e94795aSAndroid Build Coastguard Worker expectedResult: []string{ 1471*9e94795aSAndroid Build Coastguard Worker "testdata/notice/lib/libc.a.meta_lic", 1472*9e94795aSAndroid Build Coastguard Worker }, 1473*9e94795aSAndroid Build Coastguard Worker }, 1474*9e94795aSAndroid Build Coastguard Worker { 1475*9e94795aSAndroid Build Coastguard Worker name: "lib/libd.so", 1476*9e94795aSAndroid Build Coastguard Worker roots: []string{"lib/libd.so.meta_lic"}, 1477*9e94795aSAndroid Build Coastguard Worker expectedResult: []string{ 1478*9e94795aSAndroid Build Coastguard Worker "testdata/notice/lib/libd.so.meta_lic", 1479*9e94795aSAndroid Build Coastguard Worker }, 1480*9e94795aSAndroid Build Coastguard Worker }, 1481*9e94795aSAndroid Build Coastguard Worker { 1482*9e94795aSAndroid Build Coastguard Worker name: "highest.apex", 1483*9e94795aSAndroid Build Coastguard Worker roots: []string{"highest.apex.meta_lic"}, 1484*9e94795aSAndroid Build Coastguard Worker expectedResult: []string{ 1485*9e94795aSAndroid Build Coastguard Worker "testdata/notice/highest.apex.meta_lic", 1486*9e94795aSAndroid Build Coastguard Worker "testdata/notice/bin/bin1.meta_lic", 1487*9e94795aSAndroid Build Coastguard Worker "testdata/notice/bin/bin2.meta_lic", 1488*9e94795aSAndroid Build Coastguard Worker "testdata/notice/lib/liba.so.meta_lic", 1489*9e94795aSAndroid Build Coastguard Worker "testdata/notice/lib/libb.so.meta_lic", 1490*9e94795aSAndroid Build Coastguard Worker "testdata/notice/lib/libc.a.meta_lic", 1491*9e94795aSAndroid Build Coastguard Worker "testdata/notice/lib/libd.so.meta_lic", 1492*9e94795aSAndroid Build Coastguard Worker }, 1493*9e94795aSAndroid Build Coastguard Worker }, 1494*9e94795aSAndroid Build Coastguard Worker { 1495*9e94795aSAndroid Build Coastguard Worker name: "container.zip", 1496*9e94795aSAndroid Build Coastguard Worker roots: []string{"container.zip.meta_lic"}, 1497*9e94795aSAndroid Build Coastguard Worker expectedResult: []string{ 1498*9e94795aSAndroid Build Coastguard Worker "testdata/notice/container.zip.meta_lic", 1499*9e94795aSAndroid Build Coastguard Worker "testdata/notice/bin/bin1.meta_lic", 1500*9e94795aSAndroid Build Coastguard Worker "testdata/notice/bin/bin2.meta_lic", 1501*9e94795aSAndroid Build Coastguard Worker "testdata/notice/lib/liba.so.meta_lic", 1502*9e94795aSAndroid Build Coastguard Worker "testdata/notice/lib/libb.so.meta_lic", 1503*9e94795aSAndroid Build Coastguard Worker "testdata/notice/lib/libc.a.meta_lic", 1504*9e94795aSAndroid Build Coastguard Worker "testdata/notice/lib/libd.so.meta_lic", 1505*9e94795aSAndroid Build Coastguard Worker }, 1506*9e94795aSAndroid Build Coastguard Worker }, 1507*9e94795aSAndroid Build Coastguard Worker { 1508*9e94795aSAndroid Build Coastguard Worker name: "application", 1509*9e94795aSAndroid Build Coastguard Worker roots: []string{"application.meta_lic"}, 1510*9e94795aSAndroid Build Coastguard Worker expectedResult: []string{ 1511*9e94795aSAndroid Build Coastguard Worker "testdata/notice/application.meta_lic", 1512*9e94795aSAndroid Build Coastguard Worker "testdata/notice/bin/bin3.meta_lic", 1513*9e94795aSAndroid Build Coastguard Worker "testdata/notice/lib/liba.so.meta_lic", 1514*9e94795aSAndroid Build Coastguard Worker "testdata/notice/lib/libb.so.meta_lic", 1515*9e94795aSAndroid Build Coastguard Worker }, 1516*9e94795aSAndroid Build Coastguard Worker }, 1517*9e94795aSAndroid Build Coastguard Worker { 1518*9e94795aSAndroid Build Coastguard Worker name: "bin/bin1&lib/liba", 1519*9e94795aSAndroid Build Coastguard Worker roots: []string{"bin/bin1.meta_lic", "lib/liba.so.meta_lic"}, 1520*9e94795aSAndroid Build Coastguard Worker expectedResult: []string{ 1521*9e94795aSAndroid Build Coastguard Worker "testdata/notice/bin/bin1.meta_lic", 1522*9e94795aSAndroid Build Coastguard Worker "testdata/notice/lib/liba.so.meta_lic", 1523*9e94795aSAndroid Build Coastguard Worker "testdata/notice/lib/libc.a.meta_lic", 1524*9e94795aSAndroid Build Coastguard Worker }, 1525*9e94795aSAndroid Build Coastguard Worker }, 1526*9e94795aSAndroid Build Coastguard Worker { 1527*9e94795aSAndroid Build Coastguard Worker name: "bin/bin2&lib/libd", 1528*9e94795aSAndroid Build Coastguard Worker roots: []string{"bin/bin2.meta_lic", "lib/libd.so.meta_lic"}, 1529*9e94795aSAndroid Build Coastguard Worker expectedResult: []string{ 1530*9e94795aSAndroid Build Coastguard Worker "testdata/notice/bin/bin2.meta_lic", 1531*9e94795aSAndroid Build Coastguard Worker "testdata/notice/lib/libd.so.meta_lic", 1532*9e94795aSAndroid Build Coastguard Worker "testdata/notice/lib/libb.so.meta_lic", 1533*9e94795aSAndroid Build Coastguard Worker }, 1534*9e94795aSAndroid Build Coastguard Worker }, 1535*9e94795aSAndroid Build Coastguard Worker { 1536*9e94795aSAndroid Build Coastguard Worker name: "application&bin/bin3", 1537*9e94795aSAndroid Build Coastguard Worker roots: []string{"application.meta_lic", "bin/bin3.meta_lic"}, 1538*9e94795aSAndroid Build Coastguard Worker expectedResult: []string{ 1539*9e94795aSAndroid Build Coastguard Worker "testdata/notice/application.meta_lic", 1540*9e94795aSAndroid Build Coastguard Worker "testdata/notice/bin/bin3.meta_lic", 1541*9e94795aSAndroid Build Coastguard Worker "testdata/notice/lib/liba.so.meta_lic", 1542*9e94795aSAndroid Build Coastguard Worker "testdata/notice/lib/libb.so.meta_lic", 1543*9e94795aSAndroid Build Coastguard Worker }, 1544*9e94795aSAndroid Build Coastguard Worker }, 1545*9e94795aSAndroid Build Coastguard Worker { 1546*9e94795aSAndroid Build Coastguard Worker name: "highest.apex&container.zip", 1547*9e94795aSAndroid Build Coastguard Worker roots: []string{"highest.apex.meta_lic", "container.zip.meta_lic"}, 1548*9e94795aSAndroid Build Coastguard Worker expectedResult: []string{ 1549*9e94795aSAndroid Build Coastguard Worker "testdata/notice/highest.apex.meta_lic", 1550*9e94795aSAndroid Build Coastguard Worker "testdata/notice/container.zip.meta_lic", 1551*9e94795aSAndroid Build Coastguard Worker "testdata/notice/bin/bin1.meta_lic", 1552*9e94795aSAndroid Build Coastguard Worker "testdata/notice/bin/bin2.meta_lic", 1553*9e94795aSAndroid Build Coastguard Worker "testdata/notice/lib/liba.so.meta_lic", 1554*9e94795aSAndroid Build Coastguard Worker "testdata/notice/lib/libb.so.meta_lic", 1555*9e94795aSAndroid Build Coastguard Worker "testdata/notice/lib/libc.a.meta_lic", 1556*9e94795aSAndroid Build Coastguard Worker "testdata/notice/lib/libd.so.meta_lic", 1557*9e94795aSAndroid Build Coastguard Worker }, 1558*9e94795aSAndroid Build Coastguard Worker }, 1559*9e94795aSAndroid Build Coastguard Worker } 1560*9e94795aSAndroid Build Coastguard Worker 1561*9e94795aSAndroid Build Coastguard Worker for _, tt := range tests { 1562*9e94795aSAndroid Build Coastguard Worker t.Run(tt.name, func(t *testing.T) { 1563*9e94795aSAndroid Build Coastguard Worker stderr := &bytes.Buffer{} 1564*9e94795aSAndroid Build Coastguard Worker actualOut := &bytes.Buffer{} 1565*9e94795aSAndroid Build Coastguard Worker 1566*9e94795aSAndroid Build Coastguard Worker rootFiles := make([]string, 0, len(tt.roots)) 1567*9e94795aSAndroid Build Coastguard Worker for _, r := range tt.roots { 1568*9e94795aSAndroid Build Coastguard Worker rootFiles = append(rootFiles, "testdata/notice/"+r) 1569*9e94795aSAndroid Build Coastguard Worker } 1570*9e94795aSAndroid Build Coastguard Worker 1571*9e94795aSAndroid Build Coastguard Worker lg, err := ReadLicenseGraph(GetFS(""), stderr, rootFiles) 1572*9e94795aSAndroid Build Coastguard Worker 1573*9e94795aSAndroid Build Coastguard Worker if err != nil { 1574*9e94795aSAndroid Build Coastguard Worker t.Errorf("unexpected test data error: got %s, want no error", err) 1575*9e94795aSAndroid Build Coastguard Worker return 1576*9e94795aSAndroid Build Coastguard Worker } 1577*9e94795aSAndroid Build Coastguard Worker 1578*9e94795aSAndroid Build Coastguard Worker expectedRst := tt.expectedResult 1579*9e94795aSAndroid Build Coastguard Worker 1580*9e94795aSAndroid Build Coastguard Worker //Keeping track of the visited nodes 1581*9e94795aSAndroid Build Coastguard Worker //Only add to actualOut if not visited 1582*9e94795aSAndroid Build Coastguard Worker visitedNodes := make(map[string]struct{}) 1583*9e94795aSAndroid Build Coastguard Worker WalkTopDownBreadthFirst(nil, lg, func(lg *LicenseGraph, tn *TargetNode, path TargetEdgePath) bool { 1584*9e94795aSAndroid Build Coastguard Worker if _, alreadyVisited := visitedNodes[tn.Name()]; alreadyVisited { 1585*9e94795aSAndroid Build Coastguard Worker return false 1586*9e94795aSAndroid Build Coastguard Worker } 1587*9e94795aSAndroid Build Coastguard Worker fmt.Fprintln(actualOut, tn.Name()) 1588*9e94795aSAndroid Build Coastguard Worker visitedNodes[tn.Name()] = struct{}{} 1589*9e94795aSAndroid Build Coastguard Worker return true 1590*9e94795aSAndroid Build Coastguard Worker }) 1591*9e94795aSAndroid Build Coastguard Worker 1592*9e94795aSAndroid Build Coastguard Worker actualRst := strings.Split(actualOut.String(), "\n") 1593*9e94795aSAndroid Build Coastguard Worker 1594*9e94795aSAndroid Build Coastguard Worker if len(actualRst) > 0 { 1595*9e94795aSAndroid Build Coastguard Worker actualRst = actualRst[:len(actualRst)-1] 1596*9e94795aSAndroid Build Coastguard Worker } 1597*9e94795aSAndroid Build Coastguard Worker 1598*9e94795aSAndroid Build Coastguard Worker t.Logf("actual nodes visited: %s", actualOut.String()) 1599*9e94795aSAndroid Build Coastguard Worker t.Logf("expected nodes visited: %s", strings.Join(expectedRst, "\n")) 1600*9e94795aSAndroid Build Coastguard Worker 1601*9e94795aSAndroid Build Coastguard Worker if len(actualRst) != len(expectedRst) { 1602*9e94795aSAndroid Build Coastguard Worker t.Errorf("WalkTopDownBreadthFirst: number of visited nodes is different: got %d, want %d", len(actualRst), len(expectedRst)) 1603*9e94795aSAndroid Build Coastguard Worker } 1604*9e94795aSAndroid Build Coastguard Worker 1605*9e94795aSAndroid Build Coastguard Worker for i := 0; i < len(actualRst) && i < len(expectedRst); i++ { 1606*9e94795aSAndroid Build Coastguard Worker if actualRst[i] != expectedRst[i] { 1607*9e94795aSAndroid Build Coastguard Worker t.Errorf("WalkTopDownBreadthFirst: lines differ at index %d: got %q, want %q", i, actualRst[i], expectedRst[i]) 1608*9e94795aSAndroid Build Coastguard Worker break 1609*9e94795aSAndroid Build Coastguard Worker } 1610*9e94795aSAndroid Build Coastguard Worker } 1611*9e94795aSAndroid Build Coastguard Worker 1612*9e94795aSAndroid Build Coastguard Worker if len(actualRst) < len(expectedRst) { 1613*9e94795aSAndroid Build Coastguard Worker t.Errorf("WalkTopDownBreadthFirst: extra lines at %d: got %q, want nothing", len(actualRst), expectedRst[len(actualRst)]) 1614*9e94795aSAndroid Build Coastguard Worker } 1615*9e94795aSAndroid Build Coastguard Worker 1616*9e94795aSAndroid Build Coastguard Worker if len(expectedRst) < len(actualRst) { 1617*9e94795aSAndroid Build Coastguard Worker t.Errorf("WalkTopDownBreadthFirst: missing lines at %d: got nothing, want %q", len(expectedRst), actualRst[len(expectedRst)]) 1618*9e94795aSAndroid Build Coastguard Worker } 1619*9e94795aSAndroid Build Coastguard Worker }) 1620*9e94795aSAndroid Build Coastguard Worker } 1621*9e94795aSAndroid Build Coastguard Worker} 1622