Search in sources :

Example 6 with BuildResult

use of com.google.devtools.build.lib.buildtool.BuildResult in project bazel by bazelbuild.

the class BuildEventStreamerTest method testSimpleStream.

@Test
public void testSimpleStream() {
    // Verify that a well-formed event is passed through and that completion of the
    // build clears the pending progress-update event.
    RecordingBuildEventTransport transport = new RecordingBuildEventTransport();
    BuildEventStreamer streamer = new BuildEventStreamer(ImmutableSet.<BuildEventTransport>of(transport));
    BuildEvent startEvent = new GenericBuildEvent(testId("Initial"), ImmutableSet.of(ProgressEvent.INITIAL_PROGRESS_UPDATE, BuildEventId.buildFinished()));
    streamer.buildEvent(startEvent);
    List<BuildEvent> afterFirstEvent = transport.getEvents();
    assertThat(afterFirstEvent).hasSize(1);
    assertEquals(startEvent.getEventId(), afterFirstEvent.get(0).getEventId());
    streamer.buildEvent(new BuildCompleteEvent(new BuildResult(0)));
    List<BuildEvent> finalStream = transport.getEvents();
    assertThat(finalStream).hasSize(3);
    assertEquals(BuildEventId.buildFinished(), finalStream.get(1).getEventId());
    assertEquals(ProgressEvent.INITIAL_PROGRESS_UPDATE, finalStream.get(2).getEventId());
}
Also used : GenericBuildEvent(com.google.devtools.build.lib.buildeventstream.GenericBuildEvent) BuildResult(com.google.devtools.build.lib.buildtool.BuildResult) BuildEvent(com.google.devtools.build.lib.buildeventstream.BuildEvent) GenericBuildEvent(com.google.devtools.build.lib.buildeventstream.GenericBuildEvent) BuildCompleteEvent(com.google.devtools.build.lib.buildtool.buildevent.BuildCompleteEvent) Test(org.junit.Test)

Aggregations

BuildResult (com.google.devtools.build.lib.buildtool.BuildResult)6 BuildEvent (com.google.devtools.build.lib.buildeventstream.BuildEvent)3 GenericBuildEvent (com.google.devtools.build.lib.buildeventstream.GenericBuildEvent)3 BuildCompleteEvent (com.google.devtools.build.lib.buildtool.buildevent.BuildCompleteEvent)3 Test (org.junit.Test)3 ConfiguredTarget (com.google.devtools.build.lib.analysis.ConfiguredTarget)2 BuildRequest (com.google.devtools.build.lib.buildtool.BuildRequest)2 Subscribe (com.google.common.eventbus.Subscribe)1 FilesToRunProvider (com.google.devtools.build.lib.analysis.FilesToRunProvider)1 RunfilesSupport (com.google.devtools.build.lib.analysis.RunfilesSupport)1 BuildConfiguration (com.google.devtools.build.lib.analysis.config.BuildConfiguration)1 RunUnder (com.google.devtools.build.lib.analysis.config.RunUnder)1 BuildEventId (com.google.devtools.build.lib.buildeventstream.BuildEventId)1 BuildEventWithOrderConstraint (com.google.devtools.build.lib.buildeventstream.BuildEventWithOrderConstraint)1 BuildRequestOptions (com.google.devtools.build.lib.buildtool.BuildRequest.BuildRequestOptions)1 BuildTool (com.google.devtools.build.lib.buildtool.BuildTool)1 BlazeRuntime (com.google.devtools.build.lib.runtime.BlazeRuntime)1 AbnormalTerminationException (com.google.devtools.build.lib.shell.AbnormalTerminationException)1 BadExitStatusException (com.google.devtools.build.lib.shell.BadExitStatusException)1 CommandException (com.google.devtools.build.lib.shell.CommandException)1