|
| 1 | +# Triaging Crater Runs |
| 2 | + |
| 3 | +## Running crater |
| 4 | + |
| 5 | +We regularly run Crater runs, and this documents the procedure for triaging a beta run; it may also |
| 6 | +be applicable to non-release team runs (e.g., PR crater runs) with minor modifications. |
| 7 | + |
| 8 | +First, file a new issue titled "Crater runs for 1.x" ([example](https://github.com/rust-lang/rust/issues/66244)) |
| 9 | + |
| 10 | +A crater run for beta should be started as soon as we have beta out. Use the following craterbot |
| 11 | +invocations. |
| 12 | + |
| 13 | +$BETA_VERSION is e.g. 1.40.0-1, increment the 1 if it's not the first beta crater run, you can also |
| 14 | +use the auto-incremented counter on the beta `rustc --version`. |
| 15 | + |
| 16 | +$STABLE is e.g. 1.39.0 (the stable release) |
| 17 | +$BETA is beta-YYYY-MM-DD, get the date by looking at https://static.rust-lang.org/manifests.txt and |
| 18 | +get the date of the most recent channel-rust-beta.toml. |
| 19 | + |
| 20 | +``` |
| 21 | +@craterbot run name=beta-$BETA_VERSION start=$STABLE end=$BETA mode=build-and-test cap-lints=warn p=10 |
| 22 | +@craterbot run name=beta-rustdoc-$BETA_VERSION start=$STABLE end=$BETA mode=rustdoc cap-lints=warn p=5 |
| 23 | +``` |
| 24 | + |
| 25 | +Once the runs complete, you want to triage them |
| 26 | + |
| 27 | +## Triaging |
| 28 | + |
| 29 | +These steps should generally be done for the normal rustc run, and then followed up by a triage of |
| 30 | +the rustdoc run. Ignore failures in rustdoc that look to be rooted in rustc (i.e., duplicate |
| 31 | +failures). |
| 32 | + |
| 33 | +There will usually be quite a few regressions -- there are a couple tools that can help reduce the |
| 34 | +amount of work that you need to do. It's mostly a matter of personal preference which is more |
| 35 | +helpful. |
| 36 | + |
| 37 | + * https://github.com/Mark-Simulacrum/crater-generate-report/ |
| 38 | + * This groups regressions by 'root' by parsing the logs to look for the compilation failed |
| 39 | + messages printed by Cargo |
| 40 | + * https://github.com/Centril/crater-cat-errors |
| 41 | + * This groups regressions by the "error" message, also by parsing logs |
| 42 | + |
| 43 | +If you've written a tool, feel free to add it here! We're still figuring out what the best UI for |
| 44 | +this is. |
| 45 | + |
| 46 | +Regardless of the tool you've run, you ultimately need to read through a bunch of logs and try to |
| 47 | +quickly determine if they're genuine failures or spurious. Most of the time, a compiler failure is |
| 48 | +genuine, and test failures are mostly spurious, but this usually requires some level of guessing. |
| 49 | + |
| 50 | +Once you've determined that something is a genuine failure, add it to a list somewhere (local file, |
| 51 | +HackMD, whatever) with the error "category." Mostly, you're trying to group things such that the |
| 52 | +regressions in a single group are all caused by the same set of commits, and different groups have |
| 53 | +different causes. |
| 54 | + |
| 55 | +Once this is done, and you have all the regressions triaged into their separate groups, you want to |
| 56 | +file a new issue for each group. It should have the `regression-from-stable-to-beta` and |
| 57 | +`T-compiler` label by default, possibly `T-libs` if it's a standard library regression, but that's |
| 58 | +relatively rare. If you happen to think you know the PR that caused the failure, cc the PR author in |
| 59 | +a separate comment and link to the PR; otherwise compiler team will triage the issue soon. |
| 60 | + |
| 61 | +Leave a comment on the original issue with the crater runs linking to all the issues you just |
| 62 | +opened, ideally with the issue titles as well. |
| 63 | + |
| 64 | +You're done! |
| 65 | + |
| 66 | +## Re-running rustc on a crate |
| 67 | + |
| 68 | +For the crates which we're not sure about, you can try running crater locally, or build the crate |
| 69 | +directly ([`cratesio-curl`] can be helpful). Be careful -- regardless of what you do, you are running arbitrary code locally. It's |
| 70 | +also fine to file issues for the crates you're not sure about and let the triage process naturally |
| 71 | +categorize the error, though it's not good to do this for *all* the crates. Once you've triaged a |
| 72 | +crater run a couple times you get a pretty good sense of what is spurious and what isn't, too. |
| 73 | + |
| 74 | +You can run crater on just a single crate by doing something like this (at least, as of now). |
| 75 | +Note that this will download several gigabytes (on first use) and requires Docker to be running. |
| 76 | + |
| 77 | +``` |
| 78 | +git clone https://github.com/rust-lang/crater |
| 79 | +cd crater |
| 80 | +cargo run -- prepare-local |
| 81 | +CRATES="crates-io-crate-0.4.0,owner/repository-name" # Edit this. |
| 82 | +cargo run -- define-ex --crate-select=list:$CRATES --cap-lints=forbid 1.38.0 beta # Edit the stable version. |
| 83 | +cargo run -- run-graph --threads 4 |
| 84 | +cargo run -- gen-report work/ex/default/ |
| 85 | +# view report for this crate |
| 86 | +``` |
| 87 | + |
| 88 | +It's also possible to re-queue a subset of crates onto the official builders, for which that take a |
| 89 | +look at: https://gist.github.com/ecstatic-morse/be799bfa4d3b3d6e163fa61a9c30706f |
| 90 | + |
| 91 | +[`cratesio-curl`]: https://gist.githubusercontent.com/lqd/4a8af10389d10840d90655c109df5eac/raw/1bb8ac86e211b745b1674041bc725a859b390c3c/cratesio-curl |
| 92 | + |
| 93 | +## Determining the root cause of the regression |
| 94 | + |
| 95 | +It's not always apparent why a crate stopped building. This isn't generally something done as part |
| 96 | +of crater triage -- but can be a good followup. Here, [`cargo-bisect-rustc`] and Felix's |
| 97 | +[minimization guide] are excellent tools to apply. |
| 98 | + |
| 99 | +[`cargo-bisect-rustc`]: https://github.com/rust-lang/cargo-bisect-rustc |
| 100 | +[minimization guide]: http://blog.pnkfx.org/blog/2019/11/18/rust-bug-minimization-patterns/ |
0 commit comments