diff options
Diffstat (limited to 'libc/ci')
43 files changed, 552 insertions, 87 deletions
diff --git a/libc/ci/android-install-ndk.sh b/libc/ci/android-install-ndk.sh index ce11d00..54f7b2e 100644 --- a/libc/ci/android-install-ndk.sh +++ b/libc/ci/android-install-ndk.sh @@ -11,7 +11,7 @@ set -ex -curl --retry 5 -O https://dl.google.com/android/repository/android-ndk-r15b-linux-x86_64.zip +curl --retry 10 -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 diff --git a/libc/ci/android-install-sdk.sh b/libc/ci/android-install-sdk.sh index 6b5ac09..e011cfc 100644 --- a/libc/ci/android-install-sdk.sh +++ b/libc/ci/android-install-sdk.sh @@ -19,7 +19,7 @@ set -ex # which apparently magically accepts the licenses. mkdir sdk -curl --retry 5 https://dl.google.com/android/repository/sdk-tools-linux-3859397.zip -O +curl --retry 10 https://dl.google.com/android/repository/sdk-tools-linux-3859397.zip -O unzip -d sdk sdk-tools-linux-3859397.zip case "$1" in @@ -45,6 +45,9 @@ case "$1" in ;; esac; +# See: https://stackoverflow.com/a/51644855/1422197 +export JAVA_OPTS='-XX:+IgnoreUnrecognizedVMOptions --add-modules java.se.ee' + # --no_https avoids # javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: No trusted certificate found yes | ./sdk/tools/bin/sdkmanager --licenses --no_https diff --git a/libc/ci/build.sh b/libc/ci/build.sh new file mode 100644 index 0000000..eb07c18 --- /dev/null +++ b/libc/ci/build.sh @@ -0,0 +1,214 @@ +#!/usr/bin/env sh + +# Checks that libc builds properly for all supported targets on a particular +# Rust version: + +set -ex + +RUST=${TRAVIS_RUST_VERSION} +OS=${TRAVIS_OS_NAME} + +echo "Testing Rust ${RUST} on ${OS}" + +test_target() { + CARGO="${1}" + TARGET="${2}" + NO_STD="${3}" + + opt= + if [ "${TARGET}" = "x86_64-unknown-linux-gnux32" ]; then + # FIXME: x86_64-unknown-linux-gnux32 fail to compile without + # --release + # + # See https://github.com/rust-lang/rust/issues/45417 + opt="--release" + fi + + # If there is a std component, fetch it: + if [ "${NO_STD}" != "1" ]; then + # FIXME: rustup often fails to download some artifacts due to network + # issues, so we retry this N times. + N=5 + n=0 + until [ $n -ge $N ] + do + if rustup target add "${TARGET}" --toolchain "${RUST}" ; then + break + fi + n=$((n+1)) + sleep 1 + done + fi + + # Test that libc builds without any default features (no libstd) + "$CARGO" "+${RUST}" build -vv $opt --no-default-features --target "${TARGET}" + + # Test that libc builds with default features (e.g. libstd) + # if the target supports libstd + if [ "$NO_STD" != "1" ]; then + "$CARGO" "+${RUST}" build -vv $opt --target "${TARGET}" + fi + + # Test that libc builds with the `extra_traits` feature + "$CARGO" "+${RUST}" build -vv $opt --no-default-features --target "${TARGET}" \ + --features extra_traits + + # Also test that it builds with `extra_traits` and default features: + if [ "$NO_STD" != "1" ]; then + "$CARGO" "+${RUST}" build -vv $opt --target "${TARGET}" \ + --features extra_traits + fi +} + +RUST_LINUX_TARGETS="\ +aarch64-linux-android \ +aarch64-unknown-linux-gnu \ +arm-linux-androideabi \ +arm-unknown-linux-gnueabi \ +arm-unknown-linux-gnueabihf \ +armv7-linux-androideabi \ +armv7-unknown-linux-gnueabihf \ +i586-unknown-linux-gnu \ +i686-linux-android \ +i686-unknown-freebsd \ +i686-unknown-linux-gnu \ +i686-unknown-linux-musl \ +mips-unknown-linux-gnu \ +mips-unknown-linux-musl \ +mips64-unknown-linux-gnuabi64 \ +mips64el-unknown-linux-gnuabi64 \ +mipsel-unknown-linux-gnu \ +mipsel-unknown-linux-gnu \ +mipsel-unknown-linux-musl \ +powerpc-unknown-linux-gnu \ +powerpc64-unknown-linux-gnu \ +powerpc64le-unknown-linux-gnu \ +s390x-unknown-linux-gnu \ +x86_64-unknown-freebsd \ +x86_64-unknown-linux-gnu \ +x86_64-unknown-linux-musl \ +x86_64-unknown-netbsd \ +" + +RUST_GT_1_13_LINUX_TARGETS="\ +arm-unknown-linux-musleabi \ +arm-unknown-linux-musleabihf \ +armv7-unknown-linux-musleabihf \ +sparc64-unknown-linux-gnu \ +wasm32-unknown-emscripten \ +x86_64-linux-android \ +x86_64-rumprun-netbsd \ +" +RUST_GT_1_19_LINUX_TARGETS="\ +aarch64-unknown-linux-musl \ +sparcv9-sun-solaris \ +wasm32-unknown-unknown \ +x86_64-sun-solaris \ +" +RUST_GT_1_24_LINUX_TARGETS="\ +i586-unknown-linux-musl \ +x86_64-unknown-cloudabi \ +" + +RUST_NIGHTLY_LINUX_TARGETS="\ +aarch64-fuchsia \ +armv5te-unknown-linux-gnueabi \ +armv5te-unknown-linux-musleabi \ +i686-pc-windows-gnu \ +wasm32-wasi \ +x86_64-fortanix-unknown-sgx \ +x86_64-fuchsia \ +x86_64-pc-windows-gnu \ +x86_64-unknown-linux-gnux32 \ +x86_64-unknown-redox \ +" + +RUST_OSX_TARGETS="\ +aarch64-apple-ios \ +armv7-apple-ios \ +armv7s-apple-ios \ +i386-apple-ios \ +i686-apple-darwin \ +x86_64-apple-darwin \ +x86_64-apple-ios \ +" + +# The targets are listed here alphabetically +TARGETS="" +case "${OS}" in + linux*) + TARGETS="${RUST_LINUX_TARGETS}" + + if [ "${RUST}" != "1.13.0" ]; then + TARGETS="${TARGETS} ${RUST_GT_1_13_LINUX_TARGETS}" + if [ "${RUST}" != "1.19.0" ]; then + TARGETS="${TARGETS} ${RUST_GT_1_19_LINUX_TARGETS}" + if [ "${RUST}" != "1.24.0" ]; then + TARGETS="${TARGETS} ${RUST_GT_1_24_LINUX_TARGETS}" + fi + fi + fi + + if [ "${RUST}" = "nightly" ]; then + TARGETS="${TARGETS} ${RUST_NIGHTLY_LINUX_TARGETS}" + fi + + ;; + osx*) + TARGETS="${RUST_OSX_TARGETS}" + ;; + *) + ;; +esac + +for TARGET in $TARGETS; do + test_target cargo "$TARGET" +done + +# FIXME: https://github.com/rust-lang/rust/issues/58564 +# sparc-unknown-linux-gnu +RUST_LINUX_NO_CORE_TARGETS="\ +aarch64-pc-windows-msvc \ +aarch64-unknown-cloudabi \ +aarch64-unknown-hermit \ +aarch64-unknown-netbsd \ +aarch64-unknown-openbsd \ +armebv7r-none-eabi \ +armebv7r-none-eabihf \ +armv7-unknown-cloudabi-eabihf \ +armv7r-none-eabi \ +armv7r-none-eabihf \ +i586-pc-windows-msvc \ +i686-pc-windows-msvc \ +i686-unknown-cloudabi \ +i686-unknown-haiku \ +i686-unknown-netbsd \ +i686-unknown-openbsd \ +mips-unknown-linux-uclibc \ +mipsel-unknown-linux-uclibc \ +nvptx64-nvidia-cuda \ +powerpc-unknown-linux-gnuspe \ +powerpc-unknown-netbsd \ +riscv32imac-unknown-none-elf \ +riscv32imc-unknown-none-elf \ +sparc64-unknown-netbsd \ +thumbv6m-none-eabi \ +thumbv7em-none-eabi \ +thumbv7em-none-eabihf \ +thumbv7m-none-eabi \ +thumbv7neon-linux-androideabi \ +thumbv7neon-unknown-linux-gnueabihf \ +thumbv8m.main-none-eabi \ +x86_64-pc-windows-msvc +x86_64-unknown-dragonfly \ +x86_64-unknown-haiku \ +x86_64-unknown-hermit \ +x86_64-unknown-l4re-uclibc \ +x86_64-unknown-openbsd \ +" + +if [ "${RUST}" = "nightly" ] && [ "${OS}" = "linux" ]; then + for TARGET in $RUST_LINUX_NO_CORE_TARGETS; do + test_target xargo "$TARGET" 1 + done +fi diff --git a/libc/ci/docker/aarch64-linux-android/Dockerfile b/libc/ci/docker/aarch64-linux-android/Dockerfile index 5fc83aa..1458423 100644 --- a/libc/ci/docker/aarch64-linux-android/Dockerfile +++ b/libc/ci/docker/aarch64-linux-android/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:16.04 +FROM ubuntu:19.04 RUN dpkg --add-architecture i386 && \ apt-get update && \ @@ -9,7 +9,7 @@ RUN dpkg --add-architecture i386 && \ python \ unzip \ expect \ - openjdk-9-jre \ + openjdk-11-jre \ libstdc++6:i386 \ libpulse0 \ gcc \ diff --git a/libc/ci/docker/aarch64-unknown-linux-gnu/Dockerfile b/libc/ci/docker/aarch64-unknown-linux-gnu/Dockerfile index 18214a3..716a445 100644 --- a/libc/ci/docker/aarch64-unknown-linux-gnu/Dockerfile +++ b/libc/ci/docker/aarch64-unknown-linux-gnu/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:17.10 +FROM ubuntu:19.04 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 diff --git a/libc/ci/docker/aarch64-unknown-linux-musl/Dockerfile b/libc/ci/docker/aarch64-unknown-linux-musl/Dockerfile index fbc47d9..143a960 100644 --- a/libc/ci/docker/aarch64-unknown-linux-musl/Dockerfile +++ b/libc/ci/docker/aarch64-unknown-linux-musl/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:17.10 +FROM ubuntu:19.04 RUN apt-get update && apt-get install -y --no-install-recommends \ gcc make libc6-dev git curl ca-certificates \ diff --git a/libc/ci/docker/arm-linux-androideabi/Dockerfile b/libc/ci/docker/arm-linux-androideabi/Dockerfile index a3fc64b..acc784e 100644 --- a/libc/ci/docker/arm-linux-androideabi/Dockerfile +++ b/libc/ci/docker/arm-linux-androideabi/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:16.04 +FROM ubuntu:19.04 RUN dpkg --add-architecture i386 && \ apt-get update && \ @@ -9,7 +9,7 @@ RUN dpkg --add-architecture i386 && \ python \ unzip \ expect \ - openjdk-9-jre \ + openjdk-11-jre \ libstdc++6:i386 \ libpulse0 \ gcc \ diff --git a/libc/ci/docker/arm-unknown-linux-gnueabihf/Dockerfile b/libc/ci/docker/arm-unknown-linux-gnueabihf/Dockerfile index 9fe71dc..bcdbb22 100644 --- a/libc/ci/docker/arm-unknown-linux-gnueabihf/Dockerfile +++ b/libc/ci/docker/arm-unknown-linux-gnueabihf/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:17.10 +FROM ubuntu:19.04 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 diff --git a/libc/ci/docker/arm-unknown-linux-musleabihf/Dockerfile b/libc/ci/docker/arm-unknown-linux-musleabihf/Dockerfile index 0d493ca..e29e854 100644 --- a/libc/ci/docker/arm-unknown-linux-musleabihf/Dockerfile +++ b/libc/ci/docker/arm-unknown-linux-musleabihf/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:17.10 +FROM ubuntu:19.04 RUN apt-get update && apt-get install -y --no-install-recommends \ gcc make libc6-dev git curl ca-certificates \ diff --git a/libc/ci/docker/asmjs-unknown-emscripten/Dockerfile b/libc/ci/docker/asmjs-unknown-emscripten/Dockerfile index 3088fc5..6c08340 100644 --- a/libc/ci/docker/asmjs-unknown-emscripten/Dockerfile +++ b/libc/ci/docker/asmjs-unknown-emscripten/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:16.04 +FROM ubuntu:19.04 RUN apt-get update && \ apt-get install -y --no-install-recommends \ diff --git a/libc/ci/docker/i686-linux-android/Dockerfile b/libc/ci/docker/i686-linux-android/Dockerfile index f0836c3..59ea2d7 100644 --- a/libc/ci/docker/i686-linux-android/Dockerfile +++ b/libc/ci/docker/i686-linux-android/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:16.04 +FROM ubuntu:19.04 RUN dpkg --add-architecture i386 && \ apt-get update && \ @@ -9,7 +9,7 @@ RUN dpkg --add-architecture i386 && \ python \ unzip \ expect \ - openjdk-9-jre \ + openjdk-11-jre \ libstdc++6:i386 \ libpulse0 \ gcc \ diff --git a/libc/ci/docker/i686-unknown-linux-gnu/Dockerfile b/libc/ci/docker/i686-unknown-linux-gnu/Dockerfile index 03f3e8e..5563a7b 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:18.04 +FROM ubuntu:19.04 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 b726e4d..c085c10 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:17.10 +FROM ubuntu:19.04 RUN dpkg --add-architecture i386 RUN apt-get update diff --git a/libc/ci/docker/mips-unknown-linux-gnu/Dockerfile b/libc/ci/docker/mips-unknown-linux-gnu/Dockerfile index c66abd4..9f1bcaf 100644 --- a/libc/ci/docker/mips-unknown-linux-gnu/Dockerfile +++ b/libc/ci/docker/mips-unknown-linux-gnu/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:17.10 +FROM ubuntu:19.04 RUN apt-get update && apt-get install -y --no-install-recommends \ gcc libc6-dev qemu-user ca-certificates \ diff --git a/libc/ci/docker/mips-unknown-linux-musl/Dockerfile b/libc/ci/docker/mips-unknown-linux-musl/Dockerfile index dde22fd..7f2764c 100644 --- a/libc/ci/docker/mips-unknown-linux-musl/Dockerfile +++ b/libc/ci/docker/mips-unknown-linux-musl/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:17.10 +FROM ubuntu:19.04 RUN apt-get update && apt-get install -y --no-install-recommends \ gcc libc6-dev qemu-user ca-certificates qemu-system-mips curl \ diff --git a/libc/ci/docker/mips64-unknown-linux-gnuabi64/Dockerfile b/libc/ci/docker/mips64-unknown-linux-gnuabi64/Dockerfile index b9921fc..b97cdb4 100644 --- a/libc/ci/docker/mips64-unknown-linux-gnuabi64/Dockerfile +++ b/libc/ci/docker/mips64-unknown-linux-gnuabi64/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:17.10 +FROM ubuntu:19.04 RUN apt-get update && apt-get install -y --no-install-recommends \ gcc libc6-dev qemu-user ca-certificates \ diff --git a/libc/ci/docker/mips64el-unknown-linux-gnuabi64/Dockerfile b/libc/ci/docker/mips64el-unknown-linux-gnuabi64/Dockerfile index 434c908..7f79452 100644 --- a/libc/ci/docker/mips64el-unknown-linux-gnuabi64/Dockerfile +++ b/libc/ci/docker/mips64el-unknown-linux-gnuabi64/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:17.10 +FROM ubuntu:19.04 RUN apt-get update && apt-get install -y --no-install-recommends \ gcc libc6-dev qemu-user ca-certificates \ diff --git a/libc/ci/docker/mipsel-unknown-linux-musl/Dockerfile b/libc/ci/docker/mipsel-unknown-linux-musl/Dockerfile index 037bf64..03e8357 100644 --- a/libc/ci/docker/mipsel-unknown-linux-musl/Dockerfile +++ b/libc/ci/docker/mipsel-unknown-linux-musl/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:17.10 +FROM ubuntu:19.04 RUN apt-get update && apt-get install -y --no-install-recommends \ gcc libc6-dev qemu-user ca-certificates qemu-system-mips curl \ diff --git a/libc/ci/docker/powerpc-unknown-linux-gnu/Dockerfile b/libc/ci/docker/powerpc-unknown-linux-gnu/Dockerfile index 106ada4..9fa05af 100644 --- a/libc/ci/docker/powerpc-unknown-linux-gnu/Dockerfile +++ b/libc/ci/docker/powerpc-unknown-linux-gnu/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:17.10 +FROM ubuntu:19.04 RUN apt-get update && apt-get install -y --no-install-recommends \ gcc libc6-dev qemu-user ca-certificates \ @@ -7,4 +7,5 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ 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" \ + CC=powerpc-linux-gnu-gcc \ 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 a6ab66a..ab40789 100644 --- a/libc/ci/docker/powerpc64-unknown-linux-gnu/Dockerfile +++ b/libc/ci/docker/powerpc64-unknown-linux-gnu/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:17.10 +FROM ubuntu:19.04 RUN apt-get update && apt-get install -y --no-install-recommends \ gcc libc6-dev qemu-user ca-certificates \ diff --git a/libc/ci/docker/powerpc64le-unknown-linux-gnu/Dockerfile b/libc/ci/docker/powerpc64le-unknown-linux-gnu/Dockerfile index 627123e..4dcd632 100644 --- a/libc/ci/docker/powerpc64le-unknown-linux-gnu/Dockerfile +++ b/libc/ci/docker/powerpc64le-unknown-linux-gnu/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:17.10 +FROM ubuntu:19.04 RUN apt-get update && apt-get install -y --no-install-recommends \ gcc libc6-dev qemu-user ca-certificates \ diff --git a/libc/ci/docker/s390x-unknown-linux-gnu/Dockerfile b/libc/ci/docker/s390x-unknown-linux-gnu/Dockerfile index 861f4f9..75c11c1 100644 --- a/libc/ci/docker/s390x-unknown-linux-gnu/Dockerfile +++ b/libc/ci/docker/s390x-unknown-linux-gnu/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:17.10 +FROM ubuntu:19.04 RUN apt-get update && apt-get install -y --no-install-recommends \ curl ca-certificates \ diff --git a/libc/ci/docker/sparc64-unknown-linux-gnu/Dockerfile b/libc/ci/docker/sparc64-unknown-linux-gnu/Dockerfile index d9edaab..d1f4503 100644 --- a/libc/ci/docker/sparc64-unknown-linux-gnu/Dockerfile +++ b/libc/ci/docker/sparc64-unknown-linux-gnu/Dockerfile @@ -1,14 +1,11 @@ -FROM debian:stretch +FROM ubuntu:19.04 RUN apt-get update && apt-get install -y --no-install-recommends \ curl ca-certificates \ gcc libc6-dev \ gcc-sparc64-linux-gnu libc6-dev-sparc64-cross \ qemu-system-sparc64 openbios-sparc seabios ipxe-qemu \ - p7zip-full cpio linux-libc-dev-sparc64-cross linux-headers-4.9.0-3-common - -# Put linux/module.h into the right spot as it is not shipped by debian -RUN cp /usr/src/linux-headers-4.9.0-3-common/include/uapi/linux/module.h /usr/sparc64-linux-gnu/include/linux/ + p7zip-full cpio linux-libc-dev-sparc64-cross COPY linux-sparc64.sh / RUN bash /linux-sparc64.sh diff --git a/libc/ci/docker/wasm32-unknown-emscripten/Dockerfile b/libc/ci/docker/wasm32-unknown-emscripten/Dockerfile index 59bf7d9..de8e353 100644 --- a/libc/ci/docker/wasm32-unknown-emscripten/Dockerfile +++ b/libc/ci/docker/wasm32-unknown-emscripten/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:16.04 +FROM ubuntu:19.04 RUN apt-get update && \ apt-get install -y --no-install-recommends \ diff --git a/libc/ci/docker/wasm32-wasi/Dockerfile b/libc/ci/docker/wasm32-wasi/Dockerfile new file mode 100644 index 0000000..d963a44 --- /dev/null +++ b/libc/ci/docker/wasm32-wasi/Dockerfile @@ -0,0 +1,93 @@ +# In the first container we want to assemble the `wasi-sysroot` by compiling it +# from source. This requires a clang 8.0+ compiler with enough wasm support and +# then we're just running a standard `make` inside of what we clone. +FROM ubuntu:18.04 as wasi-sysroot + +RUN apt-get update && \ + apt-get install -y --no-install-recommends \ + ca-certificates \ + clang \ + cmake \ + curl \ + g++ \ + git \ + libc6-dev \ + libclang-dev \ + make \ + ssh \ + xz-utils + +# Fetch clang 8.0+ which is used to compile the wasi target and link our +# programs together. +RUN curl http://releases.llvm.org/8.0.0/clang+llvm-8.0.0-x86_64-linux-gnu-ubuntu-18.04.tar.xz | tar xJf - +RUN mv /clang+llvm-8.0.0-x86_64-linux-gnu-ubuntu-18.04 /wasmcc + +# Note that we're using `git reset --hard` to pin to a specific commit for +# verification for now. The sysroot is currently in somewhat of a state of flux +# and is expected to have breaking changes, so this is an attempt to mitigate +# those breaking changes on `libc`'s own CI +RUN git clone https://github.com/CraneStation/wasi-sysroot && \ + cd wasi-sysroot && \ + git reset --hard eee6ee7566e26f2535eb6088c8494a112ff423b9 +RUN make -C wasi-sysroot install -j $(nproc) WASM_CC=/wasmcc/bin/clang INSTALL_DIR=/wasi-sysroot + +# This is a small wrapper script which executes the actual clang binary in +# `/wasmcc` and then is sure to pass the right `--sysroot` argument which we +# just built above. +COPY docker/wasm32-wasi/clang.sh /wasi-sysroot/bin/clang + +# In the second container we're going to build the `wasmtime` binary which is +# used to execute wasi executables. This is a standard Rust project so we're +# just checking out a known revision (which pairs with the sysroot one we +# downlaoded above) and then we're building it with Cargo +FROM ubuntu:18.04 as wasmtime + +RUN apt-get update && \ + apt-get install -y --no-install-recommends \ + ca-certificates \ + clang \ + cmake \ + curl \ + g++ \ + git \ + libclang-dev \ + make \ + ssh + +RUN curl -sSf https://sh.rustup.rs | sh -s -- -y +ENV PATH=/root/.cargo/bin:$PATH + +RUN apt-get install -y --no-install-recommends python +RUN git clone --recursive https://github.com/CraneStation/wasmtime wasmtime && \ + cd wasmtime && \ + git reset --hard 67edb00f29b62864b00179fe4bfa99bc29973285 +RUN cargo build --release --manifest-path wasmtime/Cargo.toml + +# And finally in the last image we're going to assemble everything together. +# We'll install things needed at runtime for now and then copy over the +# sysroot/wasmtime artifacts into their final location. +FROM ubuntu:18.04 + +RUN apt-get update && \ + apt-get install -y --no-install-recommends \ + gcc \ + libc6-dev \ + libxml2 \ + ca-certificates + +# Copy over clang we downloaded to link executables ... +COPY --from=wasi-sysroot /wasmcc /wasmcc/ +# ... and the sysroot we built to link executables against ... +COPY --from=wasi-sysroot /wasi-sysroot/ /wasi-sysroot/ +# ... and finally wasmtime to actually execute binaries +COPY --from=wasmtime /wasmtime/target/release/wasmtime /usr/bin/ + +# Of note here is our clang wrapper which just executes a normal clang +# executable with the right sysroot, and then we're sure to turn off the +# crt-static feature to ensure that the CRT that we're specifying with `clang` +# is used. +ENV CARGO_TARGET_WASM32_WASI_RUNNER=wasmtime \ + CARGO_TARGET_WASM32_WASI_LINKER=/wasi-sysroot/bin/clang \ + CC_wasm32_wasi=/wasi-sysroot/bin/clang \ + PATH=$PATH:/rust/bin \ + RUSTFLAGS=-Ctarget-feature=-crt-static diff --git a/libc/ci/docker/wasm32-wasi/clang.sh b/libc/ci/docker/wasm32-wasi/clang.sh new file mode 100755 index 0000000..6f29812 --- /dev/null +++ b/libc/ci/docker/wasm32-wasi/clang.sh @@ -0,0 +1,2 @@ +#!/usr/bin/env sh +exec /wasmcc/bin/clang --target=wasm32-wasi --sysroot /wasi-sysroot "$@" diff --git a/libc/ci/docker/x86_64-linux-android/Dockerfile b/libc/ci/docker/x86_64-linux-android/Dockerfile index 0cfbc48..b0984c0 100644 --- a/libc/ci/docker/x86_64-linux-android/Dockerfile +++ b/libc/ci/docker/x86_64-linux-android/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:16.04 +FROM ubuntu:19.04 RUN apt-get update && \ apt-get install -y --no-install-recommends \ diff --git a/libc/ci/docker/x86_64-rumprun-netbsd/runtest.rs b/libc/ci/docker/x86_64-rumprun-netbsd/runtest.rs index 94b5946..7e96fbf 100644 --- a/libc/ci/docker/x86_64-rumprun-netbsd/runtest.rs +++ b/libc/ci/docker/x86_64-rumprun-netbsd/runtest.rs @@ -47,7 +47,8 @@ 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") { + if (line.starts_with("PASSED ") && line.contains(" tests")) || + line.starts_with("test result: ok"){ 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 6ab9c92..0dbb191 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:18.04 +FROM ubuntu:19.04 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-gnux32/Dockerfile b/libc/ci/docker/x86_64-unknown-linux-gnux32/Dockerfile index 03f3e8e..5563a7b 100644 --- a/libc/ci/docker/x86_64-unknown-linux-gnux32/Dockerfile +++ b/libc/ci/docker/x86_64-unknown-linux-gnux32/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:18.04 +FROM ubuntu:19.04 RUN apt-get update RUN apt-get install -y --no-install-recommends \ gcc-multilib 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 0a27709..59164d2 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:17.10 +FROM ubuntu:19.04 RUN apt-get update RUN apt-get install -y --no-install-recommends \ diff --git a/libc/ci/dox.sh b/libc/ci/dox.sh index 521743e..ce55081 100644 --- a/libc/ci/dox.sh +++ b/libc/ci/dox.sh @@ -6,28 +6,65 @@ set -ex -TARGETS=$(grep html_root_url src/lib.rs | sed 's/.*".*\/\(.*\)"/\1/'| sed 's/)//') +TARGET_DOC_DIR=target/doc +README=README.md +PLATFORM_SUPPORT=platform-support.md -rm -rf target/doc -mkdir -p target/doc +rm -rf $TARGET_DOC_DIR +mkdir -p $TARGET_DOC_DIR -cp ci/landing-page-head.html target/doc/index.html +# List all targets that do currently build successfully: +# shellcheck disable=SC1003 +grep '[\d|\w|-]* \\' ci/build.sh > targets +sed -i.bak 's/ \\//g' targets +grep '^[_a-zA-Z0-9-]*$' targets > tmp && mv tmp targets -for target in $TARGETS; do - echo "documenting ${target}" +# Create a markdown list of supported platforms in $PLATFORM_SUPPORT +rm $PLATFORM_SUPPORT || true - rustdoc -o "target/doc/${target}" --target "${target}" src/lib.rs --cfg cross_platform_docs \ - --crate-name libc +printf '### Platform-specific documentation\n' >> $PLATFORM_SUPPORT - echo "<li><a href=\"/libc/${target}/libc/index.html\">${target}</a></li>" \ - >> target/doc/index.html -done +while read -r target; do + echo "documenting ${target}" -cat ci/landing-page-footer.html >> target/doc/index.html + case "${target}" in + *apple*) + # FIXME: + # We can't build docs of apple targets from Linux yet. + continue + ;; + *) + ;; + esac + + rustup target add "${target}" || true + + # If cargo doc fails, then try xargo: + if ! cargo doc --target "${target}" \ + --no-default-features --features extra_traits ; then + xargo doc --target "${target}" \ + --no-default-features --features extra_traits + fi + + cp -r "target/${target}/doc" "${TARGET_DOC_DIR}/${target}" + + echo "* [${target}](${target}/libc/index.html)" >> $PLATFORM_SUPPORT +done < targets + +# Replace <div class="platform_support"></div> with the contents of $PLATFORM_SUPPORT +cp $README $TARGET_DOC_DIR +line=$(grep -n '<div class="platform_docs"></div>' $README | cut -d ":" -f 1) + +set +x +{ head -n "$((line-1))" $README; cat $PLATFORM_SUPPORT; tail -n "+$((line+1))" $README; } > $TARGET_DOC_DIR/$README +set -x + +# Copy the licenses +cp LICENSE-* $TARGET_DOC_DIR/ # If we're on travis, not a PR, and on the right branch, publish! if [ "$TRAVIS_PULL_REQUEST" = "false" ] && [ "$TRAVIS_BRANCH" = "master" ]; then pip install ghp_import --install-option="--prefix=$HOME/.local" - "${HOME}/.local/bin/ghp-import" -n target/doc + "${HOME}/.local/bin/ghp-import" $TARGET_DOC_DIR git push -qf "https://${GH_TOKEN}@github.com/${TRAVIS_REPO_SLUG}.git" gh-pages fi diff --git a/libc/ci/ios/deploy_and_run_on_ios_simulator.rs b/libc/ci/ios/deploy_and_run_on_ios_simulator.rs index 95df52d..2075be6 100644 --- a/libc/ci/ios/deploy_and_run_on_ios_simulator.rs +++ b/libc/ci/ios/deploy_and_run_on_ios_simulator.rs @@ -129,8 +129,11 @@ fn run_app_on_simulator() { let stdout = String::from_utf8_lossy(&output.stdout); let passed = stdout.lines() - .find(|l| l.contains("PASSED")) - .map(|l| l.contains("tests")) + .find(|l| + (l.contains("PASSED") && + l.contains("tests")) || + l.contains("test result: ok") + ) .unwrap_or(false); println!("Shutting down simulator"); diff --git a/libc/ci/landing-page-footer.html b/libc/ci/landing-page-footer.html deleted file mode 100644 index 941cc8d..0000000 --- a/libc/ci/landing-page-footer.html +++ /dev/null @@ -1,3 +0,0 @@ - </ul> - </body> -</html> diff --git a/libc/ci/landing-page-head.html b/libc/ci/landing-page-head.html deleted file mode 100644 index fc69fa8..0000000 --- a/libc/ci/landing-page-head.html +++ /dev/null @@ -1,7 +0,0 @@ -<!DOCTYPE html> -<html lang="en"> - <head> - <meta charset="utf-8"> - </head> - <body> - <ul> diff --git a/libc/ci/linux-s390x.sh b/libc/ci/linux-s390x.sh index a230cfe..00a7f88 100644 --- a/libc/ci/linux-s390x.sh +++ b/libc/ci/linux-s390x.sh @@ -6,8 +6,8 @@ mkdir -m 777 /qemu cd /qemu curl --retry 5 -LO https://github.com/qemu/qemu/raw/master/pc-bios/s390-ccw.img -curl --retry 5 -LO http://ftp.debian.org/debian/dists/testing/main/installer-s390x/20170828/images/generic/kernel.debian -curl --retry 5 -LO http://ftp.debian.org/debian/dists/testing/main/installer-s390x/20170828/images/generic/initrd.debian +curl --retry 5 -LO http://ftp.debian.org/debian/dists/testing/main/installer-s390x/20190410/images/generic/kernel.debian +curl --retry 5 -LO http://ftp.debian.org/debian/dists/testing/main/installer-s390x/20190410/images/generic/initrd.debian mv kernel.debian kernel mv initrd.debian initrd.gz diff --git a/libc/ci/linux-sparc64.sh b/libc/ci/linux-sparc64.sh index 7fb28d9..5580a0e 100644 --- a/libc/ci/linux-sparc64.sh +++ b/libc/ci/linux-sparc64.sh @@ -5,11 +5,11 @@ set -ex mkdir -m 777 /qemu cd /qemu -curl --retry 5 -LO https://cdimage.debian.org/cdimage/ports/9.0/sparc64/iso-cd/debian-9.0-sparc64-NETINST-1.iso -7z e debian-9.0-sparc64-NETINST-1.iso boot/initrd.gz -7z e debian-9.0-sparc64-NETINST-1.iso boot/sparc64 +curl --retry 5 -LO https://cdimage.debian.org/cdimage/ports/10.0/sparc64/iso-cd/debian-10.0-sparc64-NETINST-1.iso +7z e debian-10.0-sparc64-NETINST-1.iso boot/initrd.gz +7z e debian-10.0-sparc64-NETINST-1.iso boot/sparc64 mv sparc64 kernel -rm debian-9.0-sparc64-NETINST-1.iso +rm debian-10.0-sparc64-NETINST-1.iso mkdir init cd init diff --git a/libc/ci/run.sh b/libc/ci/run.sh index 81ebd61..427d3bf 100755 --- a/libc/ci/run.sh +++ b/libc/ci/run.sh @@ -77,7 +77,7 @@ if [ "$QEMU" != "" ]; then -net user \ -nographic \ -vga none 2>&1 | tee "${CARGO_TARGET_DIR}/out.log" - exec grep "^PASSED .* tests" "${CARGO_TARGET_DIR}/out.log" + exec egrep "^(PASSED)|(test result: ok)" "${CARGO_TARGET_DIR}/out.log" fi # FIXME: x86_64-unknown-linux-gnux32 fail to compile without --release @@ -87,13 +87,10 @@ if [ "$TARGET" = "x86_64-unknown-linux-gnux32" ]; then opt="--release" fi -# Building with --no-default-features is currently broken on rumprun because we -# need cfg(target_vendor), which is currently unstable. -if [ "$TARGET" != "x86_64-rumprun-netbsd" ]; then - cargo test $opt --no-default-features --manifest-path libc-test/Cargo.toml --target "${TARGET}" -fi -# Test the #[repr(align(x))] feature if this is building on Rust >= 1.25 -if [ "$(rustc --version | sed -E 's/^rustc 1\.([0-9]*)\..*/\1/')" -ge 25 ]; then - cargo test $opt --features align --manifest-path libc-test/Cargo.toml --target "${TARGET}" -fi -exec cargo test $opt --manifest-path libc-test/Cargo.toml --target "${TARGET}" +cargo test $opt --no-default-features --manifest-path libc-test/Cargo.toml \ + --target "${TARGET}" + +cargo test $opt --manifest-path libc-test/Cargo.toml --target "${TARGET}" + +cargo test $opt --features extra_traits --manifest-path libc-test/Cargo.toml \ + --target "${TARGET}" diff --git a/libc/ci/runtest-android.rs b/libc/ci/runtest-android.rs index a8f8db8..b8030c4 100644 --- a/libc/ci/runtest-android.rs +++ b/libc/ci/runtest-android.rs @@ -3,14 +3,18 @@ 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 args = env::args_os() + .skip(1) + .filter(|arg| arg != "--quiet") + .collect::<Vec<_>>(); + assert_eq!(args.len(), 1); + let test = PathBuf::from(&args[0]); 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"); + .expect("failed to run: adb wait-for-device"); assert!(status.success()); let status = Command::new("adb") @@ -18,14 +22,14 @@ fn main() { .arg(&test) .arg(&dst) .status() - .expect("failed to run rumprun-bake"); + .expect("failed to run: adb pushr"); assert!(status.success()); let output = Command::new("adb") .arg("shell") .arg(&dst) .output() - .expect("failed to run rumprun-bake"); + .expect("failed to run: adb shell"); assert!(status.success()); println!("status: {}\nstdout ---\n{}\nstderr ---\n{}", @@ -34,8 +38,10 @@ fn main() { 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")) { + stdout.lines().find(|l| + (l.starts_with("PASSED ") && l.contains(" tests")) || + l.starts_with("test result: ok") + ).unwrap_or_else(|| { panic!("failed to find successful test run"); - } + }); } diff --git a/libc/ci/semver.sh b/libc/ci/semver.sh new file mode 100644 index 0000000..ac6be36 --- /dev/null +++ b/libc/ci/semver.sh @@ -0,0 +1,70 @@ +#!/usr/bin/env sh + +# Checks that libc does not contain breaking changes for the following targets. + +set -ex + +OS=${TRAVIS_OS_NAME} + +echo "Testing Semver on ${OS}" + +TARGETS= +case "${OS}" in + *linux*) + TARGETS="\ +aarch64-fuchsia \ +aarch64-linux-android \ +aarch64-unknown-linux-gnu \ +aarch64-unknown-linux-musl \ +armv7-linux-androideabi \ +armv7-unknown-linux-gnueabihf \ +i586-unknown-linux-gnu \ +i586-unknown-linux-musl \ +i686-linux-android \ +i686-unknown-freebsd \ +i686-unknown-linux-gnu \ +i686-unknown-linux-musl \ +i686-pc-windows-gnu \ +x86_64-unknown-freebsd \ +x86_64-unknown-linux-gnu \ +x86_64-unknown-linux-musl \ +x86_64-unknown-netbsd \ +x86_64-unknown-cloudabi \ +x86_64-sun-solaris \ +x86_64-fuchsia \ +x86_64-pc-windows-gnu \ +x86_64-unknown-linux-gnux32 \ +x86_64-unknown-redox \ +x86_64-fortanix-unknown-sgx \ +wasm32-unknown-unknown \ +" + ;; + *osx*) + TARGETS="\ +aarch64-apple-ios \ +armv7-apple-ios \ +armv7s-apple-ios \ +i386-apple-ios \ +i686-apple-darwin \ +x86_64-apple-darwin \ +x86_64-apple-ios \ +" + ;; +esac + +for TARGET in $TARGETS; do + # FIXME: rustup often fails to download some artifacts due to network + # issues, so we retry this N times. + N=5 + n=0 + until [ $n -ge $N ] + do + if rustup target add "${TARGET}" ; then + break + fi + n=$((n+1)) + sleep 1 + done + + cargo +nightly semver --api-guidelines --target="${TARGET}" +done diff --git a/libc/ci/style.rs b/libc/ci/style.rs index 747e26c..481f57f 100644 --- a/libc/ci/style.rs +++ b/libc/ci/style.rs @@ -144,6 +144,9 @@ fn check_style(file: &str, path: &Path, err: &mut Errors) { let line = if is_pub {&line[4..]} else {line}; let line_state = if line.starts_with("use ") { + if line.contains("c_void") { + continue; + } if is_pub { State::Modules } else { diff --git a/libc/ci/switch.json b/libc/ci/switch.json new file mode 100644 index 0000000..bc18948 --- /dev/null +++ b/libc/ci/switch.json @@ -0,0 +1,37 @@ +{ + "family": "unix", + "env": "newlib", + "target-env": "newlib", + "target-family": "unix", + "target-c-int-width": "32", + "target-endian": "little", + "target-pointer-width": "64", + "os": "horizon", + "arch": "aarch64", + "panic-strategy": "unwind", + "abi-blacklist": [ + "stdcall", + "fastcall", + "vectorcall", + "thiscall", + "win64", + "sysv64" + ], + "dynamic-linking" : false, + "features": "+a53,+strict-align", + "data-layout": "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128", + "executables": true, + "position-independent-executables" : true, + "linker-flavor": "gcc", + "llvm-target": "aarch64-unknown-none", + "has-elf-tls" : false, + "linker-is-gnu" : true, + "disable-redzone" : true, + "relocation-model" : "pic", + "max-atomic-width": 128, + "exe-suffix": ".elf", + "staticlib-suffix" : ".a", + "trap-unreachable" : true, + "emit-debug-gdb-scripts" : true, + "requires-uwtable" : true +}
\ No newline at end of file diff --git a/libc/ci/test-runner-linux b/libc/ci/test-runner-linux index 5f1fb23..569fa00 100755 --- a/libc/ci/test-runner-linux +++ b/libc/ci/test-runner-linux @@ -5,7 +5,18 @@ set -e arch=$1 prog=$2 +# Skip cmsg test on linux-s390x +# https://github.com/rust-lang/libc/issues/1240 +if [ "$arch" = "s390x" ]; then + progbasename=`basename $prog` + if [ "${progbasename%%-*}" = "cmsg" ]; then + exit 0 + fi +fi + cd /qemu/init +echo "#!/bin/sh\n/prog --color=never" > run_prog.sh +chmod +x run_prog.sh cp -f $2 prog find . | cpio --create --format='newc' --quiet | gzip > ../initrd.gz cd .. @@ -15,9 +26,9 @@ timeout 30s qemu-system-$arch \ -nographic \ -kernel kernel \ -initrd initrd.gz \ - -append init=/prog > output || true + -append init=/run_prog.sh > output || true # remove kernel messages tr -d '\r' < output | egrep -v '^\[' -grep PASSED output > /dev/null +egrep "(PASSED)|(test result: ok)" output > /dev/null |