2019-10-21 08:09:53 +00:00
|
|
|
#!/usr/bin/env bash
|
2018-05-16 16:55:21 +00:00
|
|
|
set -ex
|
2018-07-28 10:14:35 +00:00
|
|
|
|
|
|
|
echo "Running clippy base tests"
|
|
|
|
|
2018-05-16 07:10:35 +00:00
|
|
|
PATH=$PATH:./node_modules/.bin
|
2019-10-21 08:09:53 +00:00
|
|
|
if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
|
|
|
|
remark -f ./*.md -f doc/*.md > /dev/null
|
2018-10-12 05:59:08 +00:00
|
|
|
fi
|
2018-07-28 10:14:35 +00:00
|
|
|
# build clippy in debug mode and run tests
|
2019-11-25 16:23:07 +00:00
|
|
|
cargo build --features deny-warnings
|
|
|
|
cargo test --features deny-warnings
|
2019-10-18 04:10:15 +00:00
|
|
|
|
2019-11-25 16:23:48 +00:00
|
|
|
(cd clippy_lints && cargo test --features deny-warnings)
|
|
|
|
(cd rustc_tools_util && cargo test --features deny-warnings)
|
|
|
|
(cd clippy_dev && cargo test --features deny-warnings)
|
2018-11-04 08:41:28 +00:00
|
|
|
|
2018-12-14 20:43:40 +00:00
|
|
|
# make sure clippy can be called via ./path/to/cargo-clippy
|
2019-01-27 01:49:29 +00:00
|
|
|
(
|
|
|
|
cd clippy_workspace_tests
|
|
|
|
../target/debug/cargo-clippy
|
|
|
|
)
|
2018-12-14 20:43:40 +00:00
|
|
|
|
2018-11-04 08:41:28 +00:00
|
|
|
# Perform various checks for lint registration
|
|
|
|
./util/dev update_lints --check
|
2019-05-16 05:31:56 +00:00
|
|
|
./util/dev --limit-stderr-length
|
2018-12-09 21:06:29 +00:00
|
|
|
|
2019-01-27 02:24:45 +00:00
|
|
|
# Check running clippy-driver without cargo
|
|
|
|
(
|
|
|
|
# Check sysroot handling
|
|
|
|
sysroot=$(./target/debug/clippy-driver --print sysroot)
|
2019-10-21 08:09:53 +00:00
|
|
|
test "$sysroot" = "$(rustc --print sysroot)"
|
2019-01-27 02:24:45 +00:00
|
|
|
|
2019-10-21 08:09:53 +00:00
|
|
|
if [[ -z "$OS_WINDOWS" ]]; then
|
2019-07-13 09:42:44 +00:00
|
|
|
desired_sysroot=/tmp
|
|
|
|
else
|
|
|
|
desired_sysroot=C:/tmp
|
|
|
|
fi
|
|
|
|
sysroot=$(./target/debug/clippy-driver --sysroot $desired_sysroot --print sysroot)
|
2019-10-21 08:09:53 +00:00
|
|
|
test "$sysroot" = $desired_sysroot
|
2019-07-13 09:42:44 +00:00
|
|
|
|
|
|
|
sysroot=$(SYSROOT=$desired_sysroot ./target/debug/clippy-driver --print sysroot)
|
2019-10-21 08:09:53 +00:00
|
|
|
test "$sysroot" = $desired_sysroot
|
2019-01-27 02:24:45 +00: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 08:09:53 +00:00
|
|
|
# FIXME: How to match the clippy invocation in compile-test.rs?
|
2019-10-22 03:19:12 +00: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 08:09:53 +00:00
|
|
|
sed -e 's,tests/ui,$DIR,' -e '/= help/d' cstring.stderr > normalized.stderr
|
|
|
|
diff normalized.stderr tests/ui/cstring.stderr
|
2019-01-27 02:24:45 +00:00
|
|
|
|
|
|
|
# TODO: CLIPPY_CONF_DIR / CARGO_MANIFEST_DIR
|
|
|
|
)
|