|
1 | 1 | # Contribution Guide |
2 | 2 |
|
3 | | -If you want to hack on miri yourself, great! Here are some resources you might |
| 3 | +If you want to hack on Miri yourself, great! Here are some resources you might |
4 | 4 | find useful. |
5 | 5 |
|
6 | 6 | ## Getting started |
@@ -89,6 +89,20 @@ MIRI_LOG=rustc_mir::interpret=info,miri::stacked_borrows ./miri run tests/run-pa |
89 | 89 | In addition, you can set `MIRI_BACKTRACE=1` to get a backtrace of where an |
90 | 90 | evaluation error was originally raised. |
91 | 91 |
|
| 92 | +#### UI testing |
| 93 | + |
| 94 | +We use ui-testing in Miri, meaning we generate `.stderr` and `.stdout` files for the output |
| 95 | +produced by Miri. You can use `./miri bless` to automatically (re)generate these files when |
| 96 | +you add new tests or change how Miri presents certain output. |
| 97 | + |
| 98 | +Note that when you also use `MIRIFLAGS` to change optimizations and similar, the ui output |
| 99 | +will change in unexpected ways. In order to still be able |
| 100 | +to run the other checks while ignoring the ui output, use `MIRI_SKIP_UI_CHECKS=1 ./miri test`. |
| 101 | + |
| 102 | +For more info on how to configure ui tests see [the documentation on the ui test crate][ui_test] |
| 103 | + |
| 104 | +[ui_test]: ui_test/README.md |
| 105 | + |
92 | 106 | ### Testing `cargo miri` |
93 | 107 |
|
94 | 108 | Working with the driver directly gives you full control, but you also lose all |
@@ -183,15 +197,15 @@ A big part of the Miri driver lives in rustc, so working on Miri will sometimes |
183 | 197 | require using a locally built rustc. The bug you want to fix may actually be on |
184 | 198 | the rustc side, or you just need to get more detailed trace of the execution |
185 | 199 | than what is possible with release builds -- in both cases, you should develop |
186 | | -miri against a rustc you compiled yourself, with debug assertions (and hence |
| 200 | +Miri against a rustc you compiled yourself, with debug assertions (and hence |
187 | 201 | tracing) enabled. |
188 | 202 |
|
189 | 203 | The setup for a local rustc works as follows: |
190 | 204 | ```sh |
191 | 205 | # Clone the rust-lang/rust repo. |
192 | 206 | git clone https://github.com/rust-lang/rust rustc |
193 | 207 | cd rustc |
194 | | -# Create a config.toml with defaults for working on miri. |
| 208 | +# Create a config.toml with defaults for working on Miri. |
195 | 209 | ./x.py setup compiler |
196 | 210 | # Now edit `config.toml` and under `[rust]` set `debug-assertions = true`. |
197 | 211 |
|
|
0 commit comments