Skip to content

Commit

Permalink
Update docs and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
apiraino committed Apr 15, 2024
1 parent e66020b commit 8dd0ac0
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 3 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## v0.6.9

### Added
- Flags `--term-old` and `--term-new` to allow custom messages when bisecting a regression.

## v0.6.8

### Added
Expand Down
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@ This tool bisects either Rust nightlies or CI artifacts.

[**Documentation**](https://rust-lang.github.io/cargo-bisect-rustc/)

To run the documentation book locally, install [mdBook](https://github.com/rust-lang/mdBook):

``` sh
cd guide
mdbook serve # launch a local server to allow you to easily see and update changes you make
mdbook build # build the book HTML
```

## License

Licensed under either of
Expand Down
28 changes: 28 additions & 0 deletions guide/src/tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,3 +135,31 @@ cargo bisect-rustc --script=./test.sh \

[issue #53157]: https://github.com/rust-lang/rust/issues/53157
[issue #55036]: https://github.com/rust-lang/rust/issues/55036

## Custom bisection messages

[Available from v0.6.9]

You can add custom messages when bisecting a regression. Taking inspiration from git-bisect, with `term-new` and `term-old` you can set custom messages to indicate if a regression matches the condition set by the bisection.

Example:
```sh
cargo bisect-rustc \
--start=2018-08-14 \
--end=2018-10-11 \
--term-old "No, this build did not reproduce the regression, rustc succeeded and compiled" \
--term-new "Yes, this build reproduces the regression, rustc failed to compile"
```

Note that `--term-{old,new}` are aware of the `--regress` parameter. If the bisection is looking for a build to reproduce a regression (i.e. `--regress {error,ice}`), `--term-old` indicates a point in time where the regression does not reproduce and `--term-new` indicates that it does. On the other hand, if `--regress {non-error,non-ice,success}` you are looking into bisecting when a condition of error stopped being reproducible (e.g. some faulty code does not produce an error anymore). In this case `cargo-bisect` flips the meaning of these two parameters.

Example:
```sh
cargo bisect-rustc \
--start=2018-08-14 \
--end=2018-10-11 \
--term-old "This build compiles and it should not" \
--term-new "This build fails to compile and that's the expected behaviour"
```

See [`--regress`](usage.html#regression-check) for more details.
6 changes: 5 additions & 1 deletion tests/cmd/h.stdout
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Options:
(YYYY-MM-DD), git tag name (e.g. 1.58.0) or git commit SHA.
--force-install Force installation over existing artifacts
-h, --help Print help (see more with '--help')
...
--host <HOST> Host triple for the compiler [default: [..]]
--install <INSTALL> Install the given artifact
--preserve Preserve the downloaded artifacts
--preserve-target Preserve the target directory used for builds
Expand All @@ -28,6 +28,10 @@ Options:
-t, --timeout <TIMEOUT> Assume failure after specified number of seconds (for bisecting
hangs)
--target <TARGET> Cross-compilation target platform
--term-new <TERM_NEW> Text shown when a test fails to match the condition requested
[default: "Test condition NOT matched"]
--term-old <TERM_OLD> Text shown when a test does match the condition requested [default:
"Test condition matched"]
--test-dir <TEST_DIR> Root directory for tests [default: .]
-v, --verbose...
-V, --version Print version
Expand Down
12 changes: 11 additions & 1 deletion tests/cmd/help.stdout
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ Options:
fixed
- ice: Marks test outcome as `Regressed` if and only if the `rustc` process issues a
diagnostic indicating that an internal compiler error (ICE) occurred. This covers the
use case for when you want to bisect to see when an ICE was introduced pon a codebase
use case for when you want to bisect to see when an ICE was introduced on a codebase
that is meant to produce a clean error
- non-ice: Marks test outcome as `Regressed` if and only if the `rustc` process does not
issue a diagnostic indicating that an internal compiler error (ICE) occurred. This
Expand All @@ -91,6 +91,16 @@ Options:
--target <TARGET>
Cross-compilation target platform

--term-new <TERM_NEW>
Text shown when a test fails to match the condition requested

[default: "Test condition NOT matched"]

--term-old <TERM_OLD>
Text shown when a test does match the condition requested

[default: "Test condition matched"]

--test-dir <TEST_DIR>
Root directory for tests

Expand Down
2 changes: 1 addition & 1 deletion tests/cmd/start-in-future.stderr
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ERROR: start date should be on or before current date, got start date request: 9999-01-01 and current date is [..]
ERROR: start date should be on or before current date, got start date request: 9999-01-01 and current date is 2024-04-15

0 comments on commit 8dd0ac0

Please sign in to comment.