diff options
author | ruperts <ruperts@google.com> | 2017-12-05 21:53:50 -0800 |
---|---|---|
committer | Copybara-Service <copybara-piper@google.com> | 2017-12-05 21:55:51 -0800 |
commit | bec2fe85bdf07d944d0cb650b59732ea8d3e804c (patch) | |
tree | 06c6498199be667869d6885ea1f0ec9bfbf8f963 /src/test/java/com/google/devtools/build/lib/runtime | |
parent | 7964b1aa0d6c681799633f8a20d5ade78aec8289 (diff) |
Make ProcessWrapperUtil aware of the execution statistics file, and add new ExecutionStatisticsProvider.
RELNOTES: None.
PiperOrigin-RevId: 178056182
Diffstat (limited to 'src/test/java/com/google/devtools/build/lib/runtime')
-rw-r--r-- | src/test/java/com/google/devtools/build/lib/runtime/ProcessWrapperUtilTest.java | 40 |
1 files changed, 19 insertions, 21 deletions
diff --git a/src/test/java/com/google/devtools/build/lib/runtime/ProcessWrapperUtilTest.java b/src/test/java/com/google/devtools/build/lib/runtime/ProcessWrapperUtilTest.java index 91735e3a22..6d182f29a8 100644 --- a/src/test/java/com/google/devtools/build/lib/runtime/ProcessWrapperUtilTest.java +++ b/src/test/java/com/google/devtools/build/lib/runtime/ProcessWrapperUtilTest.java @@ -17,8 +17,8 @@ package com.google.devtools.build.lib.runtime; import static com.google.common.truth.Truth.assertThat; import static com.google.devtools.build.lib.testutil.MoreAsserts.expectThrows; +import com.google.common.collect.ImmutableList; import java.time.Duration; -import java.util.ArrayList; import java.util.List; import org.junit.Test; import org.junit.runner.RunWith; @@ -30,9 +30,7 @@ public final class ProcessWrapperUtilTest { @Test public void testProcessWrapperCommandLineBuilder_ProcessWrapperPathIsRequired() { - List<String> commandArguments = new ArrayList<>(); - commandArguments.add("echo"); - commandArguments.add("hello, world"); + ImmutableList<String> commandArguments = ImmutableList.of("echo", "hello, world"); Exception e = expectThrows( @@ -62,13 +60,10 @@ public final class ProcessWrapperUtilTest { public void testProcessWrapperCommandLineBuilder_BuildsWithoutOptionalArguments() { String processWrapperPath = "process-wrapper"; - List<String> commandArguments = new ArrayList<>(); - commandArguments.add("echo"); - commandArguments.add("hello, world"); + ImmutableList<String> commandArguments = ImmutableList.of("echo", "hello, world"); - List<String> expectedCommandLine = new ArrayList<>(); - expectedCommandLine.add(processWrapperPath); - expectedCommandLine.addAll(commandArguments); + ImmutableList<String> expectedCommandLine = + ImmutableList.<String>builder().add(processWrapperPath).addAll(commandArguments).build(); List<String> commandLine = ProcessWrapperUtil.commandLineBuilder() @@ -83,22 +78,24 @@ public final class ProcessWrapperUtilTest { public void testProcessWrapperCommandLineBuilder_BuildsWithOptionalArguments() { String processWrapperPath = "process-wrapper"; - List<String> commandArguments = new ArrayList<>(); - commandArguments.add("echo"); - commandArguments.add("hello, world"); + ImmutableList<String> commandArguments = ImmutableList.of("echo", "hello, world"); Duration timeout = Duration.ofSeconds(10); Duration killDelay = Duration.ofSeconds(2); String stdoutPath = "stdout.txt"; String stderrPath = "stderr.txt"; - - List<String> expectedCommandLine = new ArrayList<>(); - expectedCommandLine.add(processWrapperPath); - expectedCommandLine.add("--timeout=" + timeout.getSeconds()); - expectedCommandLine.add("--kill_delay=" + killDelay.getSeconds()); - expectedCommandLine.add("--stdout=" + stdoutPath); - expectedCommandLine.add("--stderr=" + stderrPath); - expectedCommandLine.addAll(commandArguments); + String statisticsPath = "stats.out"; + + ImmutableList<String> expectedCommandLine = + ImmutableList.<String>builder() + .add(processWrapperPath) + .add("--timeout=" + timeout.getSeconds()) + .add("--kill_delay=" + killDelay.getSeconds()) + .add("--stdout=" + stdoutPath) + .add("--stderr=" + stderrPath) + .add("--stats=" + statisticsPath) + .addAll(commandArguments) + .build(); List<String> commandLine = ProcessWrapperUtil.commandLineBuilder() @@ -108,6 +105,7 @@ public final class ProcessWrapperUtilTest { .setKillDelay(killDelay) .setStdoutPath(stdoutPath) .setStderrPath(stderrPath) + .setStatisticsPath(statisticsPath) .build(); assertThat(commandLine).containsExactlyElementsIn(expectedCommandLine); |