@@ -46,32 +46,41 @@ fn parse_config(args: &[str]) -> config {
46
46
getopts:: failure ( f) { fail getopts:: fail_str ( f) }
47
47
} ;
48
48
49
- ret { compile_lib_path: getopts:: opt_str( match , "compile-lib-path" ) ,
50
- run_lib_path: getopts:: opt_str( match , "run-lib-path" ) ,
51
- rustc_path: getopts:: opt_str( match , "rustc-path" ) ,
52
- src_base: getopts:: opt_str( match , "src-base" ) ,
53
- build_base: getopts:: opt_str( match , "build-base" ) ,
54
- stage_id: getopts:: opt_str( match , "stage-id" ) ,
49
+ let cnv = istr:: from_estr;
50
+ let cnvo = fn ( o: & option:: t<str>) -> option:: t<istr> {
51
+ alt o {
52
+ option : : some ( s) { option:: some ( istr:: from_estr ( s) ) }
53
+ option:: none. { option:: none }
54
+ }
55
+ } ;
56
+
57
+ ret { compile_lib_path : cnv ( getopts:: opt_str ( match , "compile-lib-path" ) ) ,
58
+ run_lib_path : cnv ( getopts:: opt_str ( match , "run-lib-path" ) ) ,
59
+ rustc_path : cnv ( getopts:: opt_str ( match , "rustc-path" ) ) ,
60
+ src_base : cnv ( getopts:: opt_str ( match , "src-base" ) ) ,
61
+ build_base : cnv ( getopts:: opt_str ( match , "build-base" ) ) ,
62
+ stage_id : cnv ( getopts:: opt_str ( match , "stage-id" ) ) ,
55
63
mode : str_mode ( getopts:: opt_str ( match , "mode" ) ) ,
56
64
run_ignored : getopts:: opt_present ( match , "ignored" ) ,
57
65
filter:
58
66
if vec:: len ( match . free) > 0 u {
59
- option:: some( match. free [ 0 ] )
67
+ option:: some( cnv ( match. free [ 0 ] ) )
60
68
} else { option:: none } ,
61
- runtool: getopts:: opt_maybe_str( match , "runtool" ) ,
62
- rustcflags: getopts:: opt_maybe_str ( match , "rustcflags" ) ,
69
+ runtool : cnvo ( getopts:: opt_maybe_str ( match , "runtool" ) ) ,
70
+ rustcflags : cnvo ( getopts:: opt_maybe_str ( match , "rustcflags" ) ) ,
63
71
verbose: getopts:: opt_present ( match , "verbose" ) } ;
64
72
}
65
73
66
74
fn log_config ( config: & config) {
67
75
let c = config;
68
76
logv( c, #fmt[ "configuration:" ] ) ;
69
- logv( c, #fmt[ "compile_lib_path: %s" , config. compile_lib_path] ) ;
70
- logv( c, #fmt[ "run_lib_path: %s" , config. run_lib_path] ) ;
71
- logv( c, #fmt[ "rustc_path: %s" , config. rustc_path] ) ;
72
- logv( c, #fmt[ "src_base: %s" , config. src_base] ) ;
73
- logv( c, #fmt[ "build_base: %s" , config. build_base] ) ;
74
- logv( c, #fmt[ "stage_id: %s" , config. stage_id] ) ;
77
+ logv( c, #fmt[ "compile_lib_path: %s" ,
78
+ istr:: to_estr( config. compile_lib_path) ] ) ;
79
+ logv( c, #fmt[ "run_lib_path: %s" , istr:: to_estr( config. run_lib_path) ] ) ;
80
+ logv( c, #fmt[ "rustc_path: %s" , istr:: to_estr( config. rustc_path) ] ) ;
81
+ logv( c, #fmt[ "src_base: %s" , istr:: to_estr( config. src_base) ] ) ;
82
+ logv( c, #fmt[ "build_base: %s" , istr:: to_estr( config. build_base) ] ) ;
83
+ logv( c, #fmt[ "stage_id: %s" , istr:: to_estr( config. stage_id) ] ) ;
75
84
logv( c, #fmt[ "mode: %s" , mode_str( config. mode) ] ) ;
76
85
logv( c, #fmt[ "run_ignored: %b" , config. run_ignored] ) ;
77
86
logv( c, #fmt[ "filter: %s" , opt_str( config. filter) ] ) ;
@@ -81,12 +90,15 @@ fn log_config(config: &config) {
81
90
logv( c, #fmt[ "\n " ] ) ;
82
91
}
83
92
84
- fn opt_str( maybestr: option:: t < str > ) -> str {
85
- alt maybestr { option : : some( s) { s } option:: none . { "(none)" } }
93
+ fn opt_str( maybestr: option:: t < istr > ) -> str {
94
+ alt maybestr {
95
+ option : : some( s) { istr:: to_estr( s) }
96
+ option:: none . { "(none)" }
97
+ }
86
98
}
87
99
88
- fn str_opt( maybestr: str ) -> option:: t<str > {
89
- if maybestr != "(none)" { option:: some ( maybestr) } else { option:: none }
100
+ fn str_opt( maybestr: & istr ) -> option:: t<istr > {
101
+ if maybestr != ~ "( none) " { option:: some ( maybestr) } else { option:: none }
90
102
}
91
103
92
104
fn str_mode ( s : str ) -> mode {
@@ -117,17 +129,23 @@ fn run_tests(config: &config) {
117
129
}
118
130
119
131
fn test_opts ( config : & config ) -> test:: test_opts {
120
- { filter : config. filter, run_ignored : config. run_ignored}
132
+ {
133
+ filter: alt config. filter {
134
+ option:: some ( s) { option:: some ( istr:: to_estr ( s) ) }
135
+ option:: none. { option:: none }
136
+ } ,
137
+ run_ignored: config. run_ignored
138
+ }
121
139
}
122
140
123
141
type tests_and_conv_fn =
124
142
{ tests : [ test:: test_desc ] , to_task : fn ( & fn ( ) ) -> test:: joinable } ;
125
143
126
144
fn make_tests ( cx : & cx ) -> tests_and_conv_fn {
127
- log #fmt[ "making tests from %s" , cx. config. src_base] ;
145
+ log #fmt[ "making tests from %s" , istr :: to_estr ( cx. config . src_base ) ] ;
128
146
let configport = port :: < [ u8 ] > ( ) ;
129
147
let tests = [ ] ;
130
- for file: istr in fs:: list_dir( istr :: from_estr ( cx. config. src_base) ) {
148
+ for file: istr in fs:: list_dir ( cx. config . src_base ) {
131
149
let file = istr:: to_estr ( file) ;
132
150
log #fmt[ "inspecting file %s" , file] ;
133
151
if is_test ( cx. config , file) {
@@ -212,23 +230,43 @@ fn closure_to_task(cx: cx, configport: port<[u8]>, testfn: &fn()) ->
212
230
test:: joinable {
213
231
testfn ( ) ;
214
232
let testfile = recv ( configport) ;
233
+
234
+ let compile_lib_path = cx. config . compile_lib_path ;
235
+ let run_lib_path = cx. config . run_lib_path ;
236
+ let rustc_path = cx. config . rustc_path ;
237
+ let src_base = cx. config . src_base ;
238
+ let build_base = cx. config . build_base ;
239
+ let stage_id = cx. config . stage_id ;
240
+ let mode = istr:: from_estr ( mode_str ( cx. config . mode ) ) ;
241
+ let run_ignored = cx. config . run_ignored ;
242
+ let filter = istr:: from_estr ( opt_str ( cx. config . filter ) ) ;
243
+ let runtool = istr:: from_estr ( opt_str ( cx. config . runtool ) ) ;
244
+ let rustcflags = istr:: from_estr ( opt_str ( cx. config . rustcflags ) ) ;
245
+ let verbose = cx. config . verbose ;
246
+ let chan = cx. procsrv . chan ;
247
+
215
248
let testthunk =
216
- bind run_test_task( cx. config. compile_lib_path, cx. config. run_lib_path,
217
- cx. config. rustc_path, cx. config. src_base,
218
- cx. config. build_base, cx. config. stage_id,
219
- mode_str( cx. config. mode) , cx. config. run_ignored,
220
- opt_str( cx. config. filter) ,
221
- opt_str( cx. config. runtool) ,
222
- opt_str( cx. config. rustcflags) , cx. config. verbose,
223
- cx. procsrv. chan, testfile) ;
249
+ bind run_test_task ( compile_lib_path, run_lib_path,
250
+ rustc_path, src_base,
251
+ build_base, stage_id,
252
+ mode,
253
+ run_ignored,
254
+ filter,
255
+ runtool,
256
+ rustcflags,
257
+ verbose,
258
+ chan,
259
+ testfile) ;
224
260
ret task:: spawn_joinable ( testthunk) ;
225
261
}
226
262
227
- fn run_test_task( compile_lib_path: str , run_lib_path: str , rustc_path: str ,
228
- src_base: str , build_base: str , stage_id: str , mode: str ,
229
- run_ignored: bool , opt_filter: str , opt_runtool: str ,
230
- opt_rustcflags: str , verbose: bool ,
231
- procsrv_chan: procsrv:: reqchan, testfile: -[ u8] ) {
263
+ fn run_test_task ( compile_lib_path : -istr , run_lib_path : -istr ,
264
+ rustc_path : -istr ,
265
+ src_base : -istr , build_base : -istr , stage_id : -istr ,
266
+ mode : -istr ,
267
+ run_ignored : -bool , opt_filter : -istr , opt_runtool : -istr ,
268
+ opt_rustcflags : -istr , verbose : -bool ,
269
+ procsrv_chan : -procsrv:: reqchan , testfile : -[ u8 ] ) {
232
270
233
271
test:: configure_test_task ( ) ;
234
272
@@ -239,7 +277,7 @@ fn run_test_task(compile_lib_path: str, run_lib_path: str, rustc_path: str,
239
277
src_base: src_base,
240
278
build_base: build_base,
241
279
stage_id: stage_id,
242
- mode: str_mode( mode) ,
280
+ mode: str_mode ( istr :: to_estr ( mode) ) ,
243
281
run_ignored: run_ignored,
244
282
filter: str_opt ( opt_filter) ,
245
283
runtool: str_opt ( opt_runtool) ,
0 commit comments