Commit Graph

3 Commits

Author SHA1 Message Date
Paul Berry 8b66930364 [presubmits] Print stdout,stderr if CheckSorted result can't be parsed.
Previously, in the `CheckSorted` presubmit check, if
`verify_sorted_test.dart` returned a nonzero exit code but none of its
output lines contained the string `Unsorted file`, then a presubmit
failure would be generated containing an empty string, resulting in
confusing output like this:

    Running presubmit upload checks ...
      18.4s to run CheckChangeOnUpload from /home/paulberry/dart1/sdk/pkg/_fe_analyzer_shared/PRESUBMIT.py.
    ** Presubmit ERRORS: 1 **


    Presubmit checks took 21.4s to calculate.
    There were presubmit errors.

This might happen, for example, if `verify_sorted_test.dart` contained
a compile-time error or threw an unhandled exception.

With this change, the message is `CheckSorted: could not parse output
of verify_sorted_test.dart`, followed by the full stdout and stderr
from the attempt.

This should make this sort of failure a lot easier to debug.

Note: I've made this same fix before to
`pkg/_fe_analyzer_shared/PRESUBMIT.py` (see
https://dart-review.googlesource.com/c/sdk/+/485601). I didn't realize
at the time that the code was duplicated.

Note: This should make it easier to debug
https://github.com/dart-lang/sdk/issues/63464.
Change-Id: I4892dcff7ad6969ca40564c1fd7e62e36a6a6964
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/506605
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2026-05-27 14:34:26 -07:00
Paul Berry 9bd89a769d Work around issue with -r in presubmit scripts.
For some reason, when a `CheckSorted` presubmit invokes
`verify_sorted_test.dart`, the `-r` flag is preventing the compiler
from picking up the proper language version from
`.dart_tool/package_config.json`. This is interfering with my ability
to run presubmits for
https://dart-review.googlesource.com/c/sdk/+/505046.

See https://github.com/dart-lang/sdk/issues/63464 for additional
details.

As a temporary workaround, this CL removes the `-r` flag. It should be
reverted once https://github.com/dart-lang/sdk/issues/63464 has been
fixed (and the pre-built SDK has been updated to include the fix).

Change-Id: Ibc48eec4ef382d6afe17d73454f07dcd6a6a6964
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/506700
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2026-05-27 13:49:54 -07:00
Jake Macdonald 39eba46d91 add presubmit checks for sorting, support only checking changed files
BUG: https://github.com/dart-lang/sdk/issues/52064
Change-Id: Ie45f22cbfb9f97018ba2bf6256f1470abc95a220
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/476980
Commit-Queue: Jake Macdonald <jakemac@google.com>
Auto-Submit: Jake Macdonald <jakemac@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2026-02-02 08:18:20 -08:00