From 7f56756e118ac7944c02502a17d897364894c627 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A1szl=C3=B3=20Lang=C3=B3?= Date: Wed, 20 Jun 2018 03:34:49 +0200 Subject: [PATCH] Improve sonarqube analysis to cover more code path. (#2381) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com --- .travis.yml | 10 +------- tools/check-sonarqube.sh | 49 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+), 9 deletions(-) create mode 100755 tools/check-sonarqube.sh diff --git a/.travis.yml b/.travis.yml index b16a63840..7bd6a9f83 100644 --- a/.travis.yml +++ b/.travis.yml @@ -117,15 +117,7 @@ matrix: organization: "jerryscript-project" token: secure: "C1QD99nllAQndSDj4uIQPWCK0jBYrC5P0IrpdhfG7li7uvdzphUM++z3zkhYeeTJR3flw/cr8d9saYlbMjGw2eZ7AdJPFy4FJ1doBXD2amIuepaG1e829SLnJner9VA+d/8j28m7lZNtvZF5efbrS4KOicijNixmJy2PKG0K2035fs6MHLdywF8cJhyMaoRiMvYahIZEjXMvPBSgG1m4+A3PpzyN8XijwOT47cVtCLav4L21Mc7LcHsrc3LeyhtEJ+cs7Lx9WDQDwXX9iCRTA5ByqrXsS4rBV/N3lJI5M9p68Yj94Qy2OvVeCmUZ4ezwuuwkX00vBUk2f4eZx3oFAp973ekA8EGm/5qEvHVcbjHoHLbfUxsAKQHVoExXGdM5r1KeVgxLDT2FSQnBZLoxIrtGOUqFEOL4WX5YaQNoUKvYFO+CNvsMQkNg65QzLinRfqcH20KjzAsVeFwVI/j87J2VjooM8910savpw53iVBNPqmO/lG3kzFL7L2p1FeOuyEg9ANAbMhAXt3SL2srT0xni+ysg4Iwq+IkU+hkQWsvM8Voz+QJmiotFsi1Pzakcu3IOlT8lVVyn5q0z59YVDht/6if7acqkZ3X5vldeNIZYkImmYhMebScxVhzAa8AS6/81A+zJ8lW1+RWJQtP3uPM1+Dq18iFkPrCEMZwtoXI=" - script: - if [[ "${TRAVIS_REPO_SLUG}" == "jerryscript-project/jerryscript" - && ${TRAVIS_BRANCH} == "master" - && ${TRAVIS_EVENT_TYPE} == "push" ]]; - then - git fetch --unshallow; - build-wrapper-linux-x86-64 --out-dir bw-output ./tools/build.py; - sonar-scanner -Dsonar.projectVersion="${TRAVIS_COMMIT}"; - fi + script: tools/check-sonarqube.sh cache: directories: - '${HOME}/.sonar/cache' diff --git a/tools/check-sonarqube.sh b/tools/check-sonarqube.sh new file mode 100755 index 000000000..dd1fca1d8 --- /dev/null +++ b/tools/check-sonarqube.sh @@ -0,0 +1,49 @@ +#!/bin/bash + +# Copyright JS Foundation and other contributors, http://js.foundation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +if [[ "${TRAVIS_REPO_SLUG}" == "jerryscript-project/jerryscript" + && ${TRAVIS_BRANCH} == "master" + && ${TRAVIS_EVENT_TYPE} == "push" ]] +then + git fetch --unshallow + build-wrapper-linux-x86-64 --out-dir bw-output \ + ./tools/build.py --error-messages=on \ + --jerry-cmdline-snapshot=on \ + --jerry-debugger=on \ + --jerry-libc=off \ + --line-info=on \ + --mem-stats=on \ + --profile=es2015-subset \ + --snapshot-save=on \ + --snapshot-exec=on \ + --valgrind=on \ + --vm-exec-stop=on + sonar-scanner -Dsonar.projectVersion="${TRAVIS_COMMIT}" +else + # SonarQube analysis works only on the master branch. + # Ensure the build works with the options used for the analysis. + ./tools/build.py --error-messages=on \ + --jerry-cmdline-snapshot=on \ + --jerry-debugger=on \ + --jerry-libc=off \ + --line-info=on \ + --mem-stats=on \ + --profile=es2015-subset \ + --snapshot-save=on \ + --snapshot-exec=on \ + --valgrind=on \ + --vm-exec-stop=on +fi