@@ -77,8 +77,10 @@ fn run_rfail_test(config: config, props: TestProps, testfile: &Path) {
77
77
fatal_ProcRes(~" run-fail test isn' t valgrind-clean!", ProcRes);
78
78
}
79
79
80
- check_correct_failure_status(ProcRes);
81
- check_error_patterns(props, testfile, ProcRes);
80
+ if (config.flag_runnable) {
81
+ check_correct_failure_status(ProcRes);
82
+ check_error_patterns(props, testfile, ProcRes);
83
+ }
82
84
}
83
85
84
86
fn check_correct_failure_status(ProcRes: ProcRes) {
@@ -483,10 +485,96 @@ fn exec_compiled_test(config: config, props: TestProps,
483
485
props. exec_env
484
486
} ;
485
487
486
- compose_and_run ( config, testfile,
487
- make_run_args ( config, props, testfile) ,
488
- env,
489
- config. run_lib_path , None )
488
+ if ( config. host == config. target ) {
489
+ compose_and_run ( config, testfile,
490
+ make_run_args ( config, props, testfile) ,
491
+ env,
492
+ config. run_lib_path , None )
493
+ }
494
+ else {
495
+ let args = make_run_args ( config, props, testfile) ;
496
+ let cmdline = make_cmdline ( ~"", args. prog , args. args ) ;
497
+
498
+ let defaultRes = match config. mode {
499
+ mode_run_fail => ProcRes { status : 101 , stdout: ~"", stderr: ~"", cmdline : cmdline} ,
500
+ _ => ProcRes { status : 0 , stdout: ~"", stderr: ~"", cmdline : cmdline}
501
+ } ;
502
+
503
+ match ( config. target , config. flag_runnable ) {
504
+
505
+ ( ~"arm-linux-androideabi", true ) => {
506
+
507
+ // get bare program string
508
+ let mut tvec = ~[ ] ;
509
+ let tstr = args. prog ;
510
+ for str:: each_split_char( tstr, '/' ) |ts| { tvec. push ( ts. to_owned ( ) ) }
511
+ let prog_short = tvec. pop ( ) ;
512
+
513
+ // copy to target
514
+ let copy_result = procsrv:: run ( ~"", config. adb_path ,
515
+ ~[ ~"push", args. prog , ~"/system/tmp"] ,
516
+ ~[ ( ~"", ~"") ] , Some ( ~"") ) ;
517
+
518
+ if config. verbose {
519
+ io:: stdout ( ) . write_str ( fmt ! ( "push (%s) %s %s %s" ,
520
+ config. target, args. prog,
521
+ copy_result. out, copy_result. err) ) ;
522
+ }
523
+
524
+ // execute program
525
+ logv ( config, fmt ! ( "executing (%s) %s" , config. target, cmdline) ) ;
526
+
527
+ // NOTE : adb shell dose not forward to each stdout and stderr of internal result
528
+ // but forward to stdout only
529
+ let mut newargs_out = ~[ ] ;
530
+ let mut newargs_err = ~[ ] ;
531
+ let subargs = args. args ;
532
+ newargs_out. push ( ~"shell") ;
533
+ newargs_err. push ( ~"shell") ;
534
+
535
+ let mut newcmd_out = ~"";
536
+ let mut newcmd_err = ~"";
537
+ newcmd_out. push_str ( ~"LD_LIBRARY_PATH =/system/tmp; ");
538
+ newcmd_err.push_str(~" LD_LIBRARY_PATH =/system/tmp; ");
539
+ newcmd_out.push_str(~" export LD_LIBRARY_PATH ; ");
540
+ newcmd_err.push_str(~" export LD_LIBRARY_PATH ; ");
541
+ newcmd_out.push_str(~" cd /system/tmp; ");
542
+ newcmd_err.push_str(~" cd /system/tmp; ");
543
+ newcmd_out.push_str(" . /") ;
544
+ newcmd_err. push_str ( "./" ) ;
545
+ newcmd_out. push_str ( prog_short) ;
546
+ newcmd_err. push_str ( prog_short) ;
547
+
548
+ for vec:: each( subargs) |tv| {
549
+ newcmd_out. push_str ( " " ) ;
550
+ newcmd_err. push_str ( " " ) ;
551
+ newcmd_out. push_str ( tv. to_owned ( ) ) ;
552
+ newcmd_err. push_str ( tv. to_owned ( ) ) ;
553
+ }
554
+
555
+ newcmd_out. push_str ( " 2>/dev/null" ) ;
556
+ newcmd_err. push_str ( " 1>/dev/null" ) ;
557
+
558
+ newargs_out. push ( newcmd_out) ;
559
+ newargs_err. push ( newcmd_err) ;
560
+
561
+ let exe_result_out = procsrv:: run ( ~"", config. adb_path ,
562
+ newargs_out, ~[ ( ~"", ~"") ] , Some ( ~"") ) ;
563
+ let exe_result_err = procsrv:: run ( ~"", config. adb_path ,
564
+ newargs_err, ~[ ( ~"", ~"") ] , Some ( ~"") ) ;
565
+
566
+ dump_output ( config, testfile, exe_result_out. out , exe_result_err. out ) ;
567
+
568
+ match exe_result_err. out {
569
+ ~"" => ProcRes { status : exe_result_out. status, stdout : exe_result_out. out,
570
+ stderr : exe_result_err. out, cmdline : cmdline } ,
571
+ _ => ProcRes { status : 101 , stdout : exe_result_out. out ,
572
+ stderr : exe_result_err. out , cmdline : cmdline }
573
+ }
574
+ }
575
+ _=> defaultRes
576
+ }
577
+ }
490
578
}
491
579
492
580
fn compose_and_run_compiler (
@@ -516,6 +604,33 @@ fn compose_and_run_compiler(
516
604
abs_ab. to_str( ) ) ,
517
605
auxres) ;
518
606
}
607
+ if ( config. host != config. target )
608
+ {
609
+ match ( config. target , config. flag_runnable ) {
610
+
611
+ ( ~"arm-linux-androideabi", true ) => {
612
+
613
+ let tstr = aux_output_dir_name ( config, testfile) . to_str ( ) ;
614
+
615
+ for os:: list_dir_path( & Path ( tstr) ) . each |file| {
616
+
617
+ if ( file. filetype ( ) == Some ( ~". so ") ) {
618
+
619
+ let copy_result = procsrv:: run ( ~"", config. adb_path ,
620
+ ~[ ~"push", file. to_str ( ) , ~"/system/tmp"] ,
621
+ ~[ ( ~"", ~"") ] , Some ( ~"") ) ;
622
+
623
+ if config. verbose {
624
+ io:: stdout ( ) . write_str ( fmt ! ( "push (%s) %s %s %s" ,
625
+ config. target, file. to_str( ) ,
626
+ copy_result. out, copy_result. err) ) ;
627
+ }
628
+ }
629
+ }
630
+ }
631
+ _=> ( )
632
+ }
633
+ }
519
634
}
520
635
521
636
compose_and_run ( config, testfile, args, ~[ ] ,
0 commit comments