Skip to content

Commit 25ce053

Browse files
committed
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 nix-rust#568
1 parent 2f780ef commit 25ce053

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

CONTRIBUTING.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,13 @@ locally. More information is available in the [CI Readme][ci-readme].
8585
[travis-ci]: https://travis-ci.org/nix-rust/nix
8686
[ci-readme]: ci/README.md
8787

88+
### Disabling a test in the CI environment
89+
90+
Sometimes there are features that cannot be tested in the CI environment.
91+
To stop a test from running under CI, add `#[cfg_attr(travis, ignore)]`
92+
to it. Please include a comment describing the reason it shouldn't run
93+
under CI, and a link to an upstream issue if possible!
94+
8895
## bors, the bot who merges all the PRs
8996

9097
All pull requests are merged via [bors], an integration bot. After the

ci/script.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@
33
set -ex
44

55
main() {
6+
# Add a cfg spec to allow disabling specific tests under CI.
7+
if [ "$TRAVIS" = true ]; then
8+
export RUSTFLAGS=--cfg=travis
9+
fi
10+
611
# Build debug and release targets
712
cross build --target $TARGET
813
cross build --target $TARGET --release

0 commit comments

Comments
 (0)