From 5d55c56e088ccc68c7f629ebad33ad73a2427bb2 Mon Sep 17 00:00:00 2001 From: Matthew DeTullio Date: Tue, 3 Nov 2015 21:15:05 -0500 Subject: [PATCH] Get rid of the nasty shell script, update sample properites and README --- README.md | 169 ++++++++++---- sample/sonar-project.properties | 89 +++---- src/main/shell/run-sonar.sh | 319 -------------------------- src/test/shell/configuration.test | 36 --- src/test/shell/nominal.test | 369 ------------------------------ src/test/shell/usage.test | 34 --- 6 files changed, 173 insertions(+), 843 deletions(-) delete mode 100755 src/main/shell/run-sonar.sh delete mode 100644 src/test/shell/configuration.test delete mode 100644 src/test/shell/nominal.test delete mode 100644 src/test/shell/usage.test diff --git a/README.md b/README.md index 5387ac7b..499da3bd 100644 --- a/README.md +++ b/README.md @@ -1,18 +1,25 @@ -SonarQube Plugin for Objective C -================================ +# SonarQube Plugin for Objective-C -This repository hosts the Objective-C plugin for [SonarQube](http://www.sonarqube.org/). This plugin enables to analyze and track the quality of iOS (iPhone, iPad) and MacOS developments. +This repository hosts the Objective-C plugin for +[SonarQube](http://www.sonarqube.org/). This plugin aims to analyze and track +the quality of iOS (iPhone, iPad) and MacOS projects, but it can be used with +other Objective-C projects. -This plugin is not supported by SonarSource. SonarSource offers a [commercial SonarSource Objective-C plugin](http://www.sonarsource.com/products/plugins/languages/objective-c/) as well. Both plugins do not offer the same functionalities/support. +This plugin is not supported by SonarSource. SonarSource offers a +[commercial SonarSource Objective-C plugin](http://www.sonarsource.com/products/plugins/languages/objective-c/) +as well. The plugins do not offer the same features/support. -The development of this plugin has always been done thanks to the community. If you wish to contribute, check the [Contributing](https://github.com/octo-technology/sonar-objective-c/wiki/Contributing) wiki page. +The development of this plugin has always been done thanks to the community. +If you wish to contribute, check the +[Contributing](https://github.com/octo-technology/sonar-objective-c/wiki/Contributing) +wiki page. Find below an example of an iOS SonarQube dashboard:

Example iOS SonarQube dashboard

-###Features +## Features - [x] Complexity - [ ] Design @@ -22,61 +29,138 @@ Find below an example of an iOS SonarQube dashboard: - [x] Size - [x] Tests -For more details, see the list of [SonarQube metrics](https://github.com/octo-technology/sonar-objective-c/wiki/Features) implemented or pending. +For more details, see the list of +[SonarQube metrics](https://github.com/octo-technology/sonar-objective-c/wiki/Features) +implemented or pending. -###Compatibility + +## Compatibility - Use 0.3.x releases for SonarQube < 4.3 -- Use 0.4.x releases for SonarQube >= 4.3 (4.x and 5.x) +- Use 0.4.0 or later releases for SonarQube >= 4.3 (4.x and 5.x) + -###Download +## Download The latest version is the 0.4.0 and it's available [here](http://bit.ly/18A7OkE). The latest SonarQube 3.x release is the 0.3.1, and it's available [here](http://bit.ly/1fSwd5I). -You can also download the latest build of the plugin from [Cloudbees](https://rfelden.ci.cloudbees.com/job/sonar-objective-c/lastSuccessfulBuild/artifact/target/). +You can also download the latest build of the plugin from +[Cloudbees](https://rfelden.ci.cloudbees.com/job/sonar-objective-c/lastSuccessfulBuild/artifact/target/). -In the worst case, the Maven repository with all snapshots and releases is available here: http://repository-rfelden.forge.cloudbees.com/ +In the worst case, the Maven repository with all snapshots and releases is +available here: http://repository-rfelden.forge.cloudbees.com/ + + +## Prerequisites + +- A Mac with Xcode +- Optional: [Homebrew](http://brew.sh) for easier prerequisite installation +- [SonarQube](http://docs.codehaus.org/display/SONAR/Setup+and+Upgrade) +- [SonarQube Runner](http://docs.codehaus.org/display/SONAR/Installing+and+Configuring+SonarQube+Runner) (```brew install sonar-runner```) + +### JUnit + +Any of the following will produce JUnit XML reports for your project: + +- [xctool](https://github.com/facebook/xctool) (```brew install xctool```) + - This is actually a substitute for xcodebuild, so it will compile your app and run tests as part of the process + - Make sure the version of xctool you use is compatible with the version of Xcode you will be building with +- [xcpretty](https://github.com/supermarin/xcpretty) (```gem install xcpretty```) + - This will parse xcodebuild's output and prettify it, with the option of generating a JUnit XML report and/or JSON compilation database +- [ocunit2junit](https://github.com/ciryon/OCUnit2JUnit) (```gem install ocunit2junit```) + - This will parse xcodebuild's output and generate a JUnit XML report + + +### Coverage + +Run your tests with code coverage enabled, then run one of the following tools +to produce a Cobertura XML report which can be imported by this plugin. + +- With Xcode prior to version 7, use [gcovr](http://gcovr.com) to parse ```*.gcda``` and ```*.gcno``` files +- With Xcode 7 or greater, use [slather](https://github.com/venmo/slather) to parse the ```Coverage.profdata``` file + - Note: at time of writing, support for the ```*.profdata``` format has not been released, but can be installed by running ```gem install specific_install && gem specific_install -l https://github.com/viteinfinite/slather.git -b 61f00988e6ad65f817ba81b08533cf78615fff16``` + - Note: at time of writing, xctool is not capable of producing coverage data when using Xcode 7+ + + +### Clang + +[Clang Static Analyzer](http://clang-analyzer.llvm.org/) can produce Plist +reports which can be imported by this plugin. + +There are different ways to produce the reports, such as using Clang's +[scan-build](http://clang-analyzer.llvm.org/scan-build.html), however it's +probably easiest to use xcodebuild's ```analyze``` action. Xcodebuild will +invoke the analyzer with all the proper arguments and use any additional +analyzer configuration from your settings under ```*.xcodeproj```. By default, +it will produce the Plist reports this plugin needs. + -###Prerequisites +### OCLint -- a Mac with Xcode... -- [SonarQube](http://docs.codehaus.org/display/SONAR/Setup+and+Upgrade) and [SonarQube Runner](http://docs.codehaus.org/display/SONAR/Installing+and+Configuring+SonarQube+Runner) installed ([HomeBrew](http://brew.sh) installed and ```brew install sonar-runner```) -- [xctool](https://github.com/facebook/xctool) ([HomeBrew](http://brew.sh) installed and ```brew install xctool```). If you are using Xcode 6, make sure to update xctool (```brew upgrade xctool```) to a version > 0.2.2. -- [OCLint](http://docs.oclint.org/en/dev/intro/installation.html) installed. Version 0.8.1 recommended ([HomeBrew](http://brew.sh) installed and ```brew install https://gist.githubusercontent.com/TonyAnhTran/e1522b93853c5a456b74/raw/157549c7a77261e906fb88bc5606afd8bd727a73/oclint.rb```). -- [gcovr](http://gcovr.com) installed -- [lizard](https://github.com/terryyin/lizard) installed +[OCLint](http://docs.oclint.org/en/dev/intro/installation.html) version 0.8.1 recommended +(```brew install https://gist.githubusercontent.com/TonyAnhTran/e1522b93853c5a456b74/raw/157549c7a77261e906fb88bc5606afd8bd727a73/oclint.rb```). +Use it to produce a PMD-formatted XML report that can be imported by this +plugin. -###Installation (once for all your Objective-C projects) -- Install [the plugin](http://bit.ly/18A7OkE) through the Update Center (of SonarQube) or download it into the $SONARQUBE_HOME/extensions/plugins directory -- Copy [run-sonar.sh](https://rawgithub.com/octo-technology/sonar-objective-c/master/src/main/shell/run-sonar.sh) somewhere in your PATH -- Restart the SonarQube server. -###Configuration (once per project) -- Copy [sonar-project.properties](https://rawgithub.com/octo-technology/sonar-objective-c/master/sample/sonar-project.properties) in your Xcode project root folder (along your .xcodeproj file) -- Edit the *sonar-project.properties* file to match your Xcode iOS/MacOS project +### Complexity -**The good news is that you don't have to modify your Xcode project to enable SonarQube!**. Ok, there might be one needed modification if you don't have a specific scheme for your test target, but that's all. +Use [Lizard](https://github.com/terryyin/lizard) (```pip install lizard```) +to produce an XML report that can be imported by this plugin. -###Analysis -- Run the script ```run-sonar.sh``` in your Xcode project root folder + +## Installation (once for all your Objective-C projects) + +1. Install [the plugin](http://bit.ly/18A7OkE) through the Update Center (of SonarQube) or download it into the $SONARQUBE_HOME/extensions/plugins directory +2. Restart the SonarQube server. + + +## Configuration (once per project) + +Create a ```sonar-project.properties``` file defining some basic project +configuration and the location of the reports you want to import. + +**The good news is that you don't have to modify your Xcode project to enable +SonarQube!**. Ok, there might be needed modification if you don't have a +specific scheme for your test target or if coverage is not enabled, but that's all. + + +## Analysis + +- Run your build script to produce the various reports +- Run ```sonar-runner``` - Enjoy or file an issue! -###Update (once per plugin update) + +## Update + - Install the [latest plugin](http://bit.ly/18A7OkE) version -- Copy [run-sonar.sh](https://rawgithub.com/octo-technology/sonar-objective-c/master/src/main/shell/run-sonar.sh) somewhere in your PATH +- Check for documented migration steps + +### Migration to v0.5.x + +- Analysis property names have changed. Check the sample. +- Coverage report property no longer supports pattern matching. Only one coverage XML file is supported. +- ```sonar.language``` key changed from ```objc``` to ```objectivec``` + - As a side effect you may have to reconfigure your Quality Profiles -If you still have *run-sonar.sh* file in each of your project (not recommended), you will need to update all those files. -###Credits -* **Cyril Picat** -* **Gilles Grousset** -* **Denis Bregeon** -* **François Helg** -* **Romain Felden** -* **Mete Balci** +## Contributors -###History +- Cyril Picat +- Gilles Grousset +- Denis Bregeon +- François Helg +- Romain Felden +- Mete Balci +- Andrés Gil Herrera +- Matthew DeTullio + + +## History + +- v0.5.0 (2015/11): added support for Clang, made properties configurable in SonarQube UI, major refactoring - v0.4.1 (2015/05): added support for Lizard to implement complexity metrics. - v0.4.0 (2015/01): support for SonarQube >= 4.3 (4.x & 5.x) - v0.3.1 (2013/10): fix release @@ -84,7 +168,8 @@ If you still have *run-sonar.sh* file in each of your project (not recommended), - v0.2 (2013/10): added OCLint checks as SonarQube violations - v0.0.1 (2012/09): v0 with basic metrics such as nb lines of code, nb lines of comment, nb of files, duplications -###License -SonarQube Plugin for Objective C is released under the GNU LGPL 3 license: +## License + +SonarQube Plugin for Objective-C is released under the GNU LGPL 3 license: http://www.gnu.org/licenses/lgpl.txt diff --git a/sample/sonar-project.properties b/sample/sonar-project.properties index 58797447..dd3261f4 100644 --- a/sample/sonar-project.properties +++ b/sample/sonar-project.properties @@ -1,60 +1,63 @@ -########################## -# Required configuration # -########################## - -sonar.projectKey=my-project +# Required +sonar.projectKey=com.example:my-project +# Required sonar.projectName=My project +# Required sonar.projectVersion=1.0 -sonar.language=objc - -# Project description + +# Optional sonar.projectDescription=Fake description - -# Path to source directories + +# Required +# Path to source directories sonar.sources=srcDir1,srcDir2 -# Path to test directories (comment if no test) + +# Optional +sonar.inclusions=subDir1/**,subDir2/** +# Optional +sonar.exclusions=**/generatedDir/**,**/thirdpartyDir/** + +# Optional +# Path to test directories sonar.tests=testSrcDir - -# Xcode project configuration (.xcodeproj or .xcworkspace) -# -> If you have a project: configure only sonar.objectivec.project -# -> If you have a workspace: configure sonar.objectivec.workspace and sonar.objectivec.project -# and use the later to specify which project(s) to include in the analysis (comma separated list) -sonar.objectivec.project=myApplication.xcodeproj -# sonar.objectivec.workspace=myApplication.xcworkspace - -# Scheme to build your application -sonar.objectivec.appScheme=myApplication -# Scheme to build and run your tests (comment following line of you don't have any tests) -sonar.objectivec.testScheme=myApplicationTests - -########################## -# Optional configuration # -########################## +# Optional +sonar.test.inclusions=subDir3/** +# Optional +sonar.test.exclusions= + +# Recommended +# Add language property to limit to single-language analysis +sonar.language=objectivec + +# Define suffixes for multi-language analysis +# There will likely be problems if you have any other C/C++/Obj-C plugin(s) installed due to each language using .h files +sonar.objectivec.file.suffixes=.h,.m # Encoding of the source code sonar.sourceEncoding=UTF-8 -# JUnit report generated by run-sonar.sh is stored in sonar-reports/TEST-report.xml -# Change it only if you generate the file on your own -# The XML files have to be prefixed by TEST- otherwise they are not processed -# sonar.junit.reportsPath=sonar-reports/ +# Optional +# Folder with JUnit XML reports matching format of "TEST*.xml" +# Generate this with xctool, xcpretty, or ocunit2junit +sonar.objectivec.junit.reportsPath=sonar-reports/junit -# Cobertura report generated by run-sonar.sh is stored in sonar-reports/coverage.xml -# Change it only if you generate the file on your own -# sonar.objectivec.coverage.reportPattern=sonar-reports/coverage*.xml +# Optional +# Path to Cobertura XML report +# Generate this with gcovr (Xcode < 7) or slather (Xcode >= 7) +sonar.objectivec.cobertura.reportPath=sonar-reports/cobertura.xml -# OCLint report generated by run-sonar.sh is stored in sonar-reports/oclint.xml -# Change it only if you generate the file on your own -# sonar.objectivec.oclint.report=sonar-reports/oclint.xml +# Optional +# Path to OCLint PMD formatted XML report +sonar.objectivec.oclint.reportPath=sonar-reports/oclint.xml -# Lizard report generated by run-sonar.sh is stored in sonar-reports/lizard-report.xml -# Change it only if you generate the file on your own -# sonar.objectivec.lizard.report=sonar-reports/lizard-report.xml +# Optional +# Folder with Clang Plist reports matching format of "*.plist" +sonar.objectivec.clang.reportsPath=sonar-reports/clang -# Paths to exclude from coverage report (tests, 3rd party libraries etc.) -# sonar.objectivec.excludedPathsFromCoverage=pattern1,pattern2 -sonar.objectivec.excludedPathsFromCoverage=.*Tests.* +# Optional +# Path to Lizard XML report +sonar.objectivec.lizard.reportPath=sonar-reports/lizard.xml # Project SCM settings # sonar.scm.enabled=true diff --git a/src/main/shell/run-sonar.sh b/src/main/shell/run-sonar.sh deleted file mode 100755 index cd7f8ee6..00000000 --- a/src/main/shell/run-sonar.sh +++ /dev/null @@ -1,319 +0,0 @@ -#!/bin/bash -## INSTALLATION: script to copy in your Xcode project in the same directory as the .xcodeproj file -## USAGE: ./run-sonar.sh -## DEBUG: ./run-sonar.sh -v -## WARNING: edit your project parameters in sonar-project.properties rather than modifying this script -# - -trap "echo 'Script interrupted by Ctrl+C'; stopProgress; exit 1" SIGHUP SIGINT SIGTERM - -function startProgress() { - while true - do - echo -n "." - sleep 5 - done -} - -function stopProgress() { - if [ "$vflag" = "" -a "$nflag" = "" ]; then - kill $PROGRESS_PID &>/dev/null - fi -} - -function testIsInstalled() { - - hash $1 2>/dev/null - if [ $? -eq 1 ]; then - echo >&2 "ERROR - $1 is not installed or not in your PATH"; exit 1; - fi -} - -function readParameter() { - - variable=$1 - shift - parameter=$1 - shift - - eval $variable="\"$(sed '/^\#/d' sonar-project.properties | grep $parameter | tail -n 1 | cut -d '=' -f2- | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')\"" -} - -# Run a set of commands with logging and error handling -function runCommand() { - - # 1st arg: redirect stdout - # 2nd arg: command to run - # 3rd..nth arg: args - redirect=$1 - shift - - command=$1 - shift - - if [ "$nflag" = "on" ]; then - # don't execute command, just echo it - echo - if [ "$redirect" = "/dev/stdout" ]; then - if [ "$vflag" = "on" ]; then - echo "+" $command "$@" - else - echo "+" $command "$@" "> /dev/null" - fi - elif [ "$redirect" != "no" ]; then - echo "+" $command "$@" "> $redirect" - else - echo "+" $command "$@" - fi - - elif [ "$vflag" = "on" ]; then - echo - - if [ "$redirect" = "/dev/stdout" ]; then - set -x #echo on - $command "$@" - returnValue=$? - set +x #echo off - elif [ "$redirect" != "no" ]; then - set -x #echo on - $command "$@" > $redirect - returnValue=$? - set +x #echo off - else - set -x #echo on - $command "$@" - returnValue=$? - set +x #echo off - fi - - if [[ $returnValue != 0 && $returnValue != 5 ]] ; then - stopProgress - echo "ERROR - Command '$command $@' failed with error code: $returnValue" - exit $returnValue - fi - else - - if [ "$redirect" = "/dev/stdout" ]; then - $command "$@" > /dev/null - elif [ "$redirect" != "no" ]; then - $command "$@" > $redirect - else - $command "$@" - fi - - returnValue=$? - if [[ $returnValue != 0 && $returnValue != 5 ]] ; then - stopProgress - echo "ERROR - Command '$command $@' failed with error code: $returnValue" - exit $? - fi - - - echo - fi -} - -## COMMAND LINE OPTIONS -vflag="" -nflag="" -oclint="on" -lizard="on" -while [ $# -gt 0 ] -do - case "$1" in - -v) vflag=on;; - -n) nflag=on;; - -nooclint) oclint="";; - --) shift; break;; - -*) - echo >&2 "Usage: $0 [-v]" - exit 1;; - *) break;; # terminate while loop - esac - shift -done - -# Usage OK -echo "Running run-sonar.sh..." - -## CHECK PREREQUISITES - -# xctool, gcovr and oclint installed -testIsInstalled xctool -testIsInstalled gcovr -testIsInstalled oclint - -# sonar-project.properties in current directory -if [ ! -f sonar-project.properties ]; then - echo >&2 "ERROR - No sonar-project.properties in current directory"; exit 1; -fi - -## READ PARAMETERS from sonar-project.properties - -# Your .xcworkspace/.xcodeproj filename -workspaceFile=''; readParameter workspaceFile 'sonar.objectivec.workspace' -projectFile=''; readParameter projectFile 'sonar.objectivec.project' -if [[ "$workspaceFile" != "" ]] ; then - xctoolCmdPrefix="xctool -workspace $workspaceFile -sdk iphonesimulator ARCHS=i386 VALID_ARCHS=i386 CURRENT_ARCH=i386 ONLY_ACTIVE_ARCH=NO" -else - xctoolCmdPrefix="xctool -project $projectFile -sdk iphonesimulator ARCHS=i386 VALID_ARCHS=i386 CURRENT_ARCH=i386 ONLY_ACTIVE_ARCH=NO" -fi - -# Source directories for .h/.m files -srcDirs=''; readParameter srcDirs 'sonar.sources' -# The name of your application scheme in Xcode -appScheme=''; readParameter appScheme 'sonar.objectivec.appScheme' - -# The name of your test scheme in Xcode -testScheme=''; readParameter testScheme 'sonar.objectivec.testScheme' -# The file patterns to exclude from coverage report -excludedPathsFromCoverage=''; readParameter excludedPathsFromCoverage 'sonar.objectivec.excludedPathsFromCoverage' - -# Check for mandatory parameters -if [ -z "$projectFile" -o "$projectFile" = " " ]; then - - if [ ! -z "$workspaceFile" -a "$workspaceFile" != " " ]; then - echo >&2 "ERROR - sonar.objectivec.project parameter is missing in sonar-project.properties. You must specify which projects (comma-separated list) are application code within the workspace $workspaceFile." - else - echo >&2 "ERROR - sonar.objectivec.project parameter is missing in sonar-project.properties (name of your .xcodeproj)" - fi - exit 1 -fi -if [ -z "$srcDirs" -o "$srcDirs" = " " ]; then - echo >&2 "ERROR - sonar.sources parameter is missing in sonar-project.properties. You must specify which directories contain your .h/.m source files (comma-separated list)." - exit 1 -fi -if [ -z "$appScheme" -o "$appScheme" = " " ]; then - echo >&2 "ERROR - sonar.objectivec.appScheme parameter is missing in sonar-project.properties. You must specify which scheme is used to build your application." - exit 1 -fi - -if [ "$vflag" = "on" ]; then - echo "Xcode workspace file is: $workspaceFile" - echo "Xcode project file is: $projectFile" - echo "Xcode application scheme is: $appScheme" - echo "Xcode test scheme is: $testScheme" - echo "Excluded paths from coverage are: $excludedPathsFromCoverage" -fi - -## SCRIPT - -# Start progress indicator in the background -if [ "$vflag" = "" -a "$nflag" = "" ]; then - startProgress & - # Save PID - PROGRESS_PID=$! -fi - -# Create sonar-reports/ for reports output -if [[ ! (-d "sonar-reports") && ("$nflag" != "on") ]]; then - if [ "$vflag" = "on" ]; then - echo 'Creating directory sonar-reports/' - fi - mkdir sonar-reports - if [[ $? != 0 ]] ; then - stopProgress - exit $? - fi -fi - -# Extracting project information needed later -echo -n 'Extracting Xcode project information' -runCommand /dev/stdout $xctoolCmdPrefix -scheme "$appScheme" clean -runCommand /dev/stdout $xctoolCmdPrefix -scheme "$appScheme" -reporter json-compilation-database:compile_commands.json build - -# Unit tests and coverage -if [ "$testScheme" = "" ]; then - echo 'Skipping tests as no test scheme has been provided!' - - # Put default xml files with no tests and no coverage... - echo "" > sonar-reports/TEST-report.xml - echo "" > sonar-reports/coverage.xml -else - - echo -n 'Running tests using xctool' - runCommand sonar-reports/TEST-report.xml $xctoolCmdPrefix -scheme "$testScheme" -reporter junit GCC_GENERATE_TEST_COVERAGE_FILES=YES GCC_INSTRUMENT_PROGRAM_FLOW_ARCS=YES test - - echo -n 'Computing coverage report' - - # We do it for every xcodeproject (in case of workspaces) - - # Extract the path to the .gcno/.gcda coverage files - echo $projectFile | sed -n 1'p' | tr ',' '\n' > tmpFileRunSonarSh - while read projectName; do - - coverageFilesPath=$(grep 'command' compile_commands.json | sed 's#^.*-o \\/#\/#;s#",##' | grep "${projectName%%.*}.build" | awk 'NR<2' | sed 's/\\\//\//g' | sed 's/\\\\//g' | xargs -0 dirname) - if [ "$vflag" = "on" ]; then - echo - echo "Path for .gcno/.gcda coverage files is: $coverageFilesPath" - fi - - # Build the --exclude flags - excludedCommandLineFlags="" - if [ ! -z "$excludedPathsFromCoverage" -a "$excludedPathsFromCoverage" != " " ]; then - echo $excludedPathsFromCoverage | sed -n 1'p' | tr ',' '\n' > tmpFileRunSonarSh2 - while read word; do - excludedCommandLineFlags+=" --exclude $word" - done < tmpFileRunSonarSh2 - rm -rf tmpFileRunSonarSh2 - fi - if [ "$vflag" = "on" ]; then - echo "Command line exclusion flags for gcovr is:$excludedCommandLineFlags" - fi - - # Run gcovr with the right options - runCommand "sonar-reports/coverage-${projectName%%.*}.xml" gcovr -r . "$coverageFilesPath" $excludedCommandLineFlags --xml - - done < tmpFileRunSonarSh - rm -rf tmpFileRunSonarSh - -fi - -if [ "$oclint" = "on" ]; then - - # OCLint - echo -n 'Running OCLint...' - - # Build the --include flags - currentDirectory=${PWD##*/} - includedCommandLineFlags="" - echo "$srcDirs" | sed -n 1'p' | tr ',' '\n' > tmpFileRunSonarSh - while read word; do - includedCommandLineFlags+=" --include .*/${currentDirectory}/${word}" - done < tmpFileRunSonarSh - rm -rf tmpFileRunSonarSh - if [ "$vflag" = "on" ]; then - echo - echo -n "Path included in oclint analysis is:$includedCommandLineFlags" - fi - - # Run OCLint with the right set of compiler options - maxPriority=10000 - runCommand no oclint-json-compilation-database $includedCommandLineFlags -- -max-priority-1 $maxPriority -max-priority-2 $maxPriority -max-priority-3 $maxPriority -report-type pmd -o sonar-reports/oclint.xml -else - echo 'Skipping OCLint (test purposes only!)' -fi - -if [ "$lizard" = "on" ]; then - if hash lizard 2>/dev/null; then - # Lizard - echo -n 'Running Lizard...' - - # Run Lizard with xml output option and write the output in sonar-reports/lizard-report.xml - lizard --xml "$srcDirs" > sonar-reports/lizard-report.xml - else - echo 'Skipping Lizard (not installed!)' - fi - -else - echo 'Skipping Lizard (test purposes only!)' -fi - -# SonarQube -echo -n 'Running SonarQube using SonarQube Runner' -runCommand /dev/stdout sonar-runner - -# Kill progress indicator -stopProgress - -exit 0 diff --git a/src/test/shell/configuration.test b/src/test/shell/configuration.test deleted file mode 100644 index e313ee4d..00000000 --- a/src/test/shell/configuration.test +++ /dev/null @@ -1,36 +0,0 @@ -# 1. Missing sonar.sources parameter -tee sonar-project.properties | cat > /dev/null; $RUNSONAR_HOME/run-sonar.sh -v -n -<<< -sonar.objectivec.project=Application.xcodeproj -sonar.objectivec.appScheme=Application ->>>2 -ERROR - sonar.sources parameter is missing in sonar-project.properties. You must specify which directories contain your .h/.m source files (comma-separated list). ->>>= !0 - -# 2. Missing sonar.objectivec.project parameter (no workspace) -tee sonar-project.properties | cat > /dev/null; $RUNSONAR_HOME/run-sonar.sh -v -n -<<< -sonar.sources=src -sonar.objectivec.appScheme=Application ->>>2 -ERROR - sonar.objectivec.project parameter is missing in sonar-project.properties (name of your .xcodeproj) ->>>= !0 - -# 3. Missing sonar.objectivec.project parameter (w/ workspace) -tee sonar-project.properties | cat > /dev/null; $RUNSONAR_HOME/run-sonar.sh -v -n -<<< -sonar.sources=src -sonar.objectivec.workspace=Application.xcworkspace -sonar.objectivec.appScheme=Application ->>>2 -ERROR - sonar.objectivec.project parameter is missing in sonar-project.properties. You must specify which projects (comma-separated list) are application code within the workspace Application.xcworkspace. ->>>= !0 - -# 4. Missing sonar.objectivec.appScheme parameter -tee sonar-project.properties | cat > /dev/null; $RUNSONAR_HOME/run-sonar.sh -v -n -<<< -sonar.sources=src -sonar.objectivec.project=Application.xcodeproj ->>>2 -ERROR - sonar.objectivec.appScheme parameter is missing in sonar-project.properties. You must specify which scheme is used to build your application. ->>>= !0 diff --git a/src/test/shell/nominal.test b/src/test/shell/nominal.test deleted file mode 100644 index 96f330d2..00000000 --- a/src/test/shell/nominal.test +++ /dev/null @@ -1,369 +0,0 @@ -# 0. Setup default compile_commands.json -tee compile_commands.json | cat > /dev/null -<<< -[ - { - "command" : "blablabla -o \/Users\/user\/Library\/Developer\/Xcode\/DerivedData\/myApplication-hevorauelspmmeblhdabohacuurg\/Build\/Intermediates\/Application.build\/Debug-iphonesimulator\/Application.build\/Objects-normal\/i386\/myFile.o", - "directory" : "titi", - "file" : "myFile.m" - } -] ->>>= 0 - -# 1. Nominal file -tee sonar-project.properties | cat > /dev/null; $RUNSONAR_HOME/run-sonar.sh -v -n -<<< -sonar.sources=src -sonar.objectivec.project=Application.xcodeproj -sonar.objectivec.appScheme=Application -sonar.objectivec.testScheme=ApplicationTests -sonar.objectivec.excludedPathsFromCoverage=.*Tests.*,.*3rdParty.* ->>> -Running run-sonar.sh... -Xcode workspace file is: -Xcode project file is: Application.xcodeproj -Xcode application scheme is: Application -Xcode test scheme is: ApplicationTests -Excluded paths from coverage are: .*Tests.*,.*3rdParty.* -Extracting Xcode project information -+ xctool -project Application.xcodeproj -sdk iphonesimulator ARCHS=i386 VALID_ARCHS=i386 CURRENT_ARCH=i386 ONLY_ACTIVE_ARCH=NO -scheme Application clean - -+ xctool -project Application.xcodeproj -sdk iphonesimulator ARCHS=i386 VALID_ARCHS=i386 CURRENT_ARCH=i386 ONLY_ACTIVE_ARCH=NO -scheme Application -reporter json-compilation-database:compile_commands.json build -Running tests using xctool -+ xctool -project Application.xcodeproj -sdk iphonesimulator ARCHS=i386 VALID_ARCHS=i386 CURRENT_ARCH=i386 ONLY_ACTIVE_ARCH=NO -scheme ApplicationTests -reporter junit GCC_GENERATE_TEST_COVERAGE_FILES=YES GCC_INSTRUMENT_PROGRAM_FLOW_ARCS=YES test > sonar-reports/TEST-report.xml -Computing coverage report -Path for .gcno/.gcda coverage files is: /Users/user/Library/Developer/Xcode/DerivedData/myApplication-hevorauelspmmeblhdabohacuurg/Build/Intermediates/Application.build/Debug-iphonesimulator/Application.build/Objects-normal/i386 -Command line exclusion flags for gcovr is: --exclude .*Tests.* --exclude .*3rdParty.* - -+ gcovr -r . /Users/user/Library/Developer/Xcode/DerivedData/myApplication-hevorauelspmmeblhdabohacuurg/Build/Intermediates/Application.build/Debug-iphonesimulator/Application.build/Objects-normal/i386 --exclude .*Tests.* --exclude .*3rdParty.* --xml > sonar-reports/coverage-Application.xml -Running OCLint... -Path included in oclint analysis is: --include .*/shell/src.* -+ oclint-json-compilation-database --include .*/shell/src.* -- -report-type pmd -o sonar-reports/oclint.xml -Running SonarQube using SonarQube Runner -+ sonar-runner ->>>= 0 - -# 1bis. Nominal file not verbose -tee sonar-project.properties | cat > /dev/null; $RUNSONAR_HOME/run-sonar.sh -n -<<< -sonar.sources=src -sonar.objectivec.project=Application.xcodeproj -sonar.objectivec.appScheme=Application -sonar.objectivec.testScheme=ApplicationTests -sonar.objectivec.excludedPathsFromCoverage=.*Tests.*,.*3rdParty.* ->>> -Running run-sonar.sh... -Extracting Xcode project information -+ xctool -project Application.xcodeproj -sdk iphonesimulator ARCHS=i386 VALID_ARCHS=i386 CURRENT_ARCH=i386 ONLY_ACTIVE_ARCH=NO -scheme Application clean > /dev/null - -+ xctool -project Application.xcodeproj -sdk iphonesimulator ARCHS=i386 VALID_ARCHS=i386 CURRENT_ARCH=i386 ONLY_ACTIVE_ARCH=NO -scheme Application -reporter json-compilation-database:compile_commands.json build > /dev/null -Running tests using xctool -+ xctool -project Application.xcodeproj -sdk iphonesimulator ARCHS=i386 VALID_ARCHS=i386 CURRENT_ARCH=i386 ONLY_ACTIVE_ARCH=NO -scheme ApplicationTests -reporter junit GCC_GENERATE_TEST_COVERAGE_FILES=YES GCC_INSTRUMENT_PROGRAM_FLOW_ARCS=YES test > sonar-reports/TEST-report.xml -Computing coverage report -+ gcovr -r . /Users/user/Library/Developer/Xcode/DerivedData/myApplication-hevorauelspmmeblhdabohacuurg/Build/Intermediates/Application.build/Debug-iphonesimulator/Application.build/Objects-normal/i386 --exclude .*Tests.* --exclude .*3rdParty.* --xml > sonar-reports/coverage-Application.xml -Running OCLint... -+ oclint-json-compilation-database --include .*/shell/src.* -- -report-type pmd -o sonar-reports/oclint.xml -Running SonarQube using SonarQube Runner -+ sonar-runner > /dev/null ->>>= 0 - -# 2. Testing various spaces in filenames, schemes etc. -tee sonar-project.properties | cat > /dev/null; $RUNSONAR_HOME/run-sonar.sh -v -n -<<< -sonar.sources=src -sonar.objectivec.project=my Application.xcodeproj -sonar.objectivec.appScheme=my Application -sonar.objectivec.testScheme=Application tests -sonar.objectivec.excludedPathsFromCoverage=.*Tests.*,.*3rd Party.* ->>> -Running run-sonar.sh... -Xcode workspace file is: -Xcode project file is: my Application.xcodeproj -Xcode application scheme is: my Application -Xcode test scheme is: Application tests -Excluded paths from coverage are: .*Tests.*,.*3rd Party.* -Extracting Xcode project information -+ xctool -project my Application.xcodeproj -sdk iphonesimulator ARCHS=i386 VALID_ARCHS=i386 CURRENT_ARCH=i386 ONLY_ACTIVE_ARCH=NO -scheme my Application clean - -+ xctool -project my Application.xcodeproj -sdk iphonesimulator ARCHS=i386 VALID_ARCHS=i386 CURRENT_ARCH=i386 ONLY_ACTIVE_ARCH=NO -scheme my Application -reporter json-compilation-database:compile_commands.json build -Running tests using xctool -+ xctool -project my Application.xcodeproj -sdk iphonesimulator ARCHS=i386 VALID_ARCHS=i386 CURRENT_ARCH=i386 ONLY_ACTIVE_ARCH=NO -scheme Application tests -reporter junit GCC_GENERATE_TEST_COVERAGE_FILES=YES GCC_INSTRUMENT_PROGRAM_FLOW_ARCS=YES test > sonar-reports/TEST-report.xml -Computing coverage report -Path for .gcno/.gcda coverage files is: -Command line exclusion flags for gcovr is: --exclude .*Tests.* --exclude .*3rd Party.* - -+ gcovr -r . --exclude .*Tests.* --exclude .*3rd Party.* --xml > sonar-reports/coverage-my Application.xml -Running OCLint... -Path included in oclint analysis is: --include .*/shell/src.* -+ oclint-json-compilation-database --include .*/shell/src.* -- -report-type pmd -o sonar-reports/oclint.xml -Running SonarQube using SonarQube Runner -+ sonar-runner ->>>= 0 - -# 3. Testing usage of a Xcode workspace -tee sonar-project.properties | cat > /dev/null; $RUNSONAR_HOME/run-sonar.sh -v -n -<<< -sonar.sources=src -sonar.objectivec.workspace=Application.xcworkspace -sonar.objectivec.project=Application.xcodeproj -sonar.objectivec.appScheme=Application -sonar.objectivec.testScheme=ApplicationTests -sonar.objectivec.excludedPathsFromCoverage=.*Tests.*,.*3rdParty.* ->>> -Running run-sonar.sh... -Xcode workspace file is: Application.xcworkspace -Xcode project file is: Application.xcodeproj -Xcode application scheme is: Application -Xcode test scheme is: ApplicationTests -Excluded paths from coverage are: .*Tests.*,.*3rdParty.* -Extracting Xcode project information -+ xctool -workspace Application.xcworkspace -sdk iphonesimulator ARCHS=i386 VALID_ARCHS=i386 CURRENT_ARCH=i386 ONLY_ACTIVE_ARCH=NO -scheme Application clean - -+ xctool -workspace Application.xcworkspace -sdk iphonesimulator ARCHS=i386 VALID_ARCHS=i386 CURRENT_ARCH=i386 ONLY_ACTIVE_ARCH=NO -scheme Application -reporter json-compilation-database:compile_commands.json build -Running tests using xctool -+ xctool -workspace Application.xcworkspace -sdk iphonesimulator ARCHS=i386 VALID_ARCHS=i386 CURRENT_ARCH=i386 ONLY_ACTIVE_ARCH=NO -scheme ApplicationTests -reporter junit GCC_GENERATE_TEST_COVERAGE_FILES=YES GCC_INSTRUMENT_PROGRAM_FLOW_ARCS=YES test > sonar-reports/TEST-report.xml -Computing coverage report -Path for .gcno/.gcda coverage files is: /Users/user/Library/Developer/Xcode/DerivedData/myApplication-hevorauelspmmeblhdabohacuurg/Build/Intermediates/Application.build/Debug-iphonesimulator/Application.build/Objects-normal/i386 -Command line exclusion flags for gcovr is: --exclude .*Tests.* --exclude .*3rdParty.* - -+ gcovr -r . /Users/user/Library/Developer/Xcode/DerivedData/myApplication-hevorauelspmmeblhdabohacuurg/Build/Intermediates/Application.build/Debug-iphonesimulator/Application.build/Objects-normal/i386 --exclude .*Tests.* --exclude .*3rdParty.* --xml > sonar-reports/coverage-Application.xml -Running OCLint... -Path included in oclint analysis is: --include .*/shell/src.* -+ oclint-json-compilation-database --include .*/shell/src.* -- -report-type pmd -o sonar-reports/oclint.xml -Running SonarQube using SonarQube Runner -+ sonar-runner ->>>= 0 - -# 4. Testing usage of multiple source directories -tee sonar-project.properties | cat > /dev/null; $RUNSONAR_HOME/run-sonar.sh -v -n -<<< -sonar.sources=src1,src2 -sonar.objectivec.project=Application.xcodeproj -sonar.objectivec.appScheme=Application -sonar.objectivec.testScheme=ApplicationTests -sonar.objectivec.excludedPathsFromCoverage=.*Tests.*,.*3rdParty.* ->>> -Running run-sonar.sh... -Xcode workspace file is: -Xcode project file is: Application.xcodeproj -Xcode application scheme is: Application -Xcode test scheme is: ApplicationTests -Excluded paths from coverage are: .*Tests.*,.*3rdParty.* -Extracting Xcode project information -+ xctool -project Application.xcodeproj -sdk iphonesimulator ARCHS=i386 VALID_ARCHS=i386 CURRENT_ARCH=i386 ONLY_ACTIVE_ARCH=NO -scheme Application clean - -+ xctool -project Application.xcodeproj -sdk iphonesimulator ARCHS=i386 VALID_ARCHS=i386 CURRENT_ARCH=i386 ONLY_ACTIVE_ARCH=NO -scheme Application -reporter json-compilation-database:compile_commands.json build -Running tests using xctool -+ xctool -project Application.xcodeproj -sdk iphonesimulator ARCHS=i386 VALID_ARCHS=i386 CURRENT_ARCH=i386 ONLY_ACTIVE_ARCH=NO -scheme ApplicationTests -reporter junit GCC_GENERATE_TEST_COVERAGE_FILES=YES GCC_INSTRUMENT_PROGRAM_FLOW_ARCS=YES test > sonar-reports/TEST-report.xml -Computing coverage report -Path for .gcno/.gcda coverage files is: /Users/user/Library/Developer/Xcode/DerivedData/myApplication-hevorauelspmmeblhdabohacuurg/Build/Intermediates/Application.build/Debug-iphonesimulator/Application.build/Objects-normal/i386 -Command line exclusion flags for gcovr is: --exclude .*Tests.* --exclude .*3rdParty.* - -+ gcovr -r . /Users/user/Library/Developer/Xcode/DerivedData/myApplication-hevorauelspmmeblhdabohacuurg/Build/Intermediates/Application.build/Debug-iphonesimulator/Application.build/Objects-normal/i386 --exclude .*Tests.* --exclude .*3rdParty.* --xml > sonar-reports/coverage-Application.xml -Running OCLint... -Path included in oclint analysis is: --include .*/shell/src1.* --include .*/shell/src2.* -+ oclint-json-compilation-database --include .*/shell/src1.* --include .*/shell/src2.* -- -report-type pmd -o sonar-reports/oclint.xml -Running SonarQube using SonarQube Runner -+ sonar-runner ->>>= 0 - -# x. Testing usage of -nooclint -tee sonar-project.properties | cat > /dev/null; $RUNSONAR_HOME/run-sonar.sh -v -n -nooclint -<<< -sonar.sources=src -sonar.objectivec.project=Application.xcodeproj -sonar.objectivec.appScheme=Application -sonar.objectivec.testScheme=ApplicationTests -sonar.objectivec.excludedPathsFromCoverage=.*Tests.*,.*3rdParty.* ->>> -Running run-sonar.sh... -Xcode workspace file is: -Xcode project file is: Application.xcodeproj -Xcode application scheme is: Application -Xcode test scheme is: ApplicationTests -Excluded paths from coverage are: .*Tests.*,.*3rdParty.* -Extracting Xcode project information -+ xctool -project Application.xcodeproj -sdk iphonesimulator ARCHS=i386 VALID_ARCHS=i386 CURRENT_ARCH=i386 ONLY_ACTIVE_ARCH=NO -scheme Application clean - -+ xctool -project Application.xcodeproj -sdk iphonesimulator ARCHS=i386 VALID_ARCHS=i386 CURRENT_ARCH=i386 ONLY_ACTIVE_ARCH=NO -scheme Application -reporter json-compilation-database:compile_commands.json build -Running tests using xctool -+ xctool -project Application.xcodeproj -sdk iphonesimulator ARCHS=i386 VALID_ARCHS=i386 CURRENT_ARCH=i386 ONLY_ACTIVE_ARCH=NO -scheme ApplicationTests -reporter junit GCC_GENERATE_TEST_COVERAGE_FILES=YES GCC_INSTRUMENT_PROGRAM_FLOW_ARCS=YES test > sonar-reports/TEST-report.xml -Computing coverage report -Path for .gcno/.gcda coverage files is: /Users/user/Library/Developer/Xcode/DerivedData/myApplication-hevorauelspmmeblhdabohacuurg/Build/Intermediates/Application.build/Debug-iphonesimulator/Application.build/Objects-normal/i386 -Command line exclusion flags for gcovr is: --exclude .*Tests.* --exclude .*3rdParty.* - -+ gcovr -r . /Users/user/Library/Developer/Xcode/DerivedData/myApplication-hevorauelspmmeblhdabohacuurg/Build/Intermediates/Application.build/Debug-iphonesimulator/Application.build/Objects-normal/i386 --exclude .*Tests.* --exclude .*3rdParty.* --xml > sonar-reports/coverage-Application.xml -Skipping OCLint (test purposes only!) -Running SonarQube using SonarQube Runner -+ sonar-runner ->>>= 0 - -# x. No test scheme provided -tee sonar-project.properties | cat > /dev/null; $RUNSONAR_HOME/run-sonar.sh -v -n -<<< -sonar.sources=src -sonar.objectivec.project=Application.xcodeproj -sonar.objectivec.appScheme=Application -sonar.objectivec.excludedPathsFromCoverage=.*Tests.*,.*3rdParty.* ->>> -Running run-sonar.sh... -Xcode workspace file is: -Xcode project file is: Application.xcodeproj -Xcode application scheme is: Application -Xcode test scheme is: -Excluded paths from coverage are: .*Tests.*,.*3rdParty.* -Extracting Xcode project information -+ xctool -project Application.xcodeproj -sdk iphonesimulator ARCHS=i386 VALID_ARCHS=i386 CURRENT_ARCH=i386 ONLY_ACTIVE_ARCH=NO -scheme Application clean - -+ xctool -project Application.xcodeproj -sdk iphonesimulator ARCHS=i386 VALID_ARCHS=i386 CURRENT_ARCH=i386 ONLY_ACTIVE_ARCH=NO -scheme Application -reporter json-compilation-database:compile_commands.json build -Skipping tests as no test scheme has been provided! -Running OCLint... -Path included in oclint analysis is: --include .*/shell/src.* -+ oclint-json-compilation-database --include .*/shell/src.* -- -report-type pmd -o sonar-reports/oclint.xml -Running SonarQube using SonarQube Runner -+ sonar-runner ->>>= 0 - -# x. No excluded path from coverage provided -tee sonar-project.properties | cat > /dev/null; $RUNSONAR_HOME/run-sonar.sh -v -n -<<< -sonar.sources=src -sonar.objectivec.project=Application.xcodeproj -sonar.objectivec.appScheme=Application -sonar.objectivec.testScheme=ApplicationTests ->>> -Running run-sonar.sh... -Xcode workspace file is: -Xcode project file is: Application.xcodeproj -Xcode application scheme is: Application -Xcode test scheme is: ApplicationTests -Excluded paths from coverage are: -Extracting Xcode project information -+ xctool -project Application.xcodeproj -sdk iphonesimulator ARCHS=i386 VALID_ARCHS=i386 CURRENT_ARCH=i386 ONLY_ACTIVE_ARCH=NO -scheme Application clean - -+ xctool -project Application.xcodeproj -sdk iphonesimulator ARCHS=i386 VALID_ARCHS=i386 CURRENT_ARCH=i386 ONLY_ACTIVE_ARCH=NO -scheme Application -reporter json-compilation-database:compile_commands.json build -Running tests using xctool -+ xctool -project Application.xcodeproj -sdk iphonesimulator ARCHS=i386 VALID_ARCHS=i386 CURRENT_ARCH=i386 ONLY_ACTIVE_ARCH=NO -scheme ApplicationTests -reporter junit GCC_GENERATE_TEST_COVERAGE_FILES=YES GCC_INSTRUMENT_PROGRAM_FLOW_ARCS=YES test > sonar-reports/TEST-report.xml -Computing coverage report -Path for .gcno/.gcda coverage files is: /Users/user/Library/Developer/Xcode/DerivedData/myApplication-hevorauelspmmeblhdabohacuurg/Build/Intermediates/Application.build/Debug-iphonesimulator/Application.build/Objects-normal/i386 -Command line exclusion flags for gcovr is: - -+ gcovr -r . /Users/user/Library/Developer/Xcode/DerivedData/myApplication-hevorauelspmmeblhdabohacuurg/Build/Intermediates/Application.build/Debug-iphonesimulator/Application.build/Objects-normal/i386 --xml > sonar-reports/coverage-Application.xml -Running OCLint... -Path included in oclint analysis is: --include .*/shell/src.* -+ oclint-json-compilation-database --include .*/shell/src.* -- -report-type pmd -o sonar-reports/oclint.xml -Running SonarQube using SonarQube Runner -+ sonar-runner ->>>= 0 - - -# 5. Setup specific compile_commands.json -tee compile_commands.json | cat > /dev/null -<<< -[ - { - "command" : "blablabla -o \/Users\/user\/Library\/Developer\/Xcode\/DerivedData\/myApplication-hevorauelspmmeblhdabohacuurg\/Build\/Intermediates\/MyDependency.build\/Debug-iphonesimulator\/MyDependency.build\/Objects-normal\/i386\/myFile.o", - "directory" : "titi", - "file" : "myFile.m" - } - { - "command" : "blablabla -o \/Users\/user\/Library\/Developer\/Xcode\/DerivedData\/myApplication-hevorauelspmmeblhdabohacuurg\/Build\/Intermediates\/Application.build\/Debug-iphonesimulator\/Application.build\/Objects-normal\/i386\/myFile.o", - "directory" : "titi", - "file" : "myFile.m" - } -] ->>>= 0 - -# 6. Testing filtering of external projects in workspace -tee sonar-project.properties | cat > /dev/null; $RUNSONAR_HOME/run-sonar.sh -v -n -<<< -sonar.sources=src -sonar.objectivec.workspace=Application.xcworkspace -sonar.objectivec.project=Application.xcodeproj -sonar.objectivec.appScheme=Application -sonar.objectivec.testScheme=ApplicationTests -sonar.objectivec.excludedPathsFromCoverage=.*Tests.*,.*3rdParty.* ->>> -Running run-sonar.sh... -Xcode workspace file is: Application.xcworkspace -Xcode project file is: Application.xcodeproj -Xcode application scheme is: Application -Xcode test scheme is: ApplicationTests -Excluded paths from coverage are: .*Tests.*,.*3rdParty.* -Extracting Xcode project information -+ xctool -workspace Application.xcworkspace -sdk iphonesimulator ARCHS=i386 VALID_ARCHS=i386 CURRENT_ARCH=i386 ONLY_ACTIVE_ARCH=NO -scheme Application clean - -+ xctool -workspace Application.xcworkspace -sdk iphonesimulator ARCHS=i386 VALID_ARCHS=i386 CURRENT_ARCH=i386 ONLY_ACTIVE_ARCH=NO -scheme Application -reporter json-compilation-database:compile_commands.json build -Running tests using xctool -+ xctool -workspace Application.xcworkspace -sdk iphonesimulator ARCHS=i386 VALID_ARCHS=i386 CURRENT_ARCH=i386 ONLY_ACTIVE_ARCH=NO -scheme ApplicationTests -reporter junit GCC_GENERATE_TEST_COVERAGE_FILES=YES GCC_INSTRUMENT_PROGRAM_FLOW_ARCS=YES test > sonar-reports/TEST-report.xml -Computing coverage report -Path for .gcno/.gcda coverage files is: /Users/user/Library/Developer/Xcode/DerivedData/myApplication-hevorauelspmmeblhdabohacuurg/Build/Intermediates/Application.build/Debug-iphonesimulator/Application.build/Objects-normal/i386 -Command line exclusion flags for gcovr is: --exclude .*Tests.* --exclude .*3rdParty.* - -+ gcovr -r . /Users/user/Library/Developer/Xcode/DerivedData/myApplication-hevorauelspmmeblhdabohacuurg/Build/Intermediates/Application.build/Debug-iphonesimulator/Application.build/Objects-normal/i386 --exclude .*Tests.* --exclude .*3rdParty.* --xml > sonar-reports/coverage-Application.xml -Running OCLint... -Path included in oclint analysis is: --include .*/shell/src.* -+ oclint-json-compilation-database --include .*/shell/src.* -- -report-type pmd -o sonar-reports/oclint.xml -Running SonarQube using SonarQube Runner -+ sonar-runner ->>>= 0 - -# 7. Setup specific compile_commands.json with 2 projects in workspace -tee compile_commands.json | cat > /dev/null -<<< -[ - { - "command" : "blablabla -o \/Users\/user\/Library\/Developer\/Xcode\/DerivedData\/myApplication-hevorauelspmmeblhdabohacuurg\/Build\/Intermediates\/Application1.build\/Debug-iphonesimulator\/Application1.build\/Objects-normal\/i386\/myFile.o", - "directory" : "titi", - "file" : "myFile.m" - } - { - "command" : "blablabla -o \/Users\/user\/Library\/Developer\/Xcode\/DerivedData\/myApplication-hevorauelspmmeblhdabohacuurg\/Build\/Intermediates\/Application2.build\/Debug-iphonesimulator\/Application2.build\/Objects-normal\/i386\/myFile.o", - "directory" : "titi", - "file" : "myFile.m" - } -] ->>>= 0 - -# 8. Testing filtering of external projects in workspace -tee sonar-project.properties | cat > /dev/null; $RUNSONAR_HOME/run-sonar.sh -v -n -<<< -sonar.sources=src -sonar.objectivec.workspace=Application.xcworkspace -sonar.objectivec.project=Application1.xcodeproj,Application2.xcodeproj -sonar.objectivec.appScheme=Application -sonar.objectivec.testScheme=ApplicationTests -sonar.objectivec.excludedPathsFromCoverage=.*Tests.*,.*3rdParty.* ->>> -Running run-sonar.sh... -Xcode workspace file is: Application.xcworkspace -Xcode project file is: Application1.xcodeproj,Application2.xcodeproj -Xcode application scheme is: Application -Xcode test scheme is: ApplicationTests -Excluded paths from coverage are: .*Tests.*,.*3rdParty.* -Extracting Xcode project information -+ xctool -workspace Application.xcworkspace -sdk iphonesimulator ARCHS=i386 VALID_ARCHS=i386 CURRENT_ARCH=i386 ONLY_ACTIVE_ARCH=NO -scheme Application clean - -+ xctool -workspace Application.xcworkspace -sdk iphonesimulator ARCHS=i386 VALID_ARCHS=i386 CURRENT_ARCH=i386 ONLY_ACTIVE_ARCH=NO -scheme Application -reporter json-compilation-database:compile_commands.json build -Running tests using xctool -+ xctool -workspace Application.xcworkspace -sdk iphonesimulator ARCHS=i386 VALID_ARCHS=i386 CURRENT_ARCH=i386 ONLY_ACTIVE_ARCH=NO -scheme ApplicationTests -reporter junit GCC_GENERATE_TEST_COVERAGE_FILES=YES GCC_INSTRUMENT_PROGRAM_FLOW_ARCS=YES test > sonar-reports/TEST-report.xml -Computing coverage report -Path for .gcno/.gcda coverage files is: /Users/user/Library/Developer/Xcode/DerivedData/myApplication-hevorauelspmmeblhdabohacuurg/Build/Intermediates/Application1.build/Debug-iphonesimulator/Application1.build/Objects-normal/i386 -Command line exclusion flags for gcovr is: --exclude .*Tests.* --exclude .*3rdParty.* - -+ gcovr -r . /Users/user/Library/Developer/Xcode/DerivedData/myApplication-hevorauelspmmeblhdabohacuurg/Build/Intermediates/Application1.build/Debug-iphonesimulator/Application1.build/Objects-normal/i386 --exclude .*Tests.* --exclude .*3rdParty.* --xml > sonar-reports/coverage-Application1.xml - -Path for .gcno/.gcda coverage files is: /Users/user/Library/Developer/Xcode/DerivedData/myApplication-hevorauelspmmeblhdabohacuurg/Build/Intermediates/Application2.build/Debug-iphonesimulator/Application2.build/Objects-normal/i386 -Command line exclusion flags for gcovr is: --exclude .*Tests.* --exclude .*3rdParty.* - -+ gcovr -r . /Users/user/Library/Developer/Xcode/DerivedData/myApplication-hevorauelspmmeblhdabohacuurg/Build/Intermediates/Application2.build/Debug-iphonesimulator/Application2.build/Objects-normal/i386 --exclude .*Tests.* --exclude .*3rdParty.* --xml > sonar-reports/coverage-Application2.xml -Running OCLint... -Path included in oclint analysis is: --include .*/shell/src.* -+ oclint-json-compilation-database --include .*/shell/src.* -- -report-type pmd -o sonar-reports/oclint.xml -Running SonarQube using SonarQube Runner -+ sonar-runner ->>>= 0 - - - - diff --git a/src/test/shell/usage.test b/src/test/shell/usage.test deleted file mode 100644 index 5f613c80..00000000 --- a/src/test/shell/usage.test +++ /dev/null @@ -1,34 +0,0 @@ -# 1. Incorrect usage -$RUNSONAR_HOME/run-sonar.sh -titi ->>>2 /Usage: .*run-sonar\.sh \[-v\]/ ->>>= !0 - -# 2. Correct usage -rm -rf sonar-project.properties; $RUNSONAR_HOME/run-sonar.sh ->>> /Running run-sonar.sh\.\.\./ ->>>= !0 - -# 3. Correct usage and verbose -rm -rf sonar-project.properties; $RUNSONAR_HOME/run-sonar.sh -v ->>> /Running run-sonar.sh\.\.\./ ->>>= !0 - -# 4. xctool not installed -# export PATH="/usr/bin:/bin:/usr/sbin:/Users/cpicat/.cabal/bin"; $RUNSONAR_HOME/run-sonar.sh -# >>>2 /ERROR - xctool is not installed or not in your PATH/ -# >>>= !0 - -# 5. gcovr not installed -# mv /Applications/InstalledSoftware/gcovr /Applications/InstalledSoftware/gcovr2; $RUNSONAR_HOME//run-sonar.sh; mv /Applications/InstalledSoftware/gcovr2 /Applications/InstalledSoftware/gcovr -# >>>2 /ERROR - gcovr is not installed or not in your PATH/ -# >>>= 0 - -# 6. oclint not installed -# mv /Applications/InstalledSoftware/oclint-0.8.dev.2888e0f/bin/oclint /Applications/InstalledSoftware/oclint-0.8.dev.2888e0f/bin/oclint2; $RUNSONAR_HOME/run-sonar.sh; mv /Applications/InstalledSoftware/oclint-0.8.dev.2888e0f/bin/oclint2 /Applications/InstalledSoftware/oclint-0.8.dev.2888e0f/bin/oclint -# >>>2 /ERROR - oclint is not installed or not in your PATH/ -# >>>= !0 - -# 7. No sonar-project.properties in current directory -$RUNSONAR_HOME/run-sonar.sh ->>>2 /ERROR - No sonar-project.properties in current directory/ ->>>= !0