@@ -753,6 +753,99 @@ fn _arm_exec_compiled_test(config: &config, props: &TestProps,
753
753
copy_result. out, copy_result. err) ) ;
754
754
}
755
755
756
+ logv ( config, fmt ! ( "executing (%s) %s" , config. target, cmdline) ) ;
757
+
758
+
759
+ let mut runargs = ~[ ] ;
760
+ let mut exitcode : int = 1 ;
761
+ let mut maxtry = 10 ;
762
+
763
+ // sometimes code generates exit code 1 which is "1 : General unknown error"
764
+ // in this case, force to retry
765
+ // while exitcode == 1 && maxtry > 0 {
766
+ // since adb shell doesnot forward internal result (exit code) and
767
+ // distingush stderr and stdout, adb_run_wrapper is used
768
+
769
+ runargs. push ( ~"shell") ;
770
+ runargs. push ( fmt ! ( "%s/adb_run_wrapper.sh" , config. adb_test_dir) ) ;
771
+ runargs. push ( fmt ! ( "%s" , prog_short) ) ;
772
+
773
+ for args. args. each |tv| {
774
+ runargs. push ( tv. to_owned ( ) ) ;
775
+ }
776
+
777
+ procsrv:: run ( "" , config. adb_path , runargs, ~[ ( ~"", ~"") ] , Some ( ~"") ) ;
778
+
779
+ // get exitcode of result
780
+ runargs = ~[ ] ;
781
+
782
+ runargs. push ( ~"shell") ;
783
+ runargs. push ( ~"cat") ;
784
+ runargs. push ( fmt ! ( "%s/%s.exitcode" , config. adb_test_dir, prog_short) ) ;
785
+
786
+ let procsrv:: Result { out : exitcode_out, err : exitcode_err, status : exitcode_status } =
787
+ procsrv:: run ( "" , config. adb_path , runargs, ~[ ( ~"", ~"") ] ,
788
+ Some ( ~"") ) ;
789
+
790
+ exitcode = 0 ;
791
+ for str:: each_char( exitcode_out) |c| {
792
+ if !char:: is_digit ( c) { break ; }
793
+ exitcode = exitcode * 10 + match c {
794
+ '0' .. '9' => c as int - ( '0' as int ) ,
795
+ _ => 0 ,
796
+ }
797
+ }
798
+ maxtry = maxtry - 1 ;
799
+ // unsafe { libc::sleep(1); }
800
+ // }
801
+
802
+ // get stdout of result
803
+ runargs = ~[ ] ;
804
+ runargs. push ( ~"shell") ;
805
+ runargs. push ( ~"cat") ;
806
+ runargs. push ( fmt ! ( "%s/%s.stdout" , config. adb_test_dir, prog_short) ) ;
807
+
808
+ let procsrv:: Result { out : stdout_out, err : stdout_err, status : stdout_status } =
809
+ procsrv:: run ( "" , config. adb_path , runargs, ~[ ( ~"", ~"") ] ,
810
+ Some ( ~"") ) ;
811
+
812
+ // get stderr of result
813
+ runargs = ~[ ] ;
814
+ runargs. push ( ~"shell") ;
815
+ runargs. push ( ~"cat") ;
816
+ runargs. push ( fmt ! ( "%s/%s.stderr" , config. adb_test_dir, prog_short) ) ;
817
+
818
+ let procsrv:: Result { out : stderr_out, err : stderr_err, status : stderr_status } =
819
+ procsrv:: run ( "" , config. adb_path , runargs, ~[ ( ~"", ~"") ] ,
820
+ Some ( ~"") ) ;
821
+
822
+ dump_output ( config, testfile, stdout_out, stderr_out) ;
823
+
824
+ ProcRes { status : exitcode, stdout : stdout_out, stderr : stderr_out, cmdline : cmdline }
825
+ }
826
+
827
+ fn _arm_exec_compiled_test2 ( config : & config , props : & TestProps ,
828
+ testfile : & Path ) -> ProcRes {
829
+
830
+ let args = make_run_args ( config, props, testfile) ;
831
+ let cmdline = make_cmdline ( "" , args. prog , args. args ) ;
832
+
833
+ // get bare program string
834
+ let mut tvec = ~[ ] ;
835
+ for str:: each_split_char( args. prog, '/' ) |ts| { tvec. push ( ts. to_owned ( ) ) }
836
+ let prog_short = tvec. pop ( ) ;
837
+
838
+ // copy to target
839
+ let copy_result = procsrv:: run ( "" , config. adb_path ,
840
+ [ ~"push", copy args. prog , copy config. adb_test_dir ] ,
841
+ ~[ ( ~"", ~"") ] , Some ( ~"") ) ;
842
+
843
+ if config. verbose {
844
+ io:: stdout ( ) . write_str ( fmt ! ( "push (%s) %s %s %s" ,
845
+ config. target, args. prog,
846
+ copy_result. out, copy_result. err) ) ;
847
+ }
848
+
756
849
// execute program
757
850
logv ( config, fmt ! ( "executing (%s) %s" , config. target, cmdline) ) ;
758
851
0 commit comments