From bcaabae7c22d27fdbb07ea6009a6f4a9c3672fa2 Mon Sep 17 00:00:00 2001 From: Daniel Mueller Date: Sat, 16 Sep 2017 08:42:30 -0700 Subject: Update libc crate to 0.2.30 Import subrepo libc/:libc at 3520512a8c9cb55661910318a6fb169a75c02a59 --- libc/ci/android-install-ndk.sh | 9 +- libc/ci/docker/aarch64-linux-android/Dockerfile | 13 +++ .../ci/docker/aarch64-unknown-linux-gnu/Dockerfile | 6 +- libc/ci/docker/arm-linux-androideabi/Dockerfile | 13 +++ .../docker/arm-unknown-linux-gnueabihf/Dockerfile | 6 +- libc/ci/docker/asmjs-unknown-emscripten/Dockerfile | 20 ++++ libc/ci/docker/i686-linux-android/Dockerfile | 13 +++ libc/ci/docker/i686-unknown-linux-gnu/Dockerfile | 2 +- libc/ci/docker/i686-unknown-linux-musl/Dockerfile | 11 +- libc/ci/docker/mips-unknown-linux-gnu/Dockerfile | 6 +- libc/ci/docker/mips-unknown-linux-musl/Dockerfile | 8 +- .../mips64-unknown-linux-gnuabi64/Dockerfile | 6 +- .../ci/docker/mipsel-unknown-linux-musl/Dockerfile | 8 +- .../ci/docker/powerpc-unknown-linux-gnu/Dockerfile | 6 +- .../docker/powerpc64-unknown-linux-gnu/Dockerfile | 6 +- libc/ci/docker/s390x-unknown-linux-gnu/Dockerfile | 12 ++ .../ci/docker/wasm32-unknown-emscripten/Dockerfile | 21 ++++ .../wasm32-unknown-emscripten/node-wrapper.sh | 11 ++ libc/ci/docker/x86_64-linux-android/Dockerfile | 2 +- libc/ci/docker/x86_64-rumprun-netbsd/Dockerfile | 6 +- libc/ci/docker/x86_64-rumprun-netbsd/runtest.rs | 54 +++++++++ libc/ci/docker/x86_64-unknown-linux-gnu/Dockerfile | 2 +- .../ci/docker/x86_64-unknown-linux-musl/Dockerfile | 11 +- libc/ci/docker/x86_64-unknown-openbsd/Dockerfile | 8 -- libc/ci/emscripten-entry.sh | 19 ++++ libc/ci/emscripten.sh | 54 +++++++++ libc/ci/run-docker.sh | 2 +- libc/ci/run.sh | 123 +-------------------- libc/ci/runtest-android.rs | 41 +++++++ 29 files changed, 335 insertions(+), 164 deletions(-) create mode 100644 libc/ci/docker/asmjs-unknown-emscripten/Dockerfile create mode 100644 libc/ci/docker/s390x-unknown-linux-gnu/Dockerfile create mode 100644 libc/ci/docker/wasm32-unknown-emscripten/Dockerfile create mode 100755 libc/ci/docker/wasm32-unknown-emscripten/node-wrapper.sh create mode 100644 libc/ci/docker/x86_64-rumprun-netbsd/runtest.rs delete mode 100644 libc/ci/docker/x86_64-unknown-openbsd/Dockerfile create mode 100755 libc/ci/emscripten-entry.sh create mode 100644 libc/ci/emscripten.sh mode change 100644 => 100755 libc/ci/run-docker.sh create mode 100644 libc/ci/runtest-android.rs (limited to 'libc/ci') diff --git a/libc/ci/android-install-ndk.sh b/libc/ci/android-install-ndk.sh index 75bcd20..873f6c5 100644 --- a/libc/ci/android-install-ndk.sh +++ b/libc/ci/android-install-ndk.sh @@ -11,8 +11,8 @@ set -ex -curl -O https://dl.google.com/android/repository/android-ndk-r13b-linux-x86_64.zip -unzip -q android-ndk-r13b-linux-x86_64.zip +curl -O https://dl.google.com/android/repository/android-ndk-r15b-linux-x86_64.zip +unzip -q android-ndk-r15b-linux-x86_64.zip case "$1" in aarch64) @@ -28,9 +28,10 @@ case "$1" in ;; esac; -android-ndk-r13b/build/tools/make_standalone_toolchain.py \ +android-ndk-r15b/build/tools/make_standalone_toolchain.py \ + --unified-headers \ --install-dir /android/ndk-$1 \ --arch $arch \ --api 24 -rm -rf ./android-ndk-r13b-linux-x86_64.zip ./android-ndk-r13b +rm -rf ./android-ndk-r15b-linux-x86_64.zip ./android-ndk-r15b diff --git a/libc/ci/docker/aarch64-linux-android/Dockerfile b/libc/ci/docker/aarch64-linux-android/Dockerfile index 7ad8492..345540a 100644 --- a/libc/ci/docker/aarch64-linux-android/Dockerfile +++ b/libc/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/libc/ci/docker/aarch64-unknown-linux-gnu/Dockerfile b/libc/ci/docker/aarch64-unknown-linux-gnu/Dockerfile index 2ba69e1..18214a3 100644 --- a/libc/ci/docker/aarch64-unknown-linux-gnu/Dockerfile +++ b/libc/ci/docker/aarch64-unknown-linux-gnu/Dockerfile @@ -1,7 +1,7 @@ -FROM ubuntu:16.10 -RUN apt-get update -RUN apt-get install -y --no-install-recommends \ +FROM ubuntu:17.10 +RUN apt-get update && apt-get install -y --no-install-recommends \ gcc libc6-dev ca-certificates \ gcc-aarch64-linux-gnu libc6-dev-arm64-cross qemu-user ENV CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc \ + CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_RUNNER="qemu-aarch64 -L /usr/aarch64-linux-gnu" \ PATH=$PATH:/rust/bin diff --git a/libc/ci/docker/arm-linux-androideabi/Dockerfile b/libc/ci/docker/arm-linux-androideabi/Dockerfile index 0549414..554f078 100644 --- a/libc/ci/docker/arm-linux-androideabi/Dockerfile +++ b/libc/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/libc/ci/docker/arm-unknown-linux-gnueabihf/Dockerfile b/libc/ci/docker/arm-unknown-linux-gnueabihf/Dockerfile index 3824c04..9fe71dc 100644 --- a/libc/ci/docker/arm-unknown-linux-gnueabihf/Dockerfile +++ b/libc/ci/docker/arm-unknown-linux-gnueabihf/Dockerfile @@ -1,7 +1,7 @@ -FROM ubuntu:16.10 -RUN apt-get update -RUN apt-get install -y --no-install-recommends \ +FROM ubuntu:17.10 +RUN apt-get update && apt-get install -y --no-install-recommends \ gcc libc6-dev ca-certificates \ gcc-arm-linux-gnueabihf libc6-dev-armhf-cross qemu-user ENV CARGO_TARGET_ARM_UNKNOWN_LINUX_GNUEABIHF_LINKER=arm-linux-gnueabihf-gcc \ + CARGO_TARGET_ARM_UNKNOWN_LINUX_GNUEABIHF_RUNNER="qemu-arm -L /usr/arm-linux-gnueabihf" \ PATH=$PATH:/rust/bin diff --git a/libc/ci/docker/asmjs-unknown-emscripten/Dockerfile b/libc/ci/docker/asmjs-unknown-emscripten/Dockerfile new file mode 100644 index 0000000..3088fc5 --- /dev/null +++ b/libc/ci/docker/asmjs-unknown-emscripten/Dockerfile @@ -0,0 +1,20 @@ +FROM ubuntu:16.04 + +RUN apt-get update && \ + apt-get install -y --no-install-recommends \ + ca-certificates \ + curl \ + gcc \ + git \ + libc6-dev \ + python \ + xz-utils + +COPY emscripten.sh / +RUN bash /emscripten.sh + +ENV PATH=$PATH:/rust/bin \ + CARGO_TARGET_ASMJS_UNKNOWN_EMSCRIPTEN_RUNNER=node + +COPY emscripten-entry.sh / +ENTRYPOINT ["/emscripten-entry.sh"] diff --git a/libc/ci/docker/i686-linux-android/Dockerfile b/libc/ci/docker/i686-linux-android/Dockerfile index bee9043..7671f78 100644 --- a/libc/ci/docker/i686-linux-android/Dockerfile +++ b/libc/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/libc/ci/docker/i686-unknown-linux-gnu/Dockerfile b/libc/ci/docker/i686-unknown-linux-gnu/Dockerfile index c149d84..a5a4b8e 100644 --- a/libc/ci/docker/i686-unknown-linux-gnu/Dockerfile +++ b/libc/ci/docker/i686-unknown-linux-gnu/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:16.10 +FROM ubuntu:17.10 RUN apt-get update RUN apt-get install -y --no-install-recommends \ gcc-multilib libc6-dev ca-certificates diff --git a/libc/ci/docker/i686-unknown-linux-musl/Dockerfile b/libc/ci/docker/i686-unknown-linux-musl/Dockerfile index bdc2272..3adb920 100644 --- a/libc/ci/docker/i686-unknown-linux-musl/Dockerfile +++ b/libc/ci/docker/i686-unknown-linux-musl/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:16.10 +FROM ubuntu:17.10 RUN dpkg --add-architecture i386 RUN apt-get update @@ -18,6 +18,13 @@ RUN curl https://www.musl-libc.org/releases/musl-1.1.15.tar.gz | \ CC=gcc CFLAGS=-m32 ./configure --prefix=/musl-i686 --disable-shared --target=i686 && \ make CROSS_COMPILE= install -j4 && \ cd .. && \ - rm -rf musl-1.1.15 + rm -rf musl-1.1.15 && \ +# Install linux kernel headers sanitized for use with musl + curl -L https://github.com/sabotage-linux/kernel-headers/archive/v3.12.6-5.tar.gz | \ + tar xzf - && \ + cd kernel-headers-3.12.6-5 && \ + make ARCH=i386 prefix=/musl-i686 install -j4 && \ + cd .. && \ + rm -rf kernel-headers-3.12.6-5 ENV PATH=$PATH:/musl-i686/bin:/rust/bin \ CC_i686_unknown_linux_musl=musl-gcc diff --git a/libc/ci/docker/mips-unknown-linux-gnu/Dockerfile b/libc/ci/docker/mips-unknown-linux-gnu/Dockerfile index eea1f65..c66abd4 100644 --- a/libc/ci/docker/mips-unknown-linux-gnu/Dockerfile +++ b/libc/ci/docker/mips-unknown-linux-gnu/Dockerfile @@ -1,10 +1,10 @@ -FROM ubuntu:16.10 +FROM ubuntu:17.10 -RUN apt-get update -RUN apt-get install -y --no-install-recommends \ +RUN apt-get update && apt-get install -y --no-install-recommends \ gcc libc6-dev qemu-user ca-certificates \ gcc-mips-linux-gnu libc6-dev-mips-cross \ qemu-system-mips ENV CARGO_TARGET_MIPS_UNKNOWN_LINUX_GNU_LINKER=mips-linux-gnu-gcc \ + CARGO_TARGET_MIPS_UNKNOWN_LINUX_GNU_RUNNER="qemu-mips -L /usr/mips-linux-gnu" \ PATH=$PATH:/rust/bin diff --git a/libc/ci/docker/mips-unknown-linux-musl/Dockerfile b/libc/ci/docker/mips-unknown-linux-musl/Dockerfile index cbc41c2..3fb0eeb 100644 --- a/libc/ci/docker/mips-unknown-linux-musl/Dockerfile +++ b/libc/ci/docker/mips-unknown-linux-musl/Dockerfile @@ -1,7 +1,6 @@ -FROM ubuntu:16.10 +FROM ubuntu:17.10 -RUN apt-get update -RUN apt-get install -y --no-install-recommends \ +RUN apt-get update && apt-get install -y --no-install-recommends \ gcc libc6-dev qemu-user ca-certificates qemu-system-mips curl \ bzip2 @@ -14,4 +13,5 @@ RUN curl -L https://s3.amazonaws.com/rust-lang-ci/libc/OpenWrt-SDK-ar71xx-generi ENV PATH=$PATH:/rust/bin:/toolchain/staging_dir/toolchain-mips_34kc_gcc-5.3.0_musl-1.1.15/bin \ CC_mips_unknown_linux_musl=mips-openwrt-linux-gcc \ - CARGO_TARGET_MIPS_UNKNOWN_LINUX_MUSL_LINKER=mips-openwrt-linux-gcc + CARGO_TARGET_MIPS_UNKNOWN_LINUX_MUSL_LINKER=mips-openwrt-linux-gcc \ + CARGO_TARGET_MIPS_UNKNOWN_LINUX_MUSL_RUNNER="qemu-mips -L /toolchain/staging_dir/toolchain-mips_34kc_gcc-5.3.0_musl-1.1.15" diff --git a/libc/ci/docker/mips64-unknown-linux-gnuabi64/Dockerfile b/libc/ci/docker/mips64-unknown-linux-gnuabi64/Dockerfile index 2eb5de2..b9921fc 100644 --- a/libc/ci/docker/mips64-unknown-linux-gnuabi64/Dockerfile +++ b/libc/ci/docker/mips64-unknown-linux-gnuabi64/Dockerfile @@ -1,11 +1,11 @@ -FROM ubuntu:16.10 +FROM ubuntu:17.10 -RUN apt-get update -RUN apt-get install -y --no-install-recommends \ +RUN apt-get update && apt-get install -y --no-install-recommends \ gcc libc6-dev qemu-user ca-certificates \ gcc-mips64-linux-gnuabi64 libc6-dev-mips64-cross \ qemu-system-mips64 ENV CARGO_TARGET_MIPS64_UNKNOWN_LINUX_GNUABI64_LINKER=mips64-linux-gnuabi64-gcc \ + CARGO_TARGET_MIPS64_UNKNOWN_LINUX_GNUABI64_RUNNER="qemu-mips64 -L /usr/mips64-linux-gnuabi64" \ CC_mips64_unknown_linux_gnuabi64=mips64-linux-gnuabi64-gcc \ PATH=$PATH:/rust/bin diff --git a/libc/ci/docker/mipsel-unknown-linux-musl/Dockerfile b/libc/ci/docker/mipsel-unknown-linux-musl/Dockerfile index 4c7ee8b..a2c3bc4 100644 --- a/libc/ci/docker/mipsel-unknown-linux-musl/Dockerfile +++ b/libc/ci/docker/mipsel-unknown-linux-musl/Dockerfile @@ -1,7 +1,6 @@ -FROM ubuntu:16.10 +FROM ubuntu:17.10 -RUN apt-get update -RUN apt-get install -y --no-install-recommends \ +RUN apt-get update && apt-get install -y --no-install-recommends \ gcc libc6-dev qemu-user ca-certificates qemu-system-mips curl \ bzip2 @@ -14,4 +13,5 @@ RUN curl -L https://s3.amazonaws.com/rust-lang-ci/libc/OpenWrt-Toolchain-malta-l ENV PATH=$PATH:/rust/bin:/toolchain/bin \ CC_mipsel_unknown_linux_musl=mipsel-openwrt-linux-gcc \ - CARGO_TARGET_MIPSEL_UNKNOWN_LINUX_MUSL_LINKER=mipsel-openwrt-linux-gcc + CARGO_TARGET_MIPSEL_UNKNOWN_LINUX_MUSL_LINKER=mipsel-openwrt-linux-gcc \ + CARGO_TARGET_MIPSEL_UNKNOWN_LINUX_MUSL_RUNNER="qemu-mipsel -L /toolchain" diff --git a/libc/ci/docker/powerpc-unknown-linux-gnu/Dockerfile b/libc/ci/docker/powerpc-unknown-linux-gnu/Dockerfile index d9d7db0..106ada4 100644 --- a/libc/ci/docker/powerpc-unknown-linux-gnu/Dockerfile +++ b/libc/ci/docker/powerpc-unknown-linux-gnu/Dockerfile @@ -1,10 +1,10 @@ -FROM ubuntu:16.10 +FROM ubuntu:17.10 -RUN apt-get update -RUN apt-get install -y --no-install-recommends \ +RUN apt-get update && apt-get install -y --no-install-recommends \ gcc libc6-dev qemu-user ca-certificates \ gcc-powerpc-linux-gnu libc6-dev-powerpc-cross \ qemu-system-ppc ENV CARGO_TARGET_POWERPC_UNKNOWN_LINUX_GNU_LINKER=powerpc-linux-gnu-gcc \ + CARGO_TARGET_POWERPC_UNKNOWN_LINUX_GNU_RUNNER="qemu-ppc -L /usr/powerpc-linux-gnu" \ PATH=$PATH:/rust/bin diff --git a/libc/ci/docker/powerpc64-unknown-linux-gnu/Dockerfile b/libc/ci/docker/powerpc64-unknown-linux-gnu/Dockerfile index df0e605..a6ab66a 100644 --- a/libc/ci/docker/powerpc64-unknown-linux-gnu/Dockerfile +++ b/libc/ci/docker/powerpc64-unknown-linux-gnu/Dockerfile @@ -1,11 +1,11 @@ -FROM ubuntu:16.10 +FROM ubuntu:17.10 -RUN apt-get update -RUN apt-get install -y --no-install-recommends \ +RUN apt-get update && apt-get install -y --no-install-recommends \ gcc libc6-dev qemu-user ca-certificates \ gcc-powerpc64-linux-gnu libc6-dev-ppc64-cross \ qemu-system-ppc ENV CARGO_TARGET_POWERPC64_UNKNOWN_LINUX_GNU_LINKER=powerpc64-linux-gnu-gcc \ + CARGO_TARGET_POWERPC64_UNKNOWN_LINUX_GNU_RUNNER="qemu-ppc64 -L /usr/powerpc64-linux-gnu" \ CC=powerpc64-linux-gnu-gcc \ PATH=$PATH:/rust/bin diff --git a/libc/ci/docker/s390x-unknown-linux-gnu/Dockerfile b/libc/ci/docker/s390x-unknown-linux-gnu/Dockerfile new file mode 100644 index 0000000..49a277d --- /dev/null +++ b/libc/ci/docker/s390x-unknown-linux-gnu/Dockerfile @@ -0,0 +1,12 @@ +FROM ubuntu:17.10 + +RUN apt-get update && apt-get install -y --no-install-recommends \ + gcc libc6-dev qemu-user ca-certificates \ + gcc-s390x-linux-gnu libc6-dev-s390x-cross + +ENV CARGO_TARGET_S390X_UNKNOWN_LINUX_GNU_LINKER=s390x-linux-gnu-gcc \ + # TODO: in theory we should execute this, but qemu segfaults immediately :( + # CARGO_TARGET_S390X_UNKNOWN_LINUX_GNU_RUNNER="qemu-s390x -L /usr/s390x-linux-gnu" \ + CARGO_TARGET_S390X_UNKNOWN_LINUX_GNU_RUNNER=true \ + CC_s390x_unknown_linux_gnu=s390x-linux-gnu-gcc \ + PATH=$PATH:/rust/bin diff --git a/libc/ci/docker/wasm32-unknown-emscripten/Dockerfile b/libc/ci/docker/wasm32-unknown-emscripten/Dockerfile new file mode 100644 index 0000000..59bf7d9 --- /dev/null +++ b/libc/ci/docker/wasm32-unknown-emscripten/Dockerfile @@ -0,0 +1,21 @@ +FROM ubuntu:16.04 + +RUN apt-get update && \ + apt-get install -y --no-install-recommends \ + ca-certificates \ + curl \ + gcc \ + git \ + libc6-dev \ + python \ + xz-utils + +COPY emscripten.sh / +RUN bash /emscripten.sh + +ENV PATH=$PATH:/rust/bin \ + CARGO_TARGET_WASM32_UNKNOWN_EMSCRIPTEN_RUNNER=node-wrapper.sh + +COPY emscripten-entry.sh / +COPY docker/wasm32-unknown-emscripten/node-wrapper.sh /usr/local/bin/node-wrapper.sh +ENTRYPOINT ["/emscripten-entry.sh"] diff --git a/libc/ci/docker/wasm32-unknown-emscripten/node-wrapper.sh b/libc/ci/docker/wasm32-unknown-emscripten/node-wrapper.sh new file mode 100755 index 0000000..b1936f0 --- /dev/null +++ b/libc/ci/docker/wasm32-unknown-emscripten/node-wrapper.sh @@ -0,0 +1,11 @@ +#!/bin/sh + +set -e + +me=$1 +shift +dir=$(dirname $me) +file=$(basename $me) + +cd $dir +exec node $file "$@" diff --git a/libc/ci/docker/x86_64-linux-android/Dockerfile b/libc/ci/docker/x86_64-linux-android/Dockerfile index dfc0c83..0cfbc48 100644 --- a/libc/ci/docker/x86_64-linux-android/Dockerfile +++ b/libc/ci/docker/x86_64-linux-android/Dockerfile @@ -17,7 +17,7 @@ RUN sh /android/android-install-ndk.sh $ANDROID_ARCH # We do not run x86_64-linux-android tests on an android emulator. # See ci/android-sysimage.sh for informations about how tests are run. COPY android-sysimage.sh /android/ -RUN bash /android/android-sysimage.sh x86_64 x86_64-21_r04.zip +RUN bash /android/android-sysimage.sh x86_64 x86_64-24_r07.zip ENV PATH=$PATH:/rust/bin:/android/ndk-$ANDROID_ARCH/bin \ CARGO_TARGET_X86_64_LINUX_ANDROID_LINKER=x86_64-linux-android-gcc \ diff --git a/libc/ci/docker/x86_64-rumprun-netbsd/Dockerfile b/libc/ci/docker/x86_64-rumprun-netbsd/Dockerfile index 129771e..a486d05 100644 --- a/libc/ci/docker/x86_64-rumprun-netbsd/Dockerfile +++ b/libc/ci/docker/x86_64-rumprun-netbsd/Dockerfile @@ -3,4 +3,8 @@ USER root RUN apt-get update RUN apt-get install -y --no-install-recommends \ qemu -ENV PATH=$PATH:/rust/bin +ENV PATH=$PATH:/rust/bin \ + CARGO_TARGET_X86_64_RUMPRUN_NETBSD_RUNNER=/tmp/runtest + +ADD docker/x86_64-rumprun-netbsd/runtest.rs /tmp/ +ENTRYPOINT ["sh", "-c", "rustc /tmp/runtest.rs -o /tmp/runtest && exec \"$@\"", "--"] diff --git a/libc/ci/docker/x86_64-rumprun-netbsd/runtest.rs b/libc/ci/docker/x86_64-rumprun-netbsd/runtest.rs new file mode 100644 index 0000000..94b5946 --- /dev/null +++ b/libc/ci/docker/x86_64-rumprun-netbsd/runtest.rs @@ -0,0 +1,54 @@ +use std::env; +use std::process::{Command, Stdio}; +use std::sync::mpsc; +use std::thread; +use std::time::Duration; +use std::io::{BufRead, BufReader, Read}; + +fn main() { + assert_eq!(env::args().len(), 2); + + let status = Command::new("rumprun-bake") + .arg("hw_virtio") + .arg("/tmp/libc-test.img") + .arg(env::args().nth(1).unwrap()) + .status() + .expect("failed to run rumprun-bake"); + assert!(status.success()); + + let mut child = Command::new("qemu-system-x86_64") + .arg("-nographic") + .arg("-vga").arg("none") + .arg("-m").arg("64") + .arg("-kernel").arg("/tmp/libc-test.img") + .stdout(Stdio::piped()) + .stderr(Stdio::piped()) + .spawn() + .expect("failed to spawn qemu"); + + let mut stdout = child.stdout.take().unwrap(); + let mut stderr = child.stderr.take().unwrap(); + let (tx, rx) = mpsc::channel(); + let tx2 = tx.clone(); + let t1 = thread::spawn(move || find_ok(&mut stdout, tx)); + let t2 = thread::spawn(move || find_ok(&mut stderr, tx2)); + + let res = rx.recv_timeout(Duration::new(5, 0)); + child.kill().unwrap(); + t1.join().unwrap(); + t2.join().unwrap(); + + if res.is_err() { + panic!("didn't find success"); + } +} + +fn find_ok(input: &mut Read, tx: mpsc::Sender<()>) { + for line in BufReader::new(input).lines() { + let line = line.unwrap(); + println!("{}", line); + if line.starts_with("PASSED ") && line.contains(" tests") { + tx.send(()).unwrap(); + } + } +} diff --git a/libc/ci/docker/x86_64-unknown-linux-gnu/Dockerfile b/libc/ci/docker/x86_64-unknown-linux-gnu/Dockerfile index 4af3f83..ca60ede 100644 --- a/libc/ci/docker/x86_64-unknown-linux-gnu/Dockerfile +++ b/libc/ci/docker/x86_64-unknown-linux-gnu/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:16.10 +FROM ubuntu:17.10 RUN apt-get update RUN apt-get install -y --no-install-recommends \ gcc libc6-dev ca-certificates diff --git a/libc/ci/docker/x86_64-unknown-linux-musl/Dockerfile b/libc/ci/docker/x86_64-unknown-linux-musl/Dockerfile index 9c24999..d9d6511 100644 --- a/libc/ci/docker/x86_64-unknown-linux-musl/Dockerfile +++ b/libc/ci/docker/x86_64-unknown-linux-musl/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:16.10 +FROM ubuntu:17.10 RUN apt-get update RUN apt-get install -y --no-install-recommends \ @@ -9,5 +9,12 @@ RUN curl https://www.musl-libc.org/releases/musl-1.1.15.tar.gz | \ ./configure --prefix=/musl-x86_64 && \ make install -j4 && \ cd .. && \ - rm -rf musl-1.1.15 + rm -rf musl-1.1.15 && \ +# Install linux kernel headers sanitized for use with musl + curl -L https://github.com/sabotage-linux/kernel-headers/archive/v3.12.6-5.tar.gz | \ + tar xzf - && \ + cd kernel-headers-3.12.6-5 && \ + make ARCH=x86_64 prefix=/musl-x86_64 install -j4 && \ + cd .. && \ + rm -rf kernel-headers-3.12.6-5 ENV PATH=$PATH:/musl-x86_64/bin:/rust/bin diff --git a/libc/ci/docker/x86_64-unknown-openbsd/Dockerfile b/libc/ci/docker/x86_64-unknown-openbsd/Dockerfile deleted file mode 100644 index 518baf8..0000000 --- a/libc/ci/docker/x86_64-unknown-openbsd/Dockerfile +++ /dev/null @@ -1,8 +0,0 @@ -FROM ubuntu:16.10 - -RUN apt-get update -RUN apt-get install -y --no-install-recommends \ - gcc libc6-dev qemu curl ca-certificates \ - genext2fs -ENV PATH=$PATH:/rust/bin \ - QEMU=2016-11-06/openbsd-6.0-without-pkgs.qcow2 diff --git a/libc/ci/emscripten-entry.sh b/libc/ci/emscripten-entry.sh new file mode 100755 index 0000000..acaebfe --- /dev/null +++ b/libc/ci/emscripten-entry.sh @@ -0,0 +1,19 @@ +#!/bin/bash +# Copyright 2017 The Rust Project Developers. See the COPYRIGHT +# file at the top-level directory of this distribution and at +# http://rust-lang.org/COPYRIGHT. +# +# Licensed under the Apache License, Version 2.0 or the MIT license +# , at your +# option. This file may not be copied, modified, or distributed +# except according to those terms. + +set -ex + +source /emsdk-portable/emsdk_env.sh &> /dev/null + +# emsdk-portable provides a node binary, but we need version 8 to run wasm +export PATH="/node-v8.0.0-linux-x64/bin:$PATH" + +exec "$@" diff --git a/libc/ci/emscripten.sh b/libc/ci/emscripten.sh new file mode 100644 index 0000000..d802585 --- /dev/null +++ b/libc/ci/emscripten.sh @@ -0,0 +1,54 @@ +# Copyright 2017 The Rust Project Developers. See the COPYRIGHT +# file at the top-level directory of this distribution and at +# http://rust-lang.org/COPYRIGHT. +# +# Licensed under the Apache License, Version 2.0 or the MIT license +# , at your +# option. This file may not be copied, modified, or distributed +# except according to those terms. + +set -ex + +hide_output() { + set +x + on_err=" +echo ERROR: An error was encountered with the build. +cat /tmp/build.log +exit 1 +" + trap "$on_err" ERR + bash -c "while true; do sleep 30; echo \$(date) - building ...; done" & + PING_LOOP_PID=$! + $@ &> /tmp/build.log + trap - ERR + kill $PING_LOOP_PID + rm -f /tmp/build.log + set -x +} + +cd / +curl -L https://s3.amazonaws.com/mozilla-games/emscripten/releases/emsdk-portable.tar.gz | \ + tar -xz + +cd /emsdk-portable +./emsdk update +hide_output ./emsdk install sdk-1.37.20-64bit +./emsdk activate sdk-1.37.20-64bit + +# Compile and cache libc +source ./emsdk_env.sh +echo "main(){}" > a.c +HOME=/emsdk-portable/ emcc a.c +HOME=/emsdk-portable/ emcc -s BINARYEN=1 a.c +rm -f a.* + +# Make emsdk usable by any user +cp /root/.emscripten /emsdk-portable +chmod a+rxw -R /emsdk-portable + +# node 8 is required to run wasm +cd / +curl -L https://nodejs.org/dist/v8.0.0/node-v8.0.0-linux-x64.tar.xz | \ + tar -xJ + diff --git a/libc/ci/run-docker.sh b/libc/ci/run-docker.sh old mode 100644 new mode 100755 index e963078..662a1d4 --- a/libc/ci/run-docker.sh +++ b/libc/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 \ @@ -22,7 +23,6 @@ run() { --volume `pwd`/target:/checkout/target \ --env CARGO_TARGET_DIR=/checkout/target \ --workdir /checkout \ - --privileged \ libc \ ci/run.sh $1 } diff --git a/libc/ci/run.sh b/libc/ci/run.sh index 3ddc7b3..ddf18fd 100755 --- a/libc/ci/run.sh +++ b/libc/ci/run.sh @@ -39,36 +39,11 @@ if [ "$QEMU" != "" ]; then rm -f $tmpdir/libc-test.img mkdir $tmpdir/mount - # If we have a cross compiler, then we just do the standard rigamarole of - # cross-compiling an executable and then the script to run just executes the - # binary. - # - # If we don't have a cross-compiler, however, then we need to do some crazy - # acrobatics to get this to work. Generate all.{c,rs} on the host which will - # be compiled inside QEMU. Do this here because compiling syntex_syntax in - # QEMU would time out basically everywhere. - if [ "$CAN_CROSS" = "1" ]; then - cargo build --manifest-path libc-test/Cargo.toml --target $TARGET - cp $CARGO_TARGET_DIR/$TARGET/debug/libc-test $tmpdir/mount/ - echo 'exec $1/libc-test' > $tmpdir/mount/run.sh - else - rm -rf $tmpdir/generated - mkdir -p $tmpdir/generated - cargo build --manifest-path libc-test/generate-files/Cargo.toml - (cd libc-test && TARGET=$TARGET OUT_DIR=$tmpdir/generated SKIP_COMPILE=1 \ - $CARGO_TARGET_DIR/debug/generate-files) - - # Copy this folder into the mounted image, the `run.sh` entry point, and - # overwrite the standard libc-test Cargo.toml with the overlay one which will - # assume the all.{c,rs} test files have already been generated - mkdir $tmpdir/mount/libc - cp -r Cargo.* libc-test src ci $tmpdir/mount/libc/ - ln -s libc-test/target $tmpdir/mount/libc/target - cp ci/run-qemu.sh $tmpdir/mount/run.sh - echo $TARGET | tee -a $tmpdir/mount/TARGET - cp $tmpdir/generated/* $tmpdir/mount/libc/libc-test - cp libc-test/run-generated-Cargo.toml $tmpdir/mount/libc/libc-test/Cargo.toml - fi + # Do the standard rigamarole of cross-compiling an executable and then the + # script to run just executes the binary. + cargo build --manifest-path libc-test/Cargo.toml --target $TARGET + cp $CARGO_TARGET_DIR/$TARGET/debug/libc-test $tmpdir/mount/ + echo 'exec $1/libc-test' > $tmpdir/mount/run.sh du -sh $tmpdir/mount genext2fs \ @@ -93,90 +68,4 @@ if [ "$QEMU" != "" ]; then exec grep "^PASSED .* tests" $CARGO_TARGET_DIR/out.log fi -case "$TARGET" in - *-apple-ios) - cargo rustc --manifest-path libc-test/Cargo.toml --target $TARGET -- \ - -C link-args=-mios-simulator-version-min=7.0 - ;; - - *) - cargo build --manifest-path libc-test/Cargo.toml --target $TARGET - ;; -esac - -case "$TARGET" in - # Android emulator for x86_64 does not work on travis (missing hardware - # acceleration). Tests are run on case *). See ci/android-sysimage.sh for - # informations about how tests are run. - arm-linux-androideabi | aarch64-linux-android | i686-linux-android) - # set SHELL so android can detect a 64bits system, see - # http://stackoverflow.com/a/41789144 - # https://issues.jenkins-ci.org/browse/JENKINS-26930?focusedCommentId=230791&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-230791 - export SHELL=/bin/dash - arch=$(echo $TARGET | cut -d- -f1) - accel="-no-accel" - if emulator -accel-check; then - accel="" - fi - emulator @$arch -no-window $accel & - adb wait-for-device - adb push $CARGO_TARGET_DIR/$TARGET/debug/libc-test /data/local/tmp/libc-test - adb shell /data/local/tmp/libc-test 2>&1 | tee /tmp/out - grep "^PASSED .* tests" /tmp/out - ;; - - i386-apple-ios) - rustc -O ./ci/ios/deploy_and_run_on_ios_simulator.rs - ./deploy_and_run_on_ios_simulator $CARGO_TARGET_DIR/$TARGET/debug/libc-test - ;; - - x86_64-apple-ios) - rustc -O ./ci/ios/deploy_and_run_on_ios_simulator.rs - ./deploy_and_run_on_ios_simulator $CARGO_TARGET_DIR/$TARGET/debug/libc-test - ;; - - arm-unknown-linux-gnueabihf) - qemu-arm -L /usr/arm-linux-gnueabihf $CARGO_TARGET_DIR/$TARGET/debug/libc-test - ;; - - mips-unknown-linux-gnu) - qemu-mips -L /usr/mips-linux-gnu $CARGO_TARGET_DIR/$TARGET/debug/libc-test - ;; - - mips64-unknown-linux-gnuabi64) - qemu-mips64 -L /usr/mips64-linux-gnuabi64 $CARGO_TARGET_DIR/$TARGET/debug/libc-test - ;; - - mips-unknown-linux-musl) - qemu-mips -L /toolchain/staging_dir/toolchain-mips_34kc_gcc-5.3.0_musl-1.1.15 \ - $CARGO_TARGET_DIR/$TARGET/debug/libc-test - ;; - - mipsel-unknown-linux-musl) - qemu-mipsel -L /toolchain $CARGO_TARGET_DIR/$TARGET/debug/libc-test - ;; - - powerpc-unknown-linux-gnu) - qemu-ppc -L /usr/powerpc-linux-gnu $CARGO_TARGET_DIR/$TARGET/debug/libc-test - ;; - - powerpc64-unknown-linux-gnu) - qemu-ppc64 -L /usr/powerpc64-linux-gnu $CARGO_TARGET_DIR/$TARGET/debug/libc-test - ;; - - aarch64-unknown-linux-gnu) - qemu-aarch64 -L /usr/aarch64-linux-gnu/ $CARGO_TARGET_DIR/$TARGET/debug/libc-test - ;; - - *-rumprun-netbsd) - rumprun-bake hw_virtio /tmp/libc-test.img $CARGO_TARGET_DIR/$TARGET/debug/libc-test - qemu-system-x86_64 -nographic -vga none -m 64 \ - -kernel /tmp/libc-test.img 2>&1 | tee /tmp/out & - sleep 5 - grep "^PASSED .* tests" /tmp/out - ;; - - *) - $CARGO_TARGET_DIR/$TARGET/debug/libc-test - ;; -esac +exec cargo test --manifest-path libc-test/Cargo.toml --target $TARGET diff --git a/libc/ci/runtest-android.rs b/libc/ci/runtest-android.rs new file mode 100644 index 0000000..a8f8db8 --- /dev/null +++ b/libc/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"); + } +} -- cgit v1.2.3