@@ -91,64 +91,62 @@ pub fn parse_config(args: ~[~str]) -> config {
91
91
let matches =
92
92
& match getopts:: groups:: getopts ( args_, groups) {
93
93
Ok ( m) => m,
94
- Err ( f) => fail ! ( getopts :: fail_str ( f ) )
94
+ Err ( f) => fail ! ( f . to_err_msg ( ) )
95
95
} ;
96
96
97
- if getopts :: opt_present ( matches , "h" ) || getopts :: opt_present ( matches , "help" ) {
97
+ if matches . opt_present ( "h" ) || matches . opt_present ( "help" ) {
98
98
let message = fmt ! ( "Usage: %s [OPTIONS] [TESTNAME...]" , argv0) ;
99
99
println ( getopts:: groups:: usage ( message, groups) ) ;
100
100
println ( "" ) ;
101
101
fail ! ( )
102
102
}
103
103
104
104
fn opt_path ( m : & getopts:: Matches , nm : & str ) -> Path {
105
- Path ( getopts :: opt_str ( m , nm ) )
105
+ Path ( m . opt_str ( nm ) . unwrap ( ) )
106
106
}
107
107
108
108
config {
109
- compile_lib_path : getopts :: opt_str ( matches , "compile-lib-path" ) ,
110
- run_lib_path : getopts :: opt_str ( matches , "run-lib-path" ) ,
109
+ compile_lib_path : matches . opt_str ( "compile-lib-path" ) . unwrap ( ) ,
110
+ run_lib_path : matches . opt_str ( "run-lib-path" ) . unwrap ( ) ,
111
111
rustc_path : opt_path ( matches, "rustc-path" ) ,
112
- clang_path : getopts :: opt_maybe_str ( matches, "clang-path" ) . map_move ( |s| Path ( s) ) ,
113
- llvm_bin_path : getopts :: opt_maybe_str ( matches, "llvm-bin-path" ) . map_move ( |s| Path ( s) ) ,
112
+ clang_path : matches. opt_str ( "clang-path" ) . map_move ( |s| Path ( s) ) ,
113
+ llvm_bin_path : matches. opt_str ( "llvm-bin-path" ) . map_move ( |s| Path ( s) ) ,
114
114
src_base : opt_path ( matches, "src-base" ) ,
115
115
build_base : opt_path ( matches, "build-base" ) ,
116
116
aux_base : opt_path ( matches, "aux-base" ) ,
117
- stage_id : getopts :: opt_str ( matches , "stage-id" ) ,
118
- mode : str_mode ( getopts :: opt_str ( matches , "mode" ) ) ,
119
- run_ignored : getopts :: opt_present ( matches , "ignored" ) ,
117
+ stage_id : matches . opt_str ( "stage-id" ) . unwrap ( ) ,
118
+ mode : str_mode ( matches . opt_str ( "mode" ) . unwrap ( ) ) ,
119
+ run_ignored : matches . opt_present ( "ignored" ) ,
120
120
filter :
121
121
if !matches. free . is_empty ( ) {
122
122
Some ( matches. free [ 0 ] . clone ( ) )
123
123
} else {
124
124
None
125
125
} ,
126
- logfile : getopts :: opt_maybe_str ( matches, "logfile" ) . map_move ( |s| Path ( s) ) ,
127
- save_metrics : getopts :: opt_maybe_str ( matches, "save-metrics" ) . map_move ( |s| Path ( s) ) ,
126
+ logfile : matches. opt_str ( "logfile" ) . map_move ( |s| Path ( s) ) ,
127
+ save_metrics : matches. opt_str ( "save-metrics" ) . map_move ( |s| Path ( s) ) ,
128
128
ratchet_metrics :
129
- getopts :: opt_maybe_str ( matches, "ratchet-metrics" ) . map_move ( |s| Path ( s) ) ,
129
+ matches. opt_str ( "ratchet-metrics" ) . map_move ( |s| Path ( s) ) ,
130
130
ratchet_noise_percent :
131
- getopts:: opt_maybe_str ( matches,
132
- "ratchet-noise-percent" ) . map_move ( |s|
133
- from_str :: < f64 > ( s) . unwrap ( ) ) ,
134
- runtool : getopts:: opt_maybe_str ( matches, "runtool" ) ,
135
- rustcflags : getopts:: opt_maybe_str ( matches, "rustcflags" ) ,
136
- jit : getopts:: opt_present ( matches, "jit" ) ,
137
- target : opt_str2 ( getopts:: opt_maybe_str ( matches, "target" ) ) . to_str ( ) ,
138
- adb_path : opt_str2 ( getopts:: opt_maybe_str ( matches, "adb-path" ) ) . to_str ( ) ,
131
+ matches. opt_str ( "ratchet-noise-percent" ) . and_then ( |s| from_str :: < f64 > ( s) ) ,
132
+ runtool : matches. opt_str ( "runtool" ) ,
133
+ rustcflags : matches. opt_str ( "rustcflags" ) ,
134
+ jit : matches. opt_present ( "jit" ) ,
135
+ target : opt_str2 ( matches. opt_str ( "target" ) ) . to_str ( ) ,
136
+ adb_path : opt_str2 ( matches. opt_str ( "adb-path" ) ) . to_str ( ) ,
139
137
adb_test_dir :
140
- opt_str2 ( getopts :: opt_maybe_str ( matches, "adb-test-dir" ) ) . to_str ( ) ,
138
+ opt_str2 ( matches. opt_str ( "adb-test-dir" ) ) . to_str ( ) ,
141
139
adb_device_status :
142
- if ( opt_str2 ( getopts :: opt_maybe_str ( matches, "target" ) ) ==
140
+ if ( opt_str2 ( matches. opt_str ( "target" ) ) ==
143
141
~"arm-linux-androideabi") {
144
- if ( opt_str2 ( getopts :: opt_maybe_str ( matches, "adb-test-dir" ) ) !=
142
+ if ( opt_str2 ( matches. opt_str ( "adb-test-dir" ) ) !=
145
143
~"( none) " &&
146
- opt_str2 ( getopts :: opt_maybe_str ( matches, "adb-test-dir" ) ) !=
144
+ opt_str2 ( matches. opt_str ( "adb-test-dir" ) ) !=
147
145
~"") { true }
148
146
else { false }
149
147
} else { false } ,
150
- test_shard : test:: opt_shard ( getopts :: opt_maybe_str ( matches, "test-shard" ) ) ,
151
- verbose : getopts :: opt_present ( matches , "verbose" )
148
+ test_shard : test:: opt_shard ( matches. opt_str ( "test-shard" ) ) ,
149
+ verbose : matches . opt_present ( "verbose" )
152
150
}
153
151
}
154
152
0 commit comments