5 : ${INTEGRATION?"The INTEGRATION environment variable must be set."}
7 # FIXME: this means we can get a stale cargo-fmt from a previous run.
9 # `which rustfmt` fails if rustfmt is not found. Since we don't install
10 # `rustfmt` via `rustup`, this is the case unless we manually install it. Once
11 # that happens, `cargo install --force` will be called, which installs
12 # `rustfmt`, `cargo-fmt`, etc to `~/.cargo/bin`. This directory is cached by
13 # travis (see `.travis.yml`'s "cache" key), such that build-bots that arrive
14 # here after the first installation will find `rustfmt` and won't need to build
17 #which cargo-fmt || cargo install --force
20 echo "Integration tests for: ${INTEGRATION}"
21 cargo fmt -- --version
25 # * `cargo fmt --all` succeeds without any warnings or errors
26 # * `cargo fmt --all -- --check` after formatting returns success
27 # * `cargo test -all` still passes (formatting did not break the build)
30 cargo fmt --all -v |& tee rustfmt_output
31 if [[ ${PIPESTATUS[0]} != 0 ]]; then
36 ! cat rustfmt_output | grep -q "internal error"
37 if [[ $? != 0 ]]; then
40 ! cat rustfmt_output | grep -q "warning"
41 if [[ $? != 0 ]]; then
44 ! cat rustfmt_output | grep -q "Warning"
45 if [[ $? != 0 ]]; then
48 cargo fmt --all -- --check |& tee rustfmt_check_output
49 if [[ ${PIPESTATUS[0]} != 0 ]]; then
50 cat rustfmt_check_output
54 if [[ $? != 0 ]]; then
59 case ${INTEGRATION} in
61 git clone --depth=1 https://github.com/rust-lang/${INTEGRATION}.git
63 export CFG_DISABLE_CROSS_TESTS=1
68 git clone --depth=1 https://github.com/rust-lang-nursery/${INTEGRATION}.git
70 # Need to run build.rs once.
71 # See: https://github.com/rust-lang-nursery/rustfmt/issues/2789
77 git clone --depth=1 https://github.com/rust-lang-nursery/${INTEGRATION}.git
78 cd ${INTEGRATION}/failure-1.X
83 git clone --depth=1 https://github.com/rust-lang-nursery/${INTEGRATION}.git