2019-10-21 10:09:53 +02:00
|
|
|
#!/usr/bin/env bash
|
2018-05-16 18:55:21 +02:00
|
|
|
set -ex
|
2018-07-28 12:14:35 +02:00
|
|
|
|
2019-10-18 06:10:15 +02:00
|
|
|
# for faster build, share target dir between subcrates
|
|
|
|
CARGO_TARGET_DIR=$(pwd)/target/
|
|
|
|
export CARGO_TARGET_DIR
|
|
|
|
|
2018-07-28 12:14:35 +02:00
|
|
|
echo "Running clippy base tests"
|
|
|
|
|
2018-05-16 09:10:35 +02:00
|
|
|
PATH=$PATH:./node_modules/.bin
|
2019-10-21 10:09:53 +02:00
|
|
|
if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
|
|
|
|
remark -f ./*.md -f doc/*.md > /dev/null
|
2018-10-12 07:59:08 +02:00
|
|
|
fi
|
2018-07-28 12:14:35 +02:00
|
|
|
# build clippy in debug mode and run tests
|
2019-07-15 07:35:02 +02:00
|
|
|
cargo build --features "debugging deny-warnings"
|
|
|
|
cargo test --features "debugging deny-warnings"
|
2019-10-18 06:10:15 +02:00
|
|
|
|
2019-01-27 02:49:29 +01:00
|
|
|
(cd clippy_lints && cargo test)
|
|
|
|
(cd rustc_tools_util && cargo test)
|
|
|
|
(cd clippy_dev && cargo test)
|
2018-11-04 09:41:28 +01:00
|
|
|
|
2018-12-14 21:43:40 +01:00
|
|
|
# make sure clippy can be called via ./path/to/cargo-clippy
|
2019-01-27 02:49:29 +01:00
|
|
|
(
|
|
|
|
cd clippy_workspace_tests
|
|
|
|
../target/debug/cargo-clippy
|
|
|
|
)
|
2018-12-14 21:43:40 +01:00
|
|
|
|
2018-11-04 09:41:28 +01:00
|
|
|
# Perform various checks for lint registration
|
|
|
|
./util/dev update_lints --check
|
2019-05-16 07:31:56 +02:00
|
|
|
./util/dev --limit-stderr-length
|
2018-12-09 22:06:29 +01:00
|
|
|
|
2019-01-27 03:24:45 +01:00
|
|
|
# Check running clippy-driver without cargo
|
|
|
|
(
|
|
|
|
# Check sysroot handling
|
|
|
|
sysroot=$(./target/debug/clippy-driver --print sysroot)
|
2019-10-21 10:09:53 +02:00
|
|
|
test "$sysroot" = "$(rustc --print sysroot)"
|
2019-01-27 03:24:45 +01:00
|
|
|
|
2019-10-21 10:09:53 +02:00
|
|
|
if [[ -z "$OS_WINDOWS" ]]; then
|
2019-07-13 11:42:44 +02:00
|
|
|
desired_sysroot=/tmp
|
|
|
|
else
|
|
|
|
desired_sysroot=C:/tmp
|
|
|
|
fi
|
|
|
|
sysroot=$(./target/debug/clippy-driver --sysroot $desired_sysroot --print sysroot)
|
2019-10-21 10:09:53 +02:00
|
|
|
test "$sysroot" = $desired_sysroot
|
2019-07-13 11:42:44 +02:00
|
|
|
|
|
|
|
sysroot=$(SYSROOT=$desired_sysroot ./target/debug/clippy-driver --print sysroot)
|
2019-10-21 10:09:53 +02:00
|
|
|
test "$sysroot" = $desired_sysroot
|
2019-01-27 03:24:45 +01:00
|
|
|
|
|
|
|
# Make sure this isn't set - clippy-driver should cope without it
|
|
|
|
unset CARGO_MANIFEST_DIR
|
|
|
|
|
|
|
|
# Run a lint and make sure it produces the expected output. It's also expected to exit with code 1
|
2019-10-21 10:09:53 +02:00
|
|
|
# FIXME: How to match the clippy invocation in compile-test.rs?
|
2019-10-22 05:19:12 +02:00
|
|
|
./target/debug/clippy-driver -Dwarnings -Aunused -Zui-testing --emit metadata --crate-type bin tests/ui/cstring.rs 2> cstring.stderr && exit 1
|
2019-10-21 10:09:53 +02:00
|
|
|
sed -e 's,tests/ui,$DIR,' -e '/= help/d' cstring.stderr > normalized.stderr
|
|
|
|
diff normalized.stderr tests/ui/cstring.stderr
|
2019-01-27 03:24:45 +01:00
|
|
|
|
|
|
|
# TODO: CLIPPY_CONF_DIR / CARGO_MANIFEST_DIR
|
|
|
|
)
|