From 011652cb7f4b90a0f23e39130fafde8e60349a40 Mon Sep 17 00:00:00 2001 From: Ulf Adams Date: Tue, 27 Oct 2015 17:25:30 +0000 Subject: [PATCH] Remove unnecessary use of Reporter. -- MOS_MIGRATED_REVID=106410378 --- .../skyframe/MemoizingEvaluatorTest.java | 3 +- .../build/skyframe/ParallelEvaluatorTest.java | 42 +------------------ 2 files changed, 2 insertions(+), 43 deletions(-) diff --git a/src/test/java/com/google/devtools/build/skyframe/MemoizingEvaluatorTest.java b/src/test/java/com/google/devtools/build/skyframe/MemoizingEvaluatorTest.java index aea1db5f50cdc9..9aded52880fd05 100644 --- a/src/test/java/com/google/devtools/build/skyframe/MemoizingEvaluatorTest.java +++ b/src/test/java/com/google/devtools/build/skyframe/MemoizingEvaluatorTest.java @@ -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; @@ -137,7 +136,7 @@ protected boolean rootCausesStored() { @Before public void initializeReporter() { eventCollector = new EventCollector(); - reporter = new Reporter(eventCollector); + reporter = eventCollector; tester.resetPlayedEvents(); } diff --git a/src/test/java/com/google/devtools/build/skyframe/ParallelEvaluatorTest.java b/src/test/java/com/google/devtools/build/skyframe/ParallelEvaluatorTest.java index 4a2f8ed317b5d3..5fe22a278d11f1 100644 --- a/src/test/java/com/google/devtools/build/skyframe/ParallelEvaluatorTest.java +++ b/src/test/java/com/google/devtools/build/skyframe/ParallelEvaluatorTest.java @@ -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; @@ -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 @@ -111,7 +107,7 @@ private ParallelEvaluator makeEvaluator( return new ParallelEvaluator(graph, oldGraphVersion, builders, - reporter, + eventCollector, new MemoizingEvaluator.EmittedEventState(), storedEventFilter, keepGoing, @@ -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 {