3 echo "Running clippy base tests"
5 PATH=$PATH:./node_modules/.bin
6 if [ "$TRAVIS_OS_NAME" == "linux" ]; then
7 remark -f *.md > /dev/null
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)
15 (cd rustc_tools_util && cargo test)
16 (cd clippy_dev && cargo test)
18 # make sure clippy can be called via ./path/to/cargo-clippy
20 cd clippy_workspace_tests
21 ../target/debug/cargo-clippy
24 # Perform various checks for lint registration
25 ./util/dev update_lints --check
26 cargo +nightly fmt --all -- --check
28 # Check running clippy-driver without cargo
30 export LD_LIBRARY_PATH=$(rustc --print sysroot)/lib
32 # Check sysroot handling
33 sysroot=$(./target/debug/clippy-driver --print sysroot)
34 test $sysroot = $(rustc --print sysroot)
36 sysroot=$(./target/debug/clippy-driver --sysroot /tmp --print sysroot)
39 sysroot=$(SYSROOT=/tmp ./target/debug/clippy-driver --print sysroot)
42 # Make sure this isn't set - clippy-driver should cope without it
43 unset CARGO_MANIFEST_DIR
45 # Run a lint and make sure it produces the expected output. It's also expected to exit with code 1
46 # XXX How to match the clippy invocation in compile-test.rs?
47 ! ./target/debug/clippy-driver -Dwarnings -Aunused -Zui-testing --emit metadata --crate-type bin tests/ui/cstring.rs 2> cstring.stderr
48 diff <(sed -e 's,tests/ui,$DIR,' -e '/= help/d' cstring.stderr) tests/ui/cstring.stderr
50 # TODO: CLIPPY_CONF_DIR / CARGO_MANIFEST_DIR
53 # make sure tests are formatted
55 # some lints are sensitive to formatting, exclude some files
56 tests_need_reformatting="false"
58 rustup override set nightly
59 # avoid loop spam and allow cmds with exit status != 0
62 for file in `find tests -not -path "tests/ui/doc.rs" -not -path "tests/ui/unused_unit.rs" | grep "\.rs$"` ; do
63 rustfmt ${file} --check
65 echo "${file} needs reformatting!"
66 tests_need_reformatting="true"
72 if [ "${tests_need_reformatting}" == "true" ] ; then
73 echo "Tests need reformatting!"
77 # switch back to master
78 rustup override set master