From 10f5c48b237d5e53bfc7e341a90641cb884485f1 Mon Sep 17 00:00:00 2001 From: Bob Badour Date: Tue, 20 Sep 2022 21:44:17 -0700 Subject: [PATCH] Policy change: GPL+CE is permissive. Bug: 210546823 Test: m cts compliance_checkshare compliancenotice_bom \ compliancenotice_shippedlibs compliance_listshare \ compliance_dumpgraph compliance_dumpresolutions htmlnotice \ compliance_rtrace textnotice xmlnotice Change-Id: I7da36972ffbb1494e33fd63db8e5ec851d47704c --- core/tasks/tools/compatibility.mk | 2 +- tools/compliance/condition.go | 18 ++-- tools/compliance/condition_test.go | 14 +-- tools/compliance/conditionset_test.go | 50 +++++------ tools/compliance/policy_policy.go | 33 ++----- tools/compliance/policy_policy_test.go | 22 ++--- tools/compliance/policy_resolve_test.go | 34 ++++---- .../compliance/policy_resolvenotices_test.go | 17 +--- tools/compliance/policy_resolveshare_test.go | 38 ++------- tools/compliance/policy_walk_test.go | 85 +++++-------------- tools/compliance/test_util.go | 6 +- 11 files changed, 101 insertions(+), 218 deletions(-) diff --git a/core/tasks/tools/compatibility.mk b/core/tasks/tools/compatibility.mk index e56e8bad5e..a5f162af63 100644 --- a/core/tasks/tools/compatibility.mk +++ b/core/tasks/tools/compatibility.mk @@ -53,7 +53,7 @@ $(test_suite_jdk): $(shell find $(test_suite_jdk_dir) -type f | sort) $(test_suite_jdk): $(SOONG_ZIP) $(SOONG_ZIP) -o $@ -P $(PRIVATE_SUBDIR)/jdk -C $(PRIVATE_JDK_DIR) -D $(PRIVATE_JDK_DIR) -$(call declare-license-metadata,$(test_suite_jdk),SPDX-license-identifier-GPL-2.0-with-classpath-exception,restricted,\ +$(call declare-license-metadata,$(test_suite_jdk),SPDX-license-identifier-GPL-2.0-with-classpath-exception,permissive,\ $(test_suite_jdk_dir)/legal/java.base/LICENSE,JDK,prebuilts/jdk/$(notdir $(patsubst %/,%,$(dir $(test_suite_jdk_dir))))) # Copy license metadata diff --git a/tools/compliance/condition.go b/tools/compliance/condition.go index cfe6f8247e..31452497d9 100644 --- a/tools/compliance/condition.go +++ b/tools/compliance/condition.go @@ -23,7 +23,7 @@ import ( type LicenseCondition uint16 // LicenseConditionMask is a bitmask for the recognized license conditions. -const LicenseConditionMask = LicenseCondition(0x3ff) +const LicenseConditionMask = LicenseCondition(0x1ff) const ( // UnencumberedCondition identifies public domain or public domain- @@ -41,21 +41,18 @@ const ( // RestrictedCondition identifies a license with requirement to share // all source code linked to the module's source. RestrictedCondition = LicenseCondition(0x0010) - // RestrictedClasspathExceptionCondition identifies RestrictedCondition - // waived for dynamic linking from independent modules. - RestrictedClasspathExceptionCondition = LicenseCondition(0x0020) // WeaklyRestrictedCondition identifies a RestrictedCondition waived // for dynamic linking. - WeaklyRestrictedCondition = LicenseCondition(0x0040) + WeaklyRestrictedCondition = LicenseCondition(0x0020) // ProprietaryCondition identifies a license with source privacy // requirements. - ProprietaryCondition = LicenseCondition(0x0080) + ProprietaryCondition = LicenseCondition(0x0040) // ByExceptionOnly identifies a license where policy requires product // counsel review prior to use. - ByExceptionOnlyCondition = LicenseCondition(0x0100) + ByExceptionOnlyCondition = LicenseCondition(0x0080) // NotAllowedCondition identifies a license with onerous conditions // where policy prohibits use. - NotAllowedCondition = LicenseCondition(0x0200) + NotAllowedCondition = LicenseCondition(0x0100) ) var ( @@ -66,7 +63,6 @@ var ( "notice": NoticeCondition, "reciprocal": ReciprocalCondition, "restricted": RestrictedCondition, - "restricted_with_classpath_exception": RestrictedClasspathExceptionCondition, "restricted_allows_dynamic_linking": WeaklyRestrictedCondition, "proprietary": ProprietaryCondition, "by_exception_only": ByExceptionOnlyCondition, @@ -87,8 +83,6 @@ func (lc LicenseCondition) Name() string { return "reciprocal" case RestrictedCondition: return "restricted" - case RestrictedClasspathExceptionCondition: - return "restricted_with_classpath_exception" case WeaklyRestrictedCondition: return "restricted_allows_dynamic_linking" case ProprietaryCondition: @@ -98,5 +92,5 @@ func (lc LicenseCondition) Name() string { case NotAllowedCondition: return "not_allowed" } - panic(fmt.Errorf("unrecognized license condition: %04x", lc)) + panic(fmt.Errorf("unrecognized license condition: %#v", lc)) } diff --git a/tools/compliance/condition_test.go b/tools/compliance/condition_test.go index 778ce4a8dd..16ec72cb56 100644 --- a/tools/compliance/condition_test.go +++ b/tools/compliance/condition_test.go @@ -21,22 +21,22 @@ import ( func TestConditionSetHas(t *testing.T) { impliesShare := ImpliesShared - t.Logf("testing with imliesShare=%04x", impliesShare) + t.Logf("testing with imliesShare=%#v", impliesShare) if impliesShare.HasAny(NoticeCondition) { - t.Errorf("impliesShare.HasAny(\"notice\"=%04x) got true, want false", NoticeCondition) + t.Errorf("impliesShare.HasAny(\"notice\"=%#v) got true, want false", NoticeCondition) } if !impliesShare.HasAny(RestrictedCondition) { - t.Errorf("impliesShare.HasAny(\"restricted\"=%04x) got false, want true", RestrictedCondition) + t.Errorf("impliesShare.HasAny(\"restricted\"=%#v) got false, want true", RestrictedCondition) } if !impliesShare.HasAny(ReciprocalCondition) { - t.Errorf("impliesShare.HasAny(\"reciprocal\"=%04x) got false, want true", ReciprocalCondition) + t.Errorf("impliesShare.HasAny(\"reciprocal\"=%#v) got false, want true", ReciprocalCondition) } if impliesShare.HasAny(LicenseCondition(0x0000)) { - t.Errorf("impliesShare.HasAny(nil=%04x) got true, want false", LicenseCondition(0x0000)) + t.Errorf("impliesShare.HasAny(nil=%#v) got true, want false", LicenseCondition(0x0000)) } } @@ -44,7 +44,7 @@ func TestConditionName(t *testing.T) { for expected, condition := range RecognizedConditionNames { actual := condition.Name() if expected != actual { - t.Errorf("unexpected name for condition %04x: got %s, want %s", condition, actual, expected) + t.Errorf("unexpected name for condition %#v: got %s, want %s", condition, actual, expected) } } } @@ -62,6 +62,6 @@ func TestConditionName_InvalidCondition(t *testing.T) { t.Errorf("invalid condition unexpected name: got %s, wanted panic", name) }() if !panicked { - t.Errorf("no expected panic for %04x.Name(): got no panic, wanted panic", lc) + t.Errorf("no expected panic for %#v.Name(): got no panic, wanted panic", lc) } } diff --git a/tools/compliance/conditionset_test.go b/tools/compliance/conditionset_test.go index c91912f19f..020cc0cdef 100644 --- a/tools/compliance/conditionset_test.go +++ b/tools/compliance/conditionset_test.go @@ -96,14 +96,13 @@ func TestConditionSet(t *testing.T) { { name: "everything", conditions: []string{"unencumbered", "permissive", "notice", "reciprocal", "restricted", "proprietary"}, - plus: &[]string{"restricted_with_classpath_exception", "restricted_allows_dynamic_linking", "by_exception_only", "not_allowed"}, + plus: &[]string{"restricted_allows_dynamic_linking", "by_exception_only", "not_allowed"}, matchingAny: map[string][]string{ "unencumbered": []string{"unencumbered"}, "permissive": []string{"permissive"}, "notice": []string{"notice"}, "reciprocal": []string{"reciprocal"}, "restricted": []string{"restricted"}, - "restricted_with_classpath_exception": []string{"restricted_with_classpath_exception"}, "restricted_allows_dynamic_linking": []string{"restricted_allows_dynamic_linking"}, "proprietary": []string{"proprietary"}, "by_exception_only": []string{"by_exception_only"}, @@ -116,7 +115,6 @@ func TestConditionSet(t *testing.T) { "notice", "reciprocal", "restricted", - "restricted_with_classpath_exception", "restricted_allows_dynamic_linking", "proprietary", "by_exception_only", @@ -131,7 +129,6 @@ func TestConditionSet(t *testing.T) { "notice", "reciprocal", "restricted", - "restricted_with_classpath_exception", "restricted_allows_dynamic_linking", "proprietary", "by_exception_only", @@ -151,7 +148,6 @@ func TestConditionSet(t *testing.T) { "notice", "reciprocal", "restricted", - "restricted_with_classpath_exception", "restricted_allows_dynamic_linking", "proprietary", "by_exception_only", @@ -168,7 +164,6 @@ func TestConditionSet(t *testing.T) { "notice": []string{"notice"}, "reciprocal": []string{"reciprocal"}, "restricted": []string{"restricted"}, - "restricted_with_classpath_exception": []string{}, "restricted_allows_dynamic_linking": []string{"restricted_allows_dynamic_linking"}, "proprietary": []string{"proprietary"}, "by_exception_only": []string{"by_exception_only"}, @@ -195,7 +190,6 @@ func TestConditionSet(t *testing.T) { "notice", "reciprocal", "restricted", - "restricted_with_classpath_exception", "restricted_allows_dynamic_linking", "proprietary", "by_exception_only", @@ -208,7 +202,6 @@ func TestConditionSet(t *testing.T) { "notice": []string{"notice"}, "reciprocal": []string{"reciprocal"}, "restricted": []string{"restricted"}, - "restricted_with_classpath_exception": []string{"restricted_with_classpath_exception"}, "restricted_allows_dynamic_linking": []string{}, "proprietary": []string{"proprietary"}, "by_exception_only": []string{"by_exception_only"}, @@ -221,7 +214,6 @@ func TestConditionSet(t *testing.T) { "notice", "reciprocal", "restricted", - "restricted_with_classpath_exception", "proprietary", "by_exception_only", "not_allowed", @@ -235,7 +227,6 @@ func TestConditionSet(t *testing.T) { "notice", "reciprocal", "restricted", - "restricted_with_classpath_exception", "restricted_allows_dynamic_linking", "proprietary", "by_exception_only", @@ -247,7 +238,6 @@ func TestConditionSet(t *testing.T) { "notice", "reciprocal", "restricted", - "restricted_with_classpath_exception", "restricted_allows_dynamic_linking", "proprietary", "by_exception_only", @@ -259,7 +249,6 @@ func TestConditionSet(t *testing.T) { "notice": []string{}, "reciprocal": []string{}, "restricted": []string{}, - "restricted_with_classpath_exception": []string{}, "restricted_allows_dynamic_linking": []string{}, "proprietary": []string{}, "by_exception_only": []string{}, @@ -270,21 +259,20 @@ func TestConditionSet(t *testing.T) { }, { name: "restrictedplus", - conditions: []string{"restricted", "restricted_with_classpath_exception", "restricted_allows_dynamic_linking"}, + conditions: []string{"restricted", "restricted_allows_dynamic_linking"}, plus: &[]string{"permissive", "notice", "restricted", "proprietary"}, matchingAny: map[string][]string{ "unencumbered": []string{}, "permissive": []string{"permissive"}, "notice": []string{"notice"}, "restricted": []string{"restricted"}, - "restricted_with_classpath_exception": []string{"restricted_with_classpath_exception"}, "restricted_allows_dynamic_linking": []string{"restricted_allows_dynamic_linking"}, "proprietary": []string{"proprietary"}, "restricted|proprietary": []string{"restricted", "proprietary"}, "by_exception_only": []string{}, "proprietary|by_exception_only": []string{"proprietary"}, }, - expected: []string{"permissive", "notice", "restricted", "restricted_with_classpath_exception", "restricted_allows_dynamic_linking", "proprietary"}, + expected: []string{"permissive", "notice", "restricted", "restricted_allows_dynamic_linking", "proprietary"}, }, } for _, tt := range tests { @@ -342,11 +330,11 @@ func TestConditionSet(t *testing.T) { actual := cs.MatchingAny(toConditions(strings.Split(data, "|"))...) actualNames := actual.Names() - t.Logf("MatchingAny(%s): actual set %04x %s", data, actual, actual.String()) - t.Logf("MatchingAny(%s): expected set %04x %s", data, expected, expected.String()) + t.Logf("MatchingAny(%s): actual set %#v %s", data, actual, actual.String()) + t.Logf("MatchingAny(%s): expected set %#v %s", data, expected, expected.String()) if actual != expected { - t.Errorf("MatchingAny(%s): got %04x, want %04x", data, actual, expected) + t.Errorf("MatchingAny(%s): got %#v, want %#v", data, actual, expected) continue } if len(actualNames) != len(expectedNames) { @@ -382,11 +370,11 @@ func TestConditionSet(t *testing.T) { actual := cs.MatchingAnySet(NewLicenseConditionSet(toConditions(strings.Split(data, "|"))...)) actualNames := actual.Names() - t.Logf("MatchingAnySet(%s): actual set %04x %s", data, actual, actual.String()) - t.Logf("MatchingAnySet(%s): expected set %04x %s", data, expected, expected.String()) + t.Logf("MatchingAnySet(%s): actual set %#v %s", data, actual, actual.String()) + t.Logf("MatchingAnySet(%s): expected set %#v %s", data, expected, expected.String()) if actual != expected { - t.Errorf("MatchingAnySet(%s): got %04x, want %04x", data, actual, expected) + t.Errorf("MatchingAnySet(%s): got %#v, want %#v", data, actual, expected) continue } if len(actualNames) != len(expectedNames) { @@ -426,11 +414,11 @@ func TestConditionSet(t *testing.T) { actualNames := actual.Names() - t.Logf("actual license condition set: %04x %s", actual, actual.String()) - t.Logf("expected license condition set: %04x %s", expected, expected.String()) + t.Logf("actual license condition set: %#v %s", actual, actual.String()) + t.Logf("expected license condition set: %#v %s", expected, expected.String()) if actual != expected { - t.Errorf("checkExpected: got %04x, want %04x", actual, expected) + t.Errorf("checkExpected: got %#v, want %#v", actual, expected) return false } @@ -487,7 +475,7 @@ func TestConditionSet(t *testing.T) { notExpected := (AllLicenseConditions &^ expected) notExpectedList := notExpected.AsList() - t.Logf("not expected license condition set: %04x %s", notExpected, notExpected.String()) + t.Logf("not expected license condition set: %#v %s", notExpected, notExpected.String()) if len(tt.expected) == 0 { if actual.HasAny(append(expectedConditions, notExpectedList...)...) { @@ -526,11 +514,11 @@ func TestConditionSet(t *testing.T) { actualNames := actual.Names() - t.Logf("actual license condition set: %04x %s", actual, actual.String()) - t.Logf("expected license condition set: %04x %s", expected, expected.String()) + t.Logf("actual license condition set: %#v %s", actual, actual.String()) + t.Logf("expected license condition set: %#v %s", expected, expected.String()) if actual != expected { - t.Errorf("checkExpectedSet: got %04x, want %04x", actual, expected) + t.Errorf("checkExpectedSet: got %#v, want %#v", actual, expected) return false } @@ -581,7 +569,7 @@ func TestConditionSet(t *testing.T) { } notExpected := (AllLicenseConditions &^ expected) - t.Logf("not expected license condition set: %04x %s", notExpected, notExpected.String()) + t.Logf("not expected license condition set: %#v %s", notExpected, notExpected.String()) if len(tt.expected) == 0 { if actual.MatchesAnySet(expected, notExpected) { @@ -606,10 +594,10 @@ func TestConditionSet(t *testing.T) { t.Errorf("actual.Difference({expected}).IsEmpty(): want true, got false") } if expected != actual.Intersection(expected) { - t.Errorf("expected == actual.Intersection({expected}): want true, got false (%04x != %04x)", expected, actual.Intersection(expected)) + t.Errorf("expected == actual.Intersection({expected}): want true, got false (%#v != %#v)", expected, actual.Intersection(expected)) } if actual != actual.Intersection(expected) { - t.Errorf("actual == actual.Intersection({expected}): want true, got false (%04x != %04x)", actual, actual.Intersection(expected)) + t.Errorf("actual == actual.Intersection({expected}): want true, got false (%#v != %#v)", actual, actual.Intersection(expected)) } return true } diff --git a/tools/compliance/policy_policy.go b/tools/compliance/policy_policy.go index 60bdf48e22..63da73114d 100644 --- a/tools/compliance/policy_policy.go +++ b/tools/compliance/policy_policy.go @@ -16,7 +16,6 @@ package compliance import ( "regexp" - "strings" ) var ( @@ -62,14 +61,13 @@ var ( // ImpliesNotice lists the condition names implying a notice or attribution policy. ImpliesNotice = LicenseConditionSet(UnencumberedCondition | PermissiveCondition | NoticeCondition | ReciprocalCondition | - RestrictedCondition | RestrictedClasspathExceptionCondition | WeaklyRestrictedCondition | - ProprietaryCondition | ByExceptionOnlyCondition) + RestrictedCondition | WeaklyRestrictedCondition | ProprietaryCondition | ByExceptionOnlyCondition) // ImpliesReciprocal lists the condition names implying a local source-sharing policy. ImpliesReciprocal = LicenseConditionSet(ReciprocalCondition) // Restricted lists the condition names implying an infectious source-sharing policy. - ImpliesRestricted = LicenseConditionSet(RestrictedCondition | RestrictedClasspathExceptionCondition | WeaklyRestrictedCondition) + ImpliesRestricted = LicenseConditionSet(RestrictedCondition | WeaklyRestrictedCondition) // ImpliesProprietary lists the condition names implying a confidentiality policy. ImpliesProprietary = LicenseConditionSet(ProprietaryCondition) @@ -81,7 +79,7 @@ var ( ImpliesPrivate = LicenseConditionSet(ProprietaryCondition) // ImpliesShared lists the condition names implying a source-code sharing policy. - ImpliesShared = LicenseConditionSet(ReciprocalCondition | RestrictedCondition | RestrictedClasspathExceptionCondition | WeaklyRestrictedCondition) + ImpliesShared = LicenseConditionSet(ReciprocalCondition | RestrictedCondition | WeaklyRestrictedCondition) ) var ( @@ -112,13 +110,9 @@ func LicenseConditionSetFromNames(tn *TargetNode, names ...string) LicenseCondit continue } hasLgpl := false - hasClasspath := false hasGeneric := false for _, kind := range tn.LicenseKinds() { - if strings.HasSuffix(kind, "-with-classpath-exception") { - cs = cs.Plus(RestrictedClasspathExceptionCondition) - hasClasspath = true - } else if anyLgpl.MatchString(kind) { + if anyLgpl.MatchString(kind) { cs = cs.Plus(WeaklyRestrictedCondition) hasLgpl = true } else if versionedGpl.MatchString(kind) { @@ -131,7 +125,7 @@ func LicenseConditionSetFromNames(tn *TargetNode, names ...string) LicenseCondit cs = cs.Plus(RestrictedCondition) } } - if hasGeneric && !hasLgpl && !hasClasspath { + if hasGeneric && !hasLgpl { cs = cs.Plus(RestrictedCondition) } continue @@ -202,9 +196,6 @@ func depConditionsPropagatingToTarget(lg *LicenseGraph, e *TargetEdge, depCondit } result |= depConditions & LicenseConditionSet(RestrictedCondition) - if 0 != (depConditions&LicenseConditionSet(RestrictedClasspathExceptionCondition)) && !edgeNodesAreIndependentModules(e) { - result |= LicenseConditionSet(RestrictedClasspathExceptionCondition) - } return result } @@ -241,9 +232,6 @@ func targetConditionsPropagatingToDep(lg *LicenseGraph, e *TargetEdge, targetCon return result } result = result.Minus(WeaklyRestrictedCondition) - if edgeNodesAreIndependentModules(e) { - result = result.Minus(RestrictedClasspathExceptionCondition) - } return result } @@ -261,10 +249,7 @@ func conditionsAttachingAcrossEdge(lg *LicenseGraph, e *TargetEdge, universe Lic return NewLicenseConditionSet() } - result &= LicenseConditionSet(RestrictedCondition | RestrictedClasspathExceptionCondition) - if 0 != (result&LicenseConditionSet(RestrictedClasspathExceptionCondition)) && edgeNodesAreIndependentModules(e) { - result &= LicenseConditionSet(RestrictedCondition) - } + result &= LicenseConditionSet(RestrictedCondition) return result } @@ -281,9 +266,3 @@ func edgeIsDerivation(e *TargetEdge) bool { isToolchain := e.annotations.HasAnnotation("toolchain") return !isDynamic && !isToolchain } - -// edgeNodesAreIndependentModules returns true for edges where the target and -// dependency are independent modules. -func edgeNodesAreIndependentModules(e *TargetEdge) bool { - return e.target.PackageName() != e.dependency.PackageName() -} diff --git a/tools/compliance/policy_policy_test.go b/tools/compliance/policy_policy_test.go index 27ce16c54a..94d0be332c 100644 --- a/tools/compliance/policy_policy_test.go +++ b/tools/compliance/policy_policy_test.go @@ -85,19 +85,13 @@ func TestPolicy_edgeConditions(t *testing.T) { { name: "independentmodulestatic", edge: annotated{"apacheBin.meta_lic", "gplWithClasspathException.meta_lic", []string{"static"}}, - expectedDepActions: []string{ - "apacheBin.meta_lic:gplWithClasspathException.meta_lic:restricted_with_classpath_exception", - "gplWithClasspathException.meta_lic:gplWithClasspathException.meta_lic:restricted_with_classpath_exception", - }, + expectedDepActions: []string{}, expectedTargetConditions: []string{}, }, { name: "dependentmodule", edge: annotated{"dependentModule.meta_lic", "gplWithClasspathException.meta_lic", []string{"dynamic"}}, - expectedDepActions: []string{ - "dependentModule.meta_lic:gplWithClasspathException.meta_lic:restricted_with_classpath_exception", - "gplWithClasspathException.meta_lic:gplWithClasspathException.meta_lic:restricted_with_classpath_exception", - }, + expectedDepActions: []string{}, expectedTargetConditions: []string{}, }, @@ -166,13 +160,13 @@ func TestPolicy_edgeConditions(t *testing.T) { name: "independentmodulereversestatic", edge: annotated{"gplWithClasspathException.meta_lic", "apacheBin.meta_lic", []string{"static"}}, expectedDepActions: []string{}, - expectedTargetConditions: []string{"gplWithClasspathException.meta_lic:restricted_with_classpath_exception"}, + expectedTargetConditions: []string{}, }, { name: "dependentmodulereverse", edge: annotated{"gplWithClasspathException.meta_lic", "dependentModule.meta_lic", []string{"dynamic"}}, expectedDepActions: []string{}, - expectedTargetConditions: []string{"gplWithClasspathException.meta_lic:restricted_with_classpath_exception"}, + expectedTargetConditions: []string{}, }, { name: "ponr", @@ -257,9 +251,9 @@ func TestPolicy_edgeConditions(t *testing.T) { otherCs := otn.LicenseConditions() depConditions |= otherCs } - t.Logf("calculate target actions for edge=%s, dep conditions=%04x, treatAsAggregate=%v", edge.String(), depConditions, tt.treatAsAggregate) + t.Logf("calculate target actions for edge=%s, dep conditions=%#v %s, treatAsAggregate=%v", edge.String(), depConditions, depConditions, tt.treatAsAggregate) csActual := depConditionsPropagatingToTarget(lg, edge, depConditions, tt.treatAsAggregate) - t.Logf("calculated target conditions as %04x{%s}", csActual, strings.Join(csActual.Names(), ", ")) + t.Logf("calculated target conditions as %#v %s", csActual, csActual) csExpected := NewLicenseConditionSet() for _, triple := range tt.expectedDepActions { fields := strings.Split(triple, ":") @@ -269,9 +263,9 @@ func TestPolicy_edgeConditions(t *testing.T) { } csExpected |= expectedConditions } - t.Logf("expected target conditions as %04x{%s}", csExpected, strings.Join(csExpected.Names(), ", ")) + t.Logf("expected target conditions as %#v %s", csExpected, csExpected) if csActual != csExpected { - t.Errorf("unexpected license conditions: got %04x, want %04x", csActual, csExpected) + t.Errorf("unexpected license conditions: got %#v, want %#v", csActual, csExpected) } }) } diff --git a/tools/compliance/policy_resolve_test.go b/tools/compliance/policy_resolve_test.go index f98e4cc23a..d6731feb21 100644 --- a/tools/compliance/policy_resolve_test.go +++ b/tools/compliance/policy_resolve_test.go @@ -289,8 +289,8 @@ func TestResolveBottomUpConditions(t *testing.T) { {"apacheBin.meta_lic", "gplWithClasspathException.meta_lic", []string{"static"}}, }, expectedActions: []tcond{ - {"apacheBin.meta_lic", "notice|restricted_with_classpath_exception"}, - {"gplWithClasspathException.meta_lic", "restricted_with_classpath_exception"}, + {"apacheBin.meta_lic", "notice"}, + {"gplWithClasspathException.meta_lic", "permissive"}, }, }, { @@ -300,8 +300,8 @@ func TestResolveBottomUpConditions(t *testing.T) { {"dependentModule.meta_lic", "gplWithClasspathException.meta_lic", []string{"static"}}, }, expectedActions: []tcond{ - {"dependentModule.meta_lic", "notice|restricted_with_classpath_exception"}, - {"gplWithClasspathException.meta_lic", "restricted_with_classpath_exception"}, + {"dependentModule.meta_lic", "notice"}, + {"gplWithClasspathException.meta_lic", "permissive"}, }, }, { @@ -312,7 +312,7 @@ func TestResolveBottomUpConditions(t *testing.T) { }, expectedActions: []tcond{ {"apacheBin.meta_lic", "notice"}, - {"gplWithClasspathException.meta_lic", "restricted_with_classpath_exception"}, + {"gplWithClasspathException.meta_lic", "permissive"}, }, }, { @@ -322,8 +322,8 @@ func TestResolveBottomUpConditions(t *testing.T) { {"dependentModule.meta_lic", "gplWithClasspathException.meta_lic", []string{"dynamic"}}, }, expectedActions: []tcond{ - {"dependentModule.meta_lic", "notice|restricted_with_classpath_exception"}, - {"gplWithClasspathException.meta_lic", "restricted_with_classpath_exception"}, + {"dependentModule.meta_lic", "notice"}, + {"gplWithClasspathException.meta_lic", "permissive"}, }, }, } @@ -593,9 +593,9 @@ func TestResolveTopDownConditions(t *testing.T) { {"apacheBin.meta_lic", "mitLib.meta_lic", []string{"static"}}, }, expectedActions: []tcond{ - {"apacheBin.meta_lic", "notice|restricted_with_classpath_exception"}, - {"gplWithClasspathException.meta_lic", "restricted_with_classpath_exception"}, - {"mitLib.meta_lic", "notice|restricted_with_classpath_exception"}, + {"apacheBin.meta_lic", "notice"}, + {"gplWithClasspathException.meta_lic", "permissive"}, + {"mitLib.meta_lic", "notice"}, }, }, { @@ -606,9 +606,9 @@ func TestResolveTopDownConditions(t *testing.T) { {"dependentModule.meta_lic", "mitLib.meta_lic", []string{"static"}}, }, expectedActions: []tcond{ - {"dependentModule.meta_lic", "notice|restricted_with_classpath_exception"}, - {"gplWithClasspathException.meta_lic", "restricted_with_classpath_exception"}, - {"mitLib.meta_lic", "notice|restricted_with_classpath_exception"}, + {"dependentModule.meta_lic", "notice"}, + {"gplWithClasspathException.meta_lic", "permissive"}, + {"mitLib.meta_lic", "notice"}, }, }, { @@ -620,7 +620,7 @@ func TestResolveTopDownConditions(t *testing.T) { }, expectedActions: []tcond{ {"apacheBin.meta_lic", "notice"}, - {"gplWithClasspathException.meta_lic", "restricted_with_classpath_exception"}, + {"gplWithClasspathException.meta_lic", "permissive"}, {"mitLib.meta_lic", "notice"}, }, }, @@ -632,9 +632,9 @@ func TestResolveTopDownConditions(t *testing.T) { {"dependentModule.meta_lic", "mitLib.meta_lic", []string{"static"}}, }, expectedActions: []tcond{ - {"dependentModule.meta_lic", "notice|restricted_with_classpath_exception"}, - {"gplWithClasspathException.meta_lic", "restricted_with_classpath_exception"}, - {"mitLib.meta_lic", "notice|restricted_with_classpath_exception"}, + {"dependentModule.meta_lic", "notice"}, + {"gplWithClasspathException.meta_lic", "permissive"}, + {"mitLib.meta_lic", "notice"}, }, }, } diff --git a/tools/compliance/policy_resolvenotices_test.go b/tools/compliance/policy_resolvenotices_test.go index cd9dd71bdc..ee5e3b8b9e 100644 --- a/tools/compliance/policy_resolvenotices_test.go +++ b/tools/compliance/policy_resolvenotices_test.go @@ -375,10 +375,8 @@ func TestResolveNotices(t *testing.T) { }, expectedResolutions: []res{ {"apacheBin.meta_lic", "apacheBin.meta_lic", "apacheBin.meta_lic", "notice"}, - {"apacheBin.meta_lic", "apacheBin.meta_lic", "gplWithClasspathException.meta_lic", "restricted"}, - {"apacheBin.meta_lic", "gplWithClasspathException.meta_lic", "gplWithClasspathException.meta_lic", "restricted"}, + {"apacheBin.meta_lic", "gplWithClasspathException.meta_lic", "gplWithClasspathException.meta_lic", "permissive"}, {"apacheBin.meta_lic", "mitLib.meta_lic", "mitLib.meta_lic", "notice"}, - {"apacheBin.meta_lic", "mitLib.meta_lic", "gplWithClasspathException.meta_lic", "restricted"}, }, }, { @@ -390,10 +388,8 @@ func TestResolveNotices(t *testing.T) { }, expectedResolutions: []res{ {"dependentModule.meta_lic", "dependentModule.meta_lic", "dependentModule.meta_lic", "notice"}, - {"dependentModule.meta_lic", "dependentModule.meta_lic", "gplWithClasspathException.meta_lic", "restricted"}, - {"dependentModule.meta_lic", "gplWithClasspathException.meta_lic", "gplWithClasspathException.meta_lic", "restricted"}, + {"dependentModule.meta_lic", "gplWithClasspathException.meta_lic", "gplWithClasspathException.meta_lic", "permissive"}, {"dependentModule.meta_lic", "mitLib.meta_lic", "mitLib.meta_lic", "notice"}, - {"dependentModule.meta_lic", "mitLib.meta_lic", "gplWithClasspathException.meta_lic", "restricted"}, }, }, { @@ -418,7 +414,7 @@ func TestResolveNotices(t *testing.T) { expectedResolutions: []res{ {"apacheBin.meta_lic", "apacheBin.meta_lic", "apacheBin.meta_lic", "notice"}, {"apacheBin.meta_lic", "mitLib.meta_lic", "mitLib.meta_lic", "notice"}, - {"gplWithClasspathException.meta_lic", "gplWithClasspathException.meta_lic", "gplWithClasspathException.meta_lic", "restricted"}, + {"gplWithClasspathException.meta_lic", "gplWithClasspathException.meta_lic", "gplWithClasspathException.meta_lic", "permissive"}, }, }, { @@ -430,9 +426,7 @@ func TestResolveNotices(t *testing.T) { }, expectedResolutions: []res{ {"dependentModule.meta_lic", "dependentModule.meta_lic", "dependentModule.meta_lic", "notice"}, - {"dependentModule.meta_lic", "dependentModule.meta_lic", "gplWithClasspathException.meta_lic", "restricted"}, {"dependentModule.meta_lic", "mitLib.meta_lic", "mitLib.meta_lic", "notice"}, - {"dependentModule.meta_lic", "mitLib.meta_lic", "gplWithClasspathException.meta_lic", "restricted"}, }, }, { @@ -444,11 +438,8 @@ func TestResolveNotices(t *testing.T) { }, expectedResolutions: []res{ {"dependentModule.meta_lic", "dependentModule.meta_lic", "dependentModule.meta_lic", "notice"}, - {"dependentModule.meta_lic", "dependentModule.meta_lic", "gplWithClasspathException.meta_lic", "restricted"}, - {"dependentModule.meta_lic", "gplWithClasspathException.meta_lic", "gplWithClasspathException.meta_lic", "restricted"}, {"dependentModule.meta_lic", "mitLib.meta_lic", "mitLib.meta_lic", "notice"}, - {"dependentModule.meta_lic", "mitLib.meta_lic", "gplWithClasspathException.meta_lic", "restricted"}, - {"gplWithClasspathException.meta_lic", "gplWithClasspathException.meta_lic", "gplWithClasspathException.meta_lic", "restricted"}, + {"gplWithClasspathException.meta_lic", "gplWithClasspathException.meta_lic", "gplWithClasspathException.meta_lic", "permissive"}, }, }, } diff --git a/tools/compliance/policy_resolveshare_test.go b/tools/compliance/policy_resolveshare_test.go index c451b86040..d49dfa8b3d 100644 --- a/tools/compliance/policy_resolveshare_test.go +++ b/tools/compliance/policy_resolveshare_test.go @@ -40,9 +40,7 @@ func TestResolveSourceSharing(t *testing.T) { edges: []annotated{ {"apacheBin.meta_lic", "gplWithClasspathException.meta_lic", []string{"dynamic"}}, }, - expectedResolutions: []res{ - {"gplWithClasspathException.meta_lic", "gplWithClasspathException.meta_lic", "gplWithClasspathException.meta_lic", "restricted"}, - }, + expectedResolutions: []res{}, }, { name: "independentmodulestaticrestricted", @@ -50,10 +48,7 @@ func TestResolveSourceSharing(t *testing.T) { edges: []annotated{ {"apacheBin.meta_lic", "gplWithClasspathException.meta_lic", []string{"static"}}, }, - expectedResolutions: []res{ - {"apacheBin.meta_lic", "apacheBin.meta_lic", "gplWithClasspathException.meta_lic", "restricted"}, - {"apacheBin.meta_lic", "gplWithClasspathException.meta_lic", "gplWithClasspathException.meta_lic", "restricted"}, - }, + expectedResolutions: []res{}, }, { name: "dependentmodulerestricted", @@ -61,9 +56,7 @@ func TestResolveSourceSharing(t *testing.T) { edges: []annotated{ {"dependentModule.meta_lic", "gplWithClasspathException.meta_lic", []string{"dynamic"}}, }, - expectedResolutions: []res{ - {"dependentModule.meta_lic", "dependentModule.meta_lic", "gplWithClasspathException.meta_lic", "restricted"}, - }, + expectedResolutions: []res{}, }, { name: "dependentmodulerestrictedshipclasspath", @@ -71,11 +64,7 @@ func TestResolveSourceSharing(t *testing.T) { edges: []annotated{ {"dependentModule.meta_lic", "gplWithClasspathException.meta_lic", []string{"dynamic"}}, }, - expectedResolutions: []res{ - {"dependentModule.meta_lic", "dependentModule.meta_lic", "gplWithClasspathException.meta_lic", "restricted"}, - {"dependentModule.meta_lic", "gplWithClasspathException.meta_lic", "gplWithClasspathException.meta_lic", "restricted"}, - {"gplWithClasspathException.meta_lic", "gplWithClasspathException.meta_lic", "gplWithClasspathException.meta_lic", "restricted"}, - }, + expectedResolutions: []res{}, }, { name: "lgplonfprestricted", @@ -185,9 +174,7 @@ func TestResolveSourceSharing(t *testing.T) { edges: []annotated{ {"gplWithClasspathException.meta_lic", "apacheBin.meta_lic", []string{"dynamic"}}, }, - expectedResolutions: []res{ - {"gplWithClasspathException.meta_lic", "gplWithClasspathException.meta_lic", "gplWithClasspathException.meta_lic", "restricted"}, - }, + expectedResolutions: []res{}, }, { name: "independentmodulereversestaticrestricted", @@ -195,10 +182,7 @@ func TestResolveSourceSharing(t *testing.T) { edges: []annotated{ {"gplWithClasspathException.meta_lic", "apacheBin.meta_lic", []string{"static"}}, }, - expectedResolutions: []res{ - {"gplWithClasspathException.meta_lic", "gplWithClasspathException.meta_lic", "gplWithClasspathException.meta_lic", "restricted"}, - {"gplWithClasspathException.meta_lic", "apacheBin.meta_lic", "gplWithClasspathException.meta_lic", "restricted"}, - }, + expectedResolutions: []res{}, }, { name: "dependentmodulereverserestricted", @@ -206,9 +190,7 @@ func TestResolveSourceSharing(t *testing.T) { edges: []annotated{ {"gplWithClasspathException.meta_lic", "dependentModule.meta_lic", []string{"dynamic"}}, }, - expectedResolutions: []res{ - {"gplWithClasspathException.meta_lic", "gplWithClasspathException.meta_lic", "gplWithClasspathException.meta_lic", "restricted"}, - }, + expectedResolutions: []res{}, }, { name: "dependentmodulereverserestrictedshipdependent", @@ -216,11 +198,7 @@ func TestResolveSourceSharing(t *testing.T) { edges: []annotated{ {"gplWithClasspathException.meta_lic", "dependentModule.meta_lic", []string{"dynamic"}}, }, - expectedResolutions: []res{ - {"gplWithClasspathException.meta_lic", "gplWithClasspathException.meta_lic", "gplWithClasspathException.meta_lic", "restricted"}, - {"gplWithClasspathException.meta_lic", "dependentModule.meta_lic", "gplWithClasspathException.meta_lic", "restricted"}, - {"dependentModule.meta_lic", "dependentModule.meta_lic", "gplWithClasspathException.meta_lic", "restricted"}, - }, + expectedResolutions: []res{}, }, { name: "ponrrestricted", diff --git a/tools/compliance/policy_walk_test.go b/tools/compliance/policy_walk_test.go index 92867f9535..c55e2f88ae 100644 --- a/tools/compliance/policy_walk_test.go +++ b/tools/compliance/policy_walk_test.go @@ -104,8 +104,7 @@ func TestWalkResolutionsForCondition(t *testing.T) { }, expectedResolutions: []res{ {"apacheBin.meta_lic", "apacheBin.meta_lic", "apacheBin.meta_lic", "notice"}, - {"apacheBin.meta_lic", "apacheBin.meta_lic", "gplWithClasspathException.meta_lic", "restricted"}, - {"apacheBin.meta_lic", "gplWithClasspathException.meta_lic", "gplWithClasspathException.meta_lic", "restricted"}, + {"apacheBin.meta_lic", "gplWithClasspathException.meta_lic", "gplWithClasspathException.meta_lic", "permissive"}, }, }, { @@ -115,10 +114,7 @@ func TestWalkResolutionsForCondition(t *testing.T) { edges: []annotated{ {"apacheBin.meta_lic", "gplWithClasspathException.meta_lic", []string{"static"}}, }, - expectedResolutions: []res{ - {"apacheBin.meta_lic", "apacheBin.meta_lic", "gplWithClasspathException.meta_lic", "restricted"}, - {"apacheBin.meta_lic", "gplWithClasspathException.meta_lic", "gplWithClasspathException.meta_lic", "restricted"}, - }, + expectedResolutions: []res{}, }, { name: "dependentmodulenotice", @@ -129,7 +125,6 @@ func TestWalkResolutionsForCondition(t *testing.T) { }, expectedResolutions: []res{ {"dependentModule.meta_lic", "dependentModule.meta_lic", "dependentModule.meta_lic", "notice"}, - {"dependentModule.meta_lic", "dependentModule.meta_lic", "gplWithClasspathException.meta_lic", "restricted"}, }, }, { @@ -139,9 +134,7 @@ func TestWalkResolutionsForCondition(t *testing.T) { edges: []annotated{ {"dependentModule.meta_lic", "gplWithClasspathException.meta_lic", []string{"dynamic"}}, }, - expectedResolutions: []res{ - {"dependentModule.meta_lic", "dependentModule.meta_lic", "gplWithClasspathException.meta_lic", "restricted"}, - }, + expectedResolutions: []res{}, }, { name: "lgplonfpnotice", @@ -347,7 +340,7 @@ func TestWalkResolutionsForCondition(t *testing.T) { {"gplWithClasspathException.meta_lic", "apacheBin.meta_lic", []string{"dynamic"}}, }, expectedResolutions: []res{ - {"gplWithClasspathException.meta_lic", "gplWithClasspathException.meta_lic", "gplWithClasspathException.meta_lic", "restricted"}, + {"gplWithClasspathException.meta_lic", "gplWithClasspathException.meta_lic", "gplWithClasspathException.meta_lic", "permissive"}, }, }, { @@ -357,9 +350,7 @@ func TestWalkResolutionsForCondition(t *testing.T) { edges: []annotated{ {"gplWithClasspathException.meta_lic", "apacheBin.meta_lic", []string{"dynamic"}}, }, - expectedResolutions: []res{ - {"gplWithClasspathException.meta_lic", "gplWithClasspathException.meta_lic", "gplWithClasspathException.meta_lic", "restricted"}, - }, + expectedResolutions: []res{}, }, { name: "independentmodulereverserestrictedshipped", @@ -368,9 +359,7 @@ func TestWalkResolutionsForCondition(t *testing.T) { edges: []annotated{ {"gplWithClasspathException.meta_lic", "apacheBin.meta_lic", []string{"dynamic"}}, }, - expectedResolutions: []res{ - {"gplWithClasspathException.meta_lic", "gplWithClasspathException.meta_lic", "gplWithClasspathException.meta_lic", "restricted"}, - }, + expectedResolutions: []res{}, }, { name: "independentmodulereversestaticnotice", @@ -380,9 +369,8 @@ func TestWalkResolutionsForCondition(t *testing.T) { {"gplWithClasspathException.meta_lic", "apacheBin.meta_lic", []string{"static"}}, }, expectedResolutions: []res{ - {"gplWithClasspathException.meta_lic", "gplWithClasspathException.meta_lic", "gplWithClasspathException.meta_lic", "restricted"}, + {"gplWithClasspathException.meta_lic", "gplWithClasspathException.meta_lic", "gplWithClasspathException.meta_lic", "permissive"}, {"gplWithClasspathException.meta_lic", "apacheBin.meta_lic", "apacheBin.meta_lic", "notice"}, - {"gplWithClasspathException.meta_lic", "apacheBin.meta_lic", "gplWithClasspathException.meta_lic", "restricted"}, }, }, { @@ -392,10 +380,7 @@ func TestWalkResolutionsForCondition(t *testing.T) { edges: []annotated{ {"gplWithClasspathException.meta_lic", "apacheBin.meta_lic", []string{"static"}}, }, - expectedResolutions: []res{ - {"gplWithClasspathException.meta_lic", "gplWithClasspathException.meta_lic", "gplWithClasspathException.meta_lic", "restricted"}, - {"gplWithClasspathException.meta_lic", "apacheBin.meta_lic", "gplWithClasspathException.meta_lic", "restricted"}, - }, + expectedResolutions: []res{}, }, { name: "dependentmodulereversenotice", @@ -405,7 +390,7 @@ func TestWalkResolutionsForCondition(t *testing.T) { {"gplWithClasspathException.meta_lic", "dependentModule.meta_lic", []string{"dynamic"}}, }, expectedResolutions: []res{ - {"gplWithClasspathException.meta_lic", "gplWithClasspathException.meta_lic", "gplWithClasspathException.meta_lic", "restricted"}, + {"gplWithClasspathException.meta_lic", "gplWithClasspathException.meta_lic", "gplWithClasspathException.meta_lic", "permissive"}, }, }, { @@ -415,9 +400,7 @@ func TestWalkResolutionsForCondition(t *testing.T) { edges: []annotated{ {"gplWithClasspathException.meta_lic", "dependentModule.meta_lic", []string{"dynamic"}}, }, - expectedResolutions: []res{ - {"gplWithClasspathException.meta_lic", "gplWithClasspathException.meta_lic", "gplWithClasspathException.meta_lic", "restricted"}, - }, + expectedResolutions: []res{}, }, { name: "dependentmodulereverserestrictedshipped", @@ -426,11 +409,7 @@ func TestWalkResolutionsForCondition(t *testing.T) { edges: []annotated{ {"gplWithClasspathException.meta_lic", "dependentModule.meta_lic", []string{"dynamic"}}, }, - expectedResolutions: []res{ - {"gplWithClasspathException.meta_lic", "gplWithClasspathException.meta_lic", "gplWithClasspathException.meta_lic", "restricted"}, - {"gplWithClasspathException.meta_lic", "dependentModule.meta_lic", "gplWithClasspathException.meta_lic", "restricted"}, - {"dependentModule.meta_lic", "dependentModule.meta_lic", "gplWithClasspathException.meta_lic", "restricted"}, - }, + expectedResolutions: []res{}, }, { name: "ponrnotice", @@ -716,8 +695,7 @@ func TestWalkActionsForCondition(t *testing.T) { }, expectedActions: []act{ {"apacheBin.meta_lic", "apacheBin.meta_lic", "notice"}, - {"apacheBin.meta_lic", "gplWithClasspathException.meta_lic", "restricted"}, - {"gplWithClasspathException.meta_lic", "gplWithClasspathException.meta_lic", "restricted"}, + {"gplWithClasspathException.meta_lic", "gplWithClasspathException.meta_lic", "permissive"}, }, }, { @@ -727,10 +705,7 @@ func TestWalkActionsForCondition(t *testing.T) { edges: []annotated{ {"apacheBin.meta_lic", "gplWithClasspathException.meta_lic", []string{"static"}}, }, - expectedActions: []act{ - {"apacheBin.meta_lic", "gplWithClasspathException.meta_lic", "restricted"}, - {"gplWithClasspathException.meta_lic", "gplWithClasspathException.meta_lic", "restricted"}, - }, + expectedActions: []act{}, }, { name: "dependentmodulenotice", @@ -741,7 +716,6 @@ func TestWalkActionsForCondition(t *testing.T) { }, expectedActions: []act{ {"dependentModule.meta_lic", "dependentModule.meta_lic", "notice"}, - {"dependentModule.meta_lic", "gplWithClasspathException.meta_lic", "restricted"}, }, }, { @@ -751,9 +725,7 @@ func TestWalkActionsForCondition(t *testing.T) { edges: []annotated{ {"dependentModule.meta_lic", "gplWithClasspathException.meta_lic", []string{"dynamic"}}, }, - expectedActions: []act{ - {"dependentModule.meta_lic", "gplWithClasspathException.meta_lic", "restricted"}, - }, + expectedActions: []act{}, }, { name: "lgplonfpnotice", @@ -956,7 +928,7 @@ func TestWalkActionsForCondition(t *testing.T) { {"gplWithClasspathException.meta_lic", "apacheBin.meta_lic", []string{"dynamic"}}, }, expectedActions: []act{ - {"gplWithClasspathException.meta_lic", "gplWithClasspathException.meta_lic", "restricted"}, + {"gplWithClasspathException.meta_lic", "gplWithClasspathException.meta_lic", "permissive"}, }, }, { @@ -966,9 +938,7 @@ func TestWalkActionsForCondition(t *testing.T) { edges: []annotated{ {"gplWithClasspathException.meta_lic", "apacheBin.meta_lic", []string{"dynamic"}}, }, - expectedActions: []act{ - {"gplWithClasspathException.meta_lic", "gplWithClasspathException.meta_lic", "restricted"}, - }, + expectedActions: []act{}, }, { name: "independentmodulereverserestrictedshipped", @@ -977,9 +947,7 @@ func TestWalkActionsForCondition(t *testing.T) { edges: []annotated{ {"gplWithClasspathException.meta_lic", "apacheBin.meta_lic", []string{"dynamic"}}, }, - expectedActions: []act{ - {"gplWithClasspathException.meta_lic", "gplWithClasspathException.meta_lic", "restricted"}, - }, + expectedActions: []act{}, }, { name: "independentmodulereversestaticnotice", @@ -989,9 +957,8 @@ func TestWalkActionsForCondition(t *testing.T) { {"gplWithClasspathException.meta_lic", "apacheBin.meta_lic", []string{"static"}}, }, expectedActions: []act{ - {"gplWithClasspathException.meta_lic", "gplWithClasspathException.meta_lic", "restricted"}, + {"gplWithClasspathException.meta_lic", "gplWithClasspathException.meta_lic", "permissive"}, {"apacheBin.meta_lic", "apacheBin.meta_lic", "notice"}, - {"apacheBin.meta_lic", "gplWithClasspathException.meta_lic", "restricted"}, }, }, { @@ -1001,10 +968,7 @@ func TestWalkActionsForCondition(t *testing.T) { edges: []annotated{ {"gplWithClasspathException.meta_lic", "apacheBin.meta_lic", []string{"static"}}, }, - expectedActions: []act{ - {"gplWithClasspathException.meta_lic", "gplWithClasspathException.meta_lic", "restricted"}, - {"apacheBin.meta_lic", "gplWithClasspathException.meta_lic", "restricted"}, - }, + expectedActions: []act{}, }, { name: "dependentmodulereversenotice", @@ -1014,7 +978,7 @@ func TestWalkActionsForCondition(t *testing.T) { {"gplWithClasspathException.meta_lic", "dependentModule.meta_lic", []string{"dynamic"}}, }, expectedActions: []act{ - {"gplWithClasspathException.meta_lic", "gplWithClasspathException.meta_lic", "restricted"}, + {"gplWithClasspathException.meta_lic", "gplWithClasspathException.meta_lic", "permissive"}, }, }, { @@ -1024,9 +988,7 @@ func TestWalkActionsForCondition(t *testing.T) { edges: []annotated{ {"gplWithClasspathException.meta_lic", "dependentModule.meta_lic", []string{"dynamic"}}, }, - expectedActions: []act{ - {"gplWithClasspathException.meta_lic", "gplWithClasspathException.meta_lic", "restricted"}, - }, + expectedActions: []act{}, }, { name: "dependentmodulereverserestrictedshipped", @@ -1035,10 +997,7 @@ func TestWalkActionsForCondition(t *testing.T) { edges: []annotated{ {"gplWithClasspathException.meta_lic", "dependentModule.meta_lic", []string{"dynamic"}}, }, - expectedActions: []act{ - {"gplWithClasspathException.meta_lic", "gplWithClasspathException.meta_lic", "restricted"}, - {"dependentModule.meta_lic", "gplWithClasspathException.meta_lic", "restricted"}, - }, + expectedActions: []act{}, }, { name: "ponrnotice", diff --git a/tools/compliance/test_util.go b/tools/compliance/test_util.go index 26d7461b8b..c9d6fe29ec 100644 --- a/tools/compliance/test_util.go +++ b/tools/compliance/test_util.go @@ -42,7 +42,7 @@ license_conditions: "restricted" Classpath = `` + `package_name: "Free Software" license_kinds: "SPDX-license-identifier-GPL-2.0-with-classpath-exception" -license_conditions: "restricted" +license_conditions: "permissive" ` // DependentModule starts a test metadata file for a module in the same package as `Classpath`. @@ -521,7 +521,7 @@ func checkSame(rsActual, rsExpected ResolutionSet, t *testing.T) { expectedConditions := expectedRl[i].Resolves() actualConditions := actualRl[i].Resolves() if expectedConditions != actualConditions { - t.Errorf("unexpected conditions apply to %q acting on %q: got %04x with names %s, want %04x with names %s", + t.Errorf("unexpected conditions apply to %q acting on %q: got %#v with names %s, want %#v with names %s", target.name, expectedRl[i].actsOn.name, actualConditions, actualConditions.Names(), expectedConditions, expectedConditions.Names()) @@ -586,7 +586,7 @@ func checkResolves(rsActual, rsExpected ResolutionSet, t *testing.T) { expectedConditions := expectedRl[i].Resolves() actualConditions := actualRl[i].Resolves() if expectedConditions != (expectedConditions & actualConditions) { - t.Errorf("expected conditions missing from %q acting on %q: got %04x with names %s, want %04x with names %s", + t.Errorf("expected conditions missing from %q acting on %q: got %#v with names %s, want %#v with names %s", target.name, expectedRl[i].actsOn.name, actualConditions, actualConditions.Names(), expectedConditions, expectedConditions.Names())