Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
[![Build Status](https://travis-ci.org/wenns/sonar-cxx.svg?branch=master)](https://travis-ci.org/wenns/sonar-cxx)
[![Build status](https://ci.appveyor.com/api/projects/status/mi5ft6fo1qx3q8o7?svg=true)](https://ci.appveyor.com/project/jorgecosta/sonar-cxx)


## SonarQube C++ Community plugin

Expand Down
41 changes: 41 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
version: '{build}'
os: Windows Server 2012
install:
- ps: |
Add-Type -AssemblyName System.IO.Compression.FileSystem
if (!(Test-Path -Path "C:\maven" )) {
(new-object System.Net.WebClient).DownloadFile(
'http://www.us.apache.org/dist/maven/maven-3/3.2.5/binaries/apache-maven-3.2.5-bin.zip',
'C:\maven-bin.zip'
)
[System.IO.Compression.ZipFile]::ExtractToDirectory("C:\maven-bin.zip", "C:\maven")
}
- ps: |
If ($env:Platform -Match "x86") {
$env:PCRE_PLATFORM="Win32"
$env:JAVA_HOME="c:/Program Files (x86)/Java/jdk1.8.0"
$env:MSBuildDir="C:/Program Files (x86)/MSBuild/14.0/Bin/msbuild.exe"
$env:VCVARS_PLATFORM="x86"
$env:LANG_PLATFORM=""
} Else {
$env:PCRE_PLATFORM="x64"
$env:JAVA_HOME="c:/Program Files/Java/jdk1.8.0"
$env:MSBuildDir="C:/Program Files/MSBuild/14.0/Bin/msbuild.exe"
$env:VCVARS_PLATFORM="amd64"
$env:LANG_PLATFORM="-x64"
}
- cmd: SET PATH=C:\maven\apache-maven-3.2.5\bin;%JAVA_HOME%\bin;%PATH%
- cmd: SET
build_script:
- mvn clean install
cache:
- C:\maven\
- C:\Users\appveyor\.m2
artifacts:
- path: 'sonar-cxx-plugin\target\sonar-cxx-plugin-0.9.4-SNAPSHOT.jar'
- path: 'sslr-cxx-toolkit\target\sslr-cxx-toolkit-0.9.4-SNAPSHOT.jar'
on_failure:
- ps: Get-ChildItem cxx-squid\target\surefire-reports\*.txt | % { Push-AppveyorArtifact $_.FullName -FileName $_.Name }
- ps: Get-ChildItem cxx-checks\target\surefire-reports\*.txt | % { Push-AppveyorArtifact $_.FullName -FileName $_.Name }
- ps: Get-ChildItem sonar-cxx-plugin\target\surefire-reports\*.txt | % { Push-AppveyorArtifact $_.FullName -FileName $_.Name }

620 changes: 310 additions & 310 deletions cxx-squid/src/test/resources/compiler/vc++13.txt

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import org.sonar.plugins.cxx.utils.CxxUtils;

public class CxxBullseyeCoverageSensorTest {

Expand All @@ -63,16 +64,16 @@ public void shouldReportCorrectCoverage() {
settings.setProperty(CxxCoverageSensor.REPORT_PATH_KEY, "coverage-reports/bullseye/coverage-result-bullseye-win.xml");
settings.setProperty(CxxCoverageSensor.IT_REPORT_PATH_KEY, "coverage-reports/bullseye/coverage-result-bullseye-win.xml");
settings.setProperty(CxxCoverageSensor.OVERALL_REPORT_PATH_KEY, "coverage-reports/bullseye/coverage-result-bullseye-win.xml");
TestUtils.addInputFile(fs, perspectives, issuable, "d:/home/path/TESTCOV/src/testclass.h");
TestUtils.addInputFile(fs, perspectives, issuable, "d:/home/path/TESTCOV/src/testclass.cpp");
TestUtils.addInputFile(fs, perspectives, issuable, "d:/home/path/TESTCOV/main.cpp");
TestUtils.addInputFile(fs, perspectives, issuable, "d:/home/path/TESTCOV/testclass.h");
TestUtils.addInputFile(fs, perspectives, issuable, "d:/home/path/TESTCOV/testclass.cpp");
TestUtils.addInputFile(fs, perspectives, issuable, "d:/home/path/TESTCOV/source_1.cpp");
TestUtils.addInputFile(fs, perspectives, issuable, "d:/home/path/TESTCOV/src/testclass.h");
TestUtils.addInputFile(fs, perspectives, issuable, "d:/home/path/TESTCOV/src/testclass.cpp");
TestUtils.addInputFile(fs, perspectives, issuable, "d:/home/path/TESTCOV/main.cpp");
TestUtils.addInputFile(fs, perspectives, issuable, "d:/home/path/TESTCOV/testclass.h");
TestUtils.addInputFile(fs, perspectives, issuable, CxxUtils.normalizePath("c:/home/path/TESTCOV/src/testclass.h"));
TestUtils.addInputFile(fs, perspectives, issuable, CxxUtils.normalizePath("c:/home/path/TESTCOV/src/testclass.cpp"));
TestUtils.addInputFile(fs, perspectives, issuable, CxxUtils.normalizePath("c:/home/path/TESTCOV/main.cpp"));
TestUtils.addInputFile(fs, perspectives, issuable, CxxUtils.normalizePath("c:/home/path/TESTCOV/testclass.h"));
TestUtils.addInputFile(fs, perspectives, issuable, CxxUtils.normalizePath("c:/home/path/TESTCOV/testclass.cpp"));
TestUtils.addInputFile(fs, perspectives, issuable, CxxUtils.normalizePath("c:/home/path/TESTCOV/source_1.cpp"));
TestUtils.addInputFile(fs, perspectives, issuable, CxxUtils.normalizePath("c:/home/path/TESTCOV/src/testclass.h"));
TestUtils.addInputFile(fs, perspectives, issuable, CxxUtils.normalizePath("c:/home/path/TESTCOV/src/testclass.cpp"));
TestUtils.addInputFile(fs, perspectives, issuable, CxxUtils.normalizePath("c:/home/path/TESTCOV/main.cpp"));
TestUtils.addInputFile(fs, perspectives, issuable, CxxUtils.normalizePath("c:/home/path/TESTCOV/testclass.h"));
} else {
settings.setProperty(CxxCoverageSensor.REPORT_PATH_KEY, "coverage-reports/bullseye/coverage-result-bullseye-linux.xml");
settings.setProperty(CxxCoverageSensor.IT_REPORT_PATH_KEY, "coverage-reports/bullseye/coverage-result-bullseye-linux.xml");
Expand All @@ -98,16 +99,16 @@ public void shoulParseTopLevelFiles() {
Settings settings = new Settings();
if (TestUtils.isWindows()) {
settings.setProperty(CxxCoverageSensor.REPORT_PATH_KEY, "coverage-reports/bullseye/bullseye-coverage-report-data-in-root-node-win.xml");
TestUtils.addInputFile(fs, perspectives, issuable, "e:/randomfoldernamethatihopeknowmachinehas/anotherincludeattop.h");
TestUtils.addInputFile(fs, perspectives, issuable, "e:/randomfoldernamethatihopeknowmachinehas/test/test.c");
TestUtils.addInputFile(fs, perspectives, issuable, "e:/randomfoldernamethatihopeknowmachinehas/test2/test2.c");
TestUtils.addInputFile(fs, perspectives, issuable, "e:/randomfoldernamethatihopeknowmachinehas/main.c");
TestUtils.addInputFile(fs, perspectives, issuable, CxxUtils.normalizePath("C:/randomfoldernamethatihopeknowmachinehas/anotherincludeattop.h"));
TestUtils.addInputFile(fs, perspectives, issuable, CxxUtils.normalizePath("C:/randomfoldernamethatihopeknowmachinehas/test/test.c"));
TestUtils.addInputFile(fs, perspectives, issuable, CxxUtils.normalizePath("C:/randomfoldernamethatihopeknowmachinehas/test2/test2.c"));
TestUtils.addInputFile(fs, perspectives, issuable, CxxUtils.normalizePath("C:/randomfoldernamethatihopeknowmachinehas/main.c"));
} else {
settings.setProperty(CxxCoverageSensor.REPORT_PATH_KEY, "coverage-reports/bullseye/bullseye-coverage-report-data-in-root-node-linux.xml");
TestUtils.addInputFile(fs, perspectives, issuable, "/e/test/anotherincludeattop.h");
TestUtils.addInputFile(fs, perspectives, issuable, "/e/test/test/test.c");
TestUtils.addInputFile(fs, perspectives, issuable, "/e/test/test2/test2.c");
TestUtils.addInputFile(fs, perspectives, issuable, "/e/test/main.c");
TestUtils.addInputFile(fs, perspectives, issuable, "/c/test/anotherincludeattop.h");
TestUtils.addInputFile(fs, perspectives, issuable, "/c/test/test/test.c");
TestUtils.addInputFile(fs, perspectives, issuable, "/c/test/test2/test2.c");
TestUtils.addInputFile(fs, perspectives, issuable, "/c/test/main.c");
}
sensor = new CxxCoverageSensor(settings, fs, TestUtils.mockReactor());
sensor.analyse(project, context);
Expand All @@ -119,17 +120,17 @@ public void shoulCorrectlyHandleDriveLettersWithoutSlash() {
Settings settings = new Settings();
if (TestUtils.isWindows()) {
settings.setProperty(CxxCoverageSensor.REPORT_PATH_KEY, "coverage-reports/bullseye/bullseye-coverage-drive-letter-without-slash-win.xml");
TestUtils.addInputFile(fs, perspectives, issuable, "e:/main.c");
TestUtils.addInputFile(fs, perspectives, issuable, "e:/randomfoldernamethatihopeknowmachinehas/test.c");
TestUtils.addInputFile(fs, perspectives, issuable, "e:/randomfoldernamethatihopeknowmachinehas2/test2.c");
TestUtils.addInputFile(fs, perspectives, issuable, "e:/anotherincludeattop.h");
TestUtils.addInputFile(fs, perspectives, issuable, CxxUtils.normalizePath("C:/main.c"));
TestUtils.addInputFile(fs, perspectives, issuable, CxxUtils.normalizePath("C:/randomfoldernamethatihopeknowmachinehas/test.c"));
TestUtils.addInputFile(fs, perspectives, issuable, CxxUtils.normalizePath("C:/randomfoldernamethatihopeknowmachinehas2/test2.c"));
TestUtils.addInputFile(fs, perspectives, issuable, CxxUtils.normalizePath("C:/anotherincludeattop.h"));
}
else {
settings.setProperty(CxxCoverageSensor.REPORT_PATH_KEY, "coverage-reports/bullseye/bullseye-coverage-drive-letter-without-slash-linux.xml");
TestUtils.addInputFile(fs, perspectives, issuable, "/e/main.c");
TestUtils.addInputFile(fs, perspectives, issuable, "/e/test/test.c");
TestUtils.addInputFile(fs, perspectives, issuable, "/e/test2/test2.c");
TestUtils.addInputFile(fs, perspectives, issuable, "/e/anotherincludeattop.h");
TestUtils.addInputFile(fs, perspectives, issuable, "/c/main.c");
TestUtils.addInputFile(fs, perspectives, issuable, "/c/test/test.c");
TestUtils.addInputFile(fs, perspectives, issuable, "/c/test2/test2.c");
TestUtils.addInputFile(fs, perspectives, issuable, "/c/anotherincludeattop.h");
}
sensor = new CxxCoverageSensor(settings, fs, TestUtils.mockReactor());
sensor.analyse(project, context);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import static org.mockito.Mockito.mock;
import org.sonar.plugins.cxx.utils.CxxUtils;

public class CxxCoverageSensorTest {

Expand Down Expand Up @@ -133,9 +134,9 @@ public void shouldReportCoverageWhenVisualStudioCase() {
Settings settings = new Settings();
if (TestUtils.isWindows()) {
settings.setProperty(CxxCoverageSensor.REPORT_PATH_KEY, "coverage-reports/cobertura/specific-cases/coverage-result-visual-studio-win.xml");
TestUtils.addInputFile(fs, perspectives, issuable, "x:/coveragetest/project1/source1.cpp");
TestUtils.addInputFile(fs, perspectives, issuable, "x:/coveragetest/project2/source1.cpp");
TestUtils.addInputFile(fs, perspectives, issuable, "x:/coveragetest/project2/source2.cpp");
TestUtils.addInputFile(fs, perspectives, issuable, CxxUtils.normalizePath("C:/coveragetest/project1/source1.cpp"));
TestUtils.addInputFile(fs, perspectives, issuable, CxxUtils.normalizePath("C:/coveragetest/project2/source1.cpp"));
TestUtils.addInputFile(fs, perspectives, issuable, CxxUtils.normalizePath("C:/coveragetest/project2/source2.cpp"));
} else {
settings.setProperty(CxxCoverageSensor.REPORT_PATH_KEY, "coverage-reports/cobertura/specific-cases/coverage-result-visual-studio-linux.xml");
TestUtils.addInputFile(fs, perspectives, issuable, "/x/coveragetest/project1/source1.cpp");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<BullseyeCoverage name="coverage.cov" dir="/e" buildId="5e0cbdab, 2014-07-02 15:07:32" version="4" xmlns="http://www.bullseye.com/covxml">
<BullseyeCoverage name="coverage.cov" dir="/c" buildId="5e0cbdab, 2014-07-02 15:07:32" version="4" xmlns="http://www.bullseye.com/covxml">
<src name="anotherincludeattop.h" mtime="1404302508" fn_cov="1" fn_total="1" cd_cov="1" cd_total="2" d_cov="1" d_total="2">
<fn name="test_func_2(int)" fn_cov="1" fn_total="1" cd_cov="1" cd_total="2" d_cov="1" d_total="2">
<probe line="3" column="3" kind="function" event="full"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<BullseyeCoverage name="coverage.cov" dir="e:" buildId="5e0cbdab, 2014-07-02 15:07:32" version="4" xmlns="http://www.bullseye.com/covxml">
<BullseyeCoverage name="coverage.cov" dir="C:" buildId="5e0cbdab, 2014-07-02 15:07:32" version="4" xmlns="http://www.bullseye.com/covxml">
<src name="anotherincludeattop.h" mtime="1404302508" fn_cov="1" fn_total="1" cd_cov="1" cd_total="2" d_cov="1" d_total="2">
<fn name="test_func_2(int)" fn_cov="1" fn_total="1" cd_cov="1" cd_total="2" d_cov="1" d_total="2">
<probe line="3" column="3" kind="function" event="full"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<BullseyeCoverage name="coverage.cov" dir="/e/test/" buildId="5e0cbdab, 2014-07-02 15:07:32" version="4" xmlns="http://www.bullseye.com/covxml">
<BullseyeCoverage name="coverage.cov" dir="/c/test/" buildId="5e0cbdab, 2014-07-02 15:07:32" version="4" xmlns="http://www.bullseye.com/covxml">
<src name="anotherincludeattop.h" mtime="1404302508" fn_cov="1" fn_total="1" cd_cov="1" cd_total="2" d_cov="1" d_total="2">
<fn name="test_func_2(int)" fn_cov="1" fn_total="1" cd_cov="1" cd_total="2" d_cov="1" d_total="2">
<probe line="3" column="3" kind="function" event="full"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<BullseyeCoverage name="coverage.cov" dir="e:/randomfoldernamethatihopeknowmachinehas/" buildId="5e0cbdab, 2014-07-02 15:07:32" version="4" xmlns="http://www.bullseye.com/covxml">
<BullseyeCoverage name="coverage.cov" dir="C:/randomfoldernamethatihopeknowmachinehas/" buildId="5e0cbdab, 2014-07-02 15:07:32" version="4" xmlns="http://www.bullseye.com/covxml">
<src name="anotherincludeattop.h" mtime="1404302508" fn_cov="1" fn_total="1" cd_cov="1" cd_total="2" d_cov="1" d_total="2">
<fn name="test_func_2(int)" fn_cov="1" fn_total="1" cd_cov="1" cd_total="2" d_cov="1" d_total="2">
<probe line="3" column="3" kind="function" event="full"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- BullseyeCoverage 8.7.8 Linux x86 License 110389 -->
<BullseyeCoverage name="coveragefile.cov" dir="d:/home/path/" buildId="d80ba2ba, 2012-08-02 12:15:13" version="4" xmlns="http://www.bullseye.com/covxml">
<BullseyeCoverage name="coveragefile.cov" dir="C:/home/path/" buildId="d80ba2ba, 2012-08-02 12:15:13" version="4" xmlns="http://www.bullseye.com/covxml">
<folder name="TESTCOV" fn_cov="9" fn_total="15" cd_cov="34" cd_total="54" d_cov="18" d_total="30">
<src name="main.cpp" mtime="1343898900" fn_cov="1" fn_total="1" cd_cov="0" cd_total="0" d_cov="0" d_total="0">
<fn name="main(int,char**)" fn_cov="1" fn_total="1" cd_cov="0" cd_total="0" d_cov="0" d_total="0">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- BullseyeCoverage 8.7.48 Windows License 2656 -->
<BullseyeCoverage name="covfile.cov" dir="c:/Users/jocs/" buildId="9b33970f, 2013-03-14 21:52:40" version="4" xmlns="http://www.bullseye.com/covxml">
<BullseyeCoverage name="covfile.cov" dir="C:/Users/jocs/" buildId="9b33970f, 2013-03-14 21:52:40" version="4" xmlns="http://www.bullseye.com/covxml">
<folder name="e:" fn_cov="3" fn_total="5" cd_cov="0" cd_total="0" d_cov="0" d_total="0">
<folder name="Development" fn_cov="3" fn_total="5" cd_cov="0" cd_total="0" d_cov="0" d_total="0">
<folder name="sonar-cxx" fn_cov="3" fn_total="5" cd_cov="0" cd_total="0" d_cov="0" d_total="0">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</function>
</functions>
<source_files>
<source_file id="0" path="x:\coveragetest\project1\source1.cpp" checksum_type="MD5" checksum="026C9CDA50569DAD988498724697DC05">
<source_file id="0" path="c:\coveragetest\project1\source1.cpp" checksum_type="MD5" checksum="026C9CDA50569DAD988498724697DC05">
</source_file>
</source_files>
</module>
Expand Down Expand Up @@ -52,9 +52,9 @@
</function>
</functions>
<source_files>
<source_file id="0" path="x:\coveragetest\project2\source1.cpp" checksum_type="MD5" checksum="026C9CDA50569DAD988498724697DC05">
<source_file id="0" path="c:\coveragetest\project2\source1.cpp" checksum_type="MD5" checksum="026C9CDA50569DAD988498724697DC05">
</source_file>
<source_file id="1" path="x:\coveragetest\project2\source2.cpp" checksum_type="MD5" checksum="CEE3C0E3780C054D7C404DE46917FB6B">
<source_file id="1" path="c:\coveragetest\project2\source2.cpp" checksum_type="MD5" checksum="CEE3C0E3780C054D7C404DE46917FB6B">
</source_file>
</source_files>
</module>
Expand Down