Skip to content

Commit d424022

Browse files
committed
Update Android images/runners
1 parent bcbfa85 commit d424022

File tree

6 files changed

+82
-1
lines changed

6 files changed

+82
-1
lines changed

ci/docker/aarch64-linux-android/Dockerfile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,17 @@ RUN chmod 755 /android/sdk/tools/* /android/sdk/tools/qemu/linux-x86_64/*
2929

3030
ENV PATH=$PATH:/rust/bin \
3131
CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER=aarch64-linux-android-gcc \
32+
CARGO_TARGET_AARCH64_LINUX_ANDROID_RUNNER=/tmp/runtest \
3233
HOME=/tmp
34+
35+
ADD runtest-android.rs /tmp/runtest.rs
36+
ENTRYPOINT [ \
37+
"bash", \
38+
"-c", \
39+
# set SHELL so android can detect a 64bits system, see
40+
# http://stackoverflow.com/a/41789144
41+
"SHELL=/bin/dash emulator @aarch64 -no-window & \
42+
rustc /tmp/runtest.rs -o /tmp/runtest && \
43+
exec \"$@\"", \
44+
"--" \
45+
]

ci/docker/arm-linux-androideabi/Dockerfile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,17 @@ RUN chmod 755 /android/sdk/tools/* /android/sdk/tools/qemu/linux-x86_64/*
2929

3030
ENV PATH=$PATH:/rust/bin \
3131
CARGO_TARGET_ARM_LINUX_ANDROIDEABI_LINKER=arm-linux-androideabi-gcc \
32+
CARGO_TARGET_ARM_LINUX_ANDROIDEABI_RUNNER=/tmp/runtest \
3233
HOME=/tmp
34+
35+
ADD runtest-android.rs /tmp/runtest.rs
36+
ENTRYPOINT [ \
37+
"bash", \
38+
"-c", \
39+
# set SHELL so android can detect a 64bits system, see
40+
# http://stackoverflow.com/a/41789144
41+
"SHELL=/bin/dash emulator @arm -no-window & \
42+
rustc /tmp/runtest.rs -o /tmp/runtest && \
43+
exec \"$@\"", \
44+
"--" \
45+
]

ci/docker/i686-linux-android/Dockerfile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,17 @@ RUN chmod 755 /android/sdk/tools/* /android/sdk/tools/qemu/linux-x86_64/*
2929

3030
ENV PATH=$PATH:/rust/bin \
3131
CARGO_TARGET_I686_LINUX_ANDROID_LINKER=i686-linux-android-gcc \
32+
CARGO_TARGET_I686_LINUX_ANDROID_RUNNER=/tmp/runtest \
3233
HOME=/tmp
34+
35+
ADD runtest-android.rs /tmp/runtest.rs
36+
ENTRYPOINT [ \
37+
"bash", \
38+
"-c", \
39+
# set SHELL so android can detect a 64bits system, see
40+
# http://stackoverflow.com/a/41789144
41+
"SHELL=/bin/dash emulator @i686 -no-window -no-accel & \
42+
rustc /tmp/runtest.rs -o /tmp/runtest && \
43+
exec \"$@\"", \
44+
"--" \
45+
]

ci/run-docker.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ run() {
1414
docker run \
1515
--user `id -u`:`id -g` \
1616
--rm \
17+
--init \
1718
--volume $HOME/.cargo:/cargo \
1819
$kvm \
1920
--env CARGO_HOME=/cargo \

ci/run.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,4 +68,4 @@ if [ "$QEMU" != "" ]; then
6868
exec grep "^PASSED .* tests" $CARGO_TARGET_DIR/out.log
6969
fi
7070

71-
cargo test --manifest-path libc-test/Cargo.toml --target $TARGET
71+
exec cargo test --manifest-path libc-test/Cargo.toml --target $TARGET

ci/runtest-android.rs

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
use std::env;
2+
use std::process::Command;
3+
use std::path::{Path, PathBuf};
4+
5+
fn main() {
6+
assert_eq!(env::args_os().len(), 2);
7+
let test = PathBuf::from(env::args_os().nth(1).unwrap());
8+
let dst = Path::new("/data/local/tmp").join(test.file_name().unwrap());
9+
10+
let status = Command::new("adb")
11+
.arg("wait-for-device")
12+
.status()
13+
.expect("failed to run rumprun-bake");
14+
assert!(status.success());
15+
16+
let status = Command::new("adb")
17+
.arg("push")
18+
.arg(&test)
19+
.arg(&dst)
20+
.status()
21+
.expect("failed to run rumprun-bake");
22+
assert!(status.success());
23+
24+
let output = Command::new("adb")
25+
.arg("shell")
26+
.arg(&dst)
27+
.output()
28+
.expect("failed to run rumprun-bake");
29+
assert!(status.success());
30+
31+
println!("status: {}\nstdout ---\n{}\nstderr ---\n{}",
32+
output.status,
33+
String::from_utf8_lossy(&output.stdout),
34+
String::from_utf8_lossy(&output.stderr));
35+
36+
let stdout = String::from_utf8_lossy(&output.stdout);
37+
let mut lines = stdout.lines().filter(|l| l.starts_with("PASSED "));
38+
if !lines.any(|l| l.contains(" tests")) {
39+
panic!("failed to find successful test run");
40+
}
41+
}

0 commit comments

Comments
 (0)