Skip to content

Commit 077fae6

Browse files
authored
Merge pull request #2287 from rust-lang/tshepang-running-chapter-cleaning
"Running tests" chapter cleaning
2 parents ab76257 + b04865b commit 077fae6

File tree

1 file changed

+28
-28
lines changed

1 file changed

+28
-28
lines changed

src/tests/running.md

+28-28
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ a subset of test collections, and merge queue CI will exercise all of the test
1818
collection.
1919
</div>
2020

21-
```bash
21+
```text
2222
./x test
2323
```
2424

@@ -45,22 +45,22 @@ tests. For example, a good "smoke test" that can be used after modifying rustc
4545
to see if things are generally working correctly would be to exercise the `ui`
4646
test suite ([`tests/ui`]):
4747

48-
```bash
48+
```text
4949
./x test tests/ui
5050
```
5151

5252
Of course, the choice of test suites is
5353
somewhat arbitrary, and may not suit the task you are doing. For example, if you
5454
are hacking on debuginfo, you may be better off with the debuginfo test suite:
5555

56-
```bash
56+
```text
5757
./x test tests/debuginfo
5858
```
5959

6060
If you only need to test a specific subdirectory of tests for any given test
6161
suite, you can pass that directory as a filter to `./x test`:
6262

63-
```bash
63+
```text
6464
./x test tests/ui/const-generics
6565
```
6666

@@ -73,27 +73,27 @@ suite, you can pass that directory as a filter to `./x test`:
7373
7474
Likewise, you can test a single file by passing its path:
7575

76-
```bash
76+
```text
7777
./x test tests/ui/const-generics/const-test.rs
7878
```
7979

8080
`x` doesn't support running a single tool test by passing its path yet. You'll
8181
have to use the `--test-args` argument as described
8282
[below](#running-an-individual-test).
8383

84-
```bash
84+
```text
8585
./x test src/tools/miri --test-args tests/fail/uninit/padding-enum.rs
8686
```
8787

8888
### Run only the tidy script
8989

90-
```bash
90+
```text
9191
./x test tidy
9292
```
9393

9494
### Run tests on the standard library
9595

96-
```bash
96+
```text
9797
./x test --stage 0 library/std
9898
```
9999

@@ -102,13 +102,13 @@ crates, you have to specify those explicitly.
102102

103103
### Run the tidy script and tests on the standard library
104104

105-
```bash
105+
```text
106106
./x test --stage 0 tidy library/std
107107
```
108108

109109
### Run tests on the standard library using a stage 1 compiler
110110

111-
```bash
111+
```text
112112
./x test --stage 1 library/std
113113
```
114114

@@ -122,7 +122,7 @@ the tests **usually** work fine with stage 1, there are some limitations.
122122

123123
### Run all tests using a stage 2 compiler
124124

125-
```bash
125+
```text
126126
./x test --stage 2
127127
```
128128

@@ -134,13 +134,13 @@ You almost never need to do this; CI will run these tests for you.
134134

135135
You may want to run unit tests on a specific file with following:
136136

137-
```bash
137+
```text
138138
./x test compiler/rustc_data_structures/src/thin_vec/tests.rs
139139
```
140140

141141
But unfortunately, it's impossible. You should invoke the following instead:
142142

143-
```bash
143+
```text
144144
./x test compiler/rustc_data_structures/ --test-args thin_vec
145145
```
146146

@@ -151,7 +151,7 @@ often the test they are trying to fix. As mentioned earlier, you may pass the
151151
full file path to achieve this, or alternatively one may invoke `x` with the
152152
`--test-args` option:
153153

154-
```bash
154+
```text
155155
./x test tests/ui --test-args issue-1234
156156
```
157157

@@ -203,7 +203,7 @@ When `--pass $mode` is passed, these tests will be forced to run under the given
203203
`$mode` unless the directive `//@ ignore-pass` exists in the test file. For
204204
example, you can run all the tests in `tests/ui` as `check-pass`:
205205

206-
```bash
206+
```text
207207
./x test tests/ui --pass check
208208
```
209209

@@ -219,7 +219,7 @@ first look for expected output in `foo.polonius.stderr`, falling back to the
219219
usual `foo.stderr` if not found. The following will run the UI test suite in
220220
Polonius mode:
221221

222-
```bash
222+
```text
223223
./x test tests/ui --compare-mode=polonius
224224
```
225225

@@ -232,7 +232,7 @@ just `.rs` files, so after [creating a rustup
232232
toolchain](../building/how-to-build-and-run.md#creating-a-rustup-toolchain), you
233233
can do something like:
234234

235-
```bash
235+
```text
236236
rustc +stage1 tests/ui/issue-1234.rs
237237
```
238238

@@ -252,7 +252,7 @@ execution* so be careful where it is used.
252252
To do this, first build `remote-test-server` for the remote machine, e.g. for
253253
RISC-V
254254

255-
```sh
255+
```text
256256
./x build src/tools/remote-test-server --target riscv64gc-unknown-linux-gnu
257257
```
258258

@@ -264,7 +264,7 @@ On the remote machine, run the `remote-test-server` with the `--bind
264264
0.0.0.0:12345` flag (and optionally `-v` for verbose output). Output should look
265265
like this:
266266

267-
```sh
267+
```text
268268
$ ./remote-test-server -v --bind 0.0.0.0:12345
269269
starting test server
270270
listening on 0.0.0.0:12345!
@@ -278,7 +278,7 @@ restrictive IP address when binding.
278278
You can test if the `remote-test-server` is working by connecting to it and
279279
sending `ping\n`. It should reply `pong`:
280280

281-
```sh
281+
```text
282282
$ nc $REMOTE_IP 12345
283283
ping
284284
pong
@@ -288,15 +288,15 @@ To run tests using the remote runner, set the `TEST_DEVICE_ADDR` environment
288288
variable then use `x` as usual. For example, to run `ui` tests for a RISC-V
289289
machine with the IP address `1.2.3.4` use
290290

291-
```sh
291+
```text
292292
export TEST_DEVICE_ADDR="1.2.3.4:12345"
293293
./x test tests/ui --target riscv64gc-unknown-linux-gnu
294294
```
295295

296296
If `remote-test-server` was run with the verbose flag, output on the test
297297
machine may look something like
298298

299-
```
299+
```text
300300
[...]
301301
run "/tmp/work/test1007/a"
302302
run "/tmp/work/test1008/a"
@@ -362,21 +362,21 @@ codegen-backends = ["llvm", "gcc"]
362362

363363
Then you need to install libgccjit 12. For example with `apt`:
364364

365-
```bash
366-
$ apt install libgccjit-12-dev
365+
```text
366+
apt install libgccjit-12-dev
367367
```
368368

369369
Now you can run the following command:
370370

371-
```bash
372-
$ ./x test compiler/rustc_codegen_gcc/
371+
```text
372+
./x test compiler/rustc_codegen_gcc/
373373
```
374374

375375
If it cannot find the `.so` library (if you installed it with `apt` for example), you
376376
need to pass the library file path with `LIBRARY_PATH`:
377377

378-
```bash
379-
$ LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/12/ ./x test compiler/rustc_codegen_gcc/
378+
```text
379+
LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/12/ ./x test compiler/rustc_codegen_gcc/
380380
```
381381

382382
If you encounter bugs or problems, don't hesitate to open issues on the

0 commit comments

Comments
 (0)