aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Brian Silverman <bsilver16384@gmail.com>2016-01-12 16:47:12 +0000
committerGravatar Damien Martin-Guillerez <dmarting@google.com>2016-01-13 13:02:18 +0000
commit24f5ce4b602c8ab5e17ee96a86da2cc90a06f668 (patch)
tree32ef9098e2161117b67b92e04d475b9b8a2f42fc /src
parentd8df1a7d4b8a1af175e2bda5b379cca4e814cf6b (diff)
Test for extra rebuilds caused by empty files in http_archive etc.
This used to cause spurious rebuilds because the timestamp (which was changed every server restart) is used for deciding whether the file changed or not. Closes #573 -- Change-Id: I0e95910353426b22b61a3573ca7465e1edcedaac Reviewed-on: https://bazel-review.googlesource.com/#/c/2390/ MOS_MIGRATED_REVID=111953023
Diffstat (limited to 'src')
-rwxr-xr-xsrc/test/shell/bazel/external_integration_test.sh34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/test/shell/bazel/external_integration_test.sh b/src/test/shell/bazel/external_integration_test.sh
index 531360fb88..a8b3e97982 100755
--- a/src/test/shell/bazel/external_integration_test.sh
+++ b/src/test/shell/bazel/external_integration_test.sh
@@ -435,6 +435,40 @@ EOF
expect_log "Tra-la!"
}
+function test_empty_file() {
+ rm -f empty
+ touch empty
+ tar czf x.tar.gz empty
+ local sha256=$(sha256sum x.tar.gz | cut -f 1 -d ' ')
+ serve_file x.tar.gz
+
+ cat > WORKSPACE <<EOF
+new_http_archive(
+ name = "x",
+ url = "http://localhost:$nc_port/x.tar.gz",
+ sha256 = "$sha256",
+ build_file = "x.BUILD",
+)
+EOF
+ cat > x.BUILD <<EOF
+exports_files(["empty"])
+EOF
+ cat > BUILD <<'EOF'
+genrule(
+ name = "rule",
+ srcs = ["@x//:empty"],
+ outs = ["timestamp"],
+ cmd = "date > $@",
+)
+EOF
+
+ bazel build //:rule || fail "Build failed"
+ bazel shutdown || fail "Shutdown failed"
+ cp bazel-genfiles/timestamp first_timestamp || fail "No output"
+ sleep 1 # Make sure we're on a different second to avoid false passes.
+ bazel build //:rule || fail "Build failed"
+ diff bazel-genfiles/timestamp first_timestamp || fail "Output was built again"
+}
function test_invalid_rule() {
# http_jar with missing URL field.