Skip to content

Commit 75370e0

Browse files
committed
Auto merge of rust-lang#11325 - oli-obk:SPEEDTEST, r=flip1995
Fix SPEEDTEST instructions and output * `--nocapture` hasn't been needed anymore since forever (even before `ui_test`) * the result was dividing by 1000 instead of the number of test runs, giving bogus (but still useful for the purpose) timing results. changelog: fix SPEEDTEST instructions and output
2 parents 739faf3 + cd8f12d commit 75370e0

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

book/src/development/speedtest.md

+2-6
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,12 @@ accessed by the `SPEEDTEST` (and `SPEEDTEST_*`) environment variables.
99
To do a simple speed test of a lint (e.g. `allow_attributes`), use this command.
1010

1111
```sh
12-
$ SPEEDTEST=ui TESTNAME="allow_attributes" cargo uitest -- --nocapture
12+
$ SPEEDTEST=ui TESTNAME="allow_attributes" cargo uitest
1313
```
1414

1515
This will test all `ui` tests (`SPEEDTEST=ui`) whose names start with `allow_attributes`. By default, `SPEEDTEST` will
1616
iterate your test 1000 times. But you can change this with `SPEEDTEST_ITERATIONS`.
1717

1818
```sh
19-
$ SPEEDTEST=toml SPEEDTEST_ITERATIONS=100 TESTNAME="semicolon_block" cargo uitest -- --nocapture
19+
$ SPEEDTEST=toml SPEEDTEST_ITERATIONS=100 TESTNAME="semicolon_block" cargo uitest
2020
```
21-
22-
> **WARNING**: Be sure to use `-- --nocapture` at the end of the command to see the average test time. If you don't
23-
> use `-- --nocapture` (e.g. `SPEEDTEST=ui` `TESTNAME="let_underscore_untyped" cargo uitest -- --nocapture`), this
24-
> will not show up.

tests/compile-test.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,11 @@ fn main() {
377377
f();
378378
sum += start.elapsed().as_millis();
379379
}
380-
println!("average {} time: {} millis.", speedtest.to_uppercase(), sum / 1000);
380+
println!(
381+
"average {} time: {} millis.",
382+
speedtest.to_uppercase(),
383+
sum / u128::from(iterations)
384+
);
381385
} else {
382386
run_ui();
383387
run_ui_toml();

0 commit comments

Comments
 (0)