diff --git a/src/test/java/com/google/devtools/build/lib/metrics/BUILD b/src/test/java/com/google/devtools/build/lib/metrics/BUILD index 0b9dcea41800d8..4a10a7ac8ef558 100644 --- a/src/test/java/com/google/devtools/build/lib/metrics/BUILD +++ b/src/test/java/com/google/devtools/build/lib/metrics/BUILD @@ -37,7 +37,9 @@ java_test( "//src/main/java/com/google/devtools/build/lib/analysis:view_creation_failed_exception", "//src/main/java/com/google/devtools/build/lib/buildeventstream/proto:build_event_stream_java_proto", "//src/main/java/com/google/devtools/build/lib/metrics:event", + "//src/main/java/com/google/devtools/build/lib/metrics:memory-use-recorder", "//src/main/java/com/google/devtools/build/lib/metrics:metrics_module", + "//src/main/java/com/google/devtools/build/lib/profiler", "//src/main/java/com/google/devtools/build/lib/util:os", "//src/test/java/com/google/devtools/build/lib/buildtool/util", "//third_party:guava", diff --git a/src/test/java/com/google/devtools/build/lib/metrics/MetricsCollectorTest.java b/src/test/java/com/google/devtools/build/lib/metrics/MetricsCollectorTest.java index b325be8dfeb8da..00db1483835fa7 100644 --- a/src/test/java/com/google/devtools/build/lib/metrics/MetricsCollectorTest.java +++ b/src/test/java/com/google/devtools/build/lib/metrics/MetricsCollectorTest.java @@ -26,11 +26,13 @@ import com.google.devtools.build.lib.buildeventstream.BuildEventStreamProtos.BuildMetrics.BuildGraphMetrics; import com.google.devtools.build.lib.buildeventstream.BuildEventStreamProtos.BuildMetrics.CumulativeMetrics; import com.google.devtools.build.lib.buildtool.util.BuildIntegrationTestCase; +import com.google.devtools.build.lib.profiler.MemoryProfiler; import com.google.devtools.build.lib.runtime.BlazeModule; import com.google.devtools.build.lib.runtime.BlazeRuntime; import com.google.devtools.build.lib.runtime.CommandEnvironment; import com.google.devtools.build.lib.util.OS; import java.util.List; +import org.junit.After; import org.junit.Assume; import org.junit.Before; import org.junit.Test; @@ -77,6 +79,12 @@ public void writeTrivialFooTarget() throws Exception { ")"); } + @After + public void resetProfilers() throws Exception { + MemoryProfiler.instance().stop(); + PostGCMemoryUseRecorder.get().reset(); + } + @Test public void testActionsCreated() throws Exception { buildTarget("//foo:foo");