Search in sources :

Example 6 with IncrementingFakeClock

use of com.facebook.buck.timing.IncrementingFakeClock in project buck by facebook.

the class SuperConsoleEventBusListenerTest method testSimpleTest.

@Test
public void testSimpleTest() {
    Clock fakeClock = new IncrementingFakeClock(TimeUnit.SECONDS.toNanos(1));
    BuckEventBus eventBus = BuckEventBusFactory.newInstance(fakeClock);
    SuperConsoleEventBusListener listener = createSuperConsole(fakeClock, eventBus);
    SourcePathResolver pathResolver = new SourcePathResolver(new SourcePathRuleFinder(new BuildRuleResolver(TargetGraph.EMPTY, new DefaultTargetNodeToBuildRuleTransformer())));
    BuildTarget testTarget = BuildTargetFactory.newInstance("//:test");
    ImmutableSet<BuildTarget> testTargets = ImmutableSet.of(testTarget);
    Iterable<String> testArgs = Iterables.transform(testTargets, Object::toString);
    FakeBuildRule testBuildRule = new FakeBuildRule(testTarget, pathResolver, ImmutableSortedSet.of());
    ProjectBuildFileParseEvents.Started parseEventStarted = new ProjectBuildFileParseEvents.Started();
    eventBus.postWithoutConfiguring(configureTestEventAtTime(parseEventStarted, 0L, TimeUnit.MILLISECONDS, /* threadId */
    0L));
    validateConsole(listener, 0L, ImmutableList.of("[+] PARSING BUCK FILES...0.0s"));
    validateConsole(listener, 100L, ImmutableList.of("[+] PARSING BUCK FILES...0.1s"));
    eventBus.postWithoutConfiguring(configureTestEventAtTime(new ProjectBuildFileParseEvents.Finished(parseEventStarted), 200L, TimeUnit.MILLISECONDS, /* threadId */
    0L));
    validateConsole(listener, 200L, ImmutableList.of("[-] PARSING BUCK FILES...FINISHED 0.2s"));
    BuildEvent.Started buildEventStarted = BuildEvent.started(testArgs);
    eventBus.postWithoutConfiguring(configureTestEventAtTime(buildEventStarted, 200L, TimeUnit.MILLISECONDS, /* threadId */
    0L));
    ParseEvent.Started parseStarted = ParseEvent.started(testTargets);
    eventBus.postWithoutConfiguring(configureTestEventAtTime(parseStarted, 200L, TimeUnit.MILLISECONDS, /* threadId */
    0L));
    validateConsole(listener, 300L, ImmutableList.of("[+] PROCESSING BUCK FILES...0.1s"));
    eventBus.postWithoutConfiguring(configureTestEventAtTime(ParseEvent.finished(parseStarted, Optional.empty()), 300L, TimeUnit.MILLISECONDS, /* threadId */
    0L));
    ActionGraphEvent.Started actionGraphStarted = ActionGraphEvent.started();
    eventBus.postWithoutConfiguring(configureTestEventAtTime(actionGraphStarted, 300L, TimeUnit.MILLISECONDS, /* threadId */
    0L));
    eventBus.postWithoutConfiguring(configureTestEventAtTime(ActionGraphEvent.finished(actionGraphStarted), 400L, TimeUnit.MILLISECONDS, /* threadId */
    0L));
    final String parsingLine = "[-] PROCESSING BUCK FILES...FINISHED 0.2s";
    validateConsole(listener, 540L, ImmutableList.of(parsingLine, DOWNLOAD_STRING, "[+] BUILDING...0.1s"));
    BuildRuleEvent.Started started = BuildRuleEvent.started(testBuildRule, durationTracker);
    eventBus.postWithoutConfiguring(configureTestEventAtTime(started, 600L, TimeUnit.MILLISECONDS, /* threadId */
    0L));
    validateConsole(listener, 800L, ImmutableList.of(parsingLine, DOWNLOAD_STRING, "[+] BUILDING...0.4s", " |=> //:test...  0.2s (checking_cache)"));
    eventBus.postWithoutConfiguring(configureTestEventAtTime(BuildRuleEvent.finished(started, BuildRuleKeys.of(new RuleKey("aaaa")), BuildRuleStatus.SUCCESS, CacheResult.miss(), Optional.of(BuildRuleSuccessType.BUILT_LOCALLY), Optional.empty(), Optional.empty()), 1000L, TimeUnit.MILLISECONDS, /* threadId */
    0L));
    eventBus.postWithoutConfiguring(configureTestEventAtTime(BuildEvent.finished(buildEventStarted, 0), 1234L, TimeUnit.MILLISECONDS, /* threadId */
    0L));
    final String buildingLine = "[-] BUILDING...FINISHED 0.8s";
    validateConsole(listener, 1300L, ImmutableList.of(parsingLine, FINISHED_DOWNLOAD_STRING, buildingLine));
    eventBus.postWithoutConfiguring(configureTestEventAtTime(TestRunEvent.started(// isRunAllTests
    true, TestSelectorList.empty(), // shouldExplainTestSelectorList
    false, ImmutableSet.copyOf(testArgs)), 2500L, TimeUnit.MILLISECONDS, /* threadId */
    0L));
    validateConsole(listener, 3000L, ImmutableList.of(parsingLine, FINISHED_DOWNLOAD_STRING, buildingLine, "[+] TESTING...0.5s"));
    eventBus.postWithoutConfiguring(configureTestEventAtTime(TestRuleEvent.started(testTarget), 3100L, TimeUnit.MILLISECONDS, /* threadId */
    0L));
    validateConsole(listener, 3200L, ImmutableList.of(parsingLine, FINISHED_DOWNLOAD_STRING, buildingLine, "[+] TESTING...0.7s", " |=> //:test...  0.1s"));
    UUID stepUuid = new UUID(0, 1);
    StepEvent.Started stepEventStarted = StepEvent.started("step_name", "step_desc", stepUuid);
    eventBus.postWithoutConfiguring(configureTestEventAtTime(stepEventStarted, 3300L, TimeUnit.MILLISECONDS, /* threadId */
    0L));
    validateConsole(listener, 3400L, ImmutableList.of(parsingLine, FINISHED_DOWNLOAD_STRING, buildingLine, "[+] TESTING...0.9s", " |=> //:test...  0.3s (running step_name[0.1s])"));
    eventBus.postWithoutConfiguring(configureTestEventAtTime(StepEvent.finished(stepEventStarted, 0), 3500L, TimeUnit.MILLISECONDS, /* threadId */
    0L));
    validateConsole(listener, 3600L, ImmutableList.of(parsingLine, FINISHED_DOWNLOAD_STRING, buildingLine, "[+] TESTING...1.1s", " |=> //:test...  0.5s"));
    UUID testUUID = new UUID(2, 3);
    eventBus.postWithoutConfiguring(configureTestEventAtTime(TestSummaryEvent.started(testUUID, "TestClass", "Foo"), 3700L, TimeUnit.MILLISECONDS, /* threadId */
    0L));
    validateConsole(listener, 3800L, ImmutableList.of(parsingLine, FINISHED_DOWNLOAD_STRING, buildingLine, "[+] TESTING...1.3s", " |=> //:test...  0.7s (running Foo[0.1s])"));
    TestResultSummary testResultSummary = new TestResultSummary("TestClass", "Foo", ResultType.SUCCESS, // time
    0L, // message
    null, // stacktrace
    null, // stdOut
    null, // stdErr
    null);
    eventBus.postWithoutConfiguring(configureTestEventAtTime(TestSummaryEvent.finished(testUUID, testResultSummary), 3900L, TimeUnit.MILLISECONDS, /* threadId */
    0L));
    validateConsole(listener, 4000L, ImmutableList.of(parsingLine, FINISHED_DOWNLOAD_STRING, buildingLine, "[+] TESTING...1.5s (1 PASS/0 FAIL)", " |=> //:test...  0.9s"));
    eventBus.postWithoutConfiguring(configureTestEventAtTime(TestRunEvent.finished(ImmutableSet.copyOf(testArgs), ImmutableList.of(TestResults.of(testTarget, ImmutableList.of(new TestCaseSummary("TestClass", ImmutableList.of(testResultSummary))), // contacts
    ImmutableSet.of(), // labels
    ImmutableSet.of()))), 4100L, TimeUnit.MILLISECONDS, /* threadId */
    0L));
    final String testingLine = "[-] TESTING...FINISHED 1.6s (1 PASS/0 FAIL)";
    validateConsoleWithStdOutAndErr(listener, 4200L, ImmutableList.of(parsingLine, FINISHED_DOWNLOAD_STRING, buildingLine, testingLine), ImmutableList.of(), Optional.of(Joiner.on('\n').join("RESULTS FOR ALL TESTS", "PASS    <100ms  1 Passed   0 Skipped   0 Failed   TestClass", "TESTS PASSED", "")), // We don't care about stderr, since the last frame will be flushed there.
    Optional.empty());
}
Also used : BuckEventBus(com.facebook.buck.event.BuckEventBus) ConsoleTestUtils.postStoreStarted(com.facebook.buck.event.listener.ConsoleTestUtils.postStoreStarted) ProjectBuildFileParseEvents(com.facebook.buck.json.ProjectBuildFileParseEvents) IncrementingFakeClock(com.facebook.buck.timing.IncrementingFakeClock) Clock(com.facebook.buck.timing.Clock) IncrementingFakeClock(com.facebook.buck.timing.IncrementingFakeClock) BuildRuleResolver(com.facebook.buck.rules.BuildRuleResolver) BuildTarget(com.facebook.buck.model.BuildTarget) TestCaseSummary(com.facebook.buck.test.TestCaseSummary) DefaultTargetNodeToBuildRuleTransformer(com.facebook.buck.rules.DefaultTargetNodeToBuildRuleTransformer) UUID(java.util.UUID) ConsoleTestUtils.postStoreFinished(com.facebook.buck.event.listener.ConsoleTestUtils.postStoreFinished) StepEvent(com.facebook.buck.step.StepEvent) RuleKey(com.facebook.buck.rules.RuleKey) ActionGraphEvent(com.facebook.buck.event.ActionGraphEvent) TestResultSummary(com.facebook.buck.test.TestResultSummary) SourcePathResolver(com.facebook.buck.rules.SourcePathResolver) SourcePathRuleFinder(com.facebook.buck.rules.SourcePathRuleFinder) FakeBuildRule(com.facebook.buck.rules.FakeBuildRule) BuildEvent(com.facebook.buck.rules.BuildEvent) ParseEvent(com.facebook.buck.parser.ParseEvent) BuildRuleEvent(com.facebook.buck.rules.BuildRuleEvent) Test(org.junit.Test)

Example 7 with IncrementingFakeClock

use of com.facebook.buck.timing.IncrementingFakeClock in project buck by facebook.

the class SuperConsoleEventBusListenerTest method testAutoSparseUpdates.

@Test
public void testAutoSparseUpdates() {
    Clock fakeClock = new IncrementingFakeClock(TimeUnit.SECONDS.toNanos(1));
    BuckEventBus eventBus = BuckEventBusFactory.newInstance(fakeClock);
    SuperConsoleEventBusListener listener = createSuperConsole(fakeClock, eventBus);
    AutoSparseStateEvents.SparseRefreshStarted sparseRefreshStarted = new AutoSparseStateEvents.SparseRefreshStarted();
    eventBus.postWithoutConfiguring(configureTestEventAtTime(sparseRefreshStarted, 0L, TimeUnit.MILLISECONDS, /* threadId */
    0L));
    validateConsole(listener, 0L, ImmutableList.of("[+] REFRESHING SPARSE CHECKOUT...0.0s"));
    eventBus.postWithoutConfiguring(configureTestEventAtTime(new AutoSparseStateEvents.SparseRefreshFinished(sparseRefreshStarted), 0L, TimeUnit.MILLISECONDS, /* threadId */
    0L));
    validateConsole(listener, 0L, ImmutableList.of("[-] REFRESHING SPARSE CHECKOUT...FINISHED 0.0s"));
    // starting a new refresh resets the message
    sparseRefreshStarted = new AutoSparseStateEvents.SparseRefreshStarted();
    eventBus.postWithoutConfiguring(configureTestEventAtTime(sparseRefreshStarted, 0L, TimeUnit.MILLISECONDS, /* threadId */
    0L));
    validateConsole(listener, 0L, ImmutableList.of("[+] REFRESHING SPARSE CHECKOUT...0.0s"));
    eventBus.postWithoutConfiguring(configureTestEventAtTime(new AutoSparseStateEvents.SparseRefreshFinished(sparseRefreshStarted), 0L, TimeUnit.MILLISECONDS, /* threadId */
    0L));
    validateConsole(listener, 0L, ImmutableList.of("[-] REFRESHING SPARSE CHECKOUT...FINISHED 0.0s"));
}
Also used : BuckEventBus(com.facebook.buck.event.BuckEventBus) IncrementingFakeClock(com.facebook.buck.timing.IncrementingFakeClock) Clock(com.facebook.buck.timing.Clock) IncrementingFakeClock(com.facebook.buck.timing.IncrementingFakeClock) AutoSparseStateEvents(com.facebook.buck.util.autosparse.AutoSparseStateEvents) Test(org.junit.Test)

Example 8 with IncrementingFakeClock

use of com.facebook.buck.timing.IncrementingFakeClock in project buck by facebook.

the class SuperConsoleEventBusListenerTest method renderLinesWithLineLimit.

@Test
public void renderLinesWithLineLimit() throws IOException {
    Clock fakeClock = new IncrementingFakeClock(TimeUnit.SECONDS.toNanos(1));
    BuckEventBus eventBus = BuckEventBusFactory.newInstance(fakeClock);
    try (SuperConsoleEventBusListener listener = createSuperConsole(fakeClock, eventBus)) {
        FakeThreadStateRenderer fakeRenderer = new FakeThreadStateRenderer(ImmutableList.of(2L, 1L, 4L, 8L, 5L));
        ImmutableList.Builder<String> lines;
        ImmutableList<String> fullOutput = ImmutableList.of(" |=> Status of thread 2", " |=> Status of thread 1", " |=> Status of thread 4", " |=> Status of thread 8", " |=> Status of thread 5");
        compareOutput(listener, fakeRenderer, fullOutput, 10000);
        compareOutput(listener, fakeRenderer, fullOutput, 10000);
        compareOutput(listener, fakeRenderer, fullOutput, 6);
        compareOutput(listener, fakeRenderer, fullOutput, 5);
        lines = ImmutableList.builder();
        listener.renderLines(fakeRenderer, lines, 4, false);
        assertThat(lines.build(), equalTo(ImmutableList.of(" |=> Status of thread 2", " |=> Status of thread 1", " |=> Status of thread 4", " |=> 2 MORE THREADS: t8 t5")));
        assertThat(fakeRenderer.lastSortWasByTime(), is(true));
        lines = ImmutableList.builder();
        listener.renderLines(fakeRenderer, lines, 2, false);
        assertThat(lines.build(), equalTo(ImmutableList.of(" |=> Status of thread 2", " |=> 4 MORE THREADS: t1 t4 t8 t5")));
        assertThat(fakeRenderer.lastSortWasByTime(), is(true));
        lines = ImmutableList.builder();
        listener.renderLines(fakeRenderer, lines, 1, false);
        assertThat(lines.build(), equalTo(ImmutableList.of(" |=> 5 THREADS: t2 t1 t4 t8 t5")));
        assertThat(fakeRenderer.lastSortWasByTime(), is(true));
    }
}
Also used : BuckEventBus(com.facebook.buck.event.BuckEventBus) ImmutableList(com.google.common.collect.ImmutableList) IncrementingFakeClock(com.facebook.buck.timing.IncrementingFakeClock) Clock(com.facebook.buck.timing.Clock) IncrementingFakeClock(com.facebook.buck.timing.IncrementingFakeClock) Test(org.junit.Test)

Example 9 with IncrementingFakeClock

use of com.facebook.buck.timing.IncrementingFakeClock in project buck by facebook.

the class SuperConsoleEventBusListenerTest method testParsingStatus.

@Test
public void testParsingStatus() {
    Clock fakeClock = new IncrementingFakeClock(TimeUnit.SECONDS.toNanos(1));
    BuckEventBus eventBus = BuckEventBusFactory.newInstance(fakeClock);
    SuperConsoleEventBusListener listener = createSuperConsole(fakeClock, eventBus);
    // new daemon instance & action graph cache miss
    eventBus.post(DaemonEvent.newDaemonInstance());
    assertEquals(NEW_DAEMON_INSTANCE_MSG, listener.getParsingStatus());
    eventBus.post(ActionGraphEvent.Cache.miss(/* cacheWasEmpty */
    true));
    assertEquals(NEW_DAEMON_INSTANCE_MSG, listener.getParsingStatus());
    // overflow scenario
    String overflowMessage = "and if you go chasing rabbits";
    eventBus.post(WatchmanStatusEvent.overflow(overflowMessage));
    assertEquals(createParsingMessage(EMOJI_SNAIL, overflowMessage), listener.getParsingStatus());
    // file added scenario
    eventBus.post(WatchmanStatusEvent.fileCreation("and you know you're going to fall"));
    assertEquals(createParsingMessage(EMOJI_SNAIL, "File added"), listener.getParsingStatus());
    // file removed scenario
    eventBus.post(WatchmanStatusEvent.fileDeletion("Tell 'em a hookah-smoking"));
    assertEquals(createParsingMessage(EMOJI_SNAIL, "File removed"), listener.getParsingStatus());
    // symlink invalidation scenario
    eventBus.post(ParsingEvent.symlinkInvalidation("caterpillar has given you the call"));
    assertEquals(createParsingMessage(EMOJI_WHALE, "Symlink caused cache invalidation"), listener.getParsingStatus());
    // environmental change scenario
    eventBus.post(ParsingEvent.environmentalChange("WHITE_RABBIT=1"));
    assertEquals(createParsingMessage(EMOJI_SNAIL, "Environment variable changes: WHITE_RABBIT=1"), listener.getParsingStatus());
    // action graph cache hit scenario
    eventBus.post(ActionGraphEvent.Cache.hit());
    assertEquals(createParsingMessage(EMOJI_BUNNY, ""), listener.getParsingStatus());
}
Also used : BuckEventBus(com.facebook.buck.event.BuckEventBus) IncrementingFakeClock(com.facebook.buck.timing.IncrementingFakeClock) Clock(com.facebook.buck.timing.Clock) IncrementingFakeClock(com.facebook.buck.timing.IncrementingFakeClock) Test(org.junit.Test)

Example 10 with IncrementingFakeClock

use of com.facebook.buck.timing.IncrementingFakeClock in project buck by facebook.

the class SuperConsoleEventBusListenerTest method testSimpleDistBuildWithProgress.

@Test
public void testSimpleDistBuildWithProgress() throws IOException {
    Clock fakeClock = new IncrementingFakeClock(TimeUnit.SECONDS.toNanos(1));
    BuckEventBus eventBus = BuckEventBusFactory.newInstance(fakeClock);
    SuperConsoleEventBusListener listener = createSuperConsole(fakeClock, eventBus);
    BuildTarget fakeTarget = BuildTargetFactory.newInstance("//banana:stand");
    BuildTarget cachedTarget = BuildTargetFactory.newInstance("//chicken:dance");
    ImmutableSet<BuildTarget> buildTargets = ImmutableSet.of(fakeTarget, cachedTarget);
    Iterable<String> buildArgs = Iterables.transform(buildTargets, Object::toString);
    ProgressEstimator e = new ProgressEstimator(getStorageForTest(), eventBus, ObjectMappers.newDefaultInstance());
    listener.setProgressEstimator(e);
    eventBus.register(listener);
    ProjectBuildFileParseEvents.Started parseEventStarted = new ProjectBuildFileParseEvents.Started();
    eventBus.postWithoutConfiguring(configureTestEventAtTime(parseEventStarted, 0L, TimeUnit.MILLISECONDS, /* threadId */
    0L));
    validateConsole(listener, 0L, ImmutableList.of("[+] PARSING BUCK FILES...0.0s"));
    validateConsole(listener, 100L, ImmutableList.of("[+] PARSING BUCK FILES...0.1s"));
    eventBus.postWithoutConfiguring(configureTestEventAtTime(new ProjectBuildFileParseEvents.Finished(parseEventStarted), 200L, TimeUnit.MILLISECONDS, /* threadId */
    0L));
    validateConsole(listener, 200L, ImmutableList.of("[-] PARSING BUCK FILES...FINISHED 0.2s"));
    // trigger a distributed build instead of a local build
    BuildEvent.Started buildEventStarted = BuildEvent.started(buildArgs, true);
    eventBus.postWithoutConfiguring(configureTestEventAtTime(buildEventStarted, 200L, TimeUnit.MILLISECONDS, /* threadId */
    0L));
    ParseEvent.Started parseStarted = ParseEvent.started(buildTargets);
    eventBus.postWithoutConfiguring(configureTestEventAtTime(parseStarted, 200L, TimeUnit.MILLISECONDS, /* threadId */
    0L));
    validateConsole(listener, 300L, ImmutableList.of("[+] PROCESSING BUCK FILES...0.1s"));
    eventBus.postWithoutConfiguring(configureTestEventAtTime(ParseEvent.finished(parseStarted, Optional.empty()), 300L, TimeUnit.MILLISECONDS, /* threadId */
    0L));
    ActionGraphEvent.Started actionGraphStarted = ActionGraphEvent.started();
    eventBus.postWithoutConfiguring(configureTestEventAtTime(actionGraphStarted, 300L, TimeUnit.MILLISECONDS, /* threadId */
    0L));
    eventBus.postWithoutConfiguring(configureTestEventAtTime(ActionGraphEvent.finished(actionGraphStarted), 400L, TimeUnit.MILLISECONDS, /* threadId */
    0L));
    final String parsingLine = "[-] PROCESSING BUCK FILES...FINISHED 0.2s";
    validateConsole(listener, 540L, ImmutableList.of(parsingLine, DOWNLOAD_STRING, "[+] DISTBUILD STATUS: INIT...", "[+] BUILDING...0.1s [0%]"));
    eventBus.postWithoutConfiguring(configureTestEventAtTime(new DistBuildStatusEvent(DistBuildStatus.builder().setStatus(BuildStatus.QUEUED).setMessage("step 1").setETAMillis(2000).setLogBook(Optional.empty()).build()), 800L, TimeUnit.MILLISECONDS, /* threadId */
    0L));
    validateConsole(listener, 900L, ImmutableList.of(parsingLine, DOWNLOAD_STRING, "[+] DISTBUILD STATUS: QUEUED... ETA: 2.0s (step 1)", "[+] BUILDING...0.5s [29%]"));
    LinkedList<LogRecord> debugLogs = new LinkedList<LogRecord>();
    LogRecord log = new LogRecord();
    log.setName("buck-client");
    log.setTimestampMillis(0);
    debugLogs.add(log);
    final String distDebugLine = "Distributed build debug info:";
    final String logLine1 = "[1970-01-01 00:00:00.000] buck-client";
    eventBus.postWithoutConfiguring(configureTestEventAtTime(new DistBuildStatusEvent(DistBuildStatus.builder().setStatus(BuildStatus.BUILDING).setMessage("step 2").setETAMillis(1800).setLogBook(debugLogs).build()), 1000L, TimeUnit.MILLISECONDS, /* threadId */
    0L));
    validateConsole(listener, 1100L, ImmutableList.of(distDebugLine, logLine1, parsingLine, DOWNLOAD_STRING, "[+] DISTBUILD STATUS: BUILDING... ETA: 1.8s (step 2)", "[+] BUILDING...0.7s [50%]"));
    log = new LogRecord();
    log.setName("buck-frontend");
    log.setTimestampMillis(100);
    debugLogs.add(log);
    final String logLine2 = "[1970-01-01 00:00:00.100] buck-frontend";
    eventBus.postWithoutConfiguring(configureTestEventAtTime(new DistBuildStatusEvent(DistBuildStatus.builder().setStatus(BuildStatus.BUILDING).setMessage("step 2").setETAMillis(1600).setLogBook(debugLogs).build()), 1200L, TimeUnit.MILLISECONDS, /* threadId */
    0L));
    validateConsole(listener, 1300L, ImmutableList.of(distDebugLine, logLine1, logLine2, parsingLine, DOWNLOAD_STRING, "[+] DISTBUILD STATUS: BUILDING... ETA: 1.6s (step 2)", "[+] BUILDING...0.9s [64%]"));
    log = new LogRecord();
    log.setName("build_slave_start");
    log.setTimestampMillis(200);
    debugLogs.add(log);
    final String logLine3 = "[1970-01-01 00:00:00.200] build_slave_start";
    log = new LogRecord();
    log.setName("build_slave_end");
    log.setTimestampMillis(300);
    debugLogs.add(log);
    final String logLine4 = "[1970-01-01 00:00:00.300] build_slave_end";
    eventBus.postWithoutConfiguring(configureTestEventAtTime(new DistBuildStatusEvent(DistBuildStatus.builder().setStatus(BuildStatus.FINISHED_SUCCESSFULLY).setMessage("step 3").setETAMillis(0).setLogBook(debugLogs).build()), 1400L, TimeUnit.MILLISECONDS, /* threadId */
    0L));
    final String distbuildLine = "[-] DISTBUILD STATUS: FINISHED_SUCCESSFULLY... (step 3)";
    validateConsole(listener, 1500L, ImmutableList.of(distDebugLine, logLine1, logLine2, logLine3, logLine4, parsingLine, DOWNLOAD_STRING, distbuildLine, "[+] BUILDING...1.1s [100%]"));
    eventBus.postWithoutConfiguring(configureTestEventAtTime(BuildEvent.finished(buildEventStarted, 0), 1600L, TimeUnit.MILLISECONDS, /* threadId */
    0L));
    final String buildingLine = "[-] BUILDING...FINISHED 1.2s [100%]";
    validateConsole(listener, 1600L, ImmutableList.of(distDebugLine, logLine1, logLine2, logLine3, logLine4, parsingLine, FINISHED_DOWNLOAD_STRING, distbuildLine, buildingLine));
    eventBus.postWithoutConfiguring(configureTestEventAtTime(ConsoleEvent.severe(SEVERE_MESSAGE), 1700L, TimeUnit.MILLISECONDS, /* threadId */
    0L));
    validateConsoleWithLogLines(listener, 1750L, ImmutableList.of(distDebugLine, logLine1, logLine2, logLine3, logLine4, parsingLine, FINISHED_DOWNLOAD_STRING, distbuildLine, buildingLine), ImmutableList.of(SEVERE_MESSAGE));
}
Also used : BuckEventBus(com.facebook.buck.event.BuckEventBus) ConsoleTestUtils.postStoreFinished(com.facebook.buck.event.listener.ConsoleTestUtils.postStoreFinished) ConsoleTestUtils.postStoreStarted(com.facebook.buck.event.listener.ConsoleTestUtils.postStoreStarted) DistBuildStatusEvent(com.facebook.buck.distributed.DistBuildStatusEvent) ProjectBuildFileParseEvents(com.facebook.buck.json.ProjectBuildFileParseEvents) ActionGraphEvent(com.facebook.buck.event.ActionGraphEvent) IncrementingFakeClock(com.facebook.buck.timing.IncrementingFakeClock) Clock(com.facebook.buck.timing.Clock) IncrementingFakeClock(com.facebook.buck.timing.IncrementingFakeClock) LinkedList(java.util.LinkedList) LogRecord(com.facebook.buck.distributed.thrift.LogRecord) BuildTarget(com.facebook.buck.model.BuildTarget) BuildEvent(com.facebook.buck.rules.BuildEvent) ParseEvent(com.facebook.buck.parser.ParseEvent) Test(org.junit.Test)

Aggregations

IncrementingFakeClock (com.facebook.buck.timing.IncrementingFakeClock)30 Test (org.junit.Test)29 BuckEventBus (com.facebook.buck.event.BuckEventBus)25 Clock (com.facebook.buck.timing.Clock)20 BuildTarget (com.facebook.buck.model.BuildTarget)15 BuildEvent (com.facebook.buck.rules.BuildEvent)11 ActionGraphEvent (com.facebook.buck.event.ActionGraphEvent)10 ParseEvent (com.facebook.buck.parser.ParseEvent)10 ConsoleTestUtils.postStoreFinished (com.facebook.buck.event.listener.ConsoleTestUtils.postStoreFinished)9 DefaultTargetNodeToBuildRuleTransformer (com.facebook.buck.rules.DefaultTargetNodeToBuildRuleTransformer)9 RuleKey (com.facebook.buck.rules.RuleKey)9 SourcePathResolver (com.facebook.buck.rules.SourcePathResolver)9 SourcePathRuleFinder (com.facebook.buck.rules.SourcePathRuleFinder)9 BuildRuleEvent (com.facebook.buck.rules.BuildRuleEvent)8 BuildRuleResolver (com.facebook.buck.rules.BuildRuleResolver)8 FakeBuildRule (com.facebook.buck.rules.FakeBuildRule)8 BuildId (com.facebook.buck.model.BuildId)7 FakeProjectFilesystem (com.facebook.buck.testutil.FakeProjectFilesystem)7 UUID (java.util.UUID)7 StepEvent (com.facebook.buck.step.StepEvent)6