diff --git a/.travis.yml b/.travis.yml index 9c79c50e13..e5d0e105d2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,12 +17,32 @@ env: global: - CARGO_TARGET_DIR=/tmp/bindgen matrix: - - LLVM_VERSION=3.8.1 - - LLVM_VERSION=3.9.0 - - LLVM_VERSION=4.0.0 + - LLVM_VERSION="3.8.1" BINDGEN_JOB="test" BINDGEN_PROFILE= + - LLVM_VERSION="3.8.1" BINDGEN_JOB="test" BINDGEN_PROFILE="--release" + - LLVM_VERSION="3.8.1" BINDGEN_JOB="integration" BINDGEN_PROFILE= + - LLVM_VERSION="3.8.1" BINDGEN_JOB="integration" BINDGEN_PROFILE="--release" + - LLVM_VERSION="3.8.1" BINDGEN_JOB="expectations" BINDGEN_PROFILE= + - LLVM_VERSION="3.8.1" BINDGEN_JOB="expectations" BINDGEN_PROFILE="--release" + - LLVM_VERSION="3.9.0" BINDGEN_JOB="test" BINDGEN_PROFILE= + - LLVM_VERSION="3.9.0" BINDGEN_JOB="test" BINDGEN_PROFILE="--release" + - LLVM_VERSION="3.9.0" BINDGEN_JOB="integration" BINDGEN_PROFILE= + - LLVM_VERSION="3.9.0" BINDGEN_JOB="integration" BINDGEN_PROFILE="--release" + - LLVM_VERSION="3.9.0" BINDGEN_JOB="expectations" BINDGEN_PROFILE= + - LLVM_VERSION="3.9.0" BINDGEN_JOB="expectations" BINDGEN_PROFILE="--release" + - LLVM_VERSION="4.0.0" BINDGEN_JOB="test" BINDGEN_PROFILE= + - LLVM_VERSION="4.0.0" BINDGEN_JOB="test" BINDGEN_PROFILE="--release" + - LLVM_VERSION="4.0.0" BINDGEN_JOB="test" BINDGEN_PROFILE= BINDGEN_FEATURES="testing_only_extra_assertions" + - LLVM_VERSION="4.0.0" BINDGEN_JOB="test" BINDGEN_PROFILE="--release" BINDGEN_FEATURES="testing_only_extra_assertions" + - LLVM_VERSION="4.0.0" BINDGEN_JOB="integration" BINDGEN_PROFILE= + - LLVM_VERSION="4.0.0" BINDGEN_JOB="integration" BINDGEN_PROFILE="--release" + - LLVM_VERSION="4.0.0" BINDGEN_JOB="expectations" BINDGEN_PROFILE= + - LLVM_VERSION="4.0.0" BINDGEN_JOB="expectations" BINDGEN_PROFILE="--release" + - LLVM_VERSION="4.0.0" BINDGEN_JOB="misc" matrix: fast_finish: true + allow_failures: + - env: LLVM_VERSION=4.0.0 BINDGEN_JOB=rustfmt cache: directories: @@ -32,14 +52,12 @@ cache: before_install: . ./ci/before_install.sh script: - # - ./ci/assert-rustfmt.sh - - BINDGEN_FEATURES="$BINDGEN_FEATURES" ./ci/assert-docs.sh - - BINDGEN_FEATURES="$BINDGEN_FEATURES" ./ci/test.sh - - ./ci/test-book.sh + - BINDGEN_JOB="$BINDGEN_JOB" BINDGEN_PROFILE="$BINDGEN_PROFILE" BINDGEN_FEATURES="$BINDGEN_FEATURES" ./ci/script.sh after_success: - test "$TRAVIS_PULL_REQUEST" == "false" && test "$TRAVIS_BRANCH" == "master" && + test "$BINDGEN_JOB" == "misc" && ./ci/deploy-book.sh notifications: diff --git a/ci/script.sh b/ci/script.sh new file mode 100755 index 0000000000..b23d8b5d88 --- /dev/null +++ b/ci/script.sh @@ -0,0 +1,40 @@ +#!/usr/bin/env bash + +set -xeu +cd "$(dirname "$0")/.." + +# Note that `$BINDGEN_PROFILE` is never in quotes so that it expands to nothing +# (not even an empty string argument) when the variable is empty. This is +# necessary so we don't pass an unexpected flag to cargo. + +export RUST_BACKTRACE=1 + +case "$BINDGEN_JOB" in + "test") + cargo test $BINDGEN_PROFILE --features "$BINDGEN_FEATURES" + ./ci/assert-no-diff.sh + ;; + + "integration") + cd ./bindgen-integration + cargo test $BINDGEN_PROFILE --features "$BINDGEN_FEATURES" + ;; + + "expectations") + cd ./tests/expectations + cargo test $BINDGEN_PROFILE + ;; + + "misc") + ./ci/assert-docs.sh + ./ci/test-book.sh + ./ci/no-includes.sh + # `rustfmt` isn't reaching a fixed point on bindgen + # code... https://github.com/rust-lang-nursery/rustfmt/issues/1376 + # ./ci/assert-rustfmt.sh + ;; + + *) + echo "Error! Unknown \$BINDGEN_JOB: '$BINDGEN_JOB'" + exit 1 +esac diff --git a/ci/test.sh b/ci/test.sh deleted file mode 100755 index 5d8bb469f6..0000000000 --- a/ci/test.sh +++ /dev/null @@ -1,38 +0,0 @@ -#!/usr/bin/env bash - -set -xeu -cd "$(dirname "$0")/.." - -export RUST_BACKTRACE=1 - -# Disallow system header file includes in our test suite. -./ci/no-includes.sh - -# Regenerate the test headers' bindings in debug and release modes, and assert -# that we always get the expected generated bindings. - -cargo test --features "$BINDGEN_FEATURES" -./ci/assert-no-diff.sh - -cargo test --features "$BINDGEN_FEATURES testing_only_extra_assertions" -./ci/assert-no-diff.sh - -cargo test --release --features "$BINDGEN_FEATURES testing_only_extra_assertions" -./ci/assert-no-diff.sh - -if [[ "${TRAVIS}" == "true" ]]; then - - # Now test the expectations' size and alignment tests. - - pushd tests/expectations - cargo test - cargo test --release - popd - - # And finally, test our example bindgen + build.rs integration template project. - - cd bindgen-integration - cargo test --features "$BINDGEN_FEATURES" - cargo test --release --features "$BINDGEN_FEATURES" - -fi