aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/runtime/TestSummaryPrinter.java
diff options
context:
space:
mode:
authorGravatar lberki <lberki@google.com>2017-11-02 18:05:56 -0400
committerGravatar John Cater <jcater@google.com>2017-11-03 09:53:26 -0400
commitb08ed81e8173157d23fc57601a47a9fd1c957d6f (patch)
tree645d0e89de6fbfe718aea4f19604fabaf0a398de /src/main/java/com/google/devtools/build/lib/runtime/TestSummaryPrinter.java
parent01bf32e9bdf0ecd7c92f062f142dfaa5f4ab0e51 (diff)
Avoid crash when a test and its alias are specified on the command line for "blaze test".
RELNOTES: None. PiperOrigin-RevId: 174386473
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/runtime/TestSummaryPrinter.java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/runtime/TestSummaryPrinter.java8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/runtime/TestSummaryPrinter.java b/src/main/java/com/google/devtools/build/lib/runtime/TestSummaryPrinter.java
index 694eda641f..486b1505d9 100644
--- a/src/main/java/com/google/devtools/build/lib/runtime/TestSummaryPrinter.java
+++ b/src/main/java/com/google/devtools/build/lib/runtime/TestSummaryPrinter.java
@@ -42,7 +42,7 @@ public class TestSummaryPrinter {
TestOutputFormat testOutput,
AnsiTerminalPrinter printer) {
- String testName = summary.getTarget().getLabel().toString();
+ String testName = summary.getLabel().toString();
List<String> allLogs = new ArrayList<>();
for (Path path : summary.getFailedLogs()) {
allLogs.add(path.getPathString());
@@ -111,7 +111,7 @@ public class TestSummaryPrinter {
return;
}
String message = getCacheMessage(summary) + statusString(summary.getStatus());
- String targetName = summary.getTarget().getLabel().toString();
+ String targetName = summary.getLabel().toString();
if (withConfigurationName) {
targetName += " (" + summary.getTarget().getConfiguration().getMnemonic() + ")";
}
@@ -240,7 +240,9 @@ public class TestSummaryPrinter {
} else {
// We previously used com.google.math for this, which added about 1 MB of deps to the total
// size. If we re-introduce a dependency on that package, we could revert this change.
- long min = summary.getTestTimes().get(0).longValue(), max = min, sum = 0;
+ long min = summary.getTestTimes().get(0).longValue();
+ long max = min;
+ long sum = 0;
double sumOfSquares = 0.0;
for (Long l : summary.getTestTimes()) {
long value = l.longValue();