use of com.google.devtools.build.lib.events.Reporter in project bazel by bazelbuild.
the class FoundationTestCase method initializeLogging.
@Before
public final void initializeLogging() throws Exception {
eventCollector = new EventCollector(EventKind.ERRORS_AND_WARNINGS);
reporter = new Reporter(new EventBus(), eventCollector);
reporter.addHandler(failFastHandler);
}
use of com.google.devtools.build.lib.events.Reporter in project bazel by bazelbuild.
the class MemoizingEvaluatorTest method initializeReporter.
private void initializeReporter() {
eventCollector = new EventCollector();
reporter = new Reporter(new EventBus(), eventCollector);
tester.resetPlayedEvents();
}
use of com.google.devtools.build.lib.events.Reporter in project bazel by bazelbuild.
the class PrepareDepsOfPatternsFunctionSmartNegationTest method getGraphFromPatternsEvaluation.
// Helpers:
private WalkableGraph getGraphFromPatternsEvaluation(ImmutableList<String> patternSequence, boolean successExpected, boolean keepGoing) throws InterruptedException {
SkyKey independentTarget = PrepareDepsOfPatternsValue.key(patternSequence, "");
ImmutableList<SkyKey> singletonTargetPattern = ImmutableList.of(independentTarget);
// When PrepareDepsOfPatternsFunction completes evaluation,
EvaluationResult<SkyValue> evaluationResult = getSkyframeExecutor().getDriverForTesting().evaluate(singletonTargetPattern, keepGoing, LOADING_PHASE_THREADS, new Reporter(new EventBus(), eventCollector));
// The evaluation has no errors if success was expected.
assertThat(evaluationResult.hasError()).isNotEqualTo(successExpected);
return Preconditions.checkNotNull(evaluationResult.getWalkableGraph());
}
use of com.google.devtools.build.lib.events.Reporter in project bazel by bazelbuild.
the class BlazeExecutorTest method testDebugPrintActionContexts.
@Test
public void testDebugPrintActionContexts() throws Exception {
TestExecutorBuilder builder = new TestExecutorBuilder(directories, binTools);
OptionsParser parser = OptionsParser.newOptionsParser(TestExecutorBuilder.DEFAULT_OPTIONS);
parser.parse("--debug_print_action_contexts");
Reporter reporter = new Reporter(new EventBus());
StoredEventHandler storedEventHandler = new StoredEventHandler();
reporter.addHandler(storedEventHandler);
SpawnActionContext mockStrategy = Mockito.mock(SpawnActionContext.class);
builder.setReporter(reporter).setOptionsParser(parser).setExecution("mock", mockStrategy);
builder.build();
Event event = Iterables.find(storedEventHandler.getEvents(), new Predicate<Event>() {
@Override
public boolean apply(@Nullable Event event) {
return event.getMessage().contains("SpawnActionContextMap: \"mock\" = ");
}
});
assertThat(event).isNotNull();
assertThat(event.getMessage()).contains("\"mock\" = " + mockStrategy.getClass().getSimpleName());
}
use of com.google.devtools.build.lib.events.Reporter in project bazel by bazelbuild.
the class RuleFactoryTest method testWorkspaceRuleFailsInBuildFile.
@Test
public void testWorkspaceRuleFailsInBuildFile() throws Exception {
Path myPkgPath = scratch.resolve("/foo/workspace/mypkg/BUILD");
Package.Builder pkgBuilder = packageFactory.newPackageBuilder(PackageIdentifier.createInMainRepo("mypkg"), "TESTING").setFilename(myPkgPath).setMakeEnv(new MakeEnvironment.Builder());
Map<String, Object> attributeValues = new HashMap<>();
attributeValues.put("name", "foo");
attributeValues.put("actual", "//bar:baz");
RuleClass ruleClass = provider.getRuleClassMap().get("bind");
try {
RuleFactory.createAndAddRule(pkgBuilder, ruleClass, new BuildLangTypedAttributeValuesMap(attributeValues), new Reporter(new EventBus()), /*ast=*/
null, LOCATION_42, /*env=*/
null, new AttributeContainer(ruleClass));
fail();
} catch (RuleFactory.InvalidRuleException e) {
assertThat(e.getMessage()).contains("must be in the WORKSPACE file");
}
}
Aggregations