From e0214397bdf0d48b7dcd520cd075d3a22092d823 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Kr=C3=BCger?= Date: Fri, 27 Jul 2018 15:36:13 +0200 Subject: [PATCH 1/2] travis: run tests of external projects with --all-targets --all-features -- --cap-lints warn --- ci/base-tests.sh | 2 +- ci/integration-tests.sh | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ci/base-tests.sh b/ci/base-tests.sh index 4b304f6f2a6..69cd5abd925 100755 --- a/ci/base-tests.sh +++ b/ci/base-tests.sh @@ -7,7 +7,7 @@ mkdir -p ~/rust/cargo/bin cp target/debug/cargo-clippy ~/rust/cargo/bin/cargo-clippy cp target/debug/clippy-driver ~/rust/cargo/bin/clippy-driver rm ~/.cargo/bin/cargo-clippy -PATH=$PATH:~/rust/cargo/bin cargo clippy --all -- -D clippy +PATH=$PATH:~/rust/cargo/bin cargo clippy --all-targets --all-features -- --cap-lints warn -D clippy cd clippy_workspace_tests && PATH=$PATH:~/rust/cargo/bin cargo clippy -- -D clippy && cd .. cd clippy_workspace_tests/src && PATH=$PATH:~/rust/cargo/bin cargo clippy -- -D clippy && cd ../.. cd clippy_workspace_tests/subcrate && PATH=$PATH:~/rust/cargo/bin cargo clippy -- -D clippy && cd ../.. diff --git a/ci/integration-tests.sh b/ci/integration-tests.sh index a989b261ac7..67ace0b5c88 100755 --- a/ci/integration-tests.sh +++ b/ci/integration-tests.sh @@ -8,9 +8,9 @@ git clone --depth=1 https://github.com/${INTEGRATION}.git checkout cd checkout function check() { - RUST_BACKTRACE=full cargo clippy --all &> clippy_output + RUST_BACKTRACE=full cargo clippy --all-targets --all-features -- --cap-lints warn &> clippy_output cat clippy_output - ! cat clippy_output | grep -q "internal compiler error" + ! cat clippy_output | grep -q "internal compiler error\|query stack during panic" if [[ $? != 0 ]]; then return 1 fi From a2343bfe7f2bcf1eba034a3a151a7a3a23c4ccc8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Kr=C3=BCger?= Date: Sat, 28 Jul 2018 12:14:35 +0200 Subject: [PATCH 2/2] integration tests: add more clippy warnings for greater coverage integration/base tests: add a few code comments --- ci/base-tests.sh | 9 ++++++++- ci/integration-tests.sh | 3 ++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/ci/base-tests.sh b/ci/base-tests.sh index 69cd5abd925..13b652c0f7d 100755 --- a/ci/base-tests.sh +++ b/ci/base-tests.sh @@ -1,17 +1,24 @@ set -ex + +echo "Running clippy base tests" + PATH=$PATH:./node_modules/.bin remark -f *.md > /dev/null +# build clippy in debug mode and run tests cargo build --features debugging cargo test --features debugging mkdir -p ~/rust/cargo/bin cp target/debug/cargo-clippy ~/rust/cargo/bin/cargo-clippy cp target/debug/clippy-driver ~/rust/cargo/bin/clippy-driver rm ~/.cargo/bin/cargo-clippy -PATH=$PATH:~/rust/cargo/bin cargo clippy --all-targets --all-features -- --cap-lints warn -D clippy +# run clippy on its own codebase... +PATH=$PATH:~/rust/cargo/bin cargo clippy --all-targets --all-features -- -D clippy +# ... and some test directories cd clippy_workspace_tests && PATH=$PATH:~/rust/cargo/bin cargo clippy -- -D clippy && cd .. cd clippy_workspace_tests/src && PATH=$PATH:~/rust/cargo/bin cargo clippy -- -D clippy && cd ../.. cd clippy_workspace_tests/subcrate && PATH=$PATH:~/rust/cargo/bin cargo clippy -- -D clippy && cd ../.. cd clippy_workspace_tests/subcrate/src && PATH=$PATH:~/rust/cargo/bin cargo clippy -- -D clippy && cd ../../.. +# test --manifest-path PATH=$PATH:~/rust/cargo/bin cargo clippy --manifest-path=clippy_workspace_tests/Cargo.toml -- -D clippy cd clippy_workspace_tests/subcrate && PATH=$PATH:~/rust/cargo/bin cargo clippy --manifest-path=../Cargo.toml -- -D clippy && cd ../.. set +x diff --git a/ci/integration-tests.sh b/ci/integration-tests.sh index 67ace0b5c88..ac0d2f1614b 100755 --- a/ci/integration-tests.sh +++ b/ci/integration-tests.sh @@ -8,7 +8,8 @@ git clone --depth=1 https://github.com/${INTEGRATION}.git checkout cd checkout function check() { - RUST_BACKTRACE=full cargo clippy --all-targets --all-features -- --cap-lints warn &> clippy_output +# run clippy on a project, try to be verbose and trigger as many warnings as possible for greater coverage + RUST_BACKTRACE=full cargo clippy --all-targets --all-features -- --cap-lints warn -W clippy_pedantic -W clippy_nursery &> clippy_output cat clippy_output ! cat clippy_output | grep -q "internal compiler error\|query stack during panic" if [[ $? != 0 ]]; then