Skip to content

Fix some errors and adjustment for rpass on android #7128

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions mk/tests.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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) \
Expand Down
5 changes: 3 additions & 2 deletions src/etc/adb_run_wrapper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
50 changes: 49 additions & 1 deletion src/libstd/libc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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};
Expand All @@ -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,
Expand Down Expand Up @@ -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 {}
Expand Down
30 changes: 29 additions & 1 deletion src/libstd/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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;
Expand Down
8 changes: 7 additions & 1 deletion src/test/run-pass/core-run-destroy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
2 changes: 1 addition & 1 deletion src/test/run-pass/intrinsic-alignment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}
4 changes: 2 additions & 2 deletions src/test/run-pass/rec-align-u64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
}
}

Expand Down