]> git.lizzy.rs Git - rust.git/blob - ci/integration.sh
try harder to print output
[rust.git] / ci / integration.sh
1 #!/usr/bin/env bash
2
3 set -ex
4
5 : ${INTEGRATION?"The INTEGRATION environment variable must be set."}
6
7 # FIXME: this is causing the build to fail when rustfmt is found in .cargo/bin
8 # but cargo-fmt is not found.
9 #
10 # `which rustfmt` fails if rustfmt is not found. Since we don't install
11 # `rustfmt` via `rustup`, this is the case unless we manually install it. Once
12 # that happens, `cargo install --force` will be called, which installs
13 # `rustfmt`, `cargo-fmt`, etc to `~/.cargo/bin`. This directory is cached by
14 # travis (see `.travis.yml`'s "cache" key), such that build-bots that arrive
15 # here after the first installation will find `rustfmt` and won't need to build
16 # it again.
17 #
18 # which rustfmt || cargo install --force
19 cargo install --force
20
21 echo "Integration tests for: ${INTEGRATION}"
22
23 function check_fmt {
24     cargo fmt --all -v 2>&1 | tee rustfmt_output
25     if [[ $? != 0 ]]; then
26         cat rustfmt_output
27         return 1
28     fi
29     cat rustfmt_output
30     ! cat rustfmt_output | grep -q "internal error"
31     if [[ $? != 0 ]]; then
32         return 1
33     fi
34     ! cat rustfmt_output | grep -q "warning"
35     if [[ $? != 0 ]]; then
36         return 1
37     fi
38     ! cat rustfmt_output | grep -q "Warning"
39     if [[ $? != 0 ]]; then
40         return 1
41     fi
42     cargo test --all
43     if [[ $? != 0 ]]; then
44         return $?
45     fi
46 }
47
48 function check {
49     cargo test --all
50     if [[ $? != 0 ]]; then
51         return 1
52     fi
53     check_fmt
54     if [[ $? != 0 ]]; then
55         return 1
56     fi
57 }
58
59 case ${INTEGRATION} in
60     cargo)
61         git clone --depth=1 https://github.com/rust-lang/${INTEGRATION}.git
62         cd ${INTEGRATION}
63         export CFG_DISABLE_CROSS_TESTS=1
64         check
65         cd -
66         ;;
67     failure)
68         git clone --depth=1 https://github.com/rust-lang-nursery/${INTEGRATION}.git
69         cd ${INTEGRATION}/failure-1.X
70         check
71         cd -
72         ;;
73     *)
74         git clone --depth=1 https://github.com/rust-lang-nursery/${INTEGRATION}.git
75         cd ${INTEGRATION}
76         check
77         cd -
78         ;;
79 esac