Use test executor rather than mock in ExtraActionTest.
This allows the test to use more production code without loss in fidelity. It also will make future refactoring simpler.
RELNOTES: None.
@@ -33,6 +33,7 @@ import com.google.devtools.build.lib.exec.SymlinkTreeStrategy;
import com.google.devtools.build.lib.runtime.CommonCommandOptions;
import com.google.devtools.build.lib.testutil.TestConstants;
import com.google.devtools.build.lib.vfs.FileSystem;
+import com.google.devtools.build.lib.vfs.Path;
import com.google.devtools.common.options.OptionsBase;
import com.google.devtools.common.options.OptionsParser;
import com.google.devtools.common.options.OptionsParsingException;
@@ -44,7 +45,7 @@ public class TestExecutorBuilder {
public static final ImmutableList<Class<? extends OptionsBase>> DEFAULT_OPTIONS =
ImmutableList.of(ExecutionOptions.class, CommonCommandOptions.class);
private final FileSystem fileSystem;
- private final BlazeDirectories directories;
+ private final Path execRoot;
private Reporter reporter = new Reporter(new EventBus());
private OptionsParser optionsParser =
OptionsParser.builder().optionsClasses(DEFAULT_OPTIONS).build();
@@ -53,8 +54,12 @@ public class TestExecutorBuilder {
public TestExecutorBuilder(
FileSystem fileSystem, BlazeDirectories directories, BinTools binTools) {
+ this(fileSystem, directories.getExecRoot(TestConstants.WORKSPACE_NAME), binTools);
+ }
+
+ public TestExecutorBuilder(FileSystem fileSystem, Path execRoot, BinTools binTools) {
this.fileSystem = fileSystem;
- this.directories = directories;
+ this.execRoot = execRoot;
addStrategy(FileWriteActionContext.class, new FileWriteStrategy());
addStrategy(TemplateExpansionContext.class, new LocalTemplateExpansionStrategy());
addStrategy(SymlinkTreeActionContext.class, new SymlinkTreeStrategy(null, binTools));
@@ -97,7 +102,7 @@ public class TestExecutorBuilder {
SpawnActionContextMaps spawnActionContextMaps = spawnMapsBuilder.build();
return new BlazeExecutor(
fileSystem,
- directories.getExecRoot(TestConstants.WORKSPACE_NAME),
+ execRoot,
reporter,
BlazeClock.instance(),
optionsParser,
