From a95b3efdd2960ce2866b7086cde50a3770848df9 Mon Sep 17 00:00:00 2001 From: Tobias Werth Date: Tue, 13 Sep 2016 06:32:37 +0000 Subject: Open source discard_analysis_cache_test. -- MOS_MIGRATED_REVID=132965047 --- src/test/shell/integration/BUILD | 7 +++ .../integration/discard_analysis_cache_test.sh | 63 ++++++++++++++++++++++ 2 files changed, 70 insertions(+) create mode 100755 src/test/shell/integration/discard_analysis_cache_test.sh 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 @@ -54,6 +54,13 @@ sh_test( data = [":test-deps"], ) +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", 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 <hello/Hello.java <&$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" -- cgit v1.2.3