Search in sources :

Example 1 with ExtraAttributeAspect

use of com.google.devtools.build.lib.analysis.util.TestAspects.ExtraAttributeAspect in project bazel by bazelbuild.

the class AspectValueTest method keyEquality.

@Test
public void keyEquality() throws Exception {
    update();
    BuildConfiguration c1 = getTargetConfiguration();
    BuildConfiguration c2 = getHostConfiguration();
    Label l1 = Label.parseAbsolute("//a:l1");
    Label l1b = Label.parseAbsolute("//a:l1");
    Label l2 = Label.parseAbsolute("//a:l2");
    AspectParameters i1 = new AspectParameters.Builder().addAttribute("foo", "bar").build();
    AspectParameters i1b = new AspectParameters.Builder().addAttribute("foo", "bar").build();
    AspectParameters i2 = new AspectParameters.Builder().addAttribute("foo", "baz").build();
    AttributeAspect a1 = TestAspects.ATTRIBUTE_ASPECT;
    AttributeAspect a1b = TestAspects.ATTRIBUTE_ASPECT;
    ExtraAttributeAspect a2 = TestAspects.EXTRA_ATTRIBUTE_ASPECT;
    // label: //a:l1 or //a:l2
    // aspectConfiguration: target or host
    // baseConfiguration: target or host
    // aspect: Attribute or ExtraAttribute
    // parameters: bar or baz
    new EqualsTester().addEqualityGroup(createKey(l1, c1, a1, i1, c1), createKey(l1, c1, a1, i1b, c1), createKey(l1, c1, a1b, i1, c1), createKey(l1, c1, a1b, i1b, c1), createKey(l1b, c1, a1, i1, c1), createKey(l1b, c1, a1, i1b, c1), createKey(l1b, c1, a1b, i1, c1), createKey(l1b, c1, a1b, i1b, c1)).addEqualityGroup(createKey(l1, c1, a1, i2, c1), createKey(l1, c1, a1b, i2, c1), createKey(l1b, c1, a1, i2, c1), createKey(l1b, c1, a1b, i2, c1)).addEqualityGroup(createKey(l1, c1, a2, i1, c1), createKey(l1, c1, a2, i1b, c1), createKey(l1b, c1, a2, i1, c1), createKey(l1b, c1, a2, i1b, c1)).addEqualityGroup(createKey(l1, c1, a2, i2, c1), createKey(l1b, c1, a2, i2, c1)).addEqualityGroup(createKey(l1, c2, a1, i1, c1), createKey(l1, c2, a1, i1b, c1), createKey(l1, c2, a1b, i1, c1), createKey(l1, c2, a1b, i1b, c1), createKey(l1b, c2, a1, i1, c1), createKey(l1b, c2, a1, i1b, c1), createKey(l1b, c2, a1b, i1, c1), createKey(l1b, c2, a1b, i1b, c1)).addEqualityGroup(createKey(l1, c2, a1, i2, c1), createKey(l1, c2, a1b, i2, c1), createKey(l1b, c2, a1, i2, c1), createKey(l1b, c2, a1b, i2, c1)).addEqualityGroup(createKey(l1, c2, a2, i1, c1), createKey(l1, c2, a2, i1b, c1), createKey(l1b, c2, a2, i1, c1), createKey(l1b, c2, a2, i1b, c1)).addEqualityGroup(createKey(l1, c2, a2, i2, c1), createKey(l1b, c2, a2, i2, c1)).addEqualityGroup(createKey(l1, c1, a1, i1, c2), createKey(l1, c1, a1, i1b, c2), createKey(l1, c1, a1b, i1, c2), createKey(l1, c1, a1b, i1b, c2), createKey(l1b, c1, a1, i1, c2), createKey(l1b, c1, a1, i1b, c2), createKey(l1b, c1, a1b, i1, c2), createKey(l1b, c1, a1b, i1b, c2)).addEqualityGroup(createKey(l1, c1, a1, i2, c2), createKey(l1, c1, a1b, i2, c2), createKey(l1b, c1, a1, i2, c2), createKey(l1b, c1, a1b, i2, c2)).addEqualityGroup(createKey(l1, c1, a2, i1, c2), createKey(l1, c1, a2, i1b, c2), createKey(l1b, c1, a2, i1, c2), createKey(l1b, c1, a2, i1b, c2)).addEqualityGroup(createKey(l1, c1, a2, i2, c2), createKey(l1b, c1, a2, i2, c2)).addEqualityGroup(createKey(l1, c2, a1, i1, c2), createKey(l1, c2, a1, i1b, c2), createKey(l1, c2, a1b, i1, c2), createKey(l1, c2, a1b, i1b, c2), createKey(l1b, c2, a1, i1, c2), createKey(l1b, c2, a1, i1b, c2), createKey(l1b, c2, a1b, i1, c2), createKey(l1b, c2, a1b, i1b, c2)).addEqualityGroup(createKey(l1, c2, a1, i2, c2), createKey(l1, c2, a1b, i2, c2), createKey(l1b, c2, a1, i2, c2), createKey(l1b, c2, a1b, i2, c2)).addEqualityGroup(createKey(l1, c2, a2, i1, c2), createKey(l1, c2, a2, i1b, c2), createKey(l1b, c2, a2, i1, c2), createKey(l1b, c2, a2, i1b, c2)).addEqualityGroup(createKey(l1, c2, a2, i2, c2), createKey(l1b, c2, a2, i2, c2)).addEqualityGroup(createKey(l2, c1, a1, i1, c1), createKey(l2, c1, a1, i1b, c1), createKey(l2, c1, a1b, i1, c1), createKey(l2, c1, a1b, i1b, c1)).addEqualityGroup(createKey(l2, c1, a1, i2, c1), createKey(l2, c1, a1b, i2, c1)).addEqualityGroup(createKey(l2, c1, a2, i1, c1), createKey(l2, c1, a2, i1b, c1)).addEqualityGroup(createKey(l2, c1, a2, i2, c1)).addEqualityGroup(createKey(l2, c2, a1, i1, c1), createKey(l2, c2, a1, i1b, c1), createKey(l2, c2, a1b, i1, c1), createKey(l2, c2, a1b, i1b, c1)).addEqualityGroup(createKey(l2, c2, a1, i2, c1), createKey(l2, c2, a1b, i2, c1)).addEqualityGroup(createKey(l2, c2, a2, i1, c1), createKey(l2, c2, a2, i1b, c1)).addEqualityGroup(createKey(l2, c2, a2, i2, c1)).addEqualityGroup(createKey(l2, c1, a1, i1, c2), createKey(l2, c1, a1, i1b, c2), createKey(l2, c1, a1b, i1, c2), createKey(l2, c1, a1b, i1b, c2)).addEqualityGroup(createKey(l2, c1, a1, i2, c2), createKey(l2, c1, a1b, i2, c2)).addEqualityGroup(createKey(l2, c1, a2, i1, c2), createKey(l2, c1, a2, i1b, c2)).addEqualityGroup(createKey(l2, c1, a2, i2, c2)).addEqualityGroup(createKey(l2, c2, a1, i1, c2), createKey(l2, c2, a1, i1b, c2), createKey(l2, c2, a1b, i1, c2), createKey(l2, c2, a1b, i1b, c2)).addEqualityGroup(createKey(l2, c2, a1, i2, c2), createKey(l2, c2, a1b, i2, c2)).addEqualityGroup(createKey(l2, c2, a2, i1, c2), createKey(l2, c2, a2, i1b, c2)).addEqualityGroup(createKey(l2, c2, a2, i2, c2)).addEqualityGroup(createDerivedKey(l1, c1, a1, i1, c1, a2, i2, c2), createDerivedKey(l1, c1, a1, i1b, c1, a2, i2, c2)).addEqualityGroup(createDerivedKey(l1, c1, a2, i1, c1, a1, i2, c2), createDerivedKey(l1, c1, a2, i1b, c1, a1, i2, c2)).testEquals();
}
Also used : BuildConfiguration(com.google.devtools.build.lib.analysis.config.BuildConfiguration) AspectParameters(com.google.devtools.build.lib.packages.AspectParameters) EqualsTester(com.google.common.testing.EqualsTester) ExtraAttributeAspect(com.google.devtools.build.lib.analysis.util.TestAspects.ExtraAttributeAspect) AttributeAspect(com.google.devtools.build.lib.analysis.util.TestAspects.AttributeAspect) ExtraAttributeAspect(com.google.devtools.build.lib.analysis.util.TestAspects.ExtraAttributeAspect) Label(com.google.devtools.build.lib.cmdline.Label) Test(org.junit.Test)

Aggregations

EqualsTester (com.google.common.testing.EqualsTester)1 BuildConfiguration (com.google.devtools.build.lib.analysis.config.BuildConfiguration)1 AttributeAspect (com.google.devtools.build.lib.analysis.util.TestAspects.AttributeAspect)1 ExtraAttributeAspect (com.google.devtools.build.lib.analysis.util.TestAspects.ExtraAttributeAspect)1 Label (com.google.devtools.build.lib.cmdline.Label)1 AspectParameters (com.google.devtools.build.lib.packages.AspectParameters)1 Test (org.junit.Test)1