aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com
diff options
context:
space:
mode:
authorGravatar aehlig <aehlig@google.com>2017-11-29 05:03:03 -0800
committerGravatar Copybara-Service <copybara-piper@google.com>2017-11-29 05:04:28 -0800
commitd587e642c316f9b63b45190b30cf744a6eed858c (patch)
treeeab99230750144b3b1216425bcda161d01367621 /src/main/java/com
parenta7a9d56539a467ef095d3003a16d33922d9505a5 (diff)
BEP: Extend TestResult to optionally contain meta data
Extend the protocol to support also showing meta data about an action execution, if the underlying test action is able to report it. PiperOrigin-RevId: 177294531
Diffstat (limited to 'src/main/java/com')
-rw-r--r--src/main/java/com/google/devtools/build/lib/buildeventstream/proto/build_event_stream.proto31
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/test/TestAttempt.java37
2 files changed, 66 insertions, 2 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/buildeventstream/proto/build_event_stream.proto b/src/main/java/com/google/devtools/build/lib/buildeventstream/proto/build_event_stream.proto
index b67f200a14..8a2b05bb42 100644
--- a/src/main/java/com/google/devtools/build/lib/buildeventstream/proto/build_event_stream.proto
+++ b/src/main/java/com/google/devtools/build/lib/buildeventstream/proto/build_event_stream.proto
@@ -504,6 +504,37 @@ message TestResult {
// Warnings generated by that test action.
repeated string warning = 7;
+
+ // Message providing optional meta data on the execution of the test action,
+ // if available.
+ message ExecutionInfo {
+ int32 timeout_seconds = 1;
+
+ // Name of the strategy to execute this test action (e.g., "local",
+ // "remote")
+ string strategy = 2;
+
+ // The hostname of the machine where the test action was executed (in case
+ // of remote execution), if known.
+ string hostname = 3;
+
+ // Represents a hierarchical timing breakdown of an activity.
+ // The top level time should be the total time of the activity.
+ // Invariant: time_millis >= sum of time_millis of all direct children.
+ message TimingBreakdown {
+ repeated TimingBreakdown child = 1;
+ string name = 2;
+ int64 time_millis = 3;
+ }
+ TimingBreakdown timing_breakdown = 4;
+
+ message ResourceUsage {
+ string name = 1;
+ int64 value = 2;
+ }
+ repeated ResourceUsage resource_usage = 5;
+ }
+ ExecutionInfo execution_info = 8;
}
// Payload of the event summarizing a test.
diff --git a/src/main/java/com/google/devtools/build/lib/rules/test/TestAttempt.java b/src/main/java/com/google/devtools/build/lib/rules/test/TestAttempt.java
index 287773b178..14a0f108a4 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/test/TestAttempt.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/test/TestAttempt.java
@@ -43,6 +43,7 @@ public class TestAttempt implements BuildEvent {
private final List<String> testWarnings;
private final long durationMillis;
private final long startTimeMillis;
+ private final BuildEventStreamProtos.TestResult.ExecutionInfo executionInfo;
/**
* Construct the event given the test action and attempt number.
@@ -54,6 +55,7 @@ public class TestAttempt implements BuildEvent {
public TestAttempt(
boolean cachedLocally,
TestRunnerAction testAction,
+ BuildEventStreamProtos.TestResult.ExecutionInfo executionInfo,
Integer attempt,
BlazeTestStatus status,
long startTimeMillis,
@@ -62,6 +64,7 @@ public class TestAttempt implements BuildEvent {
List<String> testWarnings,
boolean lastAttempt) {
this.testAction = testAction;
+ this.executionInfo = executionInfo;
this.attempt = attempt;
this.status = status;
this.cachedLocally = cachedLocally;
@@ -73,6 +76,35 @@ public class TestAttempt implements BuildEvent {
}
public TestAttempt(
+ boolean cachedLocally,
+ TestRunnerAction testAction,
+ Integer attempt,
+ BlazeTestStatus status,
+ long startTimeMillis,
+ long durationMillis,
+ Collection<Pair<String, Path>> files,
+ List<String> testWarnings,
+ boolean lastAttempt) {
+ this(cachedLocally, testAction,
+ BuildEventStreamProtos.TestResult.ExecutionInfo.getDefaultInstance(), attempt, status,
+ startTimeMillis, durationMillis, files, testWarnings, lastAttempt);
+ }
+
+ public TestAttempt(
+ TestRunnerAction testAction,
+ BuildEventStreamProtos.TestResult.ExecutionInfo executionInfo,
+ Integer attempt,
+ BlazeTestStatus status,
+ long startTimeMillis,
+ long durationMillis,
+ Collection<Pair<String, Path>> files,
+ List<String> testWarnings,
+ boolean lastAttempt) {
+ this(false, testAction, executionInfo, attempt, status, startTimeMillis, durationMillis, files,
+ testWarnings, lastAttempt);
+ }
+
+ public TestAttempt(
TestRunnerAction testAction,
Integer attempt,
BlazeTestStatus status,
@@ -81,8 +113,8 @@ public class TestAttempt implements BuildEvent {
Collection<Pair<String, Path>> files,
List<String> testWarnings,
boolean lastAttempt) {
- this(false, testAction, attempt, status, startTimeMillis, durationMillis, files, testWarnings,
- lastAttempt);
+ this(testAction, BuildEventStreamProtos.TestResult.ExecutionInfo.getDefaultInstance(), attempt,
+ status, startTimeMillis, durationMillis, files, testWarnings, lastAttempt);
}
public static TestAttempt fromCachedTestResult(TestResult result) {
@@ -130,6 +162,7 @@ public class TestAttempt implements BuildEvent {
BuildEventStreamProtos.TestResult.Builder builder =
BuildEventStreamProtos.TestResult.newBuilder();
builder.setStatus(BuildEventStreamerUtils.bepStatus(status));
+ builder.setExecutionInfo(executionInfo);
builder.setCachedLocally(cachedLocally);
builder.setTestAttemptStartMillisEpoch(startTimeMillis);
builder.setTestAttemptDurationMillis(durationMillis);