]> git.lizzy.rs Git - rust.git/blob - ci/base-tests.sh
Add setup-toolchain.sh script to configure the master version of rustc,
[rust.git] / ci / base-tests.sh
1 set -ex
2
3 echo "Running clippy base tests"
4
5 PATH=$PATH:./node_modules/.bin
6 if [ "$TRAVIS_OS_NAME" == "linux" ]; then
7   remark -f *.md > /dev/null
8 fi
9 # build clippy in debug mode and run tests
10 cargo build --features debugging
11 cargo test --features debugging
12 # for faster build, share target dir between subcrates
13 export CARGO_TARGET_DIR=`pwd`/target/
14 cd clippy_lints && cargo test && cd ..
15 cd rustc_tools_util && cargo test && cd ..
16 cd clippy_dev && cargo test && cd ..
17
18 # make sure clippy can be called via ./path/to/cargo-clippy
19 cd clippy_workspace_tests
20 ../target/debug/cargo-clippy
21 cd ..
22
23 # Perform various checks for lint registration
24 ./util/dev update_lints --check
25 cargo +nightly fmt --all -- --check
26
27 # make sure tests are formatted
28
29 # some lints are sensitive to formatting, exclude some files
30 tests_need_reformatting="false"
31 # switch to nightly
32 rustup override set nightly
33 # avoid loop spam and allow cmds with exit status != 0
34 set +ex
35
36 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
37   rustfmt ${file} --check
38   if [ $? -ne 0 ]; then
39     echo "${file} needs reformatting!"
40     tests_need_reformatting="true"
41   fi
42 done
43
44 set -ex # reset
45
46 if [ "${tests_need_reformatting}" == "true" ] ; then
47     echo "Tests need reformatting!"
48     exit 2
49 fi
50
51 # switch back to master
52 rustup override set master