From 25ce053a2d42a94bcc2c27883eb81c2fe45e5a69 Mon Sep 17 00:00:00 2001 From: Kamal Marhubi Date: Sun, 16 Apr 2017 23:51:18 -0400 Subject: [PATCH] ci: Allow skipping tests when running under CI This adds `--cfg=travis` to builds under CI, allowing tests to be conditionally ignored by marking them with #[cfg_attr(travis, ignore)] refs #568 --- CONTRIBUTING.md | 7 +++++++ ci/script.sh | 5 +++++ 2 files changed, 12 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 8d8b8dedb4..03a1f630db 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -85,6 +85,13 @@ locally. More information is available in the [CI Readme][ci-readme]. [travis-ci]: https://travis-ci.org/nix-rust/nix [ci-readme]: ci/README.md +### Disabling a test in the CI environment + +Sometimes there are features that cannot be tested in the CI environment. +To stop a test from running under CI, add `#[cfg_attr(travis, ignore)]` +to it. Please include a comment describing the reason it shouldn't run +under CI, and a link to an upstream issue if possible! + ## bors, the bot who merges all the PRs All pull requests are merged via [bors], an integration bot. After the diff --git a/ci/script.sh b/ci/script.sh index 39c3aeec73..df61c35a6c 100644 --- a/ci/script.sh +++ b/ci/script.sh @@ -3,6 +3,11 @@ set -ex main() { + # Add a cfg spec to allow disabling specific tests under CI. + if [ "$TRAVIS" = true ]; then + export RUSTFLAGS=--cfg=travis + fi + # Build debug and release targets cross build --target $TARGET cross build --target $TARGET --release