From 22d7fb5a0505ee87692ff62b2d46ad4c508c0af0 Mon Sep 17 00:00:00 2001 From: Nick Fitzgerald Date: Thu, 10 Aug 2017 13:40:34 -0700 Subject: [PATCH 1/3] Stop testing libclang 3.7 No one intends to make this work. We should focus on new versions of libclang going forward. --- .travis.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 639832dd02..e40fc7dc8f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,15 +17,12 @@ env: global: - CARGO_TARGET_DIR=/tmp/bindgen matrix: - - LLVM_VERSION=3.7.1 BINDGEN_FEATURES=testing_only_libclang_3_8 - LLVM_VERSION=3.8.1 BINDGEN_FEATURES=testing_only_libclang_3_8 - LLVM_VERSION=3.9.0 BINDGEN_FEATURES=testing_only_libclang_3_9 - LLVM_VERSION=4.0.0 BINDGEN_FEATURES=testing_only_libclang_4 matrix: fast_finish: true - allow_failures: - - env: LLVM_VERSION=3.7.1 BINDGEN_FEATURES=testing_only_libclang_3_8 cache: directories: From 08003a4d14bc1f47ee46e2a18a0ea3154f2438fa Mon Sep 17 00:00:00 2001 From: Nick Fitzgerald Date: Thu, 10 Aug 2017 13:42:43 -0700 Subject: [PATCH 2/3] Let the libclang version being tested be implicit Our test runner is smart enough to figure out which test expectations to use now. --- .travis.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index e40fc7dc8f..9c79c50e13 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,9 +17,9 @@ env: global: - CARGO_TARGET_DIR=/tmp/bindgen matrix: - - LLVM_VERSION=3.8.1 BINDGEN_FEATURES=testing_only_libclang_3_8 - - LLVM_VERSION=3.9.0 BINDGEN_FEATURES=testing_only_libclang_3_9 - - LLVM_VERSION=4.0.0 BINDGEN_FEATURES=testing_only_libclang_4 + - LLVM_VERSION=3.8.1 + - LLVM_VERSION=3.9.0 + - LLVM_VERSION=4.0.0 matrix: fast_finish: true From 59b85354a7ce44343ef4bcfd7047b9ea0a6719c6 Mon Sep 17 00:00:00 2001 From: Nick Fitzgerald Date: Thu, 10 Aug 2017 15:17:03 -0700 Subject: [PATCH 3/3] Run many parallel CI jobs Our CI is performing multiple different jobs: * For every libclang version we support: * With both debug and release profiles: * Generating bindings from our test headers, with and without extra assertions, and asserting there is no diff from the expectations. * Compiling and testing the generated bindings. * Compiling and testing the bindgen-integration crate. * Testing the md book. * Asserting that there aren't any system includes in any of the test headers. * Asserting that all the pub functions have doc comments. We were previously doing these things sequentially for each libclang version. This commit breaks these jobs up explicitly and runs each of them one at a time so that they can each be run in parallel, on different Travis CI machines. --- .travis.yml | 32 +++++++++++++++++++++++++------- ci/script.sh | 40 ++++++++++++++++++++++++++++++++++++++++ ci/test.sh | 38 -------------------------------------- 3 files changed, 65 insertions(+), 45 deletions(-) create mode 100755 ci/script.sh delete mode 100755 ci/test.sh 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