Skip to content

Commit

Permalink
Remove calls to AnaylsisMock.setupMockToolsRepository after bazelbuild@
Browse files Browse the repository at this point in the history
…085ce0c added this to BuildIntegrationTestCase. Also remove additional calls from BazelBuildEventServiceModule that have been redundant since bazelbuild@72f5c12

PiperOrigin-RevId: 409873551
  • Loading branch information
MarkDacek authored and copybara-github committed Nov 15, 2021
1 parent 286fb80 commit 37960ca
Show file tree
Hide file tree
Showing 13 changed files with 1 addition and 79 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -43,7 +42,6 @@ public class KeepGoingTest extends BuildIntegrationTestCase {

@Before
public void stageEmbeddedTools() throws Exception {
AnalysisMock.get().setupMockToolsRepository(mockToolsConfig);
MockGenruleSupport.setup(mockToolsConfig);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -74,11 +73,6 @@ public class QueryIntegrationTest extends BuildIntegrationTestCase {
private final CustomFileSystem fs = new CustomFileSystem();
private final List<String> options = new ArrayList<>();

@Before
public void stageEmbeddedTools() throws Exception {
AnalysisMock.get().setupMockToolsRepository(mockToolsConfig);
}

@Override
protected EventCollectionApparatus createEvents() {
ImmutableSet.Builder<EventKind> eventsSet = ImmutableSet.builder();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -39,8 +38,6 @@ public class SubcommandEventTest extends BuildIntegrationTestCase {

@Before
public void stageEmbeddedTools() throws Exception {
AnalysisMock.get().setupMockToolsRepository(mockToolsConfig);

addOptions("--spawn_strategy=standalone");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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")));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -40,7 +39,6 @@ public final class UnusedInputsFailureIntegrationTest extends BuildIntegrationTe

@Before
public void stageEmbeddedTools() throws Exception {
AnalysisMock.get().setupMockToolsRepository(mockToolsConfig);
MockGenruleSupport.setup(mockToolsConfig);
}

Expand Down

0 comments on commit 37960ca

Please sign in to comment.