aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/test/java/com/google/devtools/build/lib
diff options
context:
space:
mode:
authorGravatar ulfjack <ulfjack@google.com>2017-06-19 14:17:52 +0200
committerGravatar Philipp Wollermann <philwo@google.com>2017-06-19 18:25:13 +0200
commit77c9f5ec751f4adf3a8095e2e2943ec59dc12d26 (patch)
treee26c02e39bbec73d4fdc47edbbfa7469fa0f291d /src/test/java/com/google/devtools/build/lib
parent34e22458c6058773b41958b75ef5e7459482c109 (diff)
Rewrite the Executor/ActionExecutionContext split
Move everything to ActionExecutionContext, and drop Executor whereever possible. This clarifies the API, makes it simpler to test, and simplifies the code. PiperOrigin-RevId: 159414816
Diffstat (limited to 'src/test/java/com/google/devtools/build/lib')
-rw-r--r--src/test/java/com/google/devtools/build/lib/actions/util/DummyExecutor.java6
-rw-r--r--src/test/java/com/google/devtools/build/lib/skyframe/ActionDataTest.java95
2 files changed, 0 insertions, 101 deletions
diff --git a/src/test/java/com/google/devtools/build/lib/actions/util/DummyExecutor.java b/src/test/java/com/google/devtools/build/lib/actions/util/DummyExecutor.java
index 23248e0aad..13022b9c0e 100644
--- a/src/test/java/com/google/devtools/build/lib/actions/util/DummyExecutor.java
+++ b/src/test/java/com/google/devtools/build/lib/actions/util/DummyExecutor.java
@@ -15,7 +15,6 @@ package com.google.devtools.build.lib.actions.util;
import com.google.common.eventbus.EventBus;
import com.google.devtools.build.lib.actions.Executor;
-import com.google.devtools.build.lib.actions.Spawn;
import com.google.devtools.build.lib.actions.SpawnActionContext;
import com.google.devtools.build.lib.events.EventHandler;
import com.google.devtools.build.lib.util.BlazeClock;
@@ -88,9 +87,4 @@ public final class DummyExecutor implements Executor {
public boolean reportsSubcommands() {
throw new UnsupportedOperationException();
}
-
- @Override
- public void reportSubcommand(Spawn spawn) {
- throw new UnsupportedOperationException();
- }
} \ No newline at end of file
diff --git a/src/test/java/com/google/devtools/build/lib/skyframe/ActionDataTest.java b/src/test/java/com/google/devtools/build/lib/skyframe/ActionDataTest.java
deleted file mode 100644
index 68f423aa17..0000000000
--- a/src/test/java/com/google/devtools/build/lib/skyframe/ActionDataTest.java
+++ /dev/null
@@ -1,95 +0,0 @@
-// Copyright 2015 The Bazel Authors. All rights reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-package com.google.devtools.build.lib.skyframe;
-
-import static com.google.common.truth.Truth.assertThat;
-
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.Sets;
-import com.google.devtools.build.lib.actions.AbstractAction;
-import com.google.devtools.build.lib.actions.ActionExecutionContext;
-import com.google.devtools.build.lib.actions.ActionExecutionException;
-import com.google.devtools.build.lib.actions.Artifact;
-import com.google.devtools.build.lib.actions.Executor;
-import com.google.devtools.build.lib.actions.util.ActionsTestUtil;
-import com.google.devtools.build.lib.actions.util.DummyExecutor;
-import com.google.devtools.build.lib.vfs.FileSystemUtils;
-import java.io.IOException;
-import java.util.Collection;
-import java.util.Set;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.JUnit4;
-
-/**
- * Tests that the data passed from the application to the Builder is passed
- * down to each Action executed.
- */
-@RunWith(JUnit4.class)
-public class ActionDataTest extends TimestampBuilderTestCase {
-
- @Test
- public void testArgumentToBuildArtifactsIsPassedDownToAction() throws Exception {
-
- class MyAction extends AbstractAction {
-
- Object executor = null;
-
- public MyAction(Collection<Artifact> outputs) {
- super(ActionsTestUtil.NULL_ACTION_OWNER, ImmutableList.<Artifact>of(), outputs);
- }
-
- @Override
- public void execute(ActionExecutionContext actionExecutionContext)
- throws ActionExecutionException {
- this.executor = actionExecutionContext.getExecutor();
- try {
- FileSystemUtils.createEmptyFile(getPrimaryOutput().getPath());
- } catch (IOException e) {
- throw new ActionExecutionException("failed: ", e, this, false);
- }
- }
-
- @Override
- protected String computeKey() {
- return "MyAction";
- }
-
- @Override
- public String getMnemonic() {
- return "MyAction";
- }
- }
-
- Artifact output = createDerivedArtifact("foo");
- Set<Artifact> outputs = Sets.newHashSet(output);
-
- MyAction action = new MyAction(outputs);
- registerAction(action);
-
- Executor executor = new DummyExecutor(scratch.dir("/"));
- amnesiacBuilder()
- .buildArtifacts(
- reporter, outputs, null, null, null, null, executor, null, /*explain=*/ false, null,
- null);
- assertThat(action.executor).isSameAs(executor);
-
- executor = new DummyExecutor(scratch.dir("/"));
- amnesiacBuilder()
- .buildArtifacts(
- reporter, outputs, null, null, null, null, executor, null, /*explain=*/ false, null,
- null);
- assertThat(action.executor).isSameAs(executor);
- }
-}