@@ -37,18 +37,6 @@ use std::vec;
37
37
use extra:: test:: MetricMap ;
38
38
39
39
pub fn run ( config : config , testfile : ~str ) {
40
-
41
- match config. target {
42
-
43
- ~"arm-linux-androideabi" => {
44
- if !config. adb_device_status {
45
- fail ! ( "android device not available" ) ;
46
- }
47
- }
48
-
49
- _=> { }
50
- }
51
-
52
40
let mut _mm = MetricMap :: new ( ) ;
53
41
run_metrics ( config, testfile, & mut _mm) ;
54
42
}
@@ -111,8 +99,20 @@ fn run_rfail_test(config: &config, props: &TestProps, testfile: &Path) {
111
99
fatal_ProcRes(~" run-fail test isn' t valgrind-clean!", &ProcRes);
112
100
}
113
101
114
- check_correct_failure_status(&ProcRes);
115
- check_error_patterns(props, testfile, &ProcRes);
102
+ match config.target {
103
+
104
+ ~" arm-linux-androideabi " => {
105
+ if ( config. adb_device_status ) {
106
+ check_correct_failure_status ( & ProcRes ) ;
107
+ check_error_patterns ( props, testfile, & ProcRes ) ;
108
+ }
109
+ }
110
+
111
+ _=> {
112
+ check_correct_failure_status ( & ProcRes ) ;
113
+ check_error_patterns ( props, testfile, & ProcRes ) ;
114
+ }
115
+ }
116
116
}
117
117
118
118
fn check_correct_failure_status ( ProcRes : & ProcRes ) {
@@ -275,86 +275,86 @@ fn run_debuginfo_test(config: &config, props: &TestProps, testfile: &Path) {
275
275
let mut ProcArgs ;
276
276
match config. target {
277
277
~"arm-linux-androideabi" => {
278
-
279
- cmds = cmds. replace( "run", "continue ") ;
280
-
281
- // write debugger script
282
- let script_str = [ ~"set charset UTF-8 ",
283
- format!( "file { } ", exe_file. as_str( ) . unwrap( ) . to_owned( ) ) ,
284
- ~"target remote : 5039 ",
285
- cmds,
286
- ~"quit"] . connect( "\n ") ;
287
- debug!( "script_str = { } ", script_str) ;
288
- dump_output_file( config, testfile, script_str, "debugger. script") ;
289
-
290
-
291
- procsrv: : run( "" , config. adb_path,
292
- [ ~"push", exe_file. as_str( ) . unwrap( ) . to_owned( ) ,
293
- config. adb_test_dir. clone( ) ] ,
294
- ~[ ( ~"", ~"") ] , Some ( ~"") )
295
- . expect( format ! ( "failed to exec `{}`" , config. adb_path) ) ;
296
-
297
- procsrv:: run( "" , config. adb_path,
298
- [ ~"forward", ~"tcp: 5039 ", ~"tcp: 5039 "] ,
299
- ~[ ( ~"", ~"") ] , Some ( ~"") )
300
- . expect( format ! ( "failed to exec `{}`" , config. adb_path) ) ;
301
-
302
- let adb_arg = format ! ( "export LD_LIBRARY_PATH={}; gdbserver :5039 {}/{}" ,
303
- config. adb_test_dir. clone( ) , config. adb_test_dir. clone( ) ,
304
- str :: from_utf8( exe_file. filename( ) . unwrap( ) ) ) ;
305
-
306
- let mut process = procsrv:: run_background( "" , config. adb_path,
307
- [ ~"shell", adb_arg. clone( ) ] ,
308
- ~[ ( ~"", ~"") ] , Some ( ~"") )
309
- . expect( format ! ( "failed to exec `{}`" , config. adb_path) ) ;
310
- loop {
311
- //waiting 1 second for gdbserver start
312
- timer:: sleep( 1000 ) ;
313
- let result = do task:: try {
314
- tcp : : TcpStream :: connect(
278
+ if ( config. adb_device_status) {
279
+
280
+ cmds = cmds. replace( "run", "continue ") ;
281
+
282
+ // write debugger script
283
+ let script_str = [ ~"set charset UTF-8 ",
284
+ format!( "file { } ", exe_file. as_str( ) . unwrap( ) . to_owned( ) ) ,
285
+ ~"target remote : 5039 ",
286
+ cmds,
287
+ ~"quit"] . connect( "\n ") ;
288
+ debug!( "script_str = { } ", script_str) ;
289
+ dump_output_file( config, testfile, script_str, "debugger. script") ;
290
+
291
+
292
+ procsrv : : run( "" , config. adb_path,
293
+ [ ~"push", exe_file. as_str( ) . unwrap( ) . to_owned( ) , config. adb_test_dir. clone( ) ] ,
294
+ ~[ ( ~"", ~"") ] , Some ( ~"") )
295
+ . expect( format ! ( "failed to exec `{}`" , config. adb_path) ) ;
296
+
297
+ procsrv:: run( "" , config. adb_path,
298
+ [ ~"forward", ~"tcp: 5039 ", ~"tcp: 5039 "] ,
299
+ ~[ ( ~"", ~"") ] , Some ( ~"") )
300
+ . expect( format ! ( "failed to exec `{}`" , config. adb_path) ) ;
301
+
302
+ let adb_arg = format ! ( "export LD_LIBRARY_PATH={}; gdbserver :5039 {}/{}" ,
303
+ config. adb_test_dir. clone( ) , config. adb_test_dir. clone( ) ,
304
+ str :: from_utf8( exe_file. filename( ) . unwrap( ) ) ) ;
305
+
306
+ let mut process = procsrv:: run_background( "" , config. adb_path,
307
+ [ ~"shell", adb_arg. clone( ) ] , ~[ ( ~"", ~"") ] , Some ( ~"") )
308
+ . expect( format ! ( "failed to exec `{}`" , config. adb_path) ) ;
309
+ loop {
310
+ //waiting 1 second for gdbserver start
311
+ timer:: sleep( 1000 ) ;
312
+ let result = do task:: try {
313
+ tcp : : TcpStream :: connect(
315
314
SocketAddr { ip : Ipv4Addr ( 127 , 0 , 0 , 1 ) , port : 5039 } ) ;
316
- } ;
317
- if result. is_err ( ) {
318
- continue;
315
+ } ;
316
+ if result. is_err ( ) {
317
+ continue;
318
+ }
319
+ break;
319
320
}
320
- break;
321
- }
322
321
323
- let args = split_maybe_args( & config. rustcflags) ;
324
- let mut tool_path: ~str = ~"";
325
- for arg in args. iter( ) {
326
- if arg. contains( "--android-cross-path=" ) {
327
- tool_path = arg. replace( "--android-cross-path=" , "" ) ;
328
- break ;
322
+ let args = split_maybe_args( & config. rustcflags) ;
323
+ let mut tool_path: ~str = ~"";
324
+ for arg in args. iter( ) {
325
+ if arg. contains ( "--android-cross-path=" ) {
326
+ tool_path = arg. replace ( "--android-cross-path=" , "" ) ;
327
+ break ;
328
+ }
329
329
}
330
- }
331
330
332
- if tool_path. equals( & ~"") {
333
- fatal( ~"cannot found android cross path") ;
334
- }
331
+ if tool_path. equals ( & ~"") {
332
+ fatal ( ~"cannot found android cross path") ;
333
+ }
335
334
336
- let debugger_script = make_out_name( config, testfile, "debugger.script" ) ;
337
- // FIXME (#9639): This needs to handle non-utf8 paths
338
- let debugger_opts = ~[ ~"-quiet", ~"-batch", ~"-nx",
339
- "-command=" + debugger_script. as_str( ) . unwrap( ) . to_owned( ) ] ;
340
-
341
- let gdb_path = tool_path. append( "/bin/arm-linux-androideabi-gdb" ) ;
342
- let procsrv:: Result { out, err, status } =
343
- procsrv:: run( "" ,
344
- gdb_path,
345
- debugger_opts, ~[ ( ~"", ~"") ] , None )
346
- . expect( format ! ( "failed to exec `{}`" , gdb_path) ) ;
347
- let cmdline = {
348
- let cmdline = make_cmdline( "" , "arm-linux-androideabi-gdb" , debugger_opts) ;
349
- logv( config, format ! ( "executing {}" , cmdline) ) ;
350
- cmdline
351
- } ;
352
-
353
- ProcRes = ProcRes { status : status,
354
- stdout : out,
355
- stderr : err,
356
- cmdline : cmdline} ;
357
- process. force_destroy( ) ;
335
+ let debugger_script = make_out_name ( config, testfile, "debugger.script" ) ;
336
+ // FIXME (#9639): This needs to handle non-utf8 paths
337
+ let debugger_opts = ~[ ~"-quiet", ~"-batch", ~"-nx",
338
+ "-command=" + debugger_script. as_str ( ) . unwrap ( ) . to_owned ( ) ] ;
339
+
340
+ let gdb_path = tool_path. append ( "/bin/arm-linux-androideabi-gdb" ) ;
341
+ let procsrv:: Result { out, err, status } =
342
+ procsrv:: run ( "" ,
343
+ gdb_path,
344
+ debugger_opts, ~[ ( ~"", ~"") ] , None )
345
+ . expect ( format ! ( "failed to exec `{}`" , gdb_path) ) ;
346
+ let cmdline = {
347
+ let cmdline = make_cmdline ( "" , "arm-linux-androideabi-gdb" , debugger_opts) ;
348
+ logv ( config, format ! ( "executing {}" , cmdline) ) ;
349
+ cmdline
350
+ } ;
351
+
352
+ ProcRes = ProcRes { status : status,
353
+ stdout : out,
354
+ stderr : err,
355
+ cmdline : cmdline} ;
356
+ process. force_destroy ( ) ;
357
+ }
358
358
}
359
359
360
360
_=> {
@@ -662,7 +662,11 @@ fn exec_compiled_test(config: &config, props: &TestProps,
662
662
match config. target {
663
663
664
664
~"arm-linux-androideabi" => {
665
- _arm_exec_compiled_test ( config, props, testfile, env)
665
+ if ( config. adb_device_status ) {
666
+ _arm_exec_compiled_test ( config, props, testfile, env)
667
+ } else {
668
+ _dummy_exec_compiled_test ( config, props, testfile)
669
+ }
666
670
}
667
671
668
672
_=> {
@@ -706,7 +710,9 @@ fn compose_and_run_compiler(
706
710
match config. target {
707
711
708
712
~"arm-linux-androideabi" => {
709
- _arm_push_aux_shared_library ( config, testfile) ;
713
+ if ( config. adb_device_status ) {
714
+ _arm_push_aux_shared_library ( config, testfile) ;
715
+ }
710
716
}
711
717
712
718
_=> { }
@@ -986,6 +992,20 @@ fn _arm_exec_compiled_test(config: &config, props: &TestProps,
986
992
}
987
993
}
988
994
995
+ fn _dummy_exec_compiled_test ( config : & config , props : & TestProps ,
996
+ testfile : & Path ) -> ProcRes {
997
+
998
+ let args = make_run_args ( config, props, testfile) ;
999
+ let cmdline = make_cmdline ( "" , args. prog , args. args ) ;
1000
+
1001
+ match config. mode {
1002
+ mode_run_fail => ProcRes { status : process:: ExitStatus ( 101 ) , stdout: ~"",
1003
+ stderr: ~"", cmdline : cmdline} ,
1004
+ _ => ProcRes { status : process:: ExitStatus ( 0 ) , stdout: ~"",
1005
+ stderr: ~"", cmdline : cmdline}
1006
+ }
1007
+ }
1008
+
989
1009
fn _arm_push_aux_shared_library ( config : & config , testfile : & Path ) {
990
1010
let tdir = aux_output_dir_name ( config, testfile) ;
991
1011
0 commit comments