]> git.lizzy.rs Git - rust.git/blob - ci/base-tests.sh
Merge branch 'master' into rustfmt_tests
[rust.git] / ci / base-tests.sh
1 # Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT
2 # file at the top-level directory of this distribution and at
3 # http://rust-lang.org/COPYRIGHT.
4 #
5 # Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 # http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 # <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 # option. This file may not be copied, modified, or distributed
9 # except according to those terms.
10
11
12 set -ex
13
14 echo "Running clippy base tests"
15
16 PATH=$PATH:./node_modules/.bin
17 if [ "$TRAVIS_OS_NAME" == "linux" ]; then
18   remark -f *.md > /dev/null
19 fi
20 # build clippy in debug mode and run tests
21 cargo build --features debugging
22 cargo test --features debugging
23 # for faster build, share target dir between subcrates
24 export CARGO_TARGET_DIR=`pwd`/target/
25 cd clippy_lints && cargo test && cd ..
26 cd rustc_tools_util && cargo test && cd ..
27 cd clippy_dev && cargo test && cd ..
28
29 # Perform various checks for lint registration
30 ./util/dev update_lints --check
31 cargo +nightly fmt --all -- --check
32
33
34 #avoid loop spam
35 set +ex
36 # make sure tests are formatted
37
38 # some lints are sensitive to formatting, exclude some files
39 needs_formatting=false
40 for file in `find tests -not -path "tests/ui/methods.rs" -not -path "tests/ui/format.rs" -not -path "tests/ui/formatting.rs" -not -path "tests/ui/empty_line_after_outer_attribute.rs" -not -path "tests/ui/double_parens.rs" -not -path "tests/ui/doc.rs" -not -path "tests/ui/unused_unit.rs" | grep "\.rs$"` ; do
41 rustfmt ${file} --check  || echo "${file} needs reformatting!" ; needs_formatting=true
42 done
43
44 if [ "${needs_reformatting}" = true] ; then
45     echo "Tests need reformatting!"
46     exit 2
47 fi
48
49 set -ex