diff options
author | 2015-07-29 17:51:37 +0000 | |
---|---|---|
committer | 2015-07-30 11:31:14 +0000 | |
commit | d3a726cdb6fbb0483c653264bcd05757f1f04824 (patch) | |
tree | ac8d7e7497b5909a5cff523e6291ad7efa70a825 /src/test | |
parent | 8ff5b3c00216392cd13dba61093c20501b377329 (diff) |
Fix middleman conflicts in external repositories by appending the package path
Fixes #341.
--
MOS_MIGRATED_REVID=99390495
Diffstat (limited to 'src/test')
-rwxr-xr-x | src/test/shell/bazel/workspace_test.sh | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/test/shell/bazel/workspace_test.sh b/src/test/shell/bazel/workspace_test.sh index ec04ffc63f..738d9e6640 100755 --- a/src/test/shell/bazel/workspace_test.sh +++ b/src/test/shell/bazel/workspace_test.sh @@ -72,4 +72,38 @@ function test_path_with_spaces() { bazel help &> $TEST_log || fail "Help failed" } +# Tests for middleman conflict when using workspace repository +function test_middleman_conflict() { + local test_repo1=$TEST_TMPDIR/repo1 + local test_repo2=$TEST_TMPDIR/repo2 + + mkdir -p $test_repo1 + mkdir -p $test_repo2 + echo "1" >$test_repo1/test.in + echo "2" >$test_repo2/test.in + echo 'filegroup(name="test", srcs=["test.in"], visibility=["//visibility:public"])' \ + >$test_repo1/BUILD + echo 'filegroup(name="test", srcs=["test.in"], visibility=["//visibility:public"])' \ + >$test_repo2/BUILD + touch $test_repo1/WORKSPACE + touch $test_repo2/WORKSPACE + + cat > WORKSPACE <<EOF +local_repository(name = 'repo1', path='$test_repo1') +local_repository(name = 'repo2', path='$test_repo2') +EOF + + cat > BUILD <<'EOF' +genrule( + name = "test", + srcs = ["@repo1//:test", "@repo2//:test"], + outs = ["test.out"], + cmd = "cat $(SRCS) >$@" +) +EOF + bazel fetch //:test || fail "Fetch failed" + bazel build //:test || echo "Expected build to succeed" + check_eq "12" "$(cat bazel-genfiles/test.out | tr -d '[[:space:]]')" +} + run_suite "workspace tests" |