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