]> git.lizzy.rs Git - rust.git/blob - ci/base-tests.sh
Auto merge of #3589 - flip1995:contrib_inactive_prs, r=phansch
[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 # make sure clippy can be called via ./path/to/cargo-clippy
30 cd clippy_workspace_tests
31 ../target/debug/cargo-clippy
32 cd ..
33
34 # Perform various checks for lint registration
35 ./util/dev update_lints --check
36 cargo +nightly fmt --all -- --check
37
38 # make sure tests are formatted
39
40 # some lints are sensitive to formatting, exclude some files
41 tests_need_reformatting="false"
42 # switch to nightly
43 rustup default nightly
44 # avoid loop spam and allow cmds with exit status != 0
45 set +ex
46
47 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
48   rustfmt ${file} --check
49   if [ $? -ne 0 ]; then
50     echo "${file} needs reformatting!"
51     tests_need_reformatting="true"
52   fi
53 done
54
55 set -ex # reset
56
57 if [ "${tests_need_reformatting}" == "true" ] ; then
58     echo "Tests need reformatting!"
59     exit 2
60 fi
61
62 # switch back to master
63 rustup default master