Skip to content

Commit 61b1875

Browse files
committed
make core-std respect RUST_BENCH
1 parent 6f57c61 commit 61b1875

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

src/test/bench/core-std.rs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,7 @@ import io::{reader, reader_util};
1111
fn main(argv: [str]/~) {
1212
#macro[
1313
[#bench[id],
14-
if tests.len() == 0 || vec::contains(tests, #stringify(id)) {
15-
run_test(#stringify(id), id);
16-
}
14+
maybe_run_test(argv, #stringify(id), id)
1715
]
1816
];
1917

@@ -27,7 +25,16 @@ fn main(argv: [str]/~) {
2725
#bench[vec_push_all];
2826
}
2927

30-
fn run_test(name: str, test: fn()) {
28+
fn maybe_run_test(argv: [str]/&, name: str, test: fn()) {
29+
let mut run_test = false;
30+
31+
if os::getenv("RUST_BENCH").is_some() { run_test = true }
32+
else if argv.len() > 0 {
33+
run_test = argv.contains("all") || argv.contains(name)
34+
}
35+
36+
if !run_test { ret }
37+
3138
let start = precise_time_s();
3239
test();
3340
let stop = precise_time_s();

0 commit comments

Comments
 (0)