diff options
author | Klaus Aehlig <aehlig@google.com> | 2018-06-15 06:45:07 -0700 |
---|---|---|
committer | Copybara-Service <copybara-piper@google.com> | 2018-06-15 06:46:42 -0700 |
commit | 1b8d317a46e11157745871681e0c8f0ea0e94906 (patch) | |
tree | 6362dd0d38f442c6c00b303afb1ee91523174a43 /src/test/shell | |
parent | 0d0bc63f056da44ebf32a93586191763f12dc141 (diff) |
sync: also report errors
If a failure occurs during the syncing of the external repositories,
not only set the exit code, but also report the error message.
Change-Id: I3a0e19039ab4444e811c8cff4e6f9b33331a0e02
PiperOrigin-RevId: 200709468
Diffstat (limited to 'src/test/shell')
-rwxr-xr-x | src/test/shell/bazel/workspace_resolved_test.sh | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/test/shell/bazel/workspace_resolved_test.sh b/src/test/shell/bazel/workspace_resolved_test.sh index d00202275c..624a90f7fc 100755 --- a/src/test/shell/bazel/workspace_resolved_test.sh +++ b/src/test/shell/bazel/workspace_resolved_test.sh @@ -278,4 +278,29 @@ EOF bazel build :a :b || fail "Expected both repositories to be present" } +test_sync_debug_and_errors_printed() { + rm -rf fetchrepo + mkdir fetchrepo + cd fetchrepo + cat > rule.bzl <<'EOF' +def _broken_rule_impl(ctx): + print("DEBUG-message") + fail("Failure-message") + +broken_rule = repository_rule( + implementation = _broken_rule_impl, + attrs = {}, +) +EOF + touch BUILD + cat > WORKSPACE <<'EOF' +load("//:rule.bzl", "broken_rule") + +broken_rule(name = "broken") +EOF + bazel sync > "${TEST_log}" 2>&1 && fail "expected failure" || : + expect_log "DEBUG-message" + expect_log "Failure-message" +} + run_suite "workspace_resolved_test tests" |