From cc9122777ba2e6904b0c2bfdae90e2a70673b4f7 Mon Sep 17 00:00:00 2001 From: Philipp Hansch Date: Wed, 16 May 2018 09:10:35 +0200 Subject: [PATCH 1/6] Add integration tests --- .travis.yml | 30 ++++++++++++++---------------- ci/base-tests.sh | 15 +++++++++++++++ ci/integration-tests.sh | 24 ++++++++++++++++++++++++ 3 files changed, 53 insertions(+), 16 deletions(-) create mode 100644 ci/base-tests.sh create mode 100755 ci/integration-tests.sh diff --git a/.travis.yml b/.travis.yml index 077a17e0bace..77dc8fc4b192 100644 --- a/.travis.yml +++ b/.travis.yml @@ -29,23 +29,21 @@ install: - nvm use stable - npm install remark-cli remark-lint +matrix: + include: + - env: INTEGRATION=rust-lang/cargo + - env: INTEGRATION=rust-lang-nursery/rand + allow_failures: + - env: INTEGRATION=rust-lang/cargo + - env: INTEGRATION=rust-lang-nursery/rand + script: - - PATH=$PATH:./node_modules/.bin - - remark -f *.md > /dev/null - - set -e - - 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 - - PATH=$PATH:~/rust/cargo/bin cargo clippy --all -- -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 ../.. - - cd clippy_workspace_tests/subcrate/src && PATH=$PATH:~/rust/cargo/bin cargo clippy -- -D clippy && cd ../../.. - - 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 +e + - | + if [ -z ${INTEGRATION} ]; then + ./ci/base-tests.sh + else + ./ci/integration-tests.sh + fi after_success: | #!/bin/bash diff --git a/ci/base-tests.sh b/ci/base-tests.sh new file mode 100644 index 000000000000..fc01ce05b3b6 --- /dev/null +++ b/ci/base-tests.sh @@ -0,0 +1,15 @@ +PATH=$PATH:./node_modules/.bin +remark -f *.md > /dev/null +set -e +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 +PATH=$PATH:~/rust/cargo/bin cargo clippy --all -- -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 ../.. +cd clippy_workspace_tests/subcrate/src && PATH=$PATH:~/rust/cargo/bin cargo clippy -- -D clippy && cd ../../.. +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 ../.. diff --git a/ci/integration-tests.sh b/ci/integration-tests.sh new file mode 100755 index 000000000000..c6c2a4a4d586 --- /dev/null +++ b/ci/integration-tests.sh @@ -0,0 +1,24 @@ +cargo install --force + +echo "Running integration test for crate ${INTEGRATION}" + +git clone https://github.com/${INTEGRATION}.git + +function check() { + cargo clippy --all &> clippy_output + cat clippy_output + ! cat clippy_output | grep -q "internal error" + if [[ $? != 0 ]]; then + return 1 + fi +} + +case ${INTEGRATION} in + rust-lang/cargo) + check + ;; + *) + cd ${INTEGRATION} + check + ;; +esac From 4abd4a12b77952061c59c900ba40ddeec0915dbe Mon Sep 17 00:00:00 2001 From: Philipp Hansch Date: Wed, 16 May 2018 09:17:55 +0200 Subject: [PATCH 2/6] Make sure base tests are executed, too :hammer: --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 77dc8fc4b192..60f1b6961c73 100644 --- a/.travis.yml +++ b/.travis.yml @@ -31,6 +31,7 @@ install: matrix: include: + - env: BASE_TESTS=true # runs the base tests - env: INTEGRATION=rust-lang/cargo - env: INTEGRATION=rust-lang-nursery/rand allow_failures: From 9e6dc8d2d51907f3ddf26b01257830e3c3ccec64 Mon Sep 17 00:00:00 2001 From: Philipp Hansch Date: Wed, 16 May 2018 18:55:21 +0200 Subject: [PATCH 3/6] Add exec bit, add set -ex to ci test files --- .github/deploy.sh | 3 +-- .travis.yml | 2 +- ci/base-tests.sh | 1 + ci/integration-tests.sh | 1 + 4 files changed, 4 insertions(+), 3 deletions(-) mode change 100644 => 100755 ci/base-tests.sh diff --git a/.github/deploy.sh b/.github/deploy.sh index aa76f8f4e410..1d206e61167e 100755 --- a/.github/deploy.sh +++ b/.github/deploy.sh @@ -1,8 +1,7 @@ #!/bin/bash # Automatically deploy on gh-pages -set -e -set -x +set -ex SOURCE_BRANCH="master" TARGET_BRANCH="gh-pages" diff --git a/.travis.yml b/.travis.yml index 60f1b6961c73..22dc2f572ae0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -49,7 +49,7 @@ script: after_success: | #!/bin/bash if [ $(uname) == Linux ]; then - set -e + set -ex ./.github/deploy.sh # trigger rebuild of the clippy-service, to keep it up to date with clippy itself if [ "$TRAVIS_PULL_REQUEST" == "false" ] && diff --git a/ci/base-tests.sh b/ci/base-tests.sh old mode 100644 new mode 100755 index fc01ce05b3b6..e72bd155cec0 --- a/ci/base-tests.sh +++ b/ci/base-tests.sh @@ -1,3 +1,4 @@ +set -ex PATH=$PATH:./node_modules/.bin remark -f *.md > /dev/null set -e diff --git a/ci/integration-tests.sh b/ci/integration-tests.sh index c6c2a4a4d586..cfe5c1417b4b 100755 --- a/ci/integration-tests.sh +++ b/ci/integration-tests.sh @@ -1,3 +1,4 @@ +set -ex cargo install --force echo "Running integration test for crate ${INTEGRATION}" From dd0ed5dccc93c9395bf5d9490ac49f7764069de1 Mon Sep 17 00:00:00 2001 From: Philipp Hansch Date: Wed, 16 May 2018 19:21:57 +0200 Subject: [PATCH 4/6] Clone into checkout directory and cd into it --- ci/integration-tests.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ci/integration-tests.sh b/ci/integration-tests.sh index cfe5c1417b4b..577fec96db72 100755 --- a/ci/integration-tests.sh +++ b/ci/integration-tests.sh @@ -3,7 +3,8 @@ cargo install --force echo "Running integration test for crate ${INTEGRATION}" -git clone https://github.com/${INTEGRATION}.git +git clone --depth=1 https://github.com/${INTEGRATION}.git checkout +cd checkout function check() { cargo clippy --all &> clippy_output @@ -19,7 +20,6 @@ case ${INTEGRATION} in check ;; *) - cd ${INTEGRATION} check ;; esac From 3314c5fda7925fe14e1e64bbdcd064a8e6f90a11 Mon Sep 17 00:00:00 2001 From: Philipp Hansch Date: Wed, 16 May 2018 19:54:30 +0200 Subject: [PATCH 5/6] No -e in integration_tests Because that makes the script stop early and not print any clippy error output. --- ci/base-tests.sh | 1 - ci/integration-tests.sh | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/ci/base-tests.sh b/ci/base-tests.sh index e72bd155cec0..daec740212db 100755 --- a/ci/base-tests.sh +++ b/ci/base-tests.sh @@ -1,7 +1,6 @@ set -ex PATH=$PATH:./node_modules/.bin remark -f *.md > /dev/null -set -e cargo build --features debugging cargo test --features debugging mkdir -p ~/rust/cargo/bin diff --git a/ci/integration-tests.sh b/ci/integration-tests.sh index 577fec96db72..61a3348f04f9 100755 --- a/ci/integration-tests.sh +++ b/ci/integration-tests.sh @@ -1,4 +1,4 @@ -set -ex +set -x cargo install --force echo "Running integration test for crate ${INTEGRATION}" From 569c138333ba41f66172f0c6ceb0d475e2623730 Mon Sep 17 00:00:00 2001 From: Philipp Hansch Date: Wed, 16 May 2018 20:08:46 +0200 Subject: [PATCH 6/6] s/internal error/internal compiler error/ --- ci/integration-tests.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/integration-tests.sh b/ci/integration-tests.sh index 61a3348f04f9..2fe15179b5f4 100755 --- a/ci/integration-tests.sh +++ b/ci/integration-tests.sh @@ -9,7 +9,7 @@ cd checkout function check() { cargo clippy --all &> clippy_output cat clippy_output - ! cat clippy_output | grep -q "internal error" + ! cat clippy_output | grep -q "internal compiler error" if [[ $? != 0 ]]; then return 1 fi