aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Tobias Werth <twerth@google.com>2016-09-13 06:32:37 +0000
committerGravatar Dmitry Lomov <dslomov@google.com>2016-09-13 12:31:50 +0000
commita95b3efdd2960ce2866b7086cde50a3770848df9 (patch)
tree4f3ca2167cc0a7c5c4caf1ffb7cad22d5d1a416e
parent85ac641ddf5adde31b5d2f58b76ae5db251218a9 (diff)
Open source discard_analysis_cache_test.
-- MOS_MIGRATED_REVID=132965047
-rw-r--r--src/test/shell/integration/BUILD7
-rwxr-xr-xsrc/test/shell/integration/discard_analysis_cache_test.sh63
2 files changed, 70 insertions, 0 deletions
diff --git a/src/test/shell/integration/BUILD b/src/test/shell/integration/BUILD
index b83da2bfa9..c0fb69754b 100644
--- a/src/test/shell/integration/BUILD
+++ b/src/test/shell/integration/BUILD
@@ -55,6 +55,13 @@ sh_test(
)
sh_test(
+ name = "discard_analysis_cache_test",
+ size = "medium",
+ srcs = ["discard_analysis_cache_test.sh"],
+ data = [":test-deps"],
+)
+
+sh_test(
name = "ui_test",
size = "medium",
srcs = ["ui_test.sh"],
diff --git a/src/test/shell/integration/discard_analysis_cache_test.sh b/src/test/shell/integration/discard_analysis_cache_test.sh
new file mode 100755
index 0000000000..425ffbf2fa
--- /dev/null
+++ b/src/test/shell/integration/discard_analysis_cache_test.sh
@@ -0,0 +1,63 @@
+#!/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.
+#
+# A test for --discard_analysis_cache.
+
+
+# Load test environment
+source $(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/testenv.sh \
+ || { echo "testenv.sh not found!" >&2; exit 1; }
+
+put_bazel_on_path
+create_and_cd_client
+write_default_bazelrc
+
+function write_hello_world_files() {
+ mkdir -p hello || fail "mkdir hello failed"
+ cat >hello/BUILD <<EOF
+java_binary(name = 'hello',
+ srcs = ['Hello.java'],
+ main_class = 'Hello')
+EOF
+
+ cat >hello/Hello.java <<EOF
+public class Hello {
+ public static void main(String[] args) {
+ System.out.println("hello!");
+ }
+}
+EOF
+}
+
+#### TESTS #############################################################
+
+function test_compile_helloworld() {
+ write_hello_world_files
+ bazel run --discard_analysis_cache hello:hello >&$TEST_log \
+ || fail "Build failed"
+ expect_log 'hello!'
+
+ bazel run --discard_analysis_cache hello:hello >&$TEST_log \
+ || fail "Build failed"
+ expect_log 'hello!'
+
+ # Check that further incremental builds work fine.
+ bazel run hello:hello >&$TEST_log \
+ || fail "Build failed"
+ expect_log 'hello!'
+}
+
+run_suite "test for --discard_analysis_cache"