@@ -18,7 +18,7 @@ a subset of test collections, and merge queue CI will exercise all of the test
18
18
collection.
19
19
</div >
20
20
21
- ``` bash
21
+ ``` text
22
22
./x test
23
23
```
24
24
@@ -45,22 +45,22 @@ tests. For example, a good "smoke test" that can be used after modifying rustc
45
45
to see if things are generally working correctly would be to exercise the ` ui `
46
46
test suite ([ ` tests/ui ` ] ):
47
47
48
- ``` bash
48
+ ``` text
49
49
./x test tests/ui
50
50
```
51
51
52
52
Of course, the choice of test suites is
53
53
somewhat arbitrary, and may not suit the task you are doing. For example, if you
54
54
are hacking on debuginfo, you may be better off with the debuginfo test suite:
55
55
56
- ``` bash
56
+ ``` text
57
57
./x test tests/debuginfo
58
58
```
59
59
60
60
If you only need to test a specific subdirectory of tests for any given test
61
61
suite, you can pass that directory as a filter to ` ./x test ` :
62
62
63
- ``` bash
63
+ ``` text
64
64
./x test tests/ui/const-generics
65
65
```
66
66
@@ -73,27 +73,27 @@ suite, you can pass that directory as a filter to `./x test`:
73
73
74
74
Likewise, you can test a single file by passing its path:
75
75
76
- ``` bash
76
+ ``` text
77
77
./x test tests/ui/const-generics/const-test.rs
78
78
```
79
79
80
80
` x ` doesn't support running a single tool test by passing its path yet. You'll
81
81
have to use the ` --test-args ` argument as described
82
82
[ below] ( #running-an-individual-test ) .
83
83
84
- ``` bash
84
+ ``` text
85
85
./x test src/tools/miri --test-args tests/fail/uninit/padding-enum.rs
86
86
```
87
87
88
88
### Run only the tidy script
89
89
90
- ``` bash
90
+ ``` text
91
91
./x test tidy
92
92
```
93
93
94
94
### Run tests on the standard library
95
95
96
- ``` bash
96
+ ``` text
97
97
./x test --stage 0 library/std
98
98
```
99
99
@@ -102,13 +102,13 @@ crates, you have to specify those explicitly.
102
102
103
103
### Run the tidy script and tests on the standard library
104
104
105
- ``` bash
105
+ ``` text
106
106
./x test --stage 0 tidy library/std
107
107
```
108
108
109
109
### Run tests on the standard library using a stage 1 compiler
110
110
111
- ``` bash
111
+ ``` text
112
112
./x test --stage 1 library/std
113
113
```
114
114
@@ -122,7 +122,7 @@ the tests **usually** work fine with stage 1, there are some limitations.
122
122
123
123
### Run all tests using a stage 2 compiler
124
124
125
- ``` bash
125
+ ``` text
126
126
./x test --stage 2
127
127
```
128
128
@@ -134,13 +134,13 @@ You almost never need to do this; CI will run these tests for you.
134
134
135
135
You may want to run unit tests on a specific file with following:
136
136
137
- ``` bash
137
+ ``` text
138
138
./x test compiler/rustc_data_structures/src/thin_vec/tests.rs
139
139
```
140
140
141
141
But unfortunately, it's impossible. You should invoke the following instead:
142
142
143
- ``` bash
143
+ ``` text
144
144
./x test compiler/rustc_data_structures/ --test-args thin_vec
145
145
```
146
146
@@ -151,7 +151,7 @@ often the test they are trying to fix. As mentioned earlier, you may pass the
151
151
full file path to achieve this, or alternatively one may invoke ` x ` with the
152
152
` --test-args ` option:
153
153
154
- ``` bash
154
+ ``` text
155
155
./x test tests/ui --test-args issue-1234
156
156
```
157
157
@@ -203,7 +203,7 @@ When `--pass $mode` is passed, these tests will be forced to run under the given
203
203
` $mode ` unless the directive ` //@ ignore-pass ` exists in the test file. For
204
204
example, you can run all the tests in ` tests/ui ` as ` check-pass ` :
205
205
206
- ``` bash
206
+ ``` text
207
207
./x test tests/ui --pass check
208
208
```
209
209
@@ -219,7 +219,7 @@ first look for expected output in `foo.polonius.stderr`, falling back to the
219
219
usual ` foo.stderr ` if not found. The following will run the UI test suite in
220
220
Polonius mode:
221
221
222
- ``` bash
222
+ ``` text
223
223
./x test tests/ui --compare-mode=polonius
224
224
```
225
225
@@ -232,7 +232,7 @@ just `.rs` files, so after [creating a rustup
232
232
toolchain] ( ../building/how-to-build-and-run.md#creating-a-rustup-toolchain ) , you
233
233
can do something like:
234
234
235
- ``` bash
235
+ ``` text
236
236
rustc +stage1 tests/ui/issue-1234.rs
237
237
```
238
238
@@ -252,7 +252,7 @@ execution* so be careful where it is used.
252
252
To do this, first build ` remote-test-server ` for the remote machine, e.g. for
253
253
RISC-V
254
254
255
- ``` sh
255
+ ``` text
256
256
./x build src/tools/remote-test-server --target riscv64gc-unknown-linux-gnu
257
257
```
258
258
@@ -264,7 +264,7 @@ On the remote machine, run the `remote-test-server` with the `--bind
264
264
0.0.0.0:12345` flag (and optionally ` -v` for verbose output). Output should look
265
265
like this:
266
266
267
- ``` sh
267
+ ``` text
268
268
$ ./remote-test-server -v --bind 0.0.0.0:12345
269
269
starting test server
270
270
listening on 0.0.0.0:12345!
@@ -278,7 +278,7 @@ restrictive IP address when binding.
278
278
You can test if the ` remote-test-server ` is working by connecting to it and
279
279
sending ` ping\n ` . It should reply ` pong ` :
280
280
281
- ``` sh
281
+ ``` text
282
282
$ nc $REMOTE_IP 12345
283
283
ping
284
284
pong
@@ -288,15 +288,15 @@ To run tests using the remote runner, set the `TEST_DEVICE_ADDR` environment
288
288
variable then use ` x ` as usual. For example, to run ` ui ` tests for a RISC-V
289
289
machine with the IP address ` 1.2.3.4 ` use
290
290
291
- ``` sh
291
+ ``` text
292
292
export TEST_DEVICE_ADDR="1.2.3.4:12345"
293
293
./x test tests/ui --target riscv64gc-unknown-linux-gnu
294
294
```
295
295
296
296
If ` remote-test-server ` was run with the verbose flag, output on the test
297
297
machine may look something like
298
298
299
- ```
299
+ ``` text
300
300
[...]
301
301
run "/tmp/work/test1007/a"
302
302
run "/tmp/work/test1008/a"
@@ -362,21 +362,21 @@ codegen-backends = ["llvm", "gcc"]
362
362
363
363
Then you need to install libgccjit 12. For example with ` apt ` :
364
364
365
- ``` bash
366
- $ apt install libgccjit-12-dev
365
+ ``` text
366
+ apt install libgccjit-12-dev
367
367
```
368
368
369
369
Now you can run the following command:
370
370
371
- ``` bash
372
- $ ./x test compiler/rustc_codegen_gcc/
371
+ ``` text
372
+ ./x test compiler/rustc_codegen_gcc/
373
373
```
374
374
375
375
If it cannot find the ` .so ` library (if you installed it with ` apt ` for example), you
376
376
need to pass the library file path with ` LIBRARY_PATH ` :
377
377
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/
380
380
```
381
381
382
382
If you encounter bugs or problems, don't hesitate to open issues on the
0 commit comments