diff options
author | 2016-06-16 14:55:33 +0000 | |
---|---|---|
committer | 2016-06-17 09:25:05 +0000 | |
commit | 91a7a34fb46fa04165ac90ca095d1272f2a39327 (patch) | |
tree | ec2cb39c908640932cdc13eb8db5889c092fad66 /src/test/shell/bazel/external_integration_test.sh | |
parent | 9b1fb68ea8882aaaacac1d9ee854f50f85eeefa5 (diff) |
Create mark file for local repositories, too
Local repositories were not marked, so if a WS file switched from
remote->local->remote, on the first run the remote rule would create a mark
file, on the second run the local rule would ignore it, and then on the third
run the remote rule would look at the mark file and see, "I'm already
up-to-date," leaving the repository as a local repo.
Fixes #977.
--
MOS_MIGRATED_REVID=125060180
Diffstat (limited to 'src/test/shell/bazel/external_integration_test.sh')
-rwxr-xr-x | src/test/shell/bazel/external_integration_test.sh | 55 |
1 files changed, 39 insertions, 16 deletions
diff --git a/src/test/shell/bazel/external_integration_test.sh b/src/test/shell/bazel/external_integration_test.sh index f41b001639..4873710775 100755 --- a/src/test/shell/bazel/external_integration_test.sh +++ b/src/test/shell/bazel/external_integration_test.sh @@ -281,22 +281,6 @@ EOF expect_log $what_does_the_fox_say } -# Pending proper external file handling -function DISABLED_test_changed_zip() { - nc_port=$(pick_random_unused_tcp_port) || fail "Couldn't get TCP port" - http_archive_helper zip_up - http_archive_helper zip_up "nowrite" - expect_not_log "Downloading from" - local readonly output_base=$(bazel info output_base) - local readonly repo_zip=$output_base/external/endangered/fox.zip - rm $repo_zip || fail "Couldn't delete $repo_zip" - touch $repo_zip || fail "Couldn't touch $repo_zip" - [[ -s $repo_zip ]] && fail "File size not 0" - http_archive_helper zip_up "nowrite" - expect_log "Downloading from" - [[ -s $repo_zip ]] || fail "File size was 0" -} - function test_cached_across_server_restart() { http_archive_helper zip_up bazel shutdown >& $TEST_log || fail "Couldn't shut down" @@ -825,4 +809,43 @@ EOF expect_log "//external:androidsdk" } +function test_flip_flopping() { + REPO_PATH=$TEST_TMPDIR/repo + mkdir -p "$REPO_PATH" + cd "$REPO_PATH" + touch WORKSPACE BUILD foo + zip -r repo.zip * + startup_server $PWD + # Make the remote repo and local repo slightly different. + rm foo + touch bar + cd - + + cat > local_ws <<EOF +local_repository( + name = "repo", + path = "$REPO_PATH", +) +EOF + cat > remote_ws <<EOF +http_archive( + name = "repo", + url = "http://localhost:$fileserver_port/repo.zip", +) +EOF + external_dir=$(bazel info output_base)/external + for i in $(seq 1 3); do + cp local_ws WORKSPACE + bazel build @repo//:all &> $TEST_log || fail "Build failed" + test -L "$external_dir/repo" || fail "creating local symlink failed" + test -a "$external_dir/repo/bar" || fail "bar not found" + cp remote_ws WORKSPACE + bazel build @repo//:all &> $TEST_log || fail "Build failed" + test -d "$external_dir//repo" || fail "creating remote repo failed" + test -a "$external_dir/repo/foo" || fail "foo not found" + done + + shutdown_server +} + run_suite "external tests" |