From 37960cac2c9d1201f26c17eea5854f47d3e011ee Mon Sep 17 00:00:00 2001 From: dacek Date: Sun, 14 Nov 2021 20:14:33 -0800 Subject: [PATCH] Remove calls to AnaylsisMock.setupMockToolsRepository after https://github.com/bazelbuild/bazel/commit/085ce0c9dc67f3104af802a9898cd11a3da412c3 added this to BuildIntegrationTestCase. Also remove additional calls from BazelBuildEventServiceModule that have been redundant since https://github.com/bazelbuild/bazel/commit/72f5c122a7e9227c8b0d2c2acb219707d555db03 PiperOrigin-RevId: 409873551 --- .../BazelBuildEventServiceModuleTest.java | 18 ------------------ .../ContextProviderInitializationTest.java | 7 ------- .../buildtool/CorruptedActionCacheTest.java | 7 ------- .../EnvironmentRestrictedBuildTest.java | 6 ------ .../lib/buildtool/GenQueryIntegrationTest.java | 7 ------- .../build/lib/buildtool/KeepGoingTest.java | 2 -- .../LabelCrossesPackageBoundaryTest.java | 7 ------- .../buildtool/PackageGroupIntegrationTest.java | 2 +- .../lib/buildtool/QueryIntegrationTest.java | 6 ------ .../lib/buildtool/SubcommandEventTest.java | 3 --- .../SymlinkDependencyAnalysisTest.java | 7 ------- .../TransitiveDataDependencyTest.java | 6 ------ .../UnusedInputsFailureIntegrationTest.java | 2 -- 13 files changed, 1 insertion(+), 79 deletions(-) diff --git a/src/test/java/com/google/devtools/build/lib/buildeventservice/BazelBuildEventServiceModuleTest.java b/src/test/java/com/google/devtools/build/lib/buildeventservice/BazelBuildEventServiceModuleTest.java index 4ae061cabf211f..7d4e952a0ea17b 100644 --- a/src/test/java/com/google/devtools/build/lib/buildeventservice/BazelBuildEventServiceModuleTest.java +++ b/src/test/java/com/google/devtools/build/lib/buildeventservice/BazelBuildEventServiceModuleTest.java @@ -121,24 +121,6 @@ public final class BazelBuildEventServiceModuleTest extends BuildIntegrationTest @Rule public TemporaryFolder tmpFolder = new TemporaryFolder(); - @Before - public void stageEmbeddedTools() throws Exception { - AnalysisMock.get().setupMockToolsRepository(mockToolsConfig); - // TODO(b/195130137): move these calls to somewhere common. - write("embedded_tools/tools/cpp/cc_configure.bzl", "def cc_configure(**kwargs):", " pass"); - - write("embedded_tools/tools/sh/BUILD"); - write("embedded_tools/tools/sh/sh_configure.bzl", "def sh_configure(**kwargs):", " pass"); - write("embedded_tools/tools/osx/BUILD"); - write( - "embedded_tools/tools/osx/xcode_configure.bzl", - "def xcode_configure(*args, **kwargs):", // no positional arguments for XCode - " pass"); - write("embedded_tools/bin/sh", "def sh(**kwargs):", " pass"); - - addOptions("--spawn_strategy=standalone"); - } - @Override protected BlazeModule getConnectivityModule() { return connectivityModule; diff --git a/src/test/java/com/google/devtools/build/lib/buildtool/ContextProviderInitializationTest.java b/src/test/java/com/google/devtools/build/lib/buildtool/ContextProviderInitializationTest.java index 8c8756b81a935a..9647da52cce0e6 100644 --- a/src/test/java/com/google/devtools/build/lib/buildtool/ContextProviderInitializationTest.java +++ b/src/test/java/com/google/devtools/build/lib/buildtool/ContextProviderInitializationTest.java @@ -19,7 +19,6 @@ import com.google.common.collect.ImmutableSet; import com.google.devtools.build.lib.actions.ActionGraph; import com.google.devtools.build.lib.actions.Artifact; -import com.google.devtools.build.lib.analysis.util.AnalysisMock; import com.google.devtools.build.lib.buildtool.util.BuildIntegrationTestCase; import com.google.devtools.build.lib.exec.ExecutorBuilder; import com.google.devtools.build.lib.exec.ExecutorLifecycleListener; @@ -32,7 +31,6 @@ import com.google.devtools.build.lib.util.AbruptExitException; import com.google.devtools.build.lib.util.DetailedExitCode; import java.util.function.Supplier; -import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; @@ -43,11 +41,6 @@ @RunWith(JUnit4.class) public class ContextProviderInitializationTest extends BuildIntegrationTestCase { - @Before - public final void setUpToolsConfigMock() throws Exception { - AnalysisMock.get().setupMockToolsRepository(mockToolsConfig); - } - private static class BadContextProviderModule extends BlazeModule { @Override public void executorInit( diff --git a/src/test/java/com/google/devtools/build/lib/buildtool/CorruptedActionCacheTest.java b/src/test/java/com/google/devtools/build/lib/buildtool/CorruptedActionCacheTest.java index 0d3cbc20467dae..cbdb4460213ffa 100644 --- a/src/test/java/com/google/devtools/build/lib/buildtool/CorruptedActionCacheTest.java +++ b/src/test/java/com/google/devtools/build/lib/buildtool/CorruptedActionCacheTest.java @@ -15,13 +15,11 @@ import static com.google.common.truth.Truth.assertThat; -import com.google.devtools.build.lib.analysis.util.AnalysisMock; import com.google.devtools.build.lib.buildtool.util.BuildIntegrationTestCase; import com.google.devtools.build.lib.packages.util.MockGenruleSupport; import com.google.devtools.build.lib.util.LoggingUtil; import com.google.devtools.build.lib.vfs.Path; import com.google.devtools.build.lib.vfs.UnixGlob; -import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; @@ -32,11 +30,6 @@ @RunWith(JUnit4.class) public class CorruptedActionCacheTest extends BuildIntegrationTestCase { - @Before - public void stageEmbeddedTools() throws Exception { - AnalysisMock.get().setupMockToolsRepository(mockToolsConfig); - } - @Test public void testCorruptionActionCacheErrorMessage() throws Exception { MockGenruleSupport.setup(mockToolsConfig); diff --git a/src/test/java/com/google/devtools/build/lib/buildtool/EnvironmentRestrictedBuildTest.java b/src/test/java/com/google/devtools/build/lib/buildtool/EnvironmentRestrictedBuildTest.java index 9665de0ac9f3dd..d6e383f74540f9 100644 --- a/src/test/java/com/google/devtools/build/lib/buildtool/EnvironmentRestrictedBuildTest.java +++ b/src/test/java/com/google/devtools/build/lib/buildtool/EnvironmentRestrictedBuildTest.java @@ -19,7 +19,6 @@ import com.google.common.collect.Iterables; import com.google.devtools.build.lib.analysis.ConfiguredTarget; import com.google.devtools.build.lib.analysis.ViewCreationFailedException; -import com.google.devtools.build.lib.analysis.util.AnalysisMock; import com.google.devtools.build.lib.buildtool.util.BuildIntegrationTestCase; import org.junit.Before; import org.junit.Test; @@ -37,11 +36,6 @@ public final void addNoBuildOption() throws Exception { addOptions("--nobuild"); // Target enforcement happens before the execution phase. } - @Before - public void stageEmbeddedTools() throws Exception { - AnalysisMock.get().setupMockToolsRepository(mockToolsConfig); - } - private void writeEnvironmentRules(String... defaults) throws Exception { StringBuilder defaultsBuilder = new StringBuilder(); for (String defaultEnv : defaults) { diff --git a/src/test/java/com/google/devtools/build/lib/buildtool/GenQueryIntegrationTest.java b/src/test/java/com/google/devtools/build/lib/buildtool/GenQueryIntegrationTest.java index 9347fe2796c94e..f3d65db8d962e1 100644 --- a/src/test/java/com/google/devtools/build/lib/buildtool/GenQueryIntegrationTest.java +++ b/src/test/java/com/google/devtools/build/lib/buildtool/GenQueryIntegrationTest.java @@ -22,12 +22,10 @@ import com.google.devtools.build.lib.actions.Artifact; import com.google.devtools.build.lib.actions.BuildFailedException; import com.google.devtools.build.lib.analysis.ViewCreationFailedException; -import com.google.devtools.build.lib.analysis.util.AnalysisMock; import com.google.devtools.build.lib.buildtool.util.BuildIntegrationTestCase; import java.util.ArrayList; import java.util.Collections; import java.util.List; -import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; @@ -38,11 +36,6 @@ @RunWith(JUnit4.class) public class GenQueryIntegrationTest extends BuildIntegrationTestCase { - @Before - public void stageEmbeddedTools() throws Exception { - AnalysisMock.get().setupMockToolsRepository(mockToolsConfig); - } - @Test public void testDoesNotFailHorribly() throws Exception { write( diff --git a/src/test/java/com/google/devtools/build/lib/buildtool/KeepGoingTest.java b/src/test/java/com/google/devtools/build/lib/buildtool/KeepGoingTest.java index 3b5ddbd27a355f..eb5f48dabda8c7 100644 --- a/src/test/java/com/google/devtools/build/lib/buildtool/KeepGoingTest.java +++ b/src/test/java/com/google/devtools/build/lib/buildtool/KeepGoingTest.java @@ -26,7 +26,6 @@ import com.google.devtools.build.lib.actions.Artifact; import com.google.devtools.build.lib.actions.BuildFailedException; -import com.google.devtools.build.lib.analysis.util.AnalysisMock; import com.google.devtools.build.lib.buildtool.util.BuildIntegrationTestCase; import com.google.devtools.build.lib.events.Event; import com.google.devtools.build.lib.packages.util.MockGenruleSupport; @@ -43,7 +42,6 @@ public class KeepGoingTest extends BuildIntegrationTestCase { @Before public void stageEmbeddedTools() throws Exception { - AnalysisMock.get().setupMockToolsRepository(mockToolsConfig); MockGenruleSupport.setup(mockToolsConfig); } diff --git a/src/test/java/com/google/devtools/build/lib/buildtool/LabelCrossesPackageBoundaryTest.java b/src/test/java/com/google/devtools/build/lib/buildtool/LabelCrossesPackageBoundaryTest.java index afe99efc32f894..7dec20af019e43 100644 --- a/src/test/java/com/google/devtools/build/lib/buildtool/LabelCrossesPackageBoundaryTest.java +++ b/src/test/java/com/google/devtools/build/lib/buildtool/LabelCrossesPackageBoundaryTest.java @@ -15,10 +15,8 @@ import static org.junit.Assert.assertThrows; -import com.google.devtools.build.lib.analysis.util.AnalysisMock; import com.google.devtools.build.lib.buildtool.util.BuildIntegrationTestCase; import com.google.devtools.build.lib.cmdline.TargetParsingException; -import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; @@ -29,11 +27,6 @@ @RunWith(JUnit4.class) public class LabelCrossesPackageBoundaryTest extends BuildIntegrationTestCase { - @Before - public void stageEmbeddedTools() throws Exception { - AnalysisMock.get().setupMockToolsRepository(mockToolsConfig); - } - @Test public void testLabelCrossesPackageBoundary_target() throws Exception { write("x/BUILD", diff --git a/src/test/java/com/google/devtools/build/lib/buildtool/PackageGroupIntegrationTest.java b/src/test/java/com/google/devtools/build/lib/buildtool/PackageGroupIntegrationTest.java index 0bb417f0e7a824..49cfa4ac142b5d 100644 --- a/src/test/java/com/google/devtools/build/lib/buildtool/PackageGroupIntegrationTest.java +++ b/src/test/java/com/google/devtools/build/lib/buildtool/PackageGroupIntegrationTest.java @@ -28,10 +28,10 @@ */ @RunWith(JUnit4.class) public class PackageGroupIntegrationTest extends BuildIntegrationTestCase { + @Before public final void setUpToolsConfigMock() throws Exception { AnalysisMock.get().pySupport().setup(mockToolsConfig); - AnalysisMock.get().setupMockToolsRepository(mockToolsConfig); } @Test diff --git a/src/test/java/com/google/devtools/build/lib/buildtool/QueryIntegrationTest.java b/src/test/java/com/google/devtools/build/lib/buildtool/QueryIntegrationTest.java index a98cef6716e265..36e35dbbd77fff 100644 --- a/src/test/java/com/google/devtools/build/lib/buildtool/QueryIntegrationTest.java +++ b/src/test/java/com/google/devtools/build/lib/buildtool/QueryIntegrationTest.java @@ -19,7 +19,6 @@ import com.google.common.collect.ImmutableSet; import com.google.common.collect.Iterables; -import com.google.devtools.build.lib.analysis.util.AnalysisMock; import com.google.devtools.build.lib.buildtool.util.BuildIntegrationTestCase; import com.google.devtools.build.lib.events.EventKind; import com.google.devtools.build.lib.events.util.EventCollectionApparatus; @@ -74,11 +73,6 @@ public class QueryIntegrationTest extends BuildIntegrationTestCase { private final CustomFileSystem fs = new CustomFileSystem(); private final List options = new ArrayList<>(); - @Before - public void stageEmbeddedTools() throws Exception { - AnalysisMock.get().setupMockToolsRepository(mockToolsConfig); - } - @Override protected EventCollectionApparatus createEvents() { ImmutableSet.Builder eventsSet = ImmutableSet.builder(); diff --git a/src/test/java/com/google/devtools/build/lib/buildtool/SubcommandEventTest.java b/src/test/java/com/google/devtools/build/lib/buildtool/SubcommandEventTest.java index 8a270e96d8afa6..7009b2cb9c4e36 100644 --- a/src/test/java/com/google/devtools/build/lib/buildtool/SubcommandEventTest.java +++ b/src/test/java/com/google/devtools/build/lib/buildtool/SubcommandEventTest.java @@ -16,7 +16,6 @@ import static com.google.common.truth.Truth.assertThat; import com.google.common.collect.Iterables; -import com.google.devtools.build.lib.analysis.util.AnalysisMock; import com.google.devtools.build.lib.buildtool.util.BuildIntegrationTestCase; import com.google.devtools.build.lib.events.Event; import com.google.devtools.build.lib.events.EventCollector; @@ -39,8 +38,6 @@ public class SubcommandEventTest extends BuildIntegrationTestCase { @Before public void stageEmbeddedTools() throws Exception { - AnalysisMock.get().setupMockToolsRepository(mockToolsConfig); - addOptions("--spawn_strategy=standalone"); } diff --git a/src/test/java/com/google/devtools/build/lib/buildtool/SymlinkDependencyAnalysisTest.java b/src/test/java/com/google/devtools/build/lib/buildtool/SymlinkDependencyAnalysisTest.java index 914d5d1138c0aa..aaf1742524a9d8 100644 --- a/src/test/java/com/google/devtools/build/lib/buildtool/SymlinkDependencyAnalysisTest.java +++ b/src/test/java/com/google/devtools/build/lib/buildtool/SymlinkDependencyAnalysisTest.java @@ -16,11 +16,9 @@ import static com.google.common.collect.Iterables.getOnlyElement; import static com.google.common.truth.Truth.assertThat; -import com.google.devtools.build.lib.analysis.util.AnalysisMock; import com.google.devtools.build.lib.buildtool.util.BuildIntegrationTestCase; import com.google.devtools.build.lib.packages.util.MockGenruleSupport; import com.google.devtools.build.lib.vfs.Path; -import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; @@ -32,11 +30,6 @@ @RunWith(JUnit4.class) public class SymlinkDependencyAnalysisTest extends BuildIntegrationTestCase { - @Before - public void stageEmbeddedTools() throws Exception { - AnalysisMock.get().setupMockToolsRepository(mockToolsConfig); - } - private String buildAndReturnOutput() throws Exception { buildTarget("//symlink"); return readContentAsLatin1String(getOnlyElement(getArtifacts("//symlink:out"))); diff --git a/src/test/java/com/google/devtools/build/lib/buildtool/TransitiveDataDependencyTest.java b/src/test/java/com/google/devtools/build/lib/buildtool/TransitiveDataDependencyTest.java index 059d5d5c5d4f93..7c7b33f4eef5b3 100644 --- a/src/test/java/com/google/devtools/build/lib/buildtool/TransitiveDataDependencyTest.java +++ b/src/test/java/com/google/devtools/build/lib/buildtool/TransitiveDataDependencyTest.java @@ -21,7 +21,6 @@ import com.google.devtools.build.lib.actions.Artifact; import com.google.devtools.build.lib.actions.BuildFailedException; import com.google.devtools.build.lib.analysis.ConfiguredTarget; -import com.google.devtools.build.lib.analysis.util.AnalysisMock; import com.google.devtools.build.lib.buildtool.util.BuildIntegrationTestCase; import com.google.devtools.build.lib.util.io.OutErr; import com.google.devtools.build.lib.util.io.RecordingOutErr; @@ -49,11 +48,6 @@ public final void addJobNumberOption() throws Exception { addOptions("--jobs", "" + numJobs()); } - @Before - public void stageEmbeddedTools() throws Exception { - AnalysisMock.get().setupMockToolsRepository(mockToolsConfig); - } - private void assertSameConfiguredTarget(String label) throws Exception { assertThat(getOnlyElement(getResult().getSuccessfulTargets())) .isSameInstanceAs(getConfiguredTarget(label)); diff --git a/src/test/java/com/google/devtools/build/lib/buildtool/UnusedInputsFailureIntegrationTest.java b/src/test/java/com/google/devtools/build/lib/buildtool/UnusedInputsFailureIntegrationTest.java index a29bd83a1a3a1e..19eb54dff476c6 100644 --- a/src/test/java/com/google/devtools/build/lib/buildtool/UnusedInputsFailureIntegrationTest.java +++ b/src/test/java/com/google/devtools/build/lib/buildtool/UnusedInputsFailureIntegrationTest.java @@ -18,7 +18,6 @@ import static org.junit.Assert.assertThrows; import com.google.devtools.build.lib.actions.BuildFailedException; -import com.google.devtools.build.lib.analysis.util.AnalysisMock; import com.google.devtools.build.lib.buildtool.util.BuildIntegrationTestCase; import com.google.devtools.build.lib.packages.util.MockGenruleSupport; import com.google.devtools.build.lib.server.FailureDetails; @@ -40,7 +39,6 @@ public final class UnusedInputsFailureIntegrationTest extends BuildIntegrationTe @Before public void stageEmbeddedTools() throws Exception { - AnalysisMock.get().setupMockToolsRepository(mockToolsConfig); MockGenruleSupport.setup(mockToolsConfig); }