diff options
author | 2015-07-16 15:18:39 +0000 | |
---|---|---|
committer | 2015-07-17 13:17:45 +0000 | |
commit | 6009cf953643af157c395732e058e5af8657a833 (patch) | |
tree | 4f9d8e8bb37fb67f5978333f31cd655fae078058 /src/test/shell | |
parent | 0e544ff8eba6a9576e80a8daf9461b40b837bf05 (diff) |
Invalidate external repository files when the WORKSPACE changes
Fixes #236.
--
MOS_MIGRATED_REVID=98402890
Diffstat (limited to 'src/test/shell')
-rwxr-xr-x | src/test/shell/bazel/workspace_test.sh | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/src/test/shell/bazel/workspace_test.sh b/src/test/shell/bazel/workspace_test.sh index 00bfd85d7b..5519435b30 100755 --- a/src/test/shell/bazel/workspace_test.sh +++ b/src/test/shell/bazel/workspace_test.sh @@ -20,6 +20,49 @@ source $(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/test-setup.sh \ export JAVA_RUNFILES=$TEST_SRCDIR +function setup_repo() { + mkdir -p $1 + touch $1/WORKSPACE + echo $2 > $1/thing + cat > $1/BUILD <<EOF +genrule( + name = "x", + srcs = ["thing"], + cmd = "cat \$(location thing) > \$@", + outs = ["out"], +) +EOF +} + +function test_workspace_changes() { + repo_a=$TEST_TMPDIR/a + repo_b=$TEST_TMPDIR/b + setup_repo $repo_a hi + setup_repo $repo_b bye + + cat > WORKSPACE <<EOF +local_repository( + name = "x", + path = "$repo_a", +) +EOF + + bazel build @x//:x || fail "build failed" + assert_contains "hi" bazel-genfiles/out + + cat > WORKSPACE <<EOF +local_repository( + name = "x", + path = "$repo_b", +) +EOF + + bazel build @x//:x || fail "build failed" + ls -l $(bazel info execution_root)/external/x/ + assert_contains "bye" bazel-genfiles/out +} + + function test_path_with_spaces() { ws="a b" mkdir "$ws" |