summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmilio Cobos Álvarez <emilio@crisal.io>2020-12-23 01:10:12 +0100
committerEmilio Cobos Álvarez <emilio@crisal.io>2020-12-26 19:01:53 +0100
commitfde75f68e701b2f4b52a3655afba612187e20687 (patch)
treeff930034a19ef80e4cbd29666532b8faca7ac93c
parentafa50fa1add6aca654da3fe009258e57f4fcd4f2 (diff)
ci: Switch most CI to GitHub actions.
-rw-r--r--.github/workflows/bindgen.yml150
-rw-r--r--.travis.yml83
-rw-r--r--bindgen-integration/Cargo.toml1
-rwxr-xr-xci/assert-docs.sh6
-rwxr-xr-xci/assert-no-diff.sh8
-rwxr-xr-xci/assert-rustfmt.sh13
-rwxr-xr-xci/assert-warnings.sh6
-rw-r--r--ci/before_install.sh77
-rwxr-xr-xci/script.sh65
-rwxr-xr-xci/test.sh130
-rw-r--r--tests/quickchecking/.gitignore1
11 files changed, 283 insertions, 257 deletions
diff --git a/.github/workflows/bindgen.yml b/.github/workflows/bindgen.yml
new file mode 100644
index 00000000..29309e82
--- /dev/null
+++ b/.github/workflows/bindgen.yml
@@ -0,0 +1,150 @@
+name: bindgen
+
+on:
+ push:
+ branches:
+ - master
+ pull_request:
+ branches:
+ - master
+
+jobs:
+ rustfmt:
+ runs-on: ubuntu-latest
+
+ steps:
+ - uses: actions/checkout@v2
+
+ - name: Install stable
+ uses: actions-rs/toolchain@v1
+ with:
+ profile: minimal
+ # TODO: Should ideally be stable, but we use some nightly-only
+ # features.
+ toolchain: nightly
+ override: true
+ components: rustfmt
+
+ - name: Run rustfmt
+ uses: actions-rs/cargo@v1
+ with:
+ command: fmt
+ args: -- --check
+
+ msrv:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v2
+
+ - name: Install msrv
+ uses: actions-rs/toolchain@v1
+ with:
+ profile: minimal
+ # MSRV below is documented in README.md, please update that if you
+ # change this.
+ toolchain: 1.40.0
+ override: true
+
+ - name: Build with msrv
+ run: rm Cargo.lock && cargo +1.40.0 build --lib
+
+ quickchecking:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v2
+
+ - name: Install stable
+ uses: actions-rs/toolchain@v1
+ with:
+ profile: minimal
+ toolchain: stable
+ override: true
+
+ # TODO: Actually run quickchecks once `bindgen` is reliable enough.
+ - name: Build quickcheck tests
+ run: cd tests/quickchecking && cargo test
+
+ test-expectations:
+ runs-on: ${{matrix.os}}
+ strategy:
+ matrix:
+ # TODO(#1954): These should be run on mac too, but turns out they're
+ # broken.
+ os: [ubuntu-latest]
+ steps:
+ - uses: actions/checkout@v2
+
+ - name: Install stable
+ uses: actions-rs/toolchain@v1
+ with:
+ profile: minimal
+ toolchain: stable
+ override: true
+
+ - name: Test expectations
+ run: cd tests/expectations && cargo test
+
+ test:
+ runs-on: ${{matrix.os}}
+ strategy:
+ matrix:
+ os: [ubuntu-latest]
+ llvm_version: ["3.9", "4.0", "5.0", "9.0"]
+ release_build: [0, 1]
+ no_default_features: [0, 1]
+ # FIXME: There are no pre-built static libclang libraries, so the
+ # `static` feature is not testable atm.
+ feature_runtime: [0, 1]
+ feature_extra_asserts: [0]
+ feature_testing_only_docs: [0]
+
+ exclude:
+ # 3.9 and 4.0 are too old to support regular dynamic linking, so this
+ # is not expected to work.
+ - os: ubuntu-latest
+ llvm_version: "3.9"
+ no_default_features: 1
+ feature_runtime: 0
+
+ - os: ubuntu-latest
+ llvm_version: "4.0"
+ no_default_features: 1
+ feature_runtime: 0
+
+ include:
+ # Test with extra asserts + docs just with latest llvm versions to
+ # prevent explosion
+ - os: ubuntu-latest
+ llvm_version: "9.0"
+ release_build: 0
+ no_default_features: 0
+ feature_extra_asserts: 1
+ feature_testing_only_docs: 1
+
+ # Ensure stuff works on macos too
+ - os: macos-latest
+ llvm_version: "9.0"
+ release_build: 0
+ no_default_features: 0
+ feature_extra_asserts: 0
+ feature_testing_only_docs: 0
+ steps:
+ - uses: actions/checkout@v2
+
+ - name: Install stable
+ uses: actions-rs/toolchain@v1
+ with:
+ profile: minimal
+ toolchain: stable
+ override: true
+
+ - name: Run all the tests
+ env:
+ GITHUB_ACTIONS_OS: ${{matrix.os}}
+ LLVM_VERSION: ${{matrix.llvm_version}}
+ BINDGEN_RELEASE_BUILD: ${{matrix.release_build}}
+ BINDGEN_FEATURE_RUNTIME: ${{matrix.feature_runtime}}
+ BINDGEN_FEATURE_EXTRA_ASSERTS: ${{matrix.feature_extra_asserts}}
+ BINDGEN_FEATURE_TESTING_ONLY_DOCS: ${{matrix.feature_testing_only_docs}}
+ BINDGEN_NO_DEFAULT_FEATURES: ${{matrix.no_default_features}}
+ run: ./ci/test.sh
diff --git a/.travis.yml b/.travis.yml
index c44aaa05..1e6d4f0a 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,96 +1,15 @@
language: rust
-
dist: xenial
-
os:
- linux
-
rust:
- stable
-
env:
global:
- CARGO_TARGET_DIR=/tmp/bindgen
- matrix:
- # Miscellaneous tests.
- # Start "misc" job first since it runs longer than any other job.
- - LLVM_VERSION="9.0" BINDGEN_JOB="misc"
- - LLVM_VERSION="9.0" BINDGEN_JOB="quickchecking"
- - LLVM_VERSION="9.0" BINDGEN_JOB="msrv"
-
- # General matrix.
- - LLVM_VERSION="3.9" BINDGEN_JOB="test" BINDGEN_PROFILE=
- - LLVM_VERSION="3.9" BINDGEN_JOB="test" BINDGEN_PROFILE="--release"
- - LLVM_VERSION="3.9" BINDGEN_JOB="integration" BINDGEN_PROFILE=
- - LLVM_VERSION="3.9" BINDGEN_JOB="integration" BINDGEN_PROFILE="--release"
- - LLVM_VERSION="3.9" BINDGEN_JOB="test" BINDGEN_PROFILE= BINDGEN_NO_DEFAULT_FEATURES="1" BINDGEN_FEATURES="runtime"
- - LLVM_VERSION="3.9" BINDGEN_JOB="test" BINDGEN_PROFILE="--release" BINDGEN_NO_DEFAULT_FEATURES="1" BINDGEN_FEATURES="runtime"
-
- - LLVM_VERSION="4.0" BINDGEN_JOB="test" BINDGEN_PROFILE=
- - LLVM_VERSION="4.0" BINDGEN_JOB="test" BINDGEN_PROFILE="--release"
- - LLVM_VERSION="4.0" BINDGEN_JOB="integration" BINDGEN_PROFILE=
- - LLVM_VERSION="4.0" BINDGEN_JOB="integration" BINDGEN_PROFILE="--release"
- - LLVM_VERSION="4.0" BINDGEN_JOB="test" BINDGEN_PROFILE= BINDGEN_NO_DEFAULT_FEATURES="1" BINDGEN_FEATURES="runtime"
- - LLVM_VERSION="4.0" BINDGEN_JOB="test" BINDGEN_PROFILE="--release" BINDGEN_NO_DEFAULT_FEATURES="1" BINDGEN_FEATURES="runtime"
-
- - LLVM_VERSION="5.0" BINDGEN_JOB="test" BINDGEN_PROFILE=
- - LLVM_VERSION="5.0" BINDGEN_JOB="test" BINDGEN_PROFILE="--release"
- - LLVM_VERSION="5.0" BINDGEN_JOB="integration" BINDGEN_PROFILE=
- - LLVM_VERSION="5.0" BINDGEN_JOB="integration" BINDGEN_PROFILE="--release"
- - LLVM_VERSION="5.0" BINDGEN_JOB="test" BINDGEN_PROFILE= BINDGEN_NO_DEFAULT_FEATURES="1"
- - LLVM_VERSION="5.0" BINDGEN_JOB="test" BINDGEN_PROFILE="--release" BINDGEN_NO_DEFAULT_FEATURES="1"
-
- # FIXME: There are no pre-built static libclang libraries, so this is not testable at the moment.
- # - LLVM_VERSION="5.0" BINDGEN_JOB="test" BINDGEN_PROFILE= BINDGEN_FEATURES="static" BINDGEN_NO_DEFAULT_FEATURES="1"
- # - LLVM_VERSION="5.0" BINDGEN_JOB="test" BINDGEN_PROFILE="--release" BINDGEN_FEATURES="static" BINDGEN_NO_DEFAULT_FEATURES="1"
-
- - LLVM_VERSION="9.0" BINDGEN_JOB="test" BINDGEN_PROFILE=
- - LLVM_VERSION="9.0" BINDGEN_JOB="test" BINDGEN_PROFILE="--release"
- - LLVM_VERSION="9.0" BINDGEN_JOB="integration" BINDGEN_PROFILE=
- - LLVM_VERSION="9.0" BINDGEN_JOB="integration" BINDGEN_PROFILE="--release"
- - LLVM_VERSION="9.0" BINDGEN_JOB="test" BINDGEN_PROFILE= BINDGEN_NO_DEFAULT_FEATURES="1"
- - LLVM_VERSION="9.0" BINDGEN_JOB="test" BINDGEN_PROFILE="--release" BINDGEN_NO_DEFAULT_FEATURES="1"
-
- # FIXME: There are no pre-built static libclang libraries, so this is not testable at the moment.
- # - LLVM_VERSION="9.0" BINDGEN_JOB="test" BINDGEN_PROFILE= BINDGEN_FEATURES="static" BINDGEN_NO_DEFAULT_FEATURES="1"
- # - LLVM_VERSION="9.0" BINDGEN_JOB="test" BINDGEN_PROFILE="--release" BINDGEN_FEATURES="static" BINDGEN_NO_DEFAULT_FEATURES="1"
-
- # Testing with extra asserts enabled
- - LLVM_VERSION="9.0" BINDGEN_JOB="test" BINDGEN_PROFILE= BINDGEN_FEATURES="testing_only_extra_assertions"
- - LLVM_VERSION="9.0" BINDGEN_JOB="test" BINDGEN_PROFILE="--release" BINDGEN_FEATURES="testing_only_extra_assertions"
-
-
- # Test the expectations build and pass tests.
- - LLVM_VERSION="9.0" BINDGEN_JOB="expectations" BINDGEN_PROFILE=
- - LLVM_VERSION="9.0" BINDGEN_JOB="expectations" BINDGEN_PROFILE="--release"
-
-matrix:
- fast_finish: true
-
- # Include a few jobs for spot-checking different configurations without
- # invoking combinatoric explosion of Travis jobs.
- include:
- - os: osx
- env: LLVM_VERSION="9.0" BINDGEN_JOB="test" BINDGEN_PROFILE=
- - os: osx
- env: LLVM_VERSION="9.0" BINDGEN_JOB="test" BINDGEN_PROFILE="--release"
- - os: osx
- env: LLVM_VERSION="9.0" BINDGEN_JOB="integration" BINDGEN_PROFILE=
- - os: osx
- env: LLVM_VERSION="9.0" BINDGEN_JOB="integration" BINDGEN_PROFILE="--release"
-
-cache:
- directories:
- - $HOME/.cargo
- - $HOME/.llvm-builds
-
-before_install: . ./ci/before_install.sh
-
script:
- - BINDGEN_JOB="$BINDGEN_JOB" BINDGEN_PROFILE="$BINDGEN_PROFILE" BINDGEN_FEATURES="$BINDGEN_FEATURES" BINDGEN_NO_DEFAULT_FEATURES="$BINDGEN_NO_DEFAULT_FEATURES" ./ci/script.sh
-
+ - ./ci/test-book.sh
after_success:
- test "$TRAVIS_PULL_REQUEST" == "false" &&
test "$TRAVIS_BRANCH" == "master" &&
- test "$BINDGEN_JOB" == "misc" &&
./ci/deploy-book.sh
diff --git a/bindgen-integration/Cargo.toml b/bindgen-integration/Cargo.toml
index 2664b60a..650dedaf 100644
--- a/bindgen-integration/Cargo.toml
+++ b/bindgen-integration/Cargo.toml
@@ -14,6 +14,7 @@ cc = "1.0"
static = ["bindgen/static"]
runtime = ["bindgen/runtime"]
+testing_only_docs = ["bindgen/testing_only_docs"]
testing_only_extra_assertions = ["bindgen/testing_only_extra_assertions"]
testing_only_libclang_9 = ["bindgen/testing_only_libclang_9"]
testing_only_libclang_5 = ["bindgen/testing_only_libclang_5"]
diff --git a/ci/assert-docs.sh b/ci/assert-docs.sh
deleted file mode 100755
index 2bbc35af..00000000
--- a/ci/assert-docs.sh
+++ /dev/null
@@ -1,6 +0,0 @@
-#!/usr/bin/env bash
-
-set -xeu
-cd "$(dirname "$0")/.."
-
-cargo check --features "$BINDGEN_FEATURES testing_only_docs"
diff --git a/ci/assert-no-diff.sh b/ci/assert-no-diff.sh
deleted file mode 100755
index 14f2aa21..00000000
--- a/ci/assert-no-diff.sh
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/usr/bin/env bash
-
-set -xeu
-cd "$(dirname "$0")/.."
-
-git add -u
-git diff @
-git diff-index --quiet HEAD
diff --git a/ci/assert-rustfmt.sh b/ci/assert-rustfmt.sh
deleted file mode 100755
index 785530cb..00000000
--- a/ci/assert-rustfmt.sh
+++ /dev/null
@@ -1,13 +0,0 @@
-#!/usr/bin/env bash
-
-set -xeu
-cd "$(dirname "$0")/.."
-
-TOOLCHAIN="nightly-$(curl https://rust-lang.github.io/rustup-components-history/$(rustup target list --installed | tail -1)/rustfmt)"
-rustup update "$TOOLCHAIN"
-rustup component add rustfmt --toolchain "$TOOLCHAIN"
-
-# Run `rustfmt` on the crate! If `rustfmt` can't make a long line shorter, it
-# prints an error and exits non-zero, so tell it to kindly shut its yapper and
-# make sure it doesn't cause us to exit this whole script non-zero.
-rustup run "$TOOLCHAIN" cargo fmt -- --check
diff --git a/ci/assert-warnings.sh b/ci/assert-warnings.sh
deleted file mode 100755
index 62c12c42..00000000
--- a/ci/assert-warnings.sh
+++ /dev/null
@@ -1,6 +0,0 @@
-#!/usr/bin/env bash
-
-set -xeu
-cd "$(dirname "$0")/.."
-
-cargo rustc --lib --features "$BINDGEN_FEATURES" -- -Dwarnings
diff --git a/ci/before_install.sh b/ci/before_install.sh
deleted file mode 100644
index 2e66ae4e..00000000
--- a/ci/before_install.sh
+++ /dev/null
@@ -1,77 +0,0 @@
-#!/usr/bin/env bash
-# Bail on first error
-set -e
-# Bail if an unset variable is encountered
-set -u
-# Enable debugging output
-set -x
-# Give a pipeline a non-zero exit code if one of its constituents fails
-set -o pipefail
-
-function llvm_linux_target_triple() {
- echo "x86_64-linux-gnu-ubuntu-16.04"
-}
-
-function llvm_macos_target_triple() {
- case "$1" in
- [0-8].* | 9.0.0) echo "x86_64-darwin-apple" ;;
- # Starting with 9.0.1, triple swapped ordering
- *) echo "x86_64-apple-darwin" ;;
- esac
-}
-
-function llvm_version_triple() {
- case "$1" in
- 5.0) echo "5.0.1" ;;
- # By default, take the .0 patch release
- *) echo "$1.0" ;;
- esac
-}
-
-function llvm_base_url() {
- local llvm_version_triple=$1
-
- case "$llvm_version_triple" in
- [0-8].* | 9.0.0)
- echo "http://releases.llvm.org/$llvm_version_triple"
- ;;
- # Starting with 9.0.1, releases are hosted on github
- *)
- echo "https://github.com/llvm/llvm-project/releases/download/llvmorg-$llvm_version_triple"
- ;;
- esac
-}
-
-function llvm_download() {
- local base_url=$1
- local arch=$2
-
- export LLVM=clang+llvm-${LLVM_VERSION_TRIPLE}-$arch
- export LLVM_DIRECTORY="$HOME/.llvm/${LLVM}"
-
- if [ -d "${LLVM_DIRECTORY}" ]; then
- echo "Using cached LLVM download for ${LLVM}..."
- else
- wget $base_url/${LLVM}.tar.xz
- mkdir -p "${LLVM_DIRECTORY}"
- tar xf ${LLVM}.tar.xz -C "${LLVM_DIRECTORY}" --strip-components=1
- fi
-
- export LIBCLANG_PATH="${LLVM_DIRECTORY}/lib"
- export LLVM_CONFIG_PATH="${LLVM_DIRECTORY}/bin/llvm-config"
-}
-
-export LLVM_VERSION_TRIPLE=`llvm_version_triple ${LLVM_VERSION}`
-
-base_url=`llvm_base_url ${LLVM_VERSION_TRIPLE}`
-
-if [ "${TRAVIS_OS_NAME}" == "linux" ]; then
- llvm_download $base_url `llvm_linux_target_triple ${LLVM_VERSION_TRIPLE}`
- export LD_LIBRARY_PATH="${LLVM_DIRECTORY}/lib":${LD_LIBRARY_PATH:-}
-else
- llvm_download $base_url `llvm_macos_target_triple ${LLVM_VERSION_TRIPLE}`
- export DYLD_LIBRARY_PATH="${LLVM_DIRECTORY}/lib":${DYLD_LIBRARY_PATH:-}
-fi
-
-# Subsequent scripts can see the state of `set -eu`, so unset it again.
-set +eu
diff --git a/ci/script.sh b/ci/script.sh
deleted file mode 100755
index 16eddbf8..00000000
--- a/ci/script.sh
+++ /dev/null
@@ -1,65 +0,0 @@
-#!/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
-
-NO_DEFAULT_FEATURES=""
-if [ ! -z $BINDGEN_NO_DEFAULT_FEATURES ]; then
- NO_DEFAULT_FEATURES=--no-default-features
-fi
-
-case "$BINDGEN_JOB" in
- "test")
- # Need rustfmt to compare the test expectations.
- TOOLCHAIN="nightly-$(curl https://rust-lang.github.io/rustup-components-history/$(rustup target list --installed | tail -1)/rustfmt)"
- rustup update "$TOOLCHAIN"
- rustup component add rustfmt --toolchain "$TOOLCHAIN"
- RUSTFMT="$(rustup which --toolchain "$TOOLCHAIN" rustfmt)"
- export RUSTFMT
- cargo test "$BINDGEN_PROFILE" $NO_DEFAULT_FEATURES --features "$BINDGEN_FEATURES"
- ./ci/assert-no-diff.sh
- ;;
-
- "msrv")
- # Test that the bindgen library can be built with the minimum supported Rust version
- # This test should not use Cargo.lock as it's ignored for library builds
- rm Cargo.lock
- # The MSRV below is also documented in README.md, please keep in sync
- rustup install 1.40.0
- cargo +1.40.0 build --lib $NO_DEFAULT_FEATURES --features "$BINDGEN_FEATURES"
- ;;
-
- "integration")
- cd ./bindgen-integration
- cargo test "$BINDGEN_PROFILE" $NO_DEFAULT_FEATURES --features "$BINDGEN_FEATURES"
- ;;
-
- "expectations")
- cd ./tests/expectations
- cargo test "$BINDGEN_PROFILE"
- ;;
-
- "misc")
- ./ci/assert-docs.sh
- ./ci/assert-warnings.sh
- ./ci/test-book.sh
- ./ci/no-includes.sh
- ./ci/assert-rustfmt.sh
- ;;
-
- "quickchecking")
- cd ./tests/quickchecking
- # TODO: Actually run quickchecks once `bindgen` is reliable enough.
- cargo test
- ;;
-
- *)
- echo "Error! Unknown \$BINDGEN_JOB: '$BINDGEN_JOB'"
- exit 1
-esac
diff --git a/ci/test.sh b/ci/test.sh
new file mode 100755
index 00000000..d5bb0bf4
--- /dev/null
+++ b/ci/test.sh
@@ -0,0 +1,130 @@
+#!/usr/bin/env bash
+# Bail on first error
+set -e
+# Bail if an unset variable is encountered
+set -u
+# Enable debugging output
+set -x
+# Give a pipeline a non-zero exit code if one of its constituents fails
+set -o pipefail
+
+function llvm_linux_target_triple() {
+ echo "x86_64-linux-gnu-ubuntu-16.04"
+}
+
+function llvm_macos_target_triple() {
+ case "$1" in
+ [0-8].* | 9.0.0) echo "x86_64-darwin-apple" ;;
+ # Starting with 9.0.1, triple swapped ordering
+ *) echo "x86_64-apple-darwin" ;;
+ esac
+}
+
+function llvm_version_triple() {
+ case "$1" in
+ 5.0) echo "5.0.1" ;;
+ # By default, take the .0 patch release
+ *) echo "$1.0" ;;
+ esac
+}
+
+function llvm_base_url() {
+ local llvm_version_triple=$1
+
+ case "$llvm_version_triple" in
+ [0-8].* | 9.0.0)
+ echo "http://releases.llvm.org/$llvm_version_triple"
+ ;;
+ # Starting with 9.0.1, releases are hosted on github
+ *)
+ echo "https://github.com/llvm/llvm-project/releases/download/llvmorg-$llvm_version_triple"
+ ;;
+ esac
+}
+
+function llvm_download() {
+ local base_url=$1
+ local arch=$2
+
+ export LLVM=clang+llvm-${LLVM_VERSION_TRIPLE}-$arch
+ export LLVM_DIRECTORY="$HOME/.llvm/${LLVM}"
+
+ if [ -d "${LLVM_DIRECTORY}" ]; then
+ echo "Using cached LLVM download for ${LLVM}..."
+ else
+ wget --no-verbose $base_url/${LLVM}.tar.xz
+ mkdir -p "${LLVM_DIRECTORY}"
+ tar xf ${LLVM}.tar.xz -C "${LLVM_DIRECTORY}" --strip-components=1
+ fi
+
+ export LIBCLANG_PATH="${LLVM_DIRECTORY}/lib"
+ export LLVM_CONFIG_PATH="${LLVM_DIRECTORY}/bin/llvm-config"
+}
+
+# Download and set up a sane LLVM version
+set_llvm_env() {
+ export LLVM_VERSION_TRIPLE=`llvm_version_triple ${LLVM_VERSION}`
+ local base_url=`llvm_base_url ${LLVM_VERSION_TRIPLE}`
+
+ if [ "$GITHUB_ACTIONS_OS" == "ubuntu-latest" ]; then
+ llvm_download $base_url `llvm_linux_target_triple ${LLVM_VERSION_TRIPLE}`
+ export LD_LIBRARY_PATH="${LLVM_DIRECTORY}/lib":${LD_LIBRARY_PATH:-}
+ else
+ llvm_download $base_url `llvm_macos_target_triple ${LLVM_VERSION_TRIPLE}`
+ export DYLD_LIBRARY_PATH="${LLVM_DIRECTORY}/lib":${DYLD_LIBRARY_PATH:-}
+ fi
+}
+
+# Need rustfmt to compare the test expectations.
+set_rustfmt_env() {
+ local toolchain="nightly-$(curl https://rust-lang.github.io/rustup-components-history/$(rustup target list --installed | tail -1)/rustfmt)"
+ rustup update "$toolchain"
+ rustup component add rustfmt --toolchain "$toolchain"
+ export RUSTFMT="$(rustup which --toolchain "$toolchain" rustfmt)"
+}
+
+assert_no_diff() {
+ git add -u
+ git diff @
+ git diff-index --quiet HEAD
+}
+
+set_llvm_env
+set_rustfmt_env
+
+get_cargo_args() {
+ local args=""
+ if [ "$BINDGEN_RELEASE_BUILD" == "1" ]; then
+ args+=" --release"
+ fi
+ if [ "$BINDGEN_NO_DEFAULT_FEATURES" == "1" ]; then
+ args+=" --no-default-features"
+ fi
+ local features=""
+ if [ "$BINDGEN_FEATURE_RUNTIME" == "1" ]; then
+ features+="runtime"
+ fi
+ if [ "$BINDGEN_FEATURE_EXTRA_ASSERTS" == "1" ]; then
+ features+=" testing_only_extra_assertions"
+ fi
+ if [ "$BINDGEN_FEATURE_TESTING_ONLY_DOCS" == "1" ]; then
+ features+=" testing_only_docs"
+ fi
+ if [ ! -z "$features" ]; then
+ args+=" --features $(echo $features | tr ' ' ',')"
+ fi
+ echo $args
+}
+
+CARGO_ARGS=`get_cargo_args`
+
+# Ensure we build without warnings
+cargo rustc --lib $CARGO_ARGS -- -Dwarnings
+
+# Run the tests
+cargo test $CARGO_ARGS
+
+assert_no_diff
+
+# Run the integration tests
+(cd bindgen-integration && cargo test $CARGO_ARGS)
diff --git a/tests/quickchecking/.gitignore b/tests/quickchecking/.gitignore
new file mode 100644
index 00000000..03314f77
--- /dev/null
+++ b/tests/quickchecking/.gitignore
@@ -0,0 +1 @@
+Cargo.lock