File tree Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -11,9 +11,7 @@ import io::{reader, reader_util};
11
11
fn main ( argv : [ str ] /~) {
12
12
#macro[
13
13
[ #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)
17
15
]
18
16
] ;
19
17
@@ -27,7 +25,16 @@ fn main(argv: [str]/~) {
27
25
#bench[ vec_push_all] ;
28
26
}
29
27
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
+
31
38
let start = precise_time_s ( ) ;
32
39
test ( ) ;
33
40
let stop = precise_time_s ( ) ;
You can’t perform that action at this time.
0 commit comments