diff options
author | Alex Crichton <alex@alexcrichton.com> | 2017-08-21 22:48:18 -0700 |
---|---|---|
committer | Alex Crichton <alex@alexcrichton.com> | 2017-08-21 22:52:06 -0700 |
commit | d4240220057afe518921912c0832f70d67b19de3 (patch) | |
tree | 00da2d3f6e7988e3b7bfe52d930584f83839f784 | |
parent | bcbfa856511f4f7bdacb8188eadcc7cbe38727e2 (diff) | |
download | rust-libc-d4240220057afe518921912c0832f70d67b19de3.tar.gz |
Update Android images/runners
-rw-r--r-- | ci/docker/aarch64-linux-android/Dockerfile | 13 | ||||
-rw-r--r-- | ci/docker/arm-linux-androideabi/Dockerfile | 13 | ||||
-rw-r--r-- | ci/docker/i686-linux-android/Dockerfile | 13 | ||||
-rwxr-xr-x | ci/run-docker.sh | 1 | ||||
-rwxr-xr-x | ci/run.sh | 2 | ||||
-rw-r--r-- | ci/runtest-android.rs | 41 |
6 files changed, 82 insertions, 1 deletions
diff --git a/ci/docker/aarch64-linux-android/Dockerfile b/ci/docker/aarch64-linux-android/Dockerfile index 7ad84926bf..345540a3f0 100644 --- a/ci/docker/aarch64-linux-android/Dockerfile +++ b/ci/docker/aarch64-linux-android/Dockerfile @@ -29,4 +29,17 @@ RUN chmod 755 /android/sdk/tools/* /android/sdk/tools/qemu/linux-x86_64/* ENV PATH=$PATH:/rust/bin \ CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER=aarch64-linux-android-gcc \ + CARGO_TARGET_AARCH64_LINUX_ANDROID_RUNNER=/tmp/runtest \ HOME=/tmp + +ADD runtest-android.rs /tmp/runtest.rs +ENTRYPOINT [ \ + "bash", \ + "-c", \ + # set SHELL so android can detect a 64bits system, see + # http://stackoverflow.com/a/41789144 + "SHELL=/bin/dash emulator @aarch64 -no-window & \ + rustc /tmp/runtest.rs -o /tmp/runtest && \ + exec \"$@\"", \ + "--" \ +] diff --git a/ci/docker/arm-linux-androideabi/Dockerfile b/ci/docker/arm-linux-androideabi/Dockerfile index 054941416d..554f078729 100644 --- a/ci/docker/arm-linux-androideabi/Dockerfile +++ b/ci/docker/arm-linux-androideabi/Dockerfile @@ -29,4 +29,17 @@ RUN chmod 755 /android/sdk/tools/* /android/sdk/tools/qemu/linux-x86_64/* ENV PATH=$PATH:/rust/bin \ CARGO_TARGET_ARM_LINUX_ANDROIDEABI_LINKER=arm-linux-androideabi-gcc \ + CARGO_TARGET_ARM_LINUX_ANDROIDEABI_RUNNER=/tmp/runtest \ HOME=/tmp + +ADD runtest-android.rs /tmp/runtest.rs +ENTRYPOINT [ \ + "bash", \ + "-c", \ + # set SHELL so android can detect a 64bits system, see + # http://stackoverflow.com/a/41789144 + "SHELL=/bin/dash emulator @arm -no-window & \ + rustc /tmp/runtest.rs -o /tmp/runtest && \ + exec \"$@\"", \ + "--" \ +] diff --git a/ci/docker/i686-linux-android/Dockerfile b/ci/docker/i686-linux-android/Dockerfile index bee9043796..7671f78b4f 100644 --- a/ci/docker/i686-linux-android/Dockerfile +++ b/ci/docker/i686-linux-android/Dockerfile @@ -29,4 +29,17 @@ RUN chmod 755 /android/sdk/tools/* /android/sdk/tools/qemu/linux-x86_64/* ENV PATH=$PATH:/rust/bin \ CARGO_TARGET_I686_LINUX_ANDROID_LINKER=i686-linux-android-gcc \ + CARGO_TARGET_I686_LINUX_ANDROID_RUNNER=/tmp/runtest \ HOME=/tmp + +ADD runtest-android.rs /tmp/runtest.rs +ENTRYPOINT [ \ + "bash", \ + "-c", \ + # set SHELL so android can detect a 64bits system, see + # http://stackoverflow.com/a/41789144 + "SHELL=/bin/dash emulator @i686 -no-window -no-accel & \ + rustc /tmp/runtest.rs -o /tmp/runtest && \ + exec \"$@\"", \ + "--" \ +] diff --git a/ci/run-docker.sh b/ci/run-docker.sh index deafa99226..662a1d491a 100755 --- a/ci/run-docker.sh +++ b/ci/run-docker.sh @@ -14,6 +14,7 @@ run() { docker run \ --user `id -u`:`id -g` \ --rm \ + --init \ --volume $HOME/.cargo:/cargo \ $kvm \ --env CARGO_HOME=/cargo \ @@ -68,4 +68,4 @@ if [ "$QEMU" != "" ]; then exec grep "^PASSED .* tests" $CARGO_TARGET_DIR/out.log fi -cargo test --manifest-path libc-test/Cargo.toml --target $TARGET +exec cargo test --manifest-path libc-test/Cargo.toml --target $TARGET diff --git a/ci/runtest-android.rs b/ci/runtest-android.rs new file mode 100644 index 0000000000..a8f8db83ff --- /dev/null +++ b/ci/runtest-android.rs @@ -0,0 +1,41 @@ +use std::env; +use std::process::Command; +use std::path::{Path, PathBuf}; + +fn main() { + assert_eq!(env::args_os().len(), 2); + let test = PathBuf::from(env::args_os().nth(1).unwrap()); + let dst = Path::new("/data/local/tmp").join(test.file_name().unwrap()); + + let status = Command::new("adb") + .arg("wait-for-device") + .status() + .expect("failed to run rumprun-bake"); + assert!(status.success()); + + let status = Command::new("adb") + .arg("push") + .arg(&test) + .arg(&dst) + .status() + .expect("failed to run rumprun-bake"); + assert!(status.success()); + + let output = Command::new("adb") + .arg("shell") + .arg(&dst) + .output() + .expect("failed to run rumprun-bake"); + assert!(status.success()); + + println!("status: {}\nstdout ---\n{}\nstderr ---\n{}", + output.status, + String::from_utf8_lossy(&output.stdout), + String::from_utf8_lossy(&output.stderr)); + + let stdout = String::from_utf8_lossy(&output.stdout); + let mut lines = stdout.lines().filter(|l| l.starts_with("PASSED ")); + if !lines.any(|l| l.contains(" tests")) { + panic!("failed to find successful test run"); + } +} |