Skip to content

test cargo fmt --all -- --check returns success after formatting #2788

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jun 18, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,18 @@ matrix:
- env: INTEGRATION=rand
- env: INTEGRATION=rust-clippy
- env: INTEGRATION=rust-semverver
- env: INTEGRATION=stdsimd
- env: INTEGRATION=tempdir
allow_failures:
# Need to run an lalrpop build step before testing?
# See: https://github.com/rust-lang-nursery/rustfmt/issues/2789
- env: INTEGRATION=chalk
# PR sent
- env: INTEGRATION=crater
# #2721
- env: INTEGRATION=rand
# Doesn't build
- env: INTEGRATION=rust-clippy
# Doesn't build
- env: INTEGRATION=rust-semverver
# See: https://github.com/rust-lang-nursery/rustfmt/issues/2787
- env: INTEGRATION=stdsimd

before_script:
- |
Expand Down
14 changes: 12 additions & 2 deletions ci/integration.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,15 @@ cargo install --force
echo "Integration tests for: ${INTEGRATION}"
cargo fmt -- --version

# Checks that:
#
# * `cargo fmt --all` succeeds without any warnings or errors
# * `cargo fmt --all -- --check` after formatting returns success
# * `cargo test -all` still passes (formatting did not break the build)
function check_fmt {
touch rustfmt.toml
cargo fmt --all -v 2>&1 | tee rustfmt_output
if [[ $? != 0 ]]; then
cargo fmt --all -v |& tee rustfmt_output
if [[ ${PIPESTATUS[0]} != 0 ]]; then
cat rustfmt_output
return 1
fi
Expand All @@ -40,6 +45,11 @@ function check_fmt {
if [[ $? != 0 ]]; then
return 1
fi
cargo fmt --all -- --check |& tee rustfmt_check_output
if [[ ${PIPESTATUS[0]} != 0 ]]; then
cat rustfmt_check_output
return 1
fi
cargo test --all
if [[ $? != 0 ]]; then
return $?
Expand Down