Skip to content

Commit 7011276

Browse files
varkormark-i-m
authored andcommitted
Mention running tests for subdirectories
1 parent d3a395f commit 7011276

File tree

2 files changed

+22
-3
lines changed

2 files changed

+22
-3
lines changed

src/how-to-build-and-run.md

+4
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,10 @@ in other sections:
297297
more details):
298298
- `./x.py test --stage 1 src/libstd` – runs the `#[test]` tests from libstd
299299
- `./x.py test --stage 1 src/test/run-pass` – runs the `run-pass` test suite
300+
- `./x.py test --stage 1 src/test/ui/const-generics` - runs all the tests in
301+
the `const-generics/` subdirectory of the `ui` test suite
302+
- `./x.py test --stage 1 src/test/ui/const-generics/const-types.rs` - runs
303+
the single test `const-types.rs` from the `ui` test suite
300304

301305
### ctags
302306

src/tests/running.md

+18-3
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,19 @@ the debuginfo test suite:
4747
> ./x.py test --stage 1 src/test/debuginfo
4848
```
4949

50+
If you only need to test a specific subdirectory of tests for any
51+
given test suite, you can pass that directory to `x.py test`:
52+
53+
```bash
54+
> ./x.py test --stage 1 src/test/ui/const-generics
55+
```
56+
57+
Likewise, you can test a single file by passing its path:
58+
59+
```bash
60+
> ./x.py test --stage 1 src/test/ui/const-generics/const-test.rs
61+
```
62+
5063
### Run only the tidy script
5164

5265
```bash
@@ -82,16 +95,18 @@ work well with procedural macros or custom derive tests.
8295
## Running an individual test
8396

8497
Another common thing that people want to do is to run an **individual
85-
test**, often the test they are trying to fix. One way to do this is
86-
to invoke `x.py` with the `--test-args` option:
98+
test**, often the test they are trying to fix. As mentioned earlier,
99+
you may pass the full file path to achieve this, or alternatively one
100+
may invoke `x.py` with the `--test-args` option:
87101

88102
```bash
89103
> ./x.py test --stage 1 src/test/ui --test-args issue-1234
90104
```
91105

92106
Under the hood, the test runner invokes the standard rust test runner
93107
(the same one you get with `#[test]`), so this command would wind up
94-
filtering for tests that include "issue-1234" in the name.
108+
filtering for tests that include "issue-1234" in the name. (Thus
109+
`--test-args` is a good way to run a collection of related tests.)
95110

96111
## Using incremental compilation
97112

0 commit comments

Comments
 (0)