@@ -102,15 +102,15 @@ pub fn parse_config(args: ~[~str]) -> config {
102
102
}
103
103
104
104
fn opt_path ( m : & getopts:: Matches , nm : & str ) -> Path {
105
- Path ( m. opt_str ( nm) . unwrap ( ) )
105
+ Path :: new ( m. opt_str ( nm) . unwrap ( ) )
106
106
}
107
107
108
108
config {
109
109
compile_lib_path : matches. opt_str ( "compile-lib-path" ) . unwrap ( ) ,
110
110
run_lib_path : matches. opt_str ( "run-lib-path" ) . unwrap ( ) ,
111
111
rustc_path : opt_path ( matches, "rustc-path" ) ,
112
- clang_path : matches. opt_str ( "clang-path" ) . map ( |s| Path ( s) ) ,
113
- llvm_bin_path : matches. opt_str ( "llvm-bin-path" ) . map ( |s| Path ( s) ) ,
112
+ clang_path : matches. opt_str ( "clang-path" ) . map ( |s| Path :: new ( s) ) ,
113
+ llvm_bin_path : matches. opt_str ( "llvm-bin-path" ) . map ( |s| Path :: new ( 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" ) ,
@@ -123,10 +123,10 @@ pub fn parse_config(args: ~[~str]) -> config {
123
123
} else {
124
124
None
125
125
} ,
126
- logfile : matches. opt_str ( "logfile" ) . map ( |s| Path ( s) ) ,
127
- save_metrics : matches. opt_str ( "save-metrics" ) . map ( |s| Path ( s) ) ,
126
+ logfile : matches. opt_str ( "logfile" ) . map ( |s| Path :: new ( s) ) ,
127
+ save_metrics : matches. opt_str ( "save-metrics" ) . map ( |s| Path :: new ( s) ) ,
128
128
ratchet_metrics :
129
- matches. opt_str ( "ratchet-metrics" ) . map ( |s| Path ( s) ) ,
129
+ matches. opt_str ( "ratchet-metrics" ) . map ( |s| Path :: new ( s) ) ,
130
130
ratchet_noise_percent :
131
131
matches. opt_str ( "ratchet-noise-percent" ) . and_then ( |s| from_str :: < f64 > ( s) ) ,
132
132
runtool : matches. opt_str ( "runtool" ) ,
@@ -155,9 +155,9 @@ pub fn log_config(config: &config) {
155
155
logv ( c, format ! ( "configuration:" ) ) ;
156
156
logv ( c, format ! ( "compile_lib_path: {}" , config. compile_lib_path) ) ;
157
157
logv ( c, format ! ( "run_lib_path: {}" , config. run_lib_path) ) ;
158
- logv ( c, format ! ( "rustc_path: {}" , config. rustc_path. to_str ( ) ) ) ;
159
- logv ( c, format ! ( "src_base: {}" , config. src_base. to_str ( ) ) ) ;
160
- logv ( c, format ! ( "build_base: {}" , config. build_base. to_str ( ) ) ) ;
158
+ logv ( c, format ! ( "rustc_path: {}" , config. rustc_path. display ( ) ) ) ;
159
+ logv ( c, format ! ( "src_base: {}" , config. src_base. display ( ) ) ) ;
160
+ logv ( c, format ! ( "build_base: {}" , config. build_base. display ( ) ) ) ;
161
161
logv ( c, format ! ( "stage_id: {}" , config. stage_id) ) ;
162
162
logv ( c, format ! ( "mode: {}" , mode_str( config. mode) ) ) ;
163
163
logv ( c, format ! ( "run_ignored: {}" , config. run_ignored) ) ;
@@ -245,12 +245,12 @@ pub fn test_opts(config: &config) -> test::TestOpts {
245
245
246
246
pub fn make_tests ( config : & config ) -> ~[ test:: TestDescAndFn ] {
247
247
debug2 ! ( "making tests from {}" ,
248
- config. src_base. to_str ( ) ) ;
248
+ config. src_base. display ( ) ) ;
249
249
let mut tests = ~[ ] ;
250
250
let dirs = os:: list_dir_path ( & config. src_base ) ;
251
251
for file in dirs. iter ( ) {
252
252
let file = file. clone ( ) ;
253
- debug2 ! ( "inspecting file {}" , file. to_str ( ) ) ;
253
+ debug2 ! ( "inspecting file {}" , file. display ( ) ) ;
254
254
if is_test ( config, & file) {
255
255
let t = do make_test ( config, & file) {
256
256
match config. mode {
@@ -272,7 +272,7 @@ pub fn is_test(config: &config, testfile: &Path) -> bool {
272
272
_ => ~[ ~". rc", ~". rs "]
273
273
} ;
274
274
let invalid_prefixes = ~[ ~". ", ~"#", ~" ~"] ;
275
- let name = testfile. filename ( ) . unwrap ( ) ;
275
+ let name = testfile. filename_str ( ) . unwrap ( ) ;
276
276
277
277
let mut valid = false ;
278
278
@@ -303,9 +303,9 @@ pub fn make_test_name(config: &config, testfile: &Path) -> test::TestName {
303
303
304
304
// Try to elide redundant long paths
305
305
fn shorten ( path : & Path ) -> ~str {
306
- let filename = path. filename ( ) ;
307
- let p = path. pop ( ) ;
308
- let dir = p. filename ( ) ;
306
+ let filename = path. filename_str ( ) ;
307
+ let p = path. dir_path ( ) ;
308
+ let dir = p. filename_str ( ) ;
309
309
format ! ( "{}/{}" , dir. unwrap_or( "" ) , filename. unwrap_or( "" ) )
310
310
}
311
311
@@ -317,13 +317,15 @@ pub fn make_test_name(config: &config, testfile: &Path) -> test::TestName {
317
317
pub fn make_test_closure ( config : & config , testfile : & Path ) -> test:: TestFn {
318
318
use std:: cell:: Cell ;
319
319
let config = Cell :: new ( ( * config) . clone ( ) ) ;
320
- let testfile = Cell :: new ( testfile. to_str ( ) ) ;
320
+ // FIXME (#9639): This needs to handle non-utf8 paths
321
+ let testfile = Cell :: new ( testfile. as_str ( ) . unwrap ( ) . to_owned ( ) ) ;
321
322
test:: DynTestFn ( || { runtest:: run ( config. take ( ) , testfile. take ( ) ) } )
322
323
}
323
324
324
325
pub fn make_metrics_test_closure ( config : & config , testfile : & Path ) -> test:: TestFn {
325
326
use std:: cell:: Cell ;
326
327
let config = Cell :: new ( ( * config) . clone ( ) ) ;
327
- let testfile = Cell :: new ( testfile. to_str ( ) ) ;
328
+ // FIXME (#9639): This needs to handle non-utf8 paths
329
+ let testfile = Cell :: new ( testfile. as_str ( ) . unwrap ( ) . to_owned ( ) ) ;
328
330
test:: DynMetricFn ( |mm| { runtest:: run_metrics ( config. take ( ) , testfile. take ( ) , mm) } )
329
331
}
0 commit comments