diff options
author | 2018-01-10 04:41:59 -0800 | |
---|---|---|
committer | 2018-01-10 04:44:13 -0800 | |
commit | cc386e62a2c585f7e0ef87ed5440c9abd757d647 (patch) | |
tree | 09ee6909e2d035647247a05a45b2ba8bb0410cee /src/test/shell | |
parent | 87d1c252ec8ec13aa8178ebd64810a620f74dd28 (diff) |
BEP: add a separate id for visibility errors
A build might fail because of a visibility violation that does
not happen at a top-level target. To avoid confusion, add a separate
namespace for configured targets that are just mentioned to report
the details of an error.
Change-Id: I86587f7489500f1d888bae6ce3d6f4bd79ea1609
PiperOrigin-RevId: 181448003
Diffstat (limited to 'src/test/shell')
-rwxr-xr-x | src/test/shell/integration/build_event_stream_test.sh | 30 |
1 files changed, 26 insertions, 4 deletions
diff --git a/src/test/shell/integration/build_event_stream_test.sh b/src/test/shell/integration/build_event_stream_test.sh index 65d3ef3663..75f8fa63ba 100755 --- a/src/test/shell/integration/build_event_stream_test.sh +++ b/src/test/shell/integration/build_event_stream_test.sh @@ -154,6 +154,13 @@ genrule( srcs = ["//visibility/hidden:hello"], cmd = "cp $< $@", ) + +genrule( + name = "indirect", + outs = ["indirect.txt"], + srcs = [":cannotsee"], + cmd = "cp $< $@", +) EOF mkdir -p failingtool cat > failingtool/BUILD <<'EOF' @@ -628,18 +635,33 @@ function test_visibility_failure() { bazel shutdown (bazel build --build_event_text_file=$TEST_log \ //visibility:cannotsee && fail "build failure expected") || true - expect_log_once 'reason: ANALYSIS_FAILURE' - expect_log_once '^aborted' + expect_log 'reason: ANALYSIS_FAILURE' + expect_log '^aborted' # The same should hold true, if the server has already analyzed the target (bazel build --build_event_text_file=$TEST_log \ //visibility:cannotsee && fail "build failure expected") || true - expect_log_once 'reason: ANALYSIS_FAILURE' - expect_log_once '^aborted' + expect_log 'reason: ANALYSIS_FAILURE' + expect_log '^aborted' expect_log 'last_message: true' expect_log_once '^build_tool_logs' } +function test_visibility_indirect() { + # verify that an indirect visibility error is reported, including the + # target that violates visibility constraints. + bazel shutdown + (bazel build --build_event_text_file=$TEST_log \ + //visibility:indirect && fail "build failure expected") || true + expect_log 'reason: ANALYSIS_FAILURE' + expect_log '^aborted' + expect_log '//visibility:cannotsee' + # There should be precisely one 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 1 ] \ + || fail "not precisely one target_completed event id" +} + function test_loading_failure_keep_going() { (bazel build --build_event_text_file=$TEST_log \ --noexperimental_skyframe_target_pattern_evaluator \ |