aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/test/shell
diff options
context:
space:
mode:
authorGravatar Klaus Aehlig <aehlig@google.com>2017-10-16 11:31:42 +0200
committerGravatar Jakob Buchgraber <buchgr@google.com>2017-10-16 17:48:58 +0200
commit9c7a51e3632cdc54fbc859570ad125f06a6c7c75 (patch)
tree2982fdb2f1c82981ea86defdd93b54488de52be8 /src/test/shell
parent22670a4e5abb879ebd5e41294f6aa0960346f4cf (diff)
BEP: explicitly report failures associated with a label as such
There is a conceptual difference between the (maybe unsuccessful) completion of a top-level target and a label as the root cause for a failure (i.e., a missing source file). Indicate that difference as such, by having a separate message for failures associated with an unconfigured label. Change-Id: I3f2e20d4dc85782eb11b104a7baf089e66d972e7 PiperOrigin-RevId: 172299938
Diffstat (limited to 'src/test/shell')
-rwxr-xr-xsrc/test/shell/integration/build_event_stream_test.sh28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/test/shell/integration/build_event_stream_test.sh b/src/test/shell/integration/build_event_stream_test.sh
index f9c64dffd1..90a712dd11 100755
--- a/src/test/shell/integration/build_event_stream_test.sh
+++ b/src/test/shell/integration/build_event_stream_test.sh
@@ -712,4 +712,32 @@ function test_alias() {
expect_not_log 'label: "//alias/actual'
}
+function test_missing_file() {
+ cat > BUILD <<'EOF'
+filegroup(
+ name = "badfilegroup",
+ srcs = ["doesnotexist"],
+)
+EOF
+ (bazel build --build_event_text_file="${TEST_log}" :badfilegroup \
+ && fail "Expected failure") || :
+ # There should be precisely one event with target_completed as event id type
+ (echo 'g/^id/+1p'; echo 'q') | ed "${TEST_log}" 2>&1 | tail -n +2 > event_id_types
+ [ `grep target_completed event_id_types | wc -l` -eq 1 ] \
+ || fail "not precisely one target_completed event id"
+ # Moreover, we expect precisely one event identified by an unconfigured label
+ [ `grep unconfigured_label event_id_types | wc -l` -eq 1 ] \
+ || fail "not precisely one unconfigured_label event id"
+
+ (bazel build --build_event_text_file="${TEST_log}" :badfilegroup :doesnotexist \
+ && fail "Expected failure") || :
+ # There should be precisely two events with target_completed as event id type
+ (echo 'g/^id/+1p'; echo 'q') | ed "${TEST_log}" 2>&1 | tail -n +2 > event_id_types
+ [ `grep target_completed event_id_types | wc -l` -eq 2 ] \
+ || fail "not precisely one target_completed event id"
+ # Moreover, we expect precisely one event identified by an unconfigured label
+ [ `grep unconfigured_label event_id_types | wc -l` -eq 1 ] \
+ || fail "not precisely one unconfigured_label event id"
+}
+
run_suite "Integration tests for the build event stream"