diff options
author | Klaus Aehlig <aehlig@google.com> | 2017-09-29 07:04:24 -0400 |
---|---|---|
committer | John Cater <jcater@google.com> | 2017-09-29 12:14:47 -0400 |
commit | ce1297354cb1175322a024f6d1e9f15f11716895 (patch) | |
tree | afb11c8e2bf41dae6ce2845485011940fbf4c019 /src/test/shell/integration/build_event_stream_test.sh | |
parent | 1020143c53d3f3bb650e02d9912510a4b8010821 (diff) |
BEP: correctly report AliasConfiguredTargets
When reporting the completion of a target specified by an alias,
report the label of the alias, not that of the target being aliased
to.
Change-Id: If8416ceef73b01b7531ffa0012251f25a4e9f062
PiperOrigin-RevId: 170466076
Diffstat (limited to 'src/test/shell/integration/build_event_stream_test.sh')
-rwxr-xr-x | src/test/shell/integration/build_event_stream_test.sh | 35 |
1 files changed, 35 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 6735860865..4dfa85ecc9 100755 --- a/src/test/shell/integration/build_event_stream_test.sh +++ b/src/test/shell/integration/build_event_stream_test.sh @@ -169,6 +169,21 @@ genrule( cmd = "$(location :tool) > $@", ) EOF +mkdir -p alias/actual +cat > alias/actual/BUILD <<'EOF' +genrule( + name = "it", + outs = ["it.txt"], + cmd = "touch $@", + visibility = ["//:__subpackages__"], +) +EOF +cat > alias/BUILD <<'EOF' +alias( + name = "it", + actual = "//alias/actual:it", +) +EOF } #### TESTS ############################################################# @@ -642,4 +657,24 @@ function test_no_tests_found_build_failure() { expect_log 'BUILD_FAILURE' } +function test_alias() { + bazel build --build_event_text_file=$TEST_log alias/... \ + || fail "build failed" + # If alias:it would be reported as the underlying alias/actual:it, then + # there would be no event for alias:it. So we can check the correct reporting + # by checking for aborted events. + expect_not_log 'aborted' + (echo 'g/^completed/?label?p'; echo 'q') | ed "${TEST_log}" > completed_labels + grep -q '//alias:it' completed_labels || fail "//alias:it not completed" + grep -q '//alias/actual:it' completed_labels \ + || fail "//alias/actual:it not completed" + [ `cat completed_labels | wc -l` -eq 2 ] \ + || fail "more than two targets completed" + rm -f completed_labels + bazel build --build_event_text_file=$TEST_log alias:it \ + || fail "build failed" + expect_log 'label: "//alias:it"' + expect_not_log 'label: "//alias/actual' +} + run_suite "Integration tests for the build event stream" |