From 6ca5bfaea17f5c48843abb46dc22771fbe5fda2d Mon Sep 17 00:00:00 2001
From: gnzlbg <gonzalobg88@gmail.com>
Date: Tue, 28 May 2019 19:10:23 +0200
Subject: [PATCH] Setup Azure Pipelines

---
 .travis.yml               | 256 --------------------------------------
 README.md                 |   2 +-
 azure-pipelines.yml       | 173 ++++++++++++++++++++++++++
 ci/azure-install-rust.yml |  49 ++++++++
 ci/build.sh               |  42 +++++--
 ci/dox.sh                 |   8 ++
 ci/run-docker.sh          |  15 ++-
 ci/semver.sh              |   9 +-
 ci/style.sh               |  19 +++
 libc-test/build.rs        |   3 +-
 src/unix/bsd/apple/b32.rs |   4 +
 src/unix/bsd/apple/b64.rs |   4 +
 src/unix/bsd/apple/mod.rs |   3 -
 13 files changed, 309 insertions(+), 278 deletions(-)
 delete mode 100644 .travis.yml
 create mode 100644 azure-pipelines.yml
 create mode 100644 ci/azure-install-rust.yml
 create mode 100644 ci/style.sh

diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index 6a7ddb38..00000000
--- a/.travis.yml
+++ /dev/null
@@ -1,256 +0,0 @@
-language: rust
-rust: nightly
-sudo: required
-dist: xenial
-services: docker
-
-stages:
-  - tools-and-build-and-tier1
-  - tier2
-
-matrix:
-  include:
-    # TOOLS
-    - name: "Documentation"
-      env: TARGET=x86_64-unknown-linux-gnu
-      script: sh ci/dox.sh
-      install:
-        - travis_retry rustup component add rust-src
-        - travis_retry cargo install xargo
-      stage: tools-and-build-and-tier1
-    - name: "Shellcheck"
-      install: true
-      script:
-        - shellcheck --version
-        # FIXME: https://github.com/koalaman/shellcheck/issues/1591
-        - shellcheck -e SC2103 ci/*.sh
-      stage: tools-and-build-and-tier1
-    - name: "Style"
-      install: true
-      script:
-        - rustc ci/style.rs && ./style src
-        # Disabled due to rust-lang/rustfmt#3341
-        #- |
-        #  if rustup component add rustfmt-preview ; then
-        #      cargo fmt --all -- --check
-        #  fi
-      stage: tools-and-build-and-tier1
-    - name: "Semver Linux"
-      install: travis_retry cargo +nightly install semverver
-      script: sh ci/semver.sh
-      stage: tools-and-build-and-tier1
-    - name: "Semver MacOSX"
-      install: travis_retry cargo +nightly install semverver
-      script: sh ci/semver.sh
-      os: osx
-      osx_image: xcode10
-      stage: tools-and-build-and-tier1
-
-    # BUILD stable, beta, nightly
-    - name: "Build Stable Rust"
-      script: sh ci/build.sh
-      stage: tools-and-build-and-tier1
-      rust: stable
-      install: true
-    - name: "Build Beta Rust"
-      script: sh ci/build.sh
-      stage: tools-and-build-and-tier1
-      rust: beta
-      install: true
-    - name: "Build Nightly Rust"
-      script: sh ci/build.sh
-      stage: tools-and-build-and-tier1
-      rust: nightly
-      install:
-        - travis_retry rustup component add rust-src
-        - travis_retry cargo install xargo
-    - name: "Build Stable Rust"
-      script: sh ci/build.sh
-      stage: tools-and-build-and-tier1
-      rust: stable
-      os: osx
-      osx_image: xcode10
-      install: true
-    - name: "Build Beta Rust"
-      script: sh ci/build.sh
-      stage: tools-and-build-and-tier1
-      rust: beta
-      os: osx
-      osx_image: xcode10
-      install: true
-    - name: "Build Nightly Rust"
-      script: sh ci/build.sh
-      stage: tools-and-build-and-tier1
-      rust: nightly
-      os: osx
-      osx_image: xcode10
-      install: true
-    - name: "Build Stable Rust 1.13.0"
-      script: sh ci/build.sh
-      stage: tools-and-build-and-tier1
-      rust: 1.13.0
-      install: true
-    - name: "Build Stable Rust 1.19.0"
-      script: sh ci/build.sh
-      stage: tools-and-build-and-tier1
-      rust: 1.19.0
-      install: true
-    - name: "Build Stable Rust 1.24.0"
-      script: sh ci/build.sh
-      stage: tools-and-build-and-tier1
-      rust: 1.24.0
-      install: true
-    - name: "Build Stable Rust 1.25.0"
-      script: sh ci/build.sh
-      stage: tools-and-build-and-tier1
-      rust: 1.25.0
-      install: true
-    - name: "Build Stable Rust 1.30.0"
-      script: sh ci/build.sh
-      stage: tools-and-build-and-tier1
-      rust: 1.30.0
-      install: true
-    - name: "Build Stable Rust 1.13.0"
-      script: sh ci/build.sh
-      stage: tools-and-build-and-tier1
-      rust: 1.13.0
-      os: osx
-      osx_image: xcode10
-      install: true
-    - name: "Build Stable Rust 1.19.0"
-      script: sh ci/build.sh
-      stage: tools-and-build-and-tier1
-      rust: 1.19.0
-      os: osx
-      osx_image: xcode10
-      install: true
-    - name: "Build Stable Rust 1.24.0"
-      script: sh ci/build.sh
-      stage: tools-and-build-and-tier1
-      rust: 1.24.0
-      os: osx
-      osx_image: xcode10
-      install: true
-    - name: "Build Stable Rust 1.25.0"
-      script: sh ci/build.sh
-      stage: tools-and-build-and-tier1
-      rust: 1.25.0
-      os: osx
-      osx_image: xcode10
-      install: true
-    - name: "Build Stable Rust 1.30.0"
-      script: sh ci/build.sh
-      stage: tools-and-build-and-tier1
-      rust: 1.30.0
-      os: osx
-      osx_image: xcode10
-      install: true
-    - env: TARGET=i686-apple-darwin
-      os: osx
-      osx_image: xcode10
-      stage: tools-and-build-and-tier1
-    - env: TARGET=i686-unknown-linux-gnu
-      stage: tools-and-build-and-tier1
-    - env: TARGET=x86_64-apple-darwin
-      os: osx
-      osx_image: xcode10
-      install: true
-      stage: tools-and-build-and-tier1
-    - env: TARGET=x86_64-unknown-linux-gnu
-      stage: tools-and-build-and-tier1
-      install: true
-
-    # Tier 2 targets
-    - env: TARGET=aarch64-linux-android
-      stage: tier2
-    - env: TARGET=aarch64-unknown-linux-gnu
-      stage: tier2
-    - env: TARGET=aarch64-unknown-linux-musl
-      stage: tier2
-    - env: TARGET=arm-linux-androideabi
-      stage: tier2
-    - env: TARGET=arm-unknown-linux-gnueabihf
-      stage: tier2
-    - env: TARGET=arm-unknown-linux-musleabihf
-      stage: tier2
-    - env: TARGET=asmjs-unknown-emscripten
-      stage: tier2
-    - env: TARGET=i686-linux-android
-      stage: tier2
-    - env: TARGET=i686-unknown-linux-musl
-      stage: tier2
-    - env: TARGET=mips-unknown-linux-gnu
-      stage: tier2
-    - env: TARGET=mips-unknown-linux-musl
-      stage: tier2
-    - env: TARGET=mips64-unknown-linux-gnuabi64
-      stage: tier2
-    - env: TARGET=mips64el-unknown-linux-gnuabi64
-      stage: tier2
-    - env: TARGET=mipsel-unknown-linux-musl
-      stage: tier2
-    - env: TARGET=powerpc-unknown-linux-gnu
-      stage: tier2
-    - env: TARGET=powerpc64-unknown-linux-gnu
-      stage: tier2
-    - env: TARGET=powerpc64le-unknown-linux-gnu
-      stage: tier2
-    - env: TARGET=s390x-unknown-linux-gnu
-      stage: tier2
-    - env: TARGET=sparc64-unknown-linux-gnu
-      stage: tier2
-    - env: TARGET=wasm32-unknown-emscripten
-      stage: tier2
-    - env: TARGET=x86_64-linux-android
-      stage: tier2
-    - env: TARGET=x86_64-unknown-linux-gnux32 OPT="--release"
-      stage: tier2
-    - env: TARGET=x86_64-unknown-linux-musl
-      stage: tier2
-    - env: TARGET=wasm32-wasi
-      rust: nightly
-      stage: tier2
-    - name: "Nintendo Switch - build libcore only"
-      rust: nightly
-      stage: tier2
-      install:
-        - rustup component add rust-src
-        - (test -x $HOME/.cargo/bin/cargo-xbuild || cargo install cargo-xbuild)
-      script:
-        - mkdir -p target
-        - cd target
-        - wget https://github.com/devkitPro/pacman/releases/download/devkitpro-pacman-1.0.1/devkitpro-pacman.deb
-        - sudo dpkg -i devkitpro-pacman.deb
-        - sudo dkp-pacman -Sy
-        - sudo dkp-pacman -Syu
-        - sudo dkp-pacman -S -v --noconfirm switch-dev devkitA64
-        - export PATH="$PATH:/opt/devkitpro/devkitA64/bin"
-        - export PATH="$PATH:/opt/devkitpro/tools/bin"
-        - cd ..
-        # Pull the target spec up into the current directory and then build
-        - mv ci/switch.json switch.json
-        - cargo xbuild --target switch.json
-
-  allow_failures:
-      - name: "Semver Linux"
-      - name: "Semver MacOSX"
-      - env: TARGET=wasm32-wasi
-      - env: TARGET=powerpc-unknown-linux-gnu
-      - env: TARGET=s390x-unknown-linux-gnu
-
-install: travis_retry rustup target add $TARGET
-
-script:
-  - cargo generate-lockfile --manifest-path libc-test/Cargo.toml
-  - if [[ $TRAVIS_OS_NAME = "linux" ]] && [[ $BUILD_ONLY != "1" ]]; then
-      sh ci/run-docker.sh $TARGET;
-    else
-      sh ci/run.sh $TARGET;
-    fi
-env:
-  global:
-    secure: "e2/3QjgRN9atOuSHp22TrYG7QVKcYUWY48Hi9b60w+r1+BhPkTseIJLte7WefRhdXtqpjjUJTooKDhnurFOeHaCT+nmBgiv+FPU893sBl4bhesY4m0vgUJVbNZcs6lTImYekWVb+aqjGdgV/XAgCw7c3kPmrZV0MzGDWL64Xaps="
-
-notifications:
-  email:
-    on_success: never
diff --git a/README.md b/README.md
index dc5ff04f..4ca2e944 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-[![Travis-CI Status]][Travis-CI] [![Appveyor Status]][Appveyor] [![Cirrus-CI Status]][Cirrus-CI] [![Latest Version]][crates.io] [![Documentation]][docs.rs] ![License]
+[![Build Status](https://dev.azure.com/rust-lang/libc/_apis/build/status/rust-lang.libc?branchName=master)](https://dev.azure.com/rust-lang/libc/_build/latest?definitionId=11&branchName=master) [![Appveyor Status]][Appveyor] [![Cirrus-CI Status]][Cirrus-CI] [![Latest Version]][crates.io] [![Documentation]][docs.rs] ![License]
 
 libc - Raw FFI bindings to platforms' system libraries
 ====
diff --git a/azure-pipelines.yml b/azure-pipelines.yml
new file mode 100644
index 00000000..00878c75
--- /dev/null
+++ b/azure-pipelines.yml
@@ -0,0 +1,173 @@
+trigger:
+  - master
+
+jobs:
+  - job: DockerLinux
+    pool:
+      vmImage: ubuntu-16.04
+    steps:
+      - template: ci/azure-install-rust.yml
+      - bash: sh ./ci/run-docker.sh $TARGET
+        displayName: Execute run-docker.sh
+    strategy:
+      matrix:
+        aarch64-unknown-linux-android:
+          TARGET: aarch64-linux-android
+        aarch64-unknown-linux-gnu:
+          TARGET: aarch64-unknown-linux-gnu
+        aarch64-unknown-linux-musl:
+          TARGET: aarch64-unknown-linux-musl
+        arm-linux-androideabi:
+          TARGET: arm-linux-androideabi
+        arm-unknown-linux-gnueabihf:
+          TARGET: arm-unknown-linux-gnueabihf
+        arm-unknown-linux-musleabihf:
+          TARGET: arm-unknown-linux-musleabihf
+        asmjs-unknown-emscripten:
+          TARGET: asmjs-unknown-emscripten
+        i686-linux-android:
+          TARGET: i686-linux-android
+        i686-unknown-linux-gnu:
+          TARGET: i686-unknown-linux-gnu
+        i686-unknown-linux-musl:
+          TARGET: i686-unknown-linux-musl
+        mips-unknown-linux-gnu:
+          TARGET: mips-unknown-linux-gnu
+        mips-unknown-linux-musl:
+          TARGET: mips-unknown-linux-musl
+        mips64-unknown-linux-gnuabi64:
+          TARGET: mips64-unknown-linux-gnuabi64
+        mips64el-unknown-linux-gnuabi64:
+          TARGET: mips64el-unknown-linux-gnuabi64
+        mipsel-unknown-linux-musl:
+          TARGET: mipsel-unknown-linux-musl
+        #powerpc-unknown-linux-gnu:
+        #  TARGET: powerpc-unknown-linux-gnu
+        powerpc64-unknown-linux-gnu:
+          TARGET: powerpc64-unknown-linux-gnu
+        powerpc64le-unknown-linux-gnu:
+          TARGET: powerpc64le-unknown-linux-gnu
+        #s390x-unknown-linux-gnu:
+        #  TARGET: s390x-unknown-linux-gnu
+        #wasm32-wasi
+        #  TARGET: wasm32-wasi
+        sparc64-unknown-linux-gnu:
+          TARGET: sparc64-unknown-linux-gnu
+        wasm32-unknown-emscripten:
+          TARGET: wasm32-unknown-emscripten
+        x86_64-linux-android:
+          TARGET: x86_64-linux-android
+        x86_64-unknown-linux-gnu:
+          TARGET: x86_64-unknown-linux-gnu
+        x86_64-unknown-linux-gnux32:
+          TARGET: x86_64-unknown-linux-gnux32
+        x86_64-unknown-linux-musl:
+          TARGET: x86_64-unknown-linux-musl
+
+  - job: DockerOSX64
+    pool:
+      vmImage: macos-10.14
+    steps:
+      - template: ci/azure-install-rust.yml
+      - bash: sh ./ci/run.sh $TARGET
+        displayName: Execute run.sh
+    strategy:
+      matrix:
+        x86_64-apple-darwin:
+          TARGET: x86_64-apple-darwin
+
+  - job: DockerOSX32
+    pool:
+      vmImage: macos-10.13
+    steps:
+      - template: ci/azure-install-rust.yml
+      - bash: sh ./ci/run.sh $TARGET
+        displayName: Execute run.sh
+    strategy:
+      matrix:
+        i686-apple-darwin:
+          TARGET: i686-apple-darwin
+
+  - job: StyleAndDocs
+    pool:
+      vmImage: ubuntu-16.04
+    steps:
+      - template: ci/azure-install-rust.yml
+      - script: sh ci/style.sh
+        displayName: Check style
+      - script: sh ci/dox.sh
+        displayName: Generate and upload documentation
+
+  - job: SemverLinux
+    continueOnError: true
+    pool:
+      vmImage: ubuntu-16.04
+    steps:
+      - template: ci/azure-install-rust.yml
+      - script: sh ci/semver.sh linux
+        displayName: Check breaking changes
+
+  - job: SemverOSX
+    continueOnError: true
+    pool:
+      vmImage: macos-10.14
+    steps:
+      - template: ci/azure-install-rust.yml
+      - script: sh ci/semver.sh osx
+        displayName: Check breaking changes
+
+  - job: BuildChannelsLinux
+    pool:
+      vmImage: ubuntu-16.04
+    steps:
+      - template: ci/azure-install-rust.yml
+      - script: sh ./ci/build.sh
+        displayName: Execute build.sh
+    strategy:
+      matrix:
+        stable:
+          TOOLCHAIN: stable
+        beta:
+          TOOLCHAIN: beta
+        nightly:
+          TOOLCHAIN: nightly
+        1.13.0:
+          TOOLCHAIN: 1.13.0
+        1.19.0:
+          TOOLCHAIN: 1.19.0
+        1.24.0:
+          TOOLCHAIN: 1.24.0
+        1.25.0:
+          TOOLCHAIN: 1.25.0
+        1.30.0:
+          TOOLCHAIN: 1.30.0
+    variables:
+      OS: linux
+
+  - job: BuildChannelsOSX
+    pool:
+      vmImage: macos-10.13
+    steps:
+      - template: ci/azure-install-rust.yml
+      - script: sh ./ci/build.sh
+        displayName: Execute build.sh
+    strategy:
+      matrix:
+        stable:
+          TOOLCHAIN: stable
+        beta:
+          TOOLCHAIN: beta
+        nightly:
+          TOOLCHAIN: nightly
+        1.13.0:
+          TOOLCHAIN: 1.13.0
+        1.19.0:
+          TOOLCHAIN: 1.19.0
+        1.24.0:
+          TOOLCHAIN: 1.24.0
+        1.25.0:
+          TOOLCHAIN: 1.25.0
+        1.30.0:
+          TOOLCHAIN: 1.30.0
+    variables:
+      OS: osx
diff --git a/ci/azure-install-rust.yml b/ci/azure-install-rust.yml
new file mode 100644
index 00000000..1f407130
--- /dev/null
+++ b/ci/azure-install-rust.yml
@@ -0,0 +1,49 @@
+steps:
+  - bash: |
+      set -ex
+      toolchain=$TOOLCHAIN
+      if [ "$toolchain" = "" ]; then
+        toolchain=nightly
+      fi
+      if command -v rustup; then
+        rustup update $toolchain
+        rustup default $toolchain
+      else
+        curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain $toolchain
+        echo "##vso[task.prependpath]$HOME/.cargo/bin"
+      fi
+    displayName: Install rust (unix)
+    condition: ne( variables['Agent.OS'], 'Windows_NT' )
+  - script: |
+      if not defined TOOLCHAIN set TOOLCHAIN=nightly
+      curl -sSf -o rustup-init.exe https://win.rustup.rs
+      rustup-init.exe -y --default-toolchain %TOOLCHAIN%-%TARGET%
+      echo ##vso[task.prependpath]%USERPROFILE%\.cargo\bin
+    displayName: Install rust (windows)
+    condition: eq( variables['Agent.OS'], 'Windows_NT' )
+  - script: |
+      set -ex
+      if [ -n "${TARGET}" ]; then
+        rustup target add $TARGET
+      fi
+    condition: ne( variables['Agent.OS'], 'Windows_NT' )
+    displayName: Install target (unix)
+  - script: if defined TARGET rustup target add %TARGET%
+    condition: eq( variables['Agent.OS'], 'Windows_NT' )
+    displayName: Install target (windows)
+  - script: |
+        set -ex
+        rustc -Vv
+        cargo -V
+        rustup -Vv
+        rustup show
+        which rustc
+        which cargo
+        which rustup
+    displayName: Query rust and cargo versions
+  - script: |
+      set -ex
+      cargo generate-lockfile
+      cargo generate-lockfile --manifest-path libc-test/Cargo.toml
+    displayName: Generate lockfiles
+
diff --git a/ci/build.sh b/ci/build.sh
index 00fbe35e..abec755d 100644
--- a/ci/build.sh
+++ b/ci/build.sh
@@ -5,13 +5,20 @@
 
 set -ex
 
-RUST=${TRAVIS_RUST_VERSION}
-OS=${TRAVIS_OS_NAME}
+: "${TOOLCHAIN?The TOOLCHAIN environment variable must be set.}"
+: "${OS?The OS environment variable must be set.}"
+
+RUST=${TOOLCHAIN}
 
 echo "Testing Rust ${RUST} on ${OS}"
 
+if [ "${TOOLCHAIN}" = "nightly" ] ; then
+    cargo +nightly install cargo-xbuild -Z install-upgrade
+    rustup component add rust-src
+fi
+
 test_target() {
-    CARGO="${1}"
+    BUILD_CMD="${1}"
     TARGET="${2}"
     NO_STD="${3}"
 
@@ -46,21 +53,21 @@ test_target() {
     fi
 
     # Test that libc builds without any default features (no libstd)
-    "$CARGO" "+${RUST}" build -vv $opt --no-default-features --target "${TARGET}"
+    cargo "+${RUST}" "${BUILD_CMD}" -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}"
+        cargo "+${RUST}" "${BUILD_CMD}" -vv $opt --target "${TARGET}"
     fi
 
     # Test that libc builds with the `extra_traits` feature
-    "$CARGO" "+${RUST}" build -vv $opt --no-default-features --target "${TARGET}" \
+    cargo "+${RUST}" "${BUILD_CMD}" -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}" \
+        cargo "+${RUST}" "${BUILD_CMD}" -vv $opt --target "${TARGET}" \
               --features extra_traits
     fi
 }
@@ -167,7 +174,7 @@ case "${OS}" in
 esac
 
 for TARGET in $TARGETS; do
-    test_target cargo "$TARGET"
+    test_target build "$TARGET"
 done
 
 # FIXME: https://github.com/rust-lang/rust/issues/58564
@@ -218,6 +225,23 @@ x86_64-unknown-openbsd \
 
 if [ "${RUST}" = "nightly" ] && [ "${OS}" = "linux" ]; then
     for TARGET in $RUST_LINUX_NO_CORE_TARGETS; do
-        test_target xargo "$TARGET" 1
+        test_target xbuild "$TARGET" 1
     done
+
+    # Nintendo switch
+    cargo clean
+    mkdir -p target
+    (
+        cd target
+        wget https://github.com/devkitPro/pacman/releases/download/devkitpro-pacman-1.0.1/devkitpro-pacman.deb
+        sudo dpkg -i devkitpro-pacman.deb
+        sudo dkp-pacman -Sy
+        sudo dkp-pacman -Syu
+        sudo dkp-pacman -S -v --noconfirm switch-dev devkitA64
+    )
+    cp ci/switch.json switch.json
+    PATH="$PATH:/opt/devkitpro/devkitA64/bin"
+    PATH="$PATH:/opt/devkitpro/tools/bin"
+    cargo xbuild --target switch.json
 fi
+
diff --git a/ci/dox.sh b/ci/dox.sh
index ce550814..40b7dae4 100644
--- a/ci/dox.sh
+++ b/ci/dox.sh
@@ -13,6 +13,14 @@ PLATFORM_SUPPORT=platform-support.md
 rm -rf $TARGET_DOC_DIR
 mkdir -p $TARGET_DOC_DIR
 
+if ! rustc --version | grep -E "nightly" ; then
+    echo "Building the documentation requires a nightly Rust toolchain"
+    exit 1
+fi
+
+rustup component add rust-src
+cargo +nightly install xargo -Z install-upgrade
+
 # List all targets that do currently build successfully:
 # shellcheck disable=SC1003
 grep '[\d|\w|-]* \\' ci/build.sh > targets
diff --git a/ci/run-docker.sh b/ci/run-docker.sh
index c656f590..5fd00614 100755
--- a/ci/run-docker.sh
+++ b/ci/run-docker.sh
@@ -5,6 +5,9 @@
 
 set -ex
 
+echo "${HOME}"
+pwd
+
 run() {
     echo "Building docker container for target ${1}"
 
@@ -18,19 +21,19 @@ run() {
     fi
 
     docker run \
-      --user "$(id -u)":"$(id -g)" \
       --rm \
-      --init \
-      --volume "${HOME}/.cargo":/cargo \
-      $kvm \
+      --user "$(id -u)":"$(id -g)" \
       --env CARGO_HOME=/cargo \
+      --env CARGO_TARGET_DIR=/checkout/target \
+      --volume "$(dirname "$(dirname "$(command -v cargo)")")":/cargo \
       --volume "$(rustc --print sysroot)":/rust:ro \
       --volume "$(pwd)":/checkout:ro \
       --volume "$(pwd)"/target:/checkout/target \
-      --env CARGO_TARGET_DIR=/checkout/target \
+      $kvm \
+      --init \
       --workdir /checkout \
       libc \
-      ci/run.sh "${1}"
+      sh -c "HOME=/tmp PATH=\$PATH:/rust/bin exec ci/run.sh ${1}"
 }
 
 if [ -z "${1}" ]; then
diff --git a/ci/semver.sh b/ci/semver.sh
index ac6be36f..3412501a 100644
--- a/ci/semver.sh
+++ b/ci/semver.sh
@@ -4,10 +4,17 @@
 
 set -ex
 
-OS=${TRAVIS_OS_NAME}
+OS=${1}
 
 echo "Testing Semver on ${OS}"
 
+if ! rustc --version | grep -E "nightly" ; then
+    echo "Building semverver requires a nightly Rust toolchain"
+    exit 1
+fi
+
+cargo +nightly install semverver -Z install-upgrade
+
 TARGETS=
 case "${OS}" in
     *linux*)
diff --git a/ci/style.sh b/ci/style.sh
new file mode 100644
index 00000000..a6a00171
--- /dev/null
+++ b/ci/style.sh
@@ -0,0 +1,19 @@
+#!/usr/bin/env sh
+
+set -ex
+
+rustc ci/style.rs && ./style src
+
+if rustup component add rustfmt-preview ; then
+    which rustfmt
+    rustfmt -V
+    cargo fmt --all -- --check
+fi
+
+if shellcheck --version ; then
+    shellcheck -e SC2103 ci/*.sh
+else
+    echo "shellcheck not found"
+    exit 1
+fi
+
diff --git a/libc-test/build.rs b/libc-test/build.rs
index 6edbd0f2..d4ad4a9a 100644
--- a/libc-test/build.rs
+++ b/libc-test/build.rs
@@ -1595,8 +1595,7 @@ fn test_freebsd(target: &str) {
             // These constants were removed in FreeBSD 11 (svn r262489),
             // and they've never had any legitimate use outside of the
             // base system anyway.
-            "CTL_MAXID" | "KERN_MAXID" | "HW_MAXID"
-            | "USER_MAXID" => true,
+            "CTL_MAXID" | "KERN_MAXID" | "HW_MAXID" | "USER_MAXID" => true,
 
             _ => false,
         }
diff --git a/src/unix/bsd/apple/b32.rs b/src/unix/bsd/apple/b32.rs
index 859809dc..c05de303 100644
--- a/src/unix/bsd/apple/b32.rs
+++ b/src/unix/bsd/apple/b32.rs
@@ -81,6 +81,10 @@ cfg_if! {
     }
 }
 
+#[doc(hidden)]
+#[deprecated(since = "0.2.55")]
+pub const NET_RT_MAXID: ::c_int = 10;
+
 pub const __PTHREAD_MUTEX_SIZE__: usize = 40;
 pub const __PTHREAD_COND_SIZE__: usize = 24;
 pub const __PTHREAD_CONDATTR_SIZE__: usize = 4;
diff --git a/src/unix/bsd/apple/b64.rs b/src/unix/bsd/apple/b64.rs
index 7b89fc6a..2749260b 100644
--- a/src/unix/bsd/apple/b64.rs
+++ b/src/unix/bsd/apple/b64.rs
@@ -86,6 +86,10 @@ cfg_if! {
     }
 }
 
+#[doc(hidden)]
+#[deprecated(since = "0.2.55")]
+pub const NET_RT_MAXID: ::c_int = 11;
+
 pub const __PTHREAD_MUTEX_SIZE__: usize = 56;
 pub const __PTHREAD_COND_SIZE__: usize = 40;
 pub const __PTHREAD_CONDATTR_SIZE__: usize = 8;
diff --git a/src/unix/bsd/apple/mod.rs b/src/unix/bsd/apple/mod.rs
index 2bc18fb2..24ad12be 100644
--- a/src/unix/bsd/apple/mod.rs
+++ b/src/unix/bsd/apple/mod.rs
@@ -2178,9 +2178,6 @@ pub const PF_PPP: ::c_int =  AF_PPP;
 pub const NET_RT_DUMP: ::c_int = 1;
 pub const NET_RT_FLAGS: ::c_int = 2;
 pub const NET_RT_IFLIST: ::c_int = 3;
-#[doc(hidden)]
-#[deprecated(since = "0.2.55")]
-pub const NET_RT_MAXID: ::c_int = 10;
 
 pub const SOMAXCONN: ::c_int = 128;
 
-- 
GitLab