@@ -77,18 +77,19 @@ 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
- if (config.host == config.target) {
81
- check_correct_failure_status(ProcRes);
82
- check_error_patterns(props, testfile, ProcRes);
83
- } else {
84
- match (config.target, config.flag_runnable) {
80
+ match config.target {
85
81
86
- ( ~" arm-linux-androideabi", false ) => { }
87
- _ => {
82
+ ~" arm-linux-androideabi " => {
83
+ if ( config . adb_device_status ) {
88
84
check_correct_failure_status ( ProcRes ) ;
89
85
check_error_patterns ( props, testfile, ProcRes ) ;
90
86
}
91
87
}
88
+
89
+ _=> {
90
+ check_correct_failure_status ( ProcRes ) ;
91
+ check_error_patterns ( props, testfile, ProcRes ) ;
92
+ }
92
93
}
93
94
}
94
95
@@ -494,99 +495,21 @@ fn exec_compiled_test(config: config, props: TestProps,
494
495
props. exec_env
495
496
} ;
496
497
497
- if ( config. host == config. target ) {
498
- compose_and_run ( config, testfile,
499
- make_run_args ( config, props, testfile) ,
500
- env,
501
- config. run_lib_path , None )
502
- } else {
503
- let args = make_run_args ( config, props, testfile) ;
504
- let cmdline = make_cmdline ( ~"", args. prog , args. args ) ;
505
-
506
- match ( config. target , config. flag_runnable ) {
507
-
508
- ( ~"arm-linux-androideabi", true ) => {
509
-
510
- // get bare program string
511
- let mut tvec = ~[ ] ;
512
- let tstr = args. prog ;
513
- for str:: each_split_char( tstr, '/' ) |ts| { tvec. push ( ts. to_owned ( ) ) }
514
- let prog_short = tvec. pop ( ) ;
515
-
516
- // copy to target
517
- let copy_result = procsrv:: run ( ~"", config. adb_path ,
518
- ~[ ~"push", args. prog , config. adb_test_dir ] ,
519
- ~[ ( ~"", ~"") ] , Some ( ~"") ) ;
520
-
521
- if config. verbose {
522
- io:: stdout ( ) . write_str ( fmt ! ( "push (%s) %s %s %s" ,
523
- config. target, args. prog,
524
- copy_result. out, copy_result. err) ) ;
525
- }
526
-
527
- // execute program
528
- logv ( config, fmt ! ( "executing (%s) %s" , config. target, cmdline) ) ;
529
-
530
- // NOTE: adb shell dose not forward stdout and stderr of internal result
531
- // to stdout and stderr seperately but to stdout only
532
- let mut newargs_out = ~[ ] ;
533
- let mut newargs_err = ~[ ] ;
534
- let subargs = args. args ;
535
- newargs_out. push ( ~"shell") ;
536
- newargs_err. push ( ~"shell") ;
537
-
538
- let mut newcmd_out = ~"";
539
- let mut newcmd_err = ~"";
540
-
541
- newcmd_out. push_str ( fmt ! ( "LD_LIBRARY_PATH=%s %s/%s" ,
542
- config. adb_test_dir, config. adb_test_dir, prog_short) ) ;
543
-
544
- newcmd_err. push_str ( fmt ! ( "LD_LIBRARY_PATH=%s %s/%s" ,
545
- config. adb_test_dir, config. adb_test_dir, prog_short) ) ;
546
-
547
- for vec:: each( subargs) |tv| {
548
- newcmd_out. push_str ( " " ) ;
549
- newcmd_err. push_str ( " " ) ;
550
- newcmd_out. push_str ( tv. to_owned ( ) ) ;
551
- newcmd_err. push_str ( tv. to_owned ( ) ) ;
552
- }
553
-
554
- newcmd_out. push_str ( " 2>/dev/null" ) ;
555
- newcmd_err. push_str ( " 1>/dev/null" ) ;
556
-
557
- newargs_out. push ( newcmd_out) ;
558
- newargs_err. push ( newcmd_err) ;
559
-
560
- let exe_result_out = procsrv:: run ( ~"", config. adb_path ,
561
- newargs_out, ~[ ( ~"", ~"") ] , Some ( ~"") ) ;
562
- let exe_result_err = procsrv:: run ( ~"", config. adb_path ,
563
- newargs_err, ~[ ( ~"", ~"") ] , Some ( ~"") ) ;
498
+ match config. target {
564
499
565
- dump_output ( config, testfile, exe_result_out. out , exe_result_err. out ) ;
566
-
567
- match exe_result_err. out {
568
- ~"" => ProcRes { status : exe_result_out. status, stdout : exe_result_out. out,
569
- stderr : exe_result_err. out, cmdline : cmdline } ,
570
- _ => ProcRes { status : 101 , stdout : exe_result_out. out ,
571
- stderr : exe_result_err. out , cmdline : cmdline }
572
- }
573
- }
574
-
575
- ( ~"arm-linux-androideabi", false ) => {
576
- match config. mode {
577
- mode_run_fail => ProcRes { status : 101 , stdout: ~"",
578
- stderr: ~"", cmdline : cmdline} ,
579
- _ => ProcRes { status : 0 , stdout: ~"",
580
- stderr: ~"", cmdline : cmdline}
581
- }
500
+ ~"arm-linux-androideabi" => {
501
+ if ( config. adb_device_status ) {
502
+ _arm_exec_compiled_test ( config, props, testfile)
503
+ } else {
504
+ _dummy_exec_compiled_test ( config, props, testfile)
582
505
}
506
+ }
583
507
584
- _=> {
585
- compose_and_run ( config, testfile,
586
- make_run_args ( config, props, testfile) ,
587
- env,
588
- config. run_lib_path , None )
589
- }
508
+ _=> {
509
+ compose_and_run ( config, testfile,
510
+ make_run_args ( config, props, testfile) ,
511
+ env,
512
+ config. run_lib_path , None )
590
513
}
591
514
}
592
515
}
@@ -618,32 +541,16 @@ fn compose_and_run_compiler(
618
541
abs_ab. to_str( ) ) ,
619
542
auxres) ;
620
543
}
621
- if ( config. host != config. target )
622
- {
623
- match ( config. target , config. flag_runnable ) {
624
-
625
- ( ~"arm-linux-androideabi", true ) => {
626
-
627
- let tstr = aux_output_dir_name ( config, testfile) . to_str ( ) ;
628
-
629
- for os:: list_dir_path( & Path ( tstr) ) . each |file| {
630
544
631
- if ( file . filetype ( ) == Some ( ~" . so " ) ) {
545
+ match config . target {
632
546
633
- let copy_result = procsrv:: run ( ~"", config. adb_path ,
634
- ~[ ~"push", file. to_str ( ) , config. adb_test_dir ] ,
635
- ~[ ( ~"", ~"") ] , Some ( ~"") ) ;
636
-
637
- if config. verbose {
638
- io:: stdout ( ) . write_str ( fmt ! ( "push (%s) %s %s %s" ,
639
- config. target, file. to_str( ) ,
640
- copy_result. out, copy_result. err) ) ;
641
- }
642
- }
643
- }
547
+ ~"arm-linux-androideabi" => {
548
+ if ( config. adb_device_status ) {
549
+ _arm_push_aux_shared_library ( config, testfile) ;
644
550
}
645
- _=> ( )
646
551
}
552
+
553
+ _=> { }
647
554
}
648
555
}
649
556
@@ -829,3 +736,108 @@ stderr:\n\
829
736
io:: stdout( ) . write_str( msg) ;
830
737
fail!( ) ;
831
738
}
739
+
740
+ fn _arm_exec_compiled_test( config: config, props: TestProps ,
741
+ testfile: & Path ) -> ProcRes {
742
+
743
+ let args = make_run_args( config, props, testfile) ;
744
+ let cmdline = make_cmdline( ~"", args. prog, args. args) ;
745
+
746
+ // get bare program string
747
+ let mut tvec = ~[ ] ;
748
+ let tstr = args. prog;
749
+ for str :: each_split_char( tstr, '/' ) |ts| { tvec. push( ts. to_owned( ) ) }
750
+ let prog_short = tvec. pop( ) ;
751
+
752
+ // copy to target
753
+ let copy_result = procsrv:: run( ~"", config. adb_path,
754
+ ~[ ~"push", args.prog, config.adb_test_dir],
755
+ ~[(~" ",~" ")], Some(~" "));
756
+
757
+ if config.verbose {
758
+ io::stdout().write_str(fmt!(" push ( %s) %s %s %s",
759
+ config.target, args.prog,
760
+ copy_result.out, copy_result.err));
761
+ }
762
+
763
+ // execute program
764
+ logv(config, fmt!(" executing ( %s) %s", config.target, cmdline));
765
+
766
+ // adb shell dose not forward stdout and stderr of internal result
767
+ // to stdout and stderr seperately but to stdout only
768
+ let mut newargs_out = ~[];
769
+ let mut newargs_err = ~[];
770
+ let subargs = args.args;
771
+ newargs_out.push(~" shell");
772
+ newargs_err.push(~" shell");
773
+
774
+ let mut newcmd_out = ~" ";
775
+ let mut newcmd_err = ~" ";
776
+
777
+ newcmd_out.push_str(fmt!(" LD_LIBRARY_PATH =%s %s/%s",
778
+ config.adb_test_dir, config.adb_test_dir, prog_short));
779
+
780
+ newcmd_err.push_str(fmt!(" LD_LIBRARY_PATH =%s %s/%s",
781
+ config.adb_test_dir, config.adb_test_dir, prog_short));
782
+
783
+ for vec::each(subargs) |tv| {
784
+ newcmd_out.push_str(" ");
785
+ newcmd_err.push_str(" ");
786
+ newcmd_out.push_str(tv.to_owned());
787
+ newcmd_err.push_str(tv.to_owned());
788
+ }
789
+
790
+ newcmd_out.push_str(" 2 >/dev/null");
791
+ newcmd_err.push_str(" 1 >/dev/null");
792
+
793
+ newargs_out.push(newcmd_out);
794
+ newargs_err.push(newcmd_err);
795
+
796
+ let exe_result_out = procsrv::run(~" ", config.adb_path,
797
+ newargs_out, ~[(~" ",~" ")], Some(~" "));
798
+ let exe_result_err = procsrv::run(~" ", config.adb_path,
799
+ newargs_err, ~[(~" ",~" ")], Some(~" "));
800
+
801
+ dump_output(config, testfile, exe_result_out.out, exe_result_err.out);
802
+
803
+ match exe_result_err.out {
804
+ ~" " => ProcRes {status: exe_result_out.status, stdout: exe_result_out.out,
805
+ stderr: exe_result_err.out, cmdline: cmdline },
806
+ _ => ProcRes {status: 101, stdout: exe_result_out.out,
807
+ stderr: exe_result_err.out, cmdline: cmdline }
808
+ }
809
+ }
810
+
811
+ fn _dummy_exec_compiled_test(config: config, props: TestProps,
812
+ testfile: &Path) -> ProcRes {
813
+
814
+ let args = make_run_args(config, props, testfile);
815
+ let cmdline = make_cmdline(~" ", args.prog, args.args);
816
+
817
+ match config.mode {
818
+ mode_run_fail => ProcRes {status: 101, stdout: ~" ",
819
+ stderr: ~" ", cmdline: cmdline},
820
+ _ => ProcRes {status: 0, stdout: ~" ",
821
+ stderr: ~" ", cmdline: cmdline}
822
+ }
823
+ }
824
+
825
+ fn _arm_push_aux_shared_library(config: config, testfile: &Path) {
826
+ let tstr = aux_output_dir_name(config, testfile).to_str();
827
+
828
+ for os::list_dir_path(&Path(tstr)).each |file| {
829
+
830
+ if (file.filetype() == Some(~" . so")) {
831
+
832
+ let copy_result = procsrv::run(~" ", config.adb_path,
833
+ ~[~" push", file.to_str(), config.adb_test_dir],
834
+ ~[(~" ",~" ")], Some(~" "));
835
+
836
+ if config.verbose {
837
+ io::stdout().write_str(fmt!(" push ( %s) %s %s %s" ,
838
+ config. target, file. to_str( ) ,
839
+ copy_result. out, copy_result. err) ) ;
840
+ }
841
+ }
842
+ }
843
+ }
0 commit comments