diff options
author | Daniel Mueller <deso@posteo.net> | 2018-12-10 21:00:27 -0800 |
---|---|---|
committer | Daniel Mueller <deso@posteo.net> | 2018-12-10 21:00:27 -0800 |
commit | e2604a756aaddcd5919ee2f1b9cc0055d200f846 (patch) | |
tree | 1ea1b9900db20d3aadbddbce18882d0c957247d7 /libc/ci | |
parent | 5875df6c958743cf86c75b2cb5fc2efe5ca0de43 (diff) | |
download | nitrocli-e2604a756aaddcd5919ee2f1b9cc0055d200f846.tar.gz nitrocli-e2604a756aaddcd5919ee2f1b9cc0055d200f846.tar.bz2 |
Update libc crate to 0.2.45
This change updates the libc crate to version 0.2.45.
Import subrepo libc/:libc at f5636fc618f8e16968b3178196d73c94ad9f7b05
Diffstat (limited to 'libc/ci')
25 files changed, 229 insertions, 157 deletions
diff --git a/libc/ci/README.md b/libc/ci/README.md index aef6ef1..28152e5 100644 --- a/libc/ci/README.md +++ b/libc/ci/README.md @@ -128,32 +128,72 @@ QEMU is available, and if so mount it, run a script (it'll specifically be `run-qemu.sh` in this folder which is copied into the generated image talked about above), and then shut down. -### QEMU setup - FreeBSD - -1. Download CD installer (most minimal is fine) -2. `qemu-img create -f qcow2 foo.qcow2 2G` -3. `qemu -cdrom foo.iso -drive if=virtio,file=foo.qcow2 -net nic,model=virtio -net user` -4. run installer -5. `echo 'console="comconsole"' >> /boot/loader.conf` -6. `echo 'autoboot_delay="0"' >> /boot/loader.conf` -7. look at /etc/ttys, see what getty argument is for ttyu0 -8. edit /etc/gettytab, look for ttyu0 argument, prepend `:al=root` to line - beneath - -(note that the current image has a `freebsd` user, but this isn't really -necessary) - -Once that's done, arrange for this script to run at login: - -``` -#!/bin/sh - -sudo kldload ext2fs -[ -e /dev/vtbd1 ] || exit 0 -sudo mount -t ext2fs /dev/vtbd1 /mnt -sh /mnt/run.sh /mnt -sudo poweroff -``` +### QEMU Setup - FreeBSD + +1. [Download the latest stable amd64-bootonly release ISO](https://www.freebsd.org/where.html). + E.g. FreeBSD-11.1-RELEASE-amd64-bootonly.iso +2. Create the disk image: `qemu-img create -f qcow2 FreeBSD-11.1-RELEASE-amd64.qcow2 2G` +3. Boot the machine: `qemu-system-x86_64 -cdrom FreeBSD-11.1-RELEASE-amd64-bootonly.iso -drive if=virtio,file=FreeBSD-11.1-RELEASE-amd64.qcow2 -net nic,model=virtio -net user` +4. Run the installer, and install FreeBSD: + 1. Install + 1. Continue with default keymap + 1. Set Hostname: freebsd-ci + 1. Distribution Select: + 1. Uncheck lib32 + 1. Uncheck ports + 1. Network Configuration: vtnet0 + 1. Configure IPv4? Yes + 1. DHCP? Yes + 1. Configure IPv6? No + 1. Resolver Configuration: Ok + 1. Mirror Selection: Main Site + 1. Partitioning: Auto (UFS) + 1. Partition: Entire Disk + 1. Partition Scheme: MBR + 1. App Partition: Ok + 1. Partition Editor: Finish + 1. Confirmation: Commit + 1. Wait for sets to install + 1. Set the root password to nothing (press enter twice) + 1. Set time zone to UTC + 1. Set Date: Skip + 1. Set Time: Skip + 1. System Configuration: + 1. Disable sshd + 1. Disable dumpdev + 1. System Hardening + 1. Disable Sendmail service + 1. Add User Accounts: No + 1. Final Configuration: Exit + 1. Manual Configuration: Yes + 1. `echo 'console="comconsole"' >> /boot/loader.conf` + 1. `echo 'autoboot_delay="0"' >> /boot/loader.conf` + 1. `echo 'ext2fs_load="YES"' >> /boot/loader.conf` + 1. Look at `/etc/ttys`, see what getty argument is for `ttyu0` (E.g. `3wire`) + 1. Edit `/etc/gettytab` (with `vi` for example), look for `ttyu0` argument, + prepend `:al=root` to the line beneath to have the machine auto-login as + root. E.g. + + 3wire:\ + :np:nc:sp#0: + becomes: + + 3wire:\ + :al=root:np:nc:sp#0: + + 1. Edit `/root/.login` and put this in it: + + [ -e /dev/vtbd1 ] || exit 0 + mount -t ext2fs /dev/vtbd1 /mnt + sh /mnt/run.sh /mnt + poweroff + + 1. Exit the post install shell: `exit` + 1. Back in in the installer choose Reboot + 1. If all went well the machine should reboot and show a login prompt. + If you switch to the serial console by choosing View > serial0 in + the qemu menu, you should be logged in as root. + 1. Shutdown the machine: `shutdown -p now` Helpful links diff --git a/libc/ci/android-install-ndk.sh b/libc/ci/android-install-ndk.sh index 873f6c5..ce11d00 100644 --- a/libc/ci/android-install-ndk.sh +++ b/libc/ci/android-install-ndk.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/usr/bin/env sh # Copyright 2016 The Rust Project Developers. See the COPYRIGHT # file at the top-level directory of this distribution and at # http://rust-lang.org/COPYRIGHT. @@ -11,7 +11,7 @@ set -ex -curl -O https://dl.google.com/android/repository/android-ndk-r15b-linux-x86_64.zip +curl --retry 5 -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 @@ -30,8 +30,8 @@ esac; android-ndk-r15b/build/tools/make_standalone_toolchain.py \ --unified-headers \ - --install-dir /android/ndk-$1 \ - --arch $arch \ + --install-dir "/android/ndk-${1}" \ + --arch "${arch}" \ --api 24 rm -rf ./android-ndk-r15b-linux-x86_64.zip ./android-ndk-r15b diff --git a/libc/ci/android-install-sdk.sh b/libc/ci/android-install-sdk.sh index ab7e14d..c0f63c9 100644 --- a/libc/ci/android-install-sdk.sh +++ b/libc/ci/android-install-sdk.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/usr/bin/env sh # Copyright 2016 The Rust Project Developers. See the COPYRIGHT # file at the top-level directory of this distribution and at # http://rust-lang.org/COPYRIGHT. @@ -19,7 +19,7 @@ set -ex # which apparently magically accepts the licenses. mkdir sdk -curl https://dl.google.com/android/repository/sdk-tools-linux-3859397.zip -O +curl --retry 5 https://dl.google.com/android/repository/sdk-tools-linux-3859397.zip -O unzip -d sdk sdk-tools-linux-3859397.zip case "$1" in @@ -56,5 +56,5 @@ echo "yes" | \ echo "no" | ./sdk/tools/bin/avdmanager create avd \ - --name $1 \ + --name "${1}" \ --package "system-images;android-24;default;$abi" diff --git a/libc/ci/android-sysimage.sh b/libc/ci/android-sysimage.sh index 9611dfe..9eabd7c 100644 --- a/libc/ci/android-sysimage.sh +++ b/libc/ci/android-sysimage.sh @@ -1,3 +1,5 @@ +#!/usr/bin/env 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. @@ -13,32 +15,34 @@ set -ex URL=https://dl.google.com/android/repository/sys-img/android main() { - local arch=$1 - local name=$2 + local arch="${1}" + local name="${2}" local dest=/system - local td=$(mktemp -d) + local td + td="$(mktemp -d)" apt-get install --no-install-recommends e2tools - pushd $td - curl -O $URL/$name - unzip -q $name + pushd "${td}" + curl --retry 5 -O "${URL}/${name}" + unzip -q "${name}" - local system=$(find . -name system.img) - mkdir -p $dest/{bin,lib,lib64} + local system + system="$(find . -name system.img)" + mkdir -p ${dest}/{bin,lib,lib64} # Extract android linker and libraries to /system # This allows android executables to be run directly (or with qemu) - if [ $arch = "x86_64" -o $arch = "arm64" ]; then - e2cp -p $system:/bin/linker64 $dest/bin/ - e2cp -p $system:/lib64/libdl.so $dest/lib64/ - e2cp -p $system:/lib64/libc.so $dest/lib64/ - e2cp -p $system:/lib64/libm.so $dest/lib64/ + if [ "${arch}" = "x86_64" ] || [ "${arch}" = "arm64" ]; then + e2cp -p "${system}:/bin/linker64" "${dest}/bin/" + e2cp -p "${system}:/lib64/libdl.so" "${dest}/lib64/" + e2cp -p "${system}:/lib64/libc.so" "${dest}/lib64/" + e2cp -p "${system}:/lib64/libm.so" "${dest}/lib64/" else - e2cp -p $system:/bin/linker $dest/bin/ - e2cp -p $system:/lib/libdl.so $dest/lib/ - e2cp -p $system:/lib/libc.so $dest/lib/ - e2cp -p $system:/lib/libm.so $dest/lib/ + e2cp -p "${system}:/bin/linker" "${dest}/bin/" + e2cp -p "${system}:/lib/libdl.so" "${dest}/lib/" + e2cp -p "${system}:/lib/libc.so" "${dest}/lib/" + e2cp -p "${system}:/lib/libm.so" "${dest}/lib/" fi # clean up @@ -46,7 +50,7 @@ main() { popd - rm -rf $td + rm -rf "${td}" } main "${@}" diff --git a/libc/ci/docker/aarch64-unknown-linux-musl/Dockerfile b/libc/ci/docker/aarch64-unknown-linux-musl/Dockerfile index e86c4c0..fbc47d9 100644 --- a/libc/ci/docker/aarch64-unknown-linux-musl/Dockerfile +++ b/libc/ci/docker/aarch64-unknown-linux-musl/Dockerfile @@ -3,21 +3,21 @@ FROM ubuntu:17.10 RUN apt-get update && apt-get install -y --no-install-recommends \ gcc make libc6-dev git curl ca-certificates \ gcc-aarch64-linux-gnu qemu-user -RUN curl https://www.musl-libc.org/releases/musl-1.1.16.tar.gz | \ +RUN curl --retry 5 https://www.musl-libc.org/releases/musl-1.1.19.tar.gz | \ tar xzf - && \ - cd musl-1.1.16 && \ + cd musl-1.1.19 && \ CC=aarch64-linux-gnu-gcc \ ./configure --prefix=/musl-aarch64 --enable-wrapper=yes && \ make install -j4 && \ cd .. && \ - rm -rf musl-1.1.16 && \ + rm -rf musl-1.1.19 # 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 | \ +RUN curl --retry 5 -L https://github.com/sabotage-linux/kernel-headers/archive/v3.12.6-6.tar.gz | \ tar xzf - && \ - cd kernel-headers-3.12.6-5 && \ + cd kernel-headers-3.12.6-6 && \ make ARCH=arm64 prefix=/musl-aarch64 install -j4 && \ cd .. && \ - rm -rf kernel-headers-3.12.6-5 + rm -rf kernel-headers-3.12.6-6 # FIXME: shouldn't need the `-lgcc` here, shouldn't that be in libstd? ENV PATH=$PATH:/musl-aarch64/bin:/rust/bin \ diff --git a/libc/ci/docker/arm-unknown-linux-musleabihf/Dockerfile b/libc/ci/docker/arm-unknown-linux-musleabihf/Dockerfile index 130730b..3fc9dd3 100644 --- a/libc/ci/docker/arm-unknown-linux-musleabihf/Dockerfile +++ b/libc/ci/docker/arm-unknown-linux-musleabihf/Dockerfile @@ -4,21 +4,21 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ gcc make libc6-dev git curl ca-certificates \ gcc-arm-linux-gnueabihf qemu-user -RUN curl https://www.musl-libc.org/releases/musl-1.1.16.tar.gz | tar xzf - -WORKDIR /musl-1.1.16 +RUN curl --retry 5 https://www.musl-libc.org/releases/musl-1.1.19.tar.gz | tar xzf - +WORKDIR /musl-1.1.19 RUN CC=arm-linux-gnueabihf-gcc \ CFLAGS="-march=armv6 -marm" \ ./configure --prefix=/musl-arm --enable-wrapper=yes RUN make install -j4 # Install linux kernel headers sanitized for use with musl -RUN \ - curl -L https://github.com/sabotage-linux/kernel-headers/archive/v3.12.6-5.tar.gz | \ +RUN curl --retry 5 -L https://github.com/sabotage-linux/kernel-headers/archive/v3.12.6-6.tar.gz | \ tar xzf - && \ - cd kernel-headers-3.12.6-5 && \ + cd kernel-headers-3.12.6-6 && \ make ARCH=arm prefix=/musl-arm install -j4 && \ cd .. && \ - rm -rf kernel-headers-3.12.6-5 + rm -rf kernel-headers-3.12.6-6 + ENV PATH=$PATH:/musl-arm/bin:/rust/bin \ CC_arm_unknown_linux_musleabihf=musl-gcc \ CARGO_TARGET_ARM_UNKNOWN_LINUX_MUSLEABIHF_LINKER=musl-gcc \ diff --git a/libc/ci/docker/i686-unknown-linux-gnu/Dockerfile b/libc/ci/docker/i686-unknown-linux-gnu/Dockerfile index 1af4134..03f3e8e 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:17.04 +FROM ubuntu:18.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 3adb920..b726e4d 100644 --- a/libc/ci/docker/i686-unknown-linux-musl/Dockerfile +++ b/libc/ci/docker/i686-unknown-linux-musl/Dockerfile @@ -12,19 +12,20 @@ RUN apt-get install -y --no-install-recommends \ # since otherwise the script will fail to find a compiler. # * We manually unset CROSS_COMPILE when running make; otherwise the makefile # will call the non-existent binary 'i686-ar'. -RUN curl https://www.musl-libc.org/releases/musl-1.1.15.tar.gz | \ +RUN curl --retry 5 https://www.musl-libc.org/releases/musl-1.1.19.tar.gz | \ tar xzf - && \ - cd musl-1.1.15 && \ + cd musl-1.1.19 && \ 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.19 # 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 | \ +RUN curl --retry 5 -L https://github.com/sabotage-linux/kernel-headers/archive/v3.12.6-6.tar.gz | \ tar xzf - && \ - cd kernel-headers-3.12.6-5 && \ + cd kernel-headers-3.12.6-6 && \ make ARCH=i386 prefix=/musl-i686 install -j4 && \ cd .. && \ - rm -rf kernel-headers-3.12.6-5 + rm -rf kernel-headers-3.12.6-6 + ENV PATH=$PATH:/musl-i686/bin:/rust/bin \ CC_i686_unknown_linux_musl=musl-gcc diff --git a/libc/ci/docker/mips-unknown-linux-musl/Dockerfile b/libc/ci/docker/mips-unknown-linux-musl/Dockerfile index 91ffd58..dde22fd 100644 --- a/libc/ci/docker/mips-unknown-linux-musl/Dockerfile +++ b/libc/ci/docker/mips-unknown-linux-musl/Dockerfile @@ -8,7 +8,7 @@ RUN mkdir /toolchain # Note that this originally came from: # https://downloads.openwrt.org/snapshots/trunk/ar71xx/generic/OpenWrt-SDK-ar71xx-generic_gcc-5.3.0_musl-1.1.15.Linux-x86_64.tar.bz2 -RUN curl -L https://s3-us-west-1.amazonaws.com/rust-lang-ci2/libc/OpenWrt-SDK-ar71xx-generic_gcc-5.3.0_musl-1.1.15.Linux-x86_64.tar.bz2 | \ +RUN curl --retry 5 -L https://s3-us-west-1.amazonaws.com/rust-lang-ci2/libc/OpenWrt-SDK-ar71xx-generic_gcc-5.3.0_musl-1.1.15.Linux-x86_64.tar.bz2 | \ tar xjf - -C /toolchain --strip-components=1 ENV PATH=$PATH:/rust/bin:/toolchain/staging_dir/toolchain-mips_34kc_gcc-5.3.0_musl-1.1.15/bin \ diff --git a/libc/ci/docker/mipsel-unknown-linux-musl/Dockerfile b/libc/ci/docker/mipsel-unknown-linux-musl/Dockerfile index 3642fa8..037bf64 100644 --- a/libc/ci/docker/mipsel-unknown-linux-musl/Dockerfile +++ b/libc/ci/docker/mipsel-unknown-linux-musl/Dockerfile @@ -8,7 +8,7 @@ RUN mkdir /toolchain # Note that this originally came from: # https://downloads.openwrt.org/snapshots/trunk/malta/generic/OpenWrt-Toolchain-malta-le_gcc-5.3.0_musl-1.1.15.Linux-x86_64.tar.bz2 -RUN curl -L https://s3-us-west-1.amazonaws.com/rust-lang-ci2/libc/OpenWrt-Toolchain-malta-le_gcc-5.3.0_musl-1.1.15.Linux-x86_64.tar.bz2 | \ +RUN curl --retry 5 -L https://s3-us-west-1.amazonaws.com/rust-lang-ci2/libc/OpenWrt-Toolchain-malta-le_gcc-5.3.0_musl-1.1.15.Linux-x86_64.tar.bz2 | \ tar xjf - -C /toolchain --strip-components=2 ENV PATH=$PATH:/rust/bin:/toolchain/bin \ diff --git a/libc/ci/docker/sparc64-unknown-linux-gnu/Dockerfile b/libc/ci/docker/sparc64-unknown-linux-gnu/Dockerfile index 2c551f9..d9edaab 100644 --- a/libc/ci/docker/sparc64-unknown-linux-gnu/Dockerfile +++ b/libc/ci/docker/sparc64-unknown-linux-gnu/Dockerfile @@ -1,12 +1,14 @@ -# link fails on 17.10 -FROM ubuntu:17.04 +FROM debian:stretch 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 + 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/ COPY linux-sparc64.sh / RUN bash /linux-sparc64.sh diff --git a/libc/ci/docker/x86_64-unknown-freebsd/Dockerfile b/libc/ci/docker/x86_64-unknown-freebsd/Dockerfile deleted file mode 100644 index 7ad3faf..0000000 --- a/libc/ci/docker/x86_64-unknown-freebsd/Dockerfile +++ /dev/null @@ -1,13 +0,0 @@ -FROM alexcrichton/port-prebuilt-freebsd:2017-09-16 - -RUN apt-get update -RUN apt-get install -y --no-install-recommends \ - qemu genext2fs -RUN apt-get install -y curl ca-certificates gcc - -ENTRYPOINT ["sh"] - -ENV PATH=$PATH:/rust/bin \ - QEMU=2016-11-06/freebsd.qcow2.gz \ - CAN_CROSS=1 \ - CARGO_TARGET_X86_64_UNKNOWN_FREEBSD_LINKER=x86_64-unknown-freebsd10-gcc diff --git a/libc/ci/docker/x86_64-unknown-linux-gnu/Dockerfile b/libc/ci/docker/x86_64-unknown-linux-gnu/Dockerfile index c5ec682..6ab9c92 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:17.04 +FROM ubuntu:18.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 1af4134..03f3e8e 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:17.04 +FROM ubuntu:18.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 d9d6511..0a27709 100644 --- a/libc/ci/docker/x86_64-unknown-linux-musl/Dockerfile +++ b/libc/ci/docker/x86_64-unknown-linux-musl/Dockerfile @@ -3,18 +3,18 @@ FROM ubuntu:17.10 RUN apt-get update RUN apt-get install -y --no-install-recommends \ gcc make libc6-dev git curl ca-certificates -RUN curl https://www.musl-libc.org/releases/musl-1.1.15.tar.gz | \ +RUN curl --retry 5 https://www.musl-libc.org/releases/musl-1.1.19.tar.gz | \ tar xzf - && \ - cd musl-1.1.15 && \ + cd musl-1.1.19 && \ ./configure --prefix=/musl-x86_64 && \ make install -j4 && \ cd .. && \ - rm -rf musl-1.1.15 && \ + rm -rf musl-1.1.19 # 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 | \ +RUN curl --retry 5 -L https://github.com/sabotage-linux/kernel-headers/archive/v3.12.6-6.tar.gz | \ tar xzf - && \ - cd kernel-headers-3.12.6-5 && \ + cd kernel-headers-3.12.6-6 && \ make ARCH=x86_64 prefix=/musl-x86_64 install -j4 && \ cd .. && \ - rm -rf kernel-headers-3.12.6-5 + rm -rf kernel-headers-3.12.6-6 ENV PATH=$PATH:/musl-x86_64/bin:/rust/bin diff --git a/libc/ci/dox.sh b/libc/ci/dox.sh index 85e9243..521743e 100644 --- a/libc/ci/dox.sh +++ b/libc/ci/dox.sh @@ -1,12 +1,12 @@ -#!/bin/sh +#!/usr/bin/env sh # Builds documentation for all target triples that we have a registered URL for # in liblibc. This scrapes the list of triples to document from `src/lib.rs` # which has a bunch of `html_root_url` directives we pick up. -set -e +set -ex -TARGETS=`grep html_root_url src/lib.rs | sed 's/.*".*\/\(.*\)"/\1/'` +TARGETS=$(grep html_root_url src/lib.rs | sed 's/.*".*\/\(.*\)"/\1/'| sed 's/)//') rm -rf target/doc mkdir -p target/doc @@ -14,12 +14,12 @@ mkdir -p target/doc cp ci/landing-page-head.html target/doc/index.html for target in $TARGETS; do - echo documenting $target + echo "documenting ${target}" - rustdoc -o target/doc/$target --target $target src/lib.rs --cfg dox \ + rustdoc -o "target/doc/${target}" --target "${target}" src/lib.rs --cfg cross_platform_docs \ --crate-name libc - echo "<li><a href="/libc/$target/libc/index.html">$target</a></li>" \ + echo "<li><a href=\"/libc/${target}/libc/index.html\">${target}</a></li>" \ >> target/doc/index.html done @@ -28,6 +28,6 @@ cat ci/landing-page-footer.html >> target/doc/index.html # 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 - git push -qf https://${GH_TOKEN}@github.com/${TRAVIS_REPO_SLUG}.git gh-pages + "${HOME}/.local/bin/ghp-import" -n target/doc + git push -qf "https://${GH_TOKEN}@github.com/${TRAVIS_REPO_SLUG}.git" gh-pages fi diff --git a/libc/ci/emscripten-entry.sh b/libc/ci/emscripten-entry.sh index 22ae8b0..e92c1cb 100755 --- a/libc/ci/emscripten-entry.sh +++ b/libc/ci/emscripten-entry.sh @@ -11,6 +11,7 @@ set -ex +# shellcheck disable=SC1091 source /emsdk-portable/emsdk_env.sh &> /dev/null # emsdk-portable provides a node binary, but we need version 8 to run wasm diff --git a/libc/ci/emscripten.sh b/libc/ci/emscripten.sh index d802585..ce3b541 100644 --- a/libc/ci/emscripten.sh +++ b/libc/ci/emscripten.sh @@ -1,3 +1,4 @@ +#!/usr/bin/env 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. @@ -17,10 +18,10 @@ echo ERROR: An error was encountered with the build. cat /tmp/build.log exit 1 " - trap "$on_err" ERR + trap '$on_err' ERR bash -c "while true; do sleep 30; echo \$(date) - building ...; done" & PING_LOOP_PID=$! - $@ &> /tmp/build.log + "${@}" &> /tmp/build.log trap - ERR kill $PING_LOOP_PID rm -f /tmp/build.log @@ -28,7 +29,7 @@ exit 1 } cd / -curl -L https://s3.amazonaws.com/mozilla-games/emscripten/releases/emsdk-portable.tar.gz | \ +curl --retry 5 -L https://s3.amazonaws.com/mozilla-games/emscripten/releases/emsdk-portable.tar.gz | \ tar -xz cd /emsdk-portable @@ -37,6 +38,7 @@ hide_output ./emsdk install sdk-1.37.20-64bit ./emsdk activate sdk-1.37.20-64bit # Compile and cache libc +# shellcheck disable=SC1091 source ./emsdk_env.sh echo "main(){}" > a.c HOME=/emsdk-portable/ emcc a.c @@ -49,6 +51,6 @@ 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 | \ +curl --retry 5 -L https://nodejs.org/dist/v8.0.0/node-v8.0.0-linux-x64.tar.xz | \ tar -xJ 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 b146150..95df52d 100644 --- a/libc/ci/ios/deploy_and_run_on_ios_simulator.rs +++ b/libc/ci/ios/deploy_and_run_on_ios_simulator.rs @@ -123,6 +123,7 @@ fn run_app_on_simulator() { .arg("com.rust.unittests") .output()); + println!("status: {}", output.status); println!("stdout --\n{}\n", String::from_utf8_lossy(&output.stdout)); println!("stderr --\n{}\n", String::from_utf8_lossy(&output.stderr)); diff --git a/libc/ci/linux-s390x.sh b/libc/ci/linux-s390x.sh index 972abee..a230cfe 100644 --- a/libc/ci/linux-s390x.sh +++ b/libc/ci/linux-s390x.sh @@ -1,11 +1,13 @@ +#!/usr/bin/env sh + set -ex mkdir -m 777 /qemu cd /qemu -curl -LO https://github.com/qemu/qemu/raw/master/pc-bios/s390-ccw.img -curl -LO http://ftp.debian.org/debian/dists/testing/main/installer-s390x/20170828/images/generic/kernel.debian -curl -LO http://ftp.debian.org/debian/dists/testing/main/installer-s390x/20170828/images/generic/initrd.debian +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 mv kernel.debian kernel mv initrd.debian initrd.gz diff --git a/libc/ci/linux-sparc64.sh b/libc/ci/linux-sparc64.sh index 33a3c46..7fb28d9 100644 --- a/libc/ci/linux-sparc64.sh +++ b/libc/ci/linux-sparc64.sh @@ -1,9 +1,11 @@ +#!/usr/bin/env sh + set -ex mkdir -m 777 /qemu cd /qemu -curl -LO https://cdimage.debian.org/cdimage/ports/debian-9.0-sparc64-NETINST-1.iso +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 mv sparc64 kernel diff --git a/libc/ci/run-docker.sh b/libc/ci/run-docker.sh index 662a1d4..c656f59 100755 --- a/libc/ci/run-docker.sh +++ b/libc/ci/run-docker.sh @@ -1,36 +1,42 @@ +#!/usr/bin/env sh + # Small script to run tests for a target (or all targets) inside all the # respective docker images. set -ex run() { - echo $1 + echo "Building docker container for target ${1}" + # use -f so we can use ci/ as build context - docker build -t libc -f ci/docker/$1/Dockerfile ci/ + docker build -t libc -f "ci/docker/${1}/Dockerfile" ci/ mkdir -p target if [ -w /dev/kvm ]; then - kvm="--volume /dev/kvm:/dev/kvm" + kvm="--volume /dev/kvm:/dev/kvm" + else + kvm="" fi + docker run \ - --user `id -u`:`id -g` \ + --user "$(id -u)":"$(id -g)" \ --rm \ --init \ - --volume $HOME/.cargo:/cargo \ + --volume "${HOME}/.cargo":/cargo \ $kvm \ --env CARGO_HOME=/cargo \ - --volume `rustc --print sysroot`:/rust:ro \ - --volume `pwd`:/checkout:ro \ - --volume `pwd`/target:/checkout/target \ + --volume "$(rustc --print sysroot)":/rust:ro \ + --volume "$(pwd)":/checkout:ro \ + --volume "$(pwd)"/target:/checkout/target \ --env CARGO_TARGET_DIR=/checkout/target \ --workdir /checkout \ libc \ - ci/run.sh $1 + ci/run.sh "${1}" } -if [ -z "$1" ]; then - for d in `ls ci/docker/`; do - run $d +if [ -z "${1}" ]; then + for d in ci/docker/*; do + run "${d}" done else - run $1 + run "${1}" fi diff --git a/libc/ci/run-qemu.sh b/libc/ci/run-qemu.sh index b2f457d..6fba629 100644 --- a/libc/ci/run-qemu.sh +++ b/libc/ci/run-qemu.sh @@ -1,3 +1,5 @@ +#!/usr/bin/env sh + # Initial script which is run inside of all qemu images. The first argument to # this script (as arranged by the qemu image itself) is the path to where the # libc crate is mounted. @@ -10,11 +12,11 @@ set -ex -ROOT=$1 -cp -r $ROOT/libc /tmp/libc +ROOT="${1}" +cp -r "${ROOT}/libc" /tmp/libc cd /tmp/libc -TARGET=$(cat $ROOT/TARGET) +TARGET="$(cat "${ROOT}/TARGET")" export CARGO_TARGET_DIR=/tmp case $TARGET in @@ -24,9 +26,9 @@ case $TARGET in ;; *) - echo "Unknown target: $TARGET" + echo "Unknown target: ${TARGET}" exit 1 ;; esac -exec sh ci/run.sh $TARGET +exec sh ci/run.sh "${TARGET}" diff --git a/libc/ci/run.sh b/libc/ci/run.sh index 02dd35a..81ebd61 100755 --- a/libc/ci/run.sh +++ b/libc/ci/run.sh @@ -1,11 +1,11 @@ -#!/bin/sh +#!/usr/bin/env sh # Builds and runs tests for a particular target passed as an argument to this # script. set -ex -TARGET=$1 +TARGET="${1}" # If we're going to run tests inside of a qemu image, then we don't need any of # the scripts below. Instead, download the image, prepare a filesystem which has @@ -15,45 +15,53 @@ TARGET=$1 # script from the second which we place inside. if [ "$QEMU" != "" ]; then tmpdir=/tmp/qemu-img-creation - mkdir -p $tmpdir + mkdir -p "${tmpdir}" if [ -z "${QEMU#*.gz}" ]; then # image is .gz : download and uncompress it - qemufile=$(echo ${QEMU%.gz} | sed 's/\//__/g') - if [ ! -f $tmpdir/$qemufile ]; then - curl https://s3-us-west-1.amazonaws.com/rust-lang-ci2/libc/$QEMU | \ - gunzip -d > $tmpdir/$qemufile + qemufile="$(echo "${QEMU%.gz}" | sed 's/\//__/g')" + if [ ! -f "${tmpdir}/${qemufile}" ]; then + curl --retry 5 "https://s3-us-west-1.amazonaws.com/rust-lang-ci2/libc/${QEMU}" | \ + gunzip -d > "${tmpdir}/${qemufile}" + fi + elif [ -z "${QEMU#*.xz}" ]; then + # image is .xz : download and uncompress it + qemufile="$(echo "${QEMU%.xz}" | sed 's/\//__/g')" + if [ ! -f "${tmpdir}/${qemufile}" ]; then + curl --retry 5 "https://s3-us-west-1.amazonaws.com/rust-lang-ci2/libc/${QEMU}" | \ + unxz > "${tmpdir}/${qemufile}" fi else # plain qcow2 image: just download it - qemufile=$(echo ${QEMU} | sed 's/\//__/g') - if [ ! -f $tmpdir/$qemufile ]; then - curl https://s3-us-west-1.amazonaws.com/rust-lang-ci2/libc/$QEMU \ - > $tmpdir/$qemufile + qemufile="$(echo "${QEMU}" | sed 's/\//__/g')" + if [ ! -f "${tmpdir}/${qemufile}" ]; then + curl --retry 5 "https://s3-us-west-1.amazonaws.com/rust-lang-ci2/libc/${QEMU}" \ + > "${tmpdir}/${qemufile}" fi fi # Create a mount a fresh new filesystem image that we'll later pass to QEMU. # This will have a `run.sh` script will which use the artifacts inside to run # on the host. - rm -f $tmpdir/libc-test.img - mkdir $tmpdir/mount + rm -f "${tmpdir}/libc-test.img" + mkdir "${tmpdir}/mount" # 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 \ + --target "${TARGET}" \ --test main - rm $CARGO_TARGET_DIR/$TARGET/debug/main-*.d - cp $CARGO_TARGET_DIR/$TARGET/debug/main-* $tmpdir/mount/libc-test - echo 'exec $1/libc-test' > $tmpdir/mount/run.sh + rm "${CARGO_TARGET_DIR}/${TARGET}"/debug/main-*.d + cp "${CARGO_TARGET_DIR}/${TARGET}"/debug/main-* "${tmpdir}"/mount/libc-test + # shellcheck disable=SC2016 + echo 'exec $1/libc-test' > "${tmpdir}/mount/run.sh" - du -sh $tmpdir/mount + du -sh "${tmpdir}/mount" genext2fs \ - --root $tmpdir/mount \ + --root "${tmpdir}/mount" \ --size-in-blocks 100000 \ - $tmpdir/libc-test.img + "${tmpdir}/libc-test.img" # Pass -snapshot to prevent tampering with the disk images, this helps when # running this script in development. The two drives are then passed next, @@ -63,20 +71,29 @@ if [ "$QEMU" != "" ]; then qemu-system-x86_64 \ -m 1024 \ -snapshot \ - -drive if=virtio,file=$tmpdir/$qemufile \ - -drive if=virtio,file=$tmpdir/libc-test.img \ + -drive if=virtio,file="${tmpdir}/${qemufile}" \ + -drive if=virtio,file="${tmpdir}/libc-test.img" \ -net nic,model=virtio \ -net user \ -nographic \ - -vga none 2>&1 | tee $CARGO_TARGET_DIR/out.log - exec grep "^PASSED .* tests" $CARGO_TARGET_DIR/out.log + -vga none 2>&1 | tee "${CARGO_TARGET_DIR}/out.log" + exec grep "^PASSED .* tests" "${CARGO_TARGET_DIR}/out.log" fi -# FIXME: x86_64-unknown-linux-gnux32 fail to compile wihout --release +# FIXME: x86_64-unknown-linux-gnux32 fail to compile without --release # See https://github.com/rust-lang/rust/issues/45417 opt= if [ "$TARGET" = "x86_64-unknown-linux-gnux32" ]; then opt="--release" fi -exec cargo test $opt --manifest-path libc-test/Cargo.toml --target $TARGET +# 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}" diff --git a/libc/ci/style.rs b/libc/ci/style.rs index 32e4ba7..747e26c 100644 --- a/libc/ci/style.rs +++ b/libc/ci/style.rs @@ -72,6 +72,8 @@ fn walk(path: &Path, err: &mut Errors) { "dox.rs" | "lib.rs" | + "ctypes.rs" | + "libc.rs" | "macros.rs" => continue, _ => {} @@ -127,7 +129,10 @@ fn check_style(file: &str, path: &Path, err: &mut Errors) { if line.contains("extern \"C\"") { err.error(path, i, "use `extern` instead of `extern \"C\""); } - if line.contains("#[cfg(") && !line.contains(" if ") { + if line.contains("#[cfg(") && !line.contains(" if ") + && !(line.contains("target_endian") || + line.contains("target_arch")) + { if state != State::Structs { err.error(path, i, "use cfg_if! and submodules \ instead of #[cfg]"); |