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 if [[ $? != 0 ]]; then
34 cargo fmt --all -v |& tee rustfmt_output
35 if [[ ${PIPESTATUS[0]} != 0 ]]; then
40 ! cat rustfmt_output | grep -q "internal error"
41 if [[ $? != 0 ]]; then
44 ! cat rustfmt_output | grep -q "warning"
45 if [[ $? != 0 ]]; then
48 ! cat rustfmt_output | grep -q "Warning"
49 if [[ $? != 0 ]]; then
52 cargo fmt --all -- --check |& tee rustfmt_check_output
53 if [[ ${PIPESTATUS[0]} != 0 ]]; then
54 cat rustfmt_check_output
58 if [[ $? != 0 ]]; then
63 case ${INTEGRATION} in
65 git clone --depth=1 https://github.com/rust-lang/${INTEGRATION}.git
67 export CFG_DISABLE_CROSS_TESTS=1
72 git clone --depth=1 https://github.com/rust-lang-nursery/${INTEGRATION}.git