about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2013-06-20 11:35:34 -0700
committerbors <bors@rust-lang.org>2013-06-20 11:35:34 -0700
commitf348465283d6cd85b69bcdc1711d14985d154c39 (patch)
tree2bd582132e82b3b0acb879311394913144da1ea8
parentadeb7e77ccff938c0afb105a14a2ff4df4c7efc8 (diff)
parentb82370cec65b17456b1d5b98a283d3f46a8ab09a (diff)
downloadrust-f348465283d6cd85b69bcdc1711d14985d154c39.tar.gz
rust-f348465283d6cd85b69bcdc1711d14985d154c39.zip
auto merge of #7128 : yichoi/rust/fix_sometc, r=brson
- Fix stat struct for Android (found by SEGV at run-pass/stat.rs)
- Adjust some test cases to rpass for Android 
- Modify some script to rpass for Android
-rw-r--r--mk/tests.mk4
-rwxr-xr-xsrc/etc/adb_run_wrapper.sh5
-rw-r--r--src/libstd/libc.rs50
-rw-r--r--src/libstd/path.rs30
-rw-r--r--src/test/run-pass/core-run-destroy.rs8
-rw-r--r--src/test/run-pass/intrinsic-alignment.rs2
-rw-r--r--src/test/run-pass/rec-align-u64.rs4
7 files changed, 92 insertions, 11 deletions
diff --git a/mk/tests.mk b/mk/tests.mk
index 3858de3f264..35d567ef771 100644
--- a/mk/tests.mk
+++ b/mk/tests.mk
@@ -122,9 +122,7 @@ CFG_ADB_TEST_DIR=/data/tmp
 $(info check: android device test dir $(CFG_ADB_TEST_DIR) ready \
  $(shell adb remount 1>/dev/null) \
  $(shell adb shell mkdir $(CFG_ADB_TEST_DIR) 1>/dev/null) \
- $(shell adb shell rm $(CFG_ADB_TEST_DIR)/*.so 1>/dev/null) \
- $(shell adb shell rm $(CFG_ADB_TEST_DIR)/*-arm-linux-androideabi 1>/dev/null) \
- $(shell adb shell rm $(CFG_ADB_TEST_DIR)/*-arm-linux-androideabi.* 1>/dev/null) \
+ $(shell adb shell rm -rf $(CFG_ADB_TEST_DIR)/* 1>/dev/null) \
  $(shell adb push $(S)src/etc/adb_run_wrapper.sh $(CFG_ADB_TEST_DIR) 1>/dev/null) \
  $(shell adb push $(CFG_ANDROID_CROSS_PATH)/arm-linux-androideabi/lib/armv7-a/libgnustl_shared.so \
                   $(CFG_ADB_TEST_DIR) 1>/dev/null) \
diff --git a/src/etc/adb_run_wrapper.sh b/src/etc/adb_run_wrapper.sh
index fb1e0937fc9..7cbcf94dd40 100755
--- a/src/etc/adb_run_wrapper.sh
+++ b/src/etc/adb_run_wrapper.sh
@@ -17,16 +17,17 @@ then
 
         L_RET=1
         L_COUNT=0
+        cd $PATH
         while [ $L_RET -eq 1 ]
         do
-            LD_LIBRARY_PATH=$PATH $PATH/$RUN $@ 1>$PATH/$RUN.stdout 2>$PATH/$RUN.stderr
+            TEST_EXEC_ENV=22 LD_LIBRARY_PATH=$PATH $PATH/$RUN $@ 1>$PATH/$RUN.stdout 2>$PATH/$RUN.stderr
             L_RET=$?
             if [ $L_COUNT -gt 0 ]
             then
                /system/bin/sleep $WAIT
                /system/bin/sync
             fi
-            L_COUNT=`expr $L_COUNT+1`
+            L_COUNT=$((L_COUNT+1))
         done
 
         echo $L_RET > $PATH/$RUN.exitcode
diff --git a/src/libstd/libc.rs b/src/libstd/libc.rs
index 07b2ac6ed01..988fb5cc9b1 100644
--- a/src/libstd/libc.rs
+++ b/src/libstd/libc.rs
@@ -257,6 +257,8 @@ pub mod types {
                 pub type intptr_t = int;
                 pub type uintptr_t = uint;
             }
+            #[cfg(target_arch = "x86")]
+            #[cfg(target_arch = "mips")]
             pub mod posix88 {
                 pub type off_t = i32;
                 pub type dev_t = u64;
@@ -268,6 +270,20 @@ pub mod types {
                 pub type mode_t = u32;
                 pub type ssize_t = i32;
             }
+            #[cfg(target_arch = "arm")]
+            pub mod posix88 {
+                pub type off_t = i32;
+                pub type dev_t = u32;
+                pub type ino_t = u32;
+                pub type pid_t = i32;
+                pub type uid_t = u32;
+                pub type gid_t = u32;
+                pub type useconds_t = u32;
+                pub type mode_t = u16;
+                pub type ssize_t = i32;
+            }
+            #[cfg(target_arch = "x86")]
+            #[cfg(target_arch = "mips")]
             pub mod posix01 {
                 use libc::types::os::arch::c95::{c_short, c_long, c_ulong, time_t};
                 use libc::types::os::arch::posix88::{dev_t, gid_t, ino_t};
@@ -279,7 +295,6 @@ pub mod types {
                 pub type blkcnt_t = i32;
 
                 #[cfg(target_arch = "x86")]
-                #[cfg(target_arch = "arm")]
                 pub struct stat {
                     st_dev: dev_t,
                     __pad1: c_short,
@@ -327,6 +342,39 @@ pub mod types {
                     st_pad5: [c_long, ..14],
                 }
             }
+            #[cfg(target_arch = "arm")]
+            pub mod posix01 {
+                use libc::types::os::arch::c95::{c_uchar, c_uint, c_ulong, time_t};
+                use libc::types::os::arch::c99::{c_longlong, c_ulonglong};
+                use libc::types::os::arch::posix88::{uid_t, gid_t, ino_t};
+                use libc::types::os::arch::posix88::{uid_t};
+
+                pub type nlink_t = u16;
+                pub type blksize_t = u32;
+                pub type blkcnt_t = u32;
+
+                pub struct stat {
+                    st_dev: c_ulonglong,
+                    __pad0: [c_uchar, ..4],
+                    __st_ino: ino_t,
+                    st_mode: c_uint,
+                    st_nlink: c_uint,
+                    st_uid: uid_t,
+                    st_gid: gid_t,
+                    st_rdev: c_ulonglong,
+                    __pad3: [c_uchar, ..4],
+                    st_size: c_longlong,
+                    st_blksize: blksize_t,
+                    st_blocks: c_ulonglong,
+                    st_atime: time_t,
+                    st_atime_nsec: c_ulong,
+                    st_mtime: time_t,
+                    st_mtime_nsec: c_ulong,
+                    st_ctime: time_t,
+                    st_ctime_nsec: c_ulong,
+                    st_ino: c_ulonglong
+                }
+            }
             pub mod posix08 {}
             pub mod bsd44 {}
             pub mod extra {}
diff --git a/src/libstd/path.rs b/src/libstd/path.rs
index 9c51526aa7f..d7812bf49c2 100644
--- a/src/libstd/path.rs
+++ b/src/libstd/path.rs
@@ -128,7 +128,6 @@ pub trait GenericPath {
 #[cfg(target_os = "android")]
 mod stat {
     #[cfg(target_arch = "x86")]
-    #[cfg(target_arch = "arm")]
     pub mod arch {
         use libc;
 
@@ -158,6 +157,35 @@ mod stat {
         }
     }
 
+    #[cfg(target_arch = "arm")]
+    pub mod arch {
+        use libc;
+
+        pub fn default_stat() -> libc::stat {
+            libc::stat {
+                st_dev: 0,
+                __pad0: [0, ..4],
+                __st_ino: 0,
+                st_mode: 0,
+                st_nlink: 0,
+                st_uid: 0,
+                st_gid: 0,
+                st_rdev: 0,
+                __pad3: [0, ..4],
+                st_size: 0,
+                st_blksize: 0,
+                st_blocks: 0,
+                st_atime: 0,
+                st_atime_nsec: 0,
+                st_mtime: 0,
+                st_mtime_nsec: 0,
+                st_ctime: 0,
+                st_ctime_nsec: 0,
+                st_ino: 0
+            }
+        }
+    }
+
     #[cfg(target_arch = "mips")]
     pub mod arch {
         use libc;
diff --git a/src/test/run-pass/core-run-destroy.rs b/src/test/run-pass/core-run-destroy.rs
index 81cdb926e5f..64f9ecc9de2 100644
--- a/src/test/run-pass/core-run-destroy.rs
+++ b/src/test/run-pass/core-run-destroy.rs
@@ -42,12 +42,18 @@ fn test_destroy_actually_kills(force: bool) {
     #[cfg(windows)]
     static BLOCK_COMMAND: &'static str = "cmd";
 
-    #[cfg(unix)]
+    #[cfg(unix,not(target_os="android"))]
     fn process_exists(pid: libc::pid_t) -> bool {
         let run::ProcessOutput {output, _} = run::process_output("ps", [~"-p", pid.to_str()]);
         str::from_bytes(output).contains(pid.to_str())
     }
 
+    #[cfg(unix,target_os="android")]
+    fn process_exists(pid: libc::pid_t) -> bool {
+        let run::ProcessOutput {output, _} = run::process_output("/system/bin/ps", [pid.to_str()]);
+        str::from_bytes(output).contains(~"root")
+    }
+
     #[cfg(windows)]
     fn process_exists(pid: libc::pid_t) -> bool {
 
diff --git a/src/test/run-pass/intrinsic-alignment.rs b/src/test/run-pass/intrinsic-alignment.rs
index 7a54b87404e..27767db8733 100644
--- a/src/test/run-pass/intrinsic-alignment.rs
+++ b/src/test/run-pass/intrinsic-alignment.rs
@@ -60,7 +60,7 @@ mod m {
     pub fn main() {
         unsafe {
             assert_eq!(::rusti::pref_align_of::<u64>(), 8u);
-            assert_eq!(::rusti::min_align_of::<u64>(), 4u);
+            assert_eq!(::rusti::min_align_of::<u64>(), 8u);
         }
     }
 }
diff --git a/src/test/run-pass/rec-align-u64.rs b/src/test/run-pass/rec-align-u64.rs
index 8c67b971243..7bc7a8583b9 100644
--- a/src/test/run-pass/rec-align-u64.rs
+++ b/src/test/run-pass/rec-align-u64.rs
@@ -63,8 +63,8 @@ mod m {
 mod m {
     #[cfg(target_arch = "arm")]
     pub mod m {
-        pub fn align() -> uint { 4u }
-        pub fn size() -> uint { 12u }
+        pub fn align() -> uint { 8u }
+        pub fn size() -> uint { 16u }
     }
 }