diff options
author | Klaus Aehlig <aehlig@google.com> | 2016-10-26 14:27:48 +0000 |
---|---|---|
committer | Laszlo Csomor <laszlocsomor@google.com> | 2016-10-27 09:24:43 +0000 |
commit | 8a8a7fce075db5fd633f01f65248defdeef4e041 (patch) | |
tree | 612178ae9da53978d063a8617cb75398bea7480d /src/test/shell | |
parent | 4db50640e3799c528b1c893c431227d5d5c192a3 (diff) |
Report completion of a target together with failed actions
Report the completion of all targets together with the root causes on the build
event stream. To do so, have TargetCompleteEvent and ActionExecutedEvent be
instances of BuildEvent; however, ignore an ActionExecutedEvent in the
BuildEventStreamer if the execution was successful.
By this change we get, for the first time, a build event stream that is naturally
closed, i.e., without Aborted events closing up lose ends. Add a test asserting
this property.
--
Change-Id: Ie90dd52ee80deb0fdabdce1da551935522880a1a
Reviewed-on: https://bazel-review.googlesource.com/#/c/6279
MOS_MIGRATED_REVID=137273002
Diffstat (limited to 'src/test/shell')
-rw-r--r-- | src/test/shell/integration/BUILD | 7 | ||||
-rwxr-xr-x | src/test/shell/integration/build_event_stream_test.sh | 68 |
2 files changed, 75 insertions, 0 deletions
diff --git a/src/test/shell/integration/BUILD b/src/test/shell/integration/BUILD index eb131b11c6..c6f0cffb0c 100644 --- a/src/test/shell/integration/BUILD +++ b/src/test/shell/integration/BUILD @@ -173,6 +173,13 @@ sh_test( shard_count = 5, ) +sh_test( + name = "build_event_stream_test", + size = "medium", + srcs = ["build_event_stream_test.sh"], + data = [":test-deps"], +) + test_suite( name = "all_tests", visibility = ["//visibility:public"], diff --git a/src/test/shell/integration/build_event_stream_test.sh b/src/test/shell/integration/build_event_stream_test.sh new file mode 100755 index 0000000000..cbd2f79c9f --- /dev/null +++ b/src/test/shell/integration/build_event_stream_test.sh @@ -0,0 +1,68 @@ +#!/bin/bash +# +# Copyright 2016 The Bazel Authors. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# An end-to-end test that Bazel's experimental UI produces reasonable output. + +# Load the test setup defined in the parent directory +CURRENT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +source "${CURRENT_DIR}/../integration_test_setup.sh" \ + || { echo "integration_test_setup.sh not found!" >&2; exit 1; } + +#### SETUP ############################################################# + +set -e + +function set_up() { + mkdir -p pkg + cat > pkg/true.sh <<EOF +#!/bin/sh +exit 0 +EOF + chmod 755 pkg/true.sh + cat > pkg/BUILD <<EOF +sh_test( + name = "true", + srcs = ["true.sh"], +) +test_suite( + name = "suite", + tests = ["true"], +) +EOF +} + +#### TESTS ############################################################# + +function test_basic() { + # Basic properties of the event stream + # - a completed target explicity requested should be reported + # - after success the stream should close naturally, without any + # reports about aborted events. + bazel test --experimental_build_event_text_file=$TEST_log pkg:true \ + || fail "bazel test failed" + expect_log 'pkg:true' + expect_not_log 'aborted' +} + +function test_suite() { + # ...same true when running a test suite containing that test + bazel test --experimental_build_event_text_file=$TEST_log pkg:suite \ + || fail "bazel test failed" + expect_log 'pkg:true' + expect_not_log 'aborted' +} + +run_suite "Integration tests for the build event stream" |