Skip to content

Commit

Permalink
Remove unnecessary use of Reporter.
Browse files Browse the repository at this point in the history
--
MOS_MIGRATED_REVID=106410378
  • Loading branch information
ulfjack authored and davidzchen committed Oct 27, 2015
1 parent cc8954a commit 011652c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 43 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
import com.google.devtools.build.lib.events.EventCollector;
import com.google.devtools.build.lib.events.EventHandler;
import com.google.devtools.build.lib.events.EventKind;
import com.google.devtools.build.lib.events.Reporter;
import com.google.devtools.build.lib.testutil.TestThread;
import com.google.devtools.build.lib.testutil.TestUtils;
import com.google.devtools.build.skyframe.GraphTester.StringValue;
Expand Down Expand Up @@ -137,7 +136,7 @@ protected boolean rootCausesStored() {
@Before
public void initializeReporter() {
eventCollector = new EventCollector();
reporter = new Reporter(eventCollector);
reporter = eventCollector;
tester.resetPlayedEvents();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@
import com.google.devtools.build.lib.events.EventCollector;
import com.google.devtools.build.lib.events.EventHandler;
import com.google.devtools.build.lib.events.EventKind;
import com.google.devtools.build.lib.events.OutputFilter.RegexOutputFilter;
import com.google.devtools.build.lib.events.Reporter;
import com.google.devtools.build.lib.testutil.TestThread;
import com.google.devtools.build.lib.testutil.TestUtils;
import com.google.devtools.build.skyframe.GraphTester.StringValue;
Expand Down Expand Up @@ -83,14 +81,12 @@ public class ParallelEvaluatorTest {
protected GraphTester tester = new GraphTester();

private EventCollector eventCollector;
private EventHandler reporter;

private EvaluationProgressReceiver revalidationReceiver;

@Before
public void initializeReporter() {
eventCollector = new EventCollector();
reporter = new Reporter(eventCollector);
}

@After
Expand All @@ -111,7 +107,7 @@ private ParallelEvaluator makeEvaluator(
return new ParallelEvaluator(graph,
oldGraphVersion,
builders,
reporter,
eventCollector,
new MemoizingEvaluator.EmittedEventState(),
storedEventFilter,
keepGoing,
Expand Down Expand Up @@ -436,42 +432,6 @@ public void simpleWarning() throws Exception {
assertEventCount(1, eventCollector);
}

@Test
public void warningMatchesRegex() throws Exception {
graph = new InMemoryGraph();
((Reporter) reporter).setOutputFilter(RegexOutputFilter.forRegex("a"));
set("example", "a value").setWarning("warning message");
SkyKey a = GraphTester.toSkyKey("example");
tester.getOrCreate(a).setTag("a");
StringValue value = (StringValue) eval(false, a);
assertEquals("a value", value.getValue());
assertContainsEvent(eventCollector, "warning message");
assertEventCount(1, eventCollector);
}

@Test
public void warningMatchesRegexOnlyTag() throws Exception {
graph = new InMemoryGraph();
((Reporter) reporter).setOutputFilter(RegexOutputFilter.forRegex("a"));
set("a", "a value").setWarning("warning on 'a'");
SkyKey a = GraphTester.toSkyKey("a");
tester.getOrCreate(a).setTag("b");
StringValue value = (StringValue) eval(false, a);
assertEquals("a value", value.getValue());
assertEventCount(0, eventCollector); }

@Test
public void warningDoesNotMatchRegex() throws Exception {
graph = new InMemoryGraph();
((Reporter) reporter).setOutputFilter(RegexOutputFilter.forRegex("b"));
set("a", "a").setWarning("warning on 'a'");
SkyKey a = GraphTester.toSkyKey("a");
tester.getOrCreate(a).setTag("a");
StringValue value = (StringValue) eval(false, a);
assertEquals("a", value.getValue());
assertEventCount(0, eventCollector);
}

/** Regression test: events from already-done value not replayed. */
@Test
public void eventFromDoneChildRecorded() throws Exception {
Expand Down

0 comments on commit 011652c

Please sign in to comment.