@@ -91,64 +91,62 @@ pub fn parse_config(args: ~[~str]) -> config {
9191 let matches =
9292 & match getopts:: groups:: getopts ( args_, groups) {
9393 Ok ( m) => m,
94- Err ( f) => fail ! ( getopts :: fail_str ( f ) )
94+ Err ( f) => fail ! ( f . to_err_msg ( ) )
9595 } ;
9696
97- if getopts :: opt_present ( matches , "h" ) || getopts :: opt_present ( matches , "help" ) {
97+ if matches . opt_present ( "h" ) || matches . opt_present ( "help" ) {
9898 let message = fmt ! ( "Usage: %s [OPTIONS] [TESTNAME...]" , argv0) ;
9999 println ( getopts:: groups:: usage ( message, groups) ) ;
100100 println ( "" ) ;
101101 fail ! ( )
102102 }
103103
104104 fn opt_path ( m : & getopts:: Matches , nm : & str ) -> Path {
105- Path ( getopts :: opt_str ( m , nm ) )
105+ Path ( m . opt_str ( nm ) . unwrap ( ) )
106106 }
107107
108108 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 ( ) ,
111111 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) ) ,
114114 src_base : opt_path ( matches, "src-base" ) ,
115115 build_base : opt_path ( matches, "build-base" ) ,
116116 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" ) ,
120120 filter :
121121 if !matches. free . is_empty ( ) {
122122 Some ( matches. free [ 0 ] . clone ( ) )
123123 } else {
124124 None
125125 } ,
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) ) ,
128128 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) ) ,
130130 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 ( ) ,
139137 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 ( ) ,
141139 adb_device_status :
142- if ( opt_str2 ( getopts :: opt_maybe_str ( matches, "target" ) ) ==
140+ if ( opt_str2 ( matches. opt_str ( "target" ) ) ==
143141 ~"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" ) ) !=
145143 ~"( none) " &&
146- opt_str2 ( getopts :: opt_maybe_str ( matches, "adb-test-dir" ) ) !=
144+ opt_str2 ( matches. opt_str ( "adb-test-dir" ) ) !=
147145 ~"") { true }
148146 else { false }
149147 } 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" )
152150 }
153151}
154152
0 commit comments