13
13
#![ feature( slicing_syntax, unboxed_closures) ]
14
14
#![ feature( box_syntax) ]
15
15
#![ feature( int_uint) ]
16
+ #![ feature( test) ]
17
+ #![ feature( rustc_private) ]
18
+ #![ feature( std_misc) ]
19
+ #![ feature( path) ]
20
+ #![ feature( io) ]
21
+ #![ feature( core) ]
22
+ #![ feature( collections) ]
23
+ #![ feature( os) ]
24
+ #![ feature( unicode) ]
16
25
17
26
#![ deny( warnings) ]
18
27
@@ -21,7 +30,6 @@ extern crate getopts;
21
30
22
31
#[ macro_use]
23
32
extern crate log;
24
- extern crate regex;
25
33
26
34
use std:: os;
27
35
use std:: io;
@@ -32,7 +40,6 @@ use getopts::{optopt, optflag, reqopt};
32
40
use common:: Config ;
33
41
use common:: { Pretty , DebugInfoGdb , DebugInfoLldb , Codegen } ;
34
42
use util:: logv;
35
- use regex:: Regex ;
36
43
37
44
pub mod procsrv;
38
45
pub mod util;
@@ -76,10 +83,6 @@ pub fn parse_config(args: Vec<String> ) -> Config {
76
83
optopt( "" , "target-rustcflags" , "flags to pass to rustc for target" , "FLAGS" ) ,
77
84
optflag( "" , "verbose" , "run tests verbosely, showing all output" ) ,
78
85
optopt( "" , "logfile" , "file to log test execution to" , "FILE" ) ,
79
- optopt( "" , "save-metrics" , "file to save metrics to" , "FILE" ) ,
80
- optopt( "" , "ratchet-metrics" , "file to ratchet metrics against" , "FILE" ) ,
81
- optopt( "" , "ratchet-noise-percent" ,
82
- "percent change in metrics to consider noise" , "N" ) ,
83
86
optflag( "" , "jit" , "run tests under the JIT" ) ,
84
87
optopt( "" , "target" , "the target to build for" , "TARGET" ) ,
85
88
optopt( "" , "host" , "the host to build for" , "HOST" ) ,
@@ -89,7 +92,6 @@ pub fn parse_config(args: Vec<String> ) -> Config {
89
92
optopt( "" , "adb-path" , "path to the android debugger" , "PATH" ) ,
90
93
optopt( "" , "adb-test-dir" , "path to tests for the android debugger" , "PATH" ) ,
91
94
optopt( "" , "lldb-python-dir" , "directory containing LLDB's python module" , "PATH" ) ,
92
- optopt( "" , "test-shard" , "run shard A, of B shards, worth of the testsuite" , "A.B" ) ,
93
95
optflag( "h" , "help" , "show this message" ) ) ;
94
96
95
97
assert ! ( !args. is_empty( ) ) ;
@@ -120,14 +122,7 @@ pub fn parse_config(args: Vec<String> ) -> Config {
120
122
}
121
123
122
124
let filter = if !matches. free . is_empty ( ) {
123
- let s = matches. free [ 0 ] . as_slice ( ) ;
124
- match regex:: Regex :: new ( s) {
125
- Ok ( re) => Some ( re) ,
126
- Err ( e) => {
127
- println ! ( "failed to parse filter /{}/: {:?}" , s, e) ;
128
- panic ! ( )
129
- }
130
- }
125
+ Some ( matches. free [ 0 ] . clone ( ) )
131
126
} else {
132
127
None
133
128
} ;
@@ -149,14 +144,7 @@ pub fn parse_config(args: Vec<String> ) -> Config {
149
144
. as_slice ( ) ) . expect ( "invalid mode" ) ,
150
145
run_ignored : matches. opt_present ( "ignored" ) ,
151
146
filter : filter,
152
- cfail_regex : Regex :: new ( errors:: EXPECTED_PATTERN ) . unwrap ( ) ,
153
147
logfile : matches. opt_str ( "logfile" ) . map ( |s| Path :: new ( s) ) ,
154
- save_metrics : matches. opt_str ( "save-metrics" ) . map ( |s| Path :: new ( s) ) ,
155
- ratchet_metrics :
156
- matches. opt_str ( "ratchet-metrics" ) . map ( |s| Path :: new ( s) ) ,
157
- ratchet_noise_percent :
158
- matches. opt_str ( "ratchet-noise-percent" )
159
- . and_then ( |s| s. as_slice ( ) . parse :: < f64 > ( ) ) ,
160
148
runtool : matches. opt_str ( "runtool" ) ,
161
149
host_rustcflags : matches. opt_str ( "host-rustcflags" ) ,
162
150
target_rustcflags : matches. opt_str ( "target-rustcflags" ) ,
@@ -175,7 +163,6 @@ pub fn parse_config(args: Vec<String> ) -> Config {
175
163
opt_str2 ( matches. opt_str ( "adb-test-dir" ) ) . as_slice ( ) &&
176
164
!opt_str2 ( matches. opt_str ( "adb-test-dir" ) ) . is_empty ( ) ,
177
165
lldb_python_dir : matches. opt_str ( "lldb-python-dir" ) ,
178
- test_shard : test:: opt_shard ( matches. opt_str ( "test-shard" ) ) ,
179
166
verbose : matches. opt_present ( "verbose" ) ,
180
167
}
181
168
}
@@ -209,10 +196,6 @@ pub fn log_config(config: &Config) {
209
196
logv ( c, format ! ( "adb_test_dir: {:?}" , config. adb_test_dir) ) ;
210
197
logv ( c, format ! ( "adb_device_status: {}" ,
211
198
config. adb_device_status) ) ;
212
- match config. test_shard {
213
- None => logv ( c, "test_shard: (all)" . to_string ( ) ) ,
214
- Some ( ( a, b) ) => logv ( c, format ! ( "test_shard: {}.{}" , a, b) )
215
- }
216
199
logv ( c, format ! ( "verbose: {}" , config. verbose) ) ;
217
200
logv ( c, format ! ( "\n " ) ) ;
218
201
}
@@ -263,6 +246,9 @@ pub fn run_tests(config: &Config) {
263
246
// parallel (especially when we have lots and lots of child processes).
264
247
// For context, see #8904
265
248
io:: test:: raise_fd_limit ( ) ;
249
+ // Prevent issue #21352 UAC blocking .exe containing 'patch' etc. on Windows
250
+ // If #11207 is resolved (adding manifest to .exe) this becomes unnecessary
251
+ os:: setenv ( "__COMPAT_LAYER" , "RunAsInvoker" ) ;
266
252
let res = test:: run_tests_console ( & opts, tests. into_iter ( ) . collect ( ) ) ;
267
253
match res {
268
254
Ok ( true ) => { }
@@ -283,15 +269,8 @@ pub fn test_opts(config: &Config) -> test::TestOpts {
283
269
logfile : config. logfile . clone ( ) ,
284
270
run_tests : true ,
285
271
run_benchmarks : true ,
286
- ratchet_metrics : config. ratchet_metrics . clone ( ) ,
287
- ratchet_noise_percent : config. ratchet_noise_percent . clone ( ) ,
288
- save_metrics : config. save_metrics . clone ( ) ,
289
- test_shard : config. test_shard . clone ( ) ,
290
272
nocapture : false ,
291
273
color : test:: AutoColor ,
292
- show_boxplot : false ,
293
- boxplot_width : 50 ,
294
- show_all_stats : false ,
295
274
}
296
275
}
297
276
@@ -393,18 +372,24 @@ fn extract_gdb_version(full_version_line: Option<String>) -> Option<String> {
393
372
if full_version_line. as_slice ( ) . trim ( ) . len ( ) > 0 => {
394
373
let full_version_line = full_version_line. as_slice ( ) . trim ( ) ;
395
374
396
- let re = Regex :: new ( r"(^|[^0-9])([0-9]\.[0-9])([^0-9]|$)" ) . unwrap ( ) ;
397
-
398
- match re. captures ( full_version_line) {
399
- Some ( captures) => {
400
- Some ( captures. at ( 2 ) . unwrap_or ( "" ) . to_string ( ) )
375
+ // used to be a regex "(^|[^0-9])([0-9]\.[0-9])([^0-9]|$)"
376
+ for ( pos, c) in full_version_line. char_indices ( ) {
377
+ if !c. is_digit ( 10 ) { continue }
378
+ if pos + 2 >= full_version_line. len ( ) { continue }
379
+ if full_version_line. char_at ( pos + 1 ) != '.' { continue }
380
+ if !full_version_line. char_at ( pos + 2 ) . is_digit ( 10 ) { continue }
381
+ if pos > 0 && full_version_line. char_at_reverse ( pos) . is_digit ( 10 ) {
382
+ continue
401
383
}
402
- None => {
403
- println ! ( "Could not extract GDB version from line '{}'" ,
404
- full_version_line) ;
405
- None
384
+ if pos + 3 < full_version_line. len ( ) &&
385
+ full_version_line. char_at ( pos + 3 ) . is_digit ( 10 ) {
386
+ continue
406
387
}
388
+ return Some ( full_version_line[ pos..pos+3 ] . to_string ( ) ) ;
407
389
}
390
+ println ! ( "Could not extract GDB version from line '{}'" ,
391
+ full_version_line) ;
392
+ None
408
393
} ,
409
394
_ => None
410
395
}
@@ -427,18 +412,26 @@ fn extract_lldb_version(full_version_line: Option<String>) -> Option<String> {
427
412
if full_version_line. as_slice ( ) . trim ( ) . len ( ) > 0 => {
428
413
let full_version_line = full_version_line. as_slice ( ) . trim ( ) ;
429
414
430
- let re = Regex :: new ( r"[Ll][Ll][Dd][Bb]-([0-9]+)" ) . unwrap ( ) ;
431
-
432
- match re. captures ( full_version_line) {
433
- Some ( captures) => {
434
- Some ( captures. at ( 1 ) . unwrap_or ( "" ) . to_string ( ) )
435
- }
436
- None => {
437
- println ! ( "Could not extract LLDB version from line '{}'" ,
438
- full_version_line) ;
439
- None
440
- }
415
+ for ( pos, l) in full_version_line. char_indices ( ) {
416
+ if l != 'l' && l != 'L' { continue }
417
+ if pos + 5 >= full_version_line. len ( ) { continue }
418
+ let l = full_version_line. char_at ( pos + 1 ) ;
419
+ if l != 'l' && l != 'L' { continue }
420
+ let d = full_version_line. char_at ( pos + 2 ) ;
421
+ if d != 'd' && d != 'D' { continue }
422
+ let b = full_version_line. char_at ( pos + 3 ) ;
423
+ if b != 'b' && b != 'B' { continue }
424
+ let dash = full_version_line. char_at ( pos + 4 ) ;
425
+ if dash != '-' { continue }
426
+
427
+ let vers = full_version_line[ pos + 5 ..] . chars ( ) . take_while ( |c| {
428
+ c. is_digit ( 10 )
429
+ } ) . collect :: < String > ( ) ;
430
+ if vers. len ( ) > 0 { return Some ( vers) }
441
431
}
432
+ println ! ( "Could not extract LLDB version from line '{}'" ,
433
+ full_version_line) ;
434
+ None
442
435
} ,
443
436
_ => None
444
437
}
0 commit comments