aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/test/shell
diff options
context:
space:
mode:
authorGravatar Kristina Chodorow <kchodorow@google.com>2016-09-13 22:33:51 +0000
committerGravatar Dmitry Lomov <dslomov@google.com>2016-09-14 09:36:56 +0000
commitf92ecb3d12a8a966524cda067029dc0aaae409b3 (patch)
tree0e4d982777c21c4ff04dae2fead20b2d1cea5b5e /src/test/shell
parent69a8d7205287bedf3a6140ec9327e2fad1758c22 (diff)
Fix build_file_content overwriting source files
Fixes #1697. -- MOS_MIGRATED_REVID=133056813
Diffstat (limited to 'src/test/shell')
-rwxr-xr-xsrc/test/shell/bazel/local_repository_test.sh30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/test/shell/bazel/local_repository_test.sh b/src/test/shell/bazel/local_repository_test.sh
index 41b5319f6b..1206e8cb49 100755
--- a/src/test/shell/bazel/local_repository_test.sh
+++ b/src/test/shell/bazel/local_repository_test.sh
@@ -1114,4 +1114,34 @@ EOF
bazel build :* || fail "build failed"
}
+# Regression test for #1697.
+function test_overwrite_build_file() {
+ local r=$TEST_TMPDIR/r
+ mkdir -p $r
+ touch $r/WORKSPACE
+ cat > $r/BUILD <<'EOF'
+genrule(
+ name = "orig"
+ cmd = "echo foo > $@",
+ outs = ["orig.out"],
+)
+EOF
+
+ cat > WORKSPACE <<EOF
+new_local_repository(
+ name = "r",
+ path = "$TEST_TMPDIR/r",
+ build_file_content = """
+genrule(
+ name = "rewrite",
+ cmd = "echo bar > \$@",
+ outs = ["rewrite.out"],
+)
+""",
+)
+EOF
+ bazel build @r//... &> $TEST_log || fail "Build failed"
+ assert_contains "orig" $r/BUILD
+}
+
run_suite "local repository tests"