aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--src/main/java/com/google/devtools/build/lib/analysis/TargetCompleteEvent.java21
-rw-r--r--src/main/java/com/google/devtools/build/lib/buildeventstream/proto/build_event_stream.proto13
-rwxr-xr-xsrc/test/shell/integration/build_event_stream_test.sh3
3 files changed, 37 insertions, 0 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/TargetCompleteEvent.java b/src/main/java/com/google/devtools/build/lib/analysis/TargetCompleteEvent.java
index 0c91396cf4..01a3ddf18d 100644
--- a/src/main/java/com/google/devtools/build/lib/analysis/TargetCompleteEvent.java
+++ b/src/main/java/com/google/devtools/build/lib/analysis/TargetCompleteEvent.java
@@ -37,6 +37,7 @@ import com.google.devtools.build.lib.collect.nestedset.NestedSetBuilder;
import com.google.devtools.build.lib.collect.nestedset.NestedSetView;
import com.google.devtools.build.lib.collect.nestedset.Order;
import com.google.devtools.build.lib.packages.AttributeMap;
+import com.google.devtools.build.lib.packages.TestSize;
import com.google.devtools.build.lib.rules.test.TestProvider;
import com.google.devtools.build.lib.syntax.Type;
import com.google.devtools.build.lib.util.Preconditions;
@@ -142,6 +143,21 @@ public final class TargetCompleteEvent
return childrenBuilder.build();
}
+ private BuildEventStreamProtos.TestSize bepTestSize(TestSize size) {
+ switch (size) {
+ case SMALL:
+ return BuildEventStreamProtos.TestSize.SMALL;
+ case MEDIUM:
+ return BuildEventStreamProtos.TestSize.MEDIUM;
+ case LARGE:
+ return BuildEventStreamProtos.TestSize.LARGE;
+ case ENORMOUS:
+ return BuildEventStreamProtos.TestSize.ENORMOUS;
+ default:
+ return BuildEventStreamProtos.TestSize.UNKNOWN;
+ }
+ }
+
@Override
public BuildEventStreamProtos.BuildEvent asStreamProto(BuildEventConverters converters) {
BuildEventStreamProtos.TargetComplete.Builder builder =
@@ -152,6 +168,11 @@ public final class TargetCompleteEvent
builder.addAllTag(getTags());
builder.addAllOutputGroup(getOutputFilesByGroup(converters.artifactGroupNamer()));
+ if (isTest) {
+ builder.setTestSize(
+ bepTestSize(TestSize.getTestSize(target.getTarget().getAssociatedRule())));
+ }
+
// TODO(aehlig): remove direct reporting of artifacts as soon as clients no longer
// need it.
for (ArtifactsInOutputGroup group : outputs) {
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 b3649abcaa..2dd862b837 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
@@ -355,6 +355,16 @@ message OutputGroup {
repeated BuildEventId.NamedSetOfFilesId file_sets = 3;
}
+// Enumeration type characterizing the size of a test, as specified by the
+// test rule.
+enum TestSize {
+ UNKNOWN = 0;
+ SMALL = 1;
+ MEDIUM = 2;
+ LARGE = 3;
+ ENORMOUS = 4;
+}
+
// Payload of the event indicating the completion of a target. The target is
// specified in the id. If the target failed the root causes are provided as
// children events.
@@ -365,6 +375,9 @@ message TargetComplete {
// "generated file") where the completion is reported.
string target_kind = 5;
+ // The size of the test, if the target is a test target. Unset otherwise.
+ TestSize test_size = 6;
+
// The output files are arranged by their output group. If an output file
// is part of multiple output groups, it appears once in each output
// group.
diff --git a/src/test/shell/integration/build_event_stream_test.sh b/src/test/shell/integration/build_event_stream_test.sh
index f895661c34..647393581e 100755
--- a/src/test/shell/integration/build_event_stream_test.sh
+++ b/src/test/shell/integration/build_event_stream_test.sh
@@ -48,6 +48,7 @@ EOF
sh_test(
name = "true",
srcs = ["true.sh"],
+ size = "small",
)
sh_test(
name = "slow",
@@ -153,6 +154,8 @@ function test_basic() {
expect_not_log 'aborted'
# target kind for the sh_test
expect_log 'target_kind:.*sh'
+ # test size should be reported
+ expect_log 'test_size: SMALL'
# configuration reported with make variables
expect_log_once '^configuration '
expect_log 'key: "TARGET_CPU"'