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
This commit is contained in:
bors 2013-06-20 11:35:34 -07:00
commit f348465283
7 changed files with 92 additions and 11 deletions

View File

@ -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) \

View File

@ -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

View File

@ -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 {}

View File

@ -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;

View File

@ -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 {

View File

@ -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);
}
}
}

View File

@ -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 }
}
}