Skip to content

Commit

Permalink
Change meson test's build failure exit code to 125
Browse files Browse the repository at this point in the history
  • Loading branch information
WSoptics authored and jpakkane committed Jul 12, 2019
1 parent 264533c commit 185238f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
16 changes: 16 additions & 0 deletions man/meson.1
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,18 @@ The default way of running tests is to invoke the default build command:
.B meson test
provides a richer set of tools for invoking tests.

.B meson test
automatically rebuilds the necessary targets to run tests when used with the Ninja backend.
Upon build failure,
.B meson test
will return an exit code of 125.
This return code tells
.B git bisect run
to skip the current commit.
Thus bisecting using git can be done conveniently like this.

.B git bisect run meson test -C build_dir

.SS "options:"
.TP
\fB\-\-repeat\fR
Expand Down Expand Up @@ -214,6 +226,10 @@ Usage error, or an error parsing or executing meson.build.
.B 2
Internal error.
.TP
.B 125
.B meson test
could not rebuild the required targets.
.TP

.SH SEE ALSO

Expand Down
5 changes: 4 additions & 1 deletion mesonbuild/mtest.py
Original file line number Diff line number Diff line change
Expand Up @@ -1021,7 +1021,10 @@ def run(options: argparse.Namespace) -> int:

if not options.list and not options.no_rebuild:
if not rebuild_all(options.wd):
return 1
# We return 125 here in case the build failed.
# The reason is that exit code 125 tells `git bisect run` that the current commit should be skipped.
# Thus users can directly use `meson test` to bisect without needing to handle the does-not-build case separately in a wrapper script.
return 125

with TestHarness(options) as th:
try:
Expand Down

0 comments on commit 185238f

Please sign in to comment.