aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Klaus Aehlig <aehlig@google.com>2016-03-15 13:02:52 +0000
committerGravatar Kristina Chodorow <kchodorow@google.com>2016-03-15 20:30:36 +0000
commitd5faa98bc43561a990e9ff701605a92563103a44 (patch)
tree2a0be2bd741582f852ba0cc625aecd1fbe376294 /src
parent5f38d9e6c4dc7cc53d7ac21d1224d48882ee4953 (diff)
Add an integration test for --experimental_ui
Add end-to-end tests for very basic properties of the new experimental UI. - At some point during a successful build, we should see an N / M actions progress bar status indicator. - Curses are used to erase some lines. - On a successful test, PASS is written in green. - On a failed test, FAIL is written in red bold. -- Change-Id: I0130017949330882ca6b33552cd288286a4f5b6f Reviewed-on: https://bazel-review.googlesource.com/#/c/3080 MOS_MIGRATED_REVID=117230615
Diffstat (limited to 'src')
-rw-r--r--src/test/shell/integration/BUILD7
-rwxr-xr-xsrc/test/shell/integration/experimental_ui_test.sh77
2 files changed, 84 insertions, 0 deletions
diff --git a/src/test/shell/integration/BUILD b/src/test/shell/integration/BUILD
index 5f25ab8c2f..b900612b28 100644
--- a/src/test/shell/integration/BUILD
+++ b/src/test/shell/integration/BUILD
@@ -24,6 +24,13 @@ sh_test(
shard_count = 4,
)
+sh_test(
+ name = "experimental_ui_test",
+ size = "medium",
+ srcs = ["experimental_ui_test.sh"],
+ data = [":test-deps"],
+)
+
test_suite(
name = "all_tests",
visibility = ["//visibility:public"],
diff --git a/src/test/shell/integration/experimental_ui_test.sh b/src/test/shell/integration/experimental_ui_test.sh
new file mode 100755
index 0000000000..2959d6e3f2
--- /dev/null
+++ b/src/test/shell/integration/experimental_ui_test.sh
@@ -0,0 +1,77 @@
+#!/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 test environment
+source $(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/testenv.sh \
+ || { echo "testenv.sh not found!" >&2; exit 1; }
+
+create_and_cd_client
+put_bazel_on_path
+write_default_bazelrc
+
+#### 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/false.sh <<EOF
+#!/bin/sh
+exit 1
+EOF
+ chmod 755 pkg/false.sh
+ cat > pkg/BUILD <<EOF
+sh_test(
+ name = "true",
+ srcs = ["true.sh"],
+)
+sh_test(
+ name = "false",
+ srcs = ["false.sh"],
+)
+EOF
+}
+
+#### TESTS #############################################################
+
+function test_basic_progress() {
+ bazel test --experimental_ui --curses=yes --color=yes pkg:true 2>$TEST_log || fail "bazel test failed"
+ # some progress indicator is shown
+ expect_log '\[[0-9,]* / [0-9,]*\]'
+ # curses are used to delete at least one line
+ expect_log $'\x1b\[1A\x1b\[K'
+}
+
+function test_pass() {
+ bazel test --experimental_ui --curses=yes --color=yes pkg:true >$TEST_log || fail "bazel test failed"
+ # PASS is written in green on the same line as the test target
+ expect_log 'pkg:true.*'$'\x1b\[32m''.*PASS'
+}
+
+function test_fail() {
+ bazel test --experimental_ui --curses=yes --color=yes pkg:false >$TEST_log && fail "expected failure"
+ # FAIL is written in red bold on the same line as the test target
+ expect_log 'pkg:false.*'$'\x1b\[31m\x1b\[1m''.*FAIL'
+}
+
+run_suite "Integration tests for bazel's experimental UI"