diff options
Diffstat (limited to 'src')
-rwxr-xr-x | src/test/shell/bazel/external_integration_test.sh | 34 |
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. |