Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
path: root/scripts
diff options
context:
space:
mode:
authorsp-dani-garcia2019-08-29 17:47:56 +0200
committerMartin Hořeňovský2019-10-27 10:02:41 +0100
commit51b29ced1ac2bde83d977283f6e0b4f871898b8a (patch)
tree901d0ce6a74961c3917b5b04638bca21a0406e4d /scripts
parent9a558171d836cf7b292883b6f65bdd937c30cc76 (diff)
downloadcatch3-51b29ced1ac2bde83d977283f6e0b4f871898b8a.tar.gz
Add SonarQube Generic Test Data reporter
It outputs reports in the `Generic Execution Test Data` format, see https://docs.sonarqube.org/latest/analysis/generic-test/, specifically https://docs.sonarqube.org/latest/analysis/generic-test/#header-2 Close #1738 (this is a cherry-pick and fixup of that PR)
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/approvalTests.py4
-rw-r--r--scripts/releaseCommon.py2
2 files changed, 5 insertions, 1 deletions
diff --git a/scripts/approvalTests.py b/scripts/approvalTests.py
index bb01e6d5..dad2a96b 100755
--- a/scripts/approvalTests.py
+++ b/scripts/approvalTests.py
@@ -29,6 +29,7 @@ filelocParser = re.compile(r'''
lineNumberParser = re.compile(r' line="[0-9]*"')
hexParser = re.compile(r'\b(0[xX][0-9a-fA-F]+)\b')
durationsParser = re.compile(r' time="[0-9]*\.[0-9]*"')
+sonarqubeDurationParser = re.compile(r' duration="[0-9]+"')
timestampsParser = re.compile(r'\d{4}-\d{2}-\d{2}T\d{2}\:\d{2}\:\d{2}Z')
versionParser = re.compile(r'Catch v[0-9]+\.[0-9]+\.[0-9]+(-develop\.[0-9]+)?')
nullParser = re.compile(r'\b(__null|nullptr)\b')
@@ -138,6 +139,7 @@ def filterLine(line, isCompact):
# strip durations and timestamps
line = durationsParser.sub(' time="{duration}"', line)
+ line = sonarqubeDurationParser.sub(' duration="{duration}"', line)
line = timestampsParser.sub('{iso8601-timestamp}', line)
line = specialCaseParser.sub('file:\g<1>', line)
line = errnoParser.sub('errno', line)
@@ -204,6 +206,8 @@ approve("junit.sw", ["~[!nonportable]~[!benchmark]~[approvals]", "-s", "-w", "No
approve("xml.sw", ["~[!nonportable]~[!benchmark]~[approvals]", "-s", "-w", "NoAssertions", "-r", "xml", "--order", "lex", "--rng-seed", "1"])
# compact reporter, include passes, warn about No Assertions
approve('compact.sw', ['~[!nonportable]~[!benchmark]~[approvals]', '-s', '-w', 'NoAssertions', '-r', 'compact', '--order', 'lex', "--rng-seed", "1"])
+# sonarqube reporter, include passes, warn about No Assertions
+approve("sonarqube.sw", ["~[!nonportable]~[!benchmark]~[approvals]", "-s", "-w", "NoAssertions", "-r", "sonarqube", "--order", "lex", "--rng-seed", "1"])
if overallResult != 0:
print("If these differences are expected, run approve.py to approve new baselines.")
diff --git a/scripts/releaseCommon.py b/scripts/releaseCommon.py
index 102fe46a..283337d4 100644
--- a/scripts/releaseCommon.py
+++ b/scripts/releaseCommon.py
@@ -156,7 +156,7 @@ def performUpdates(version):
# We probably should have some kind of convention to select which reporters need to be copied automagically,
# but this works for now
import shutil
- for rep in ('automake', 'tap', 'teamcity'):
+ for rep in ('automake', 'tap', 'teamcity', 'sonarqube'):
sourceFile = os.path.join(catchPath, 'include/reporters/catch_reporter_{}.hpp'.format(rep))
destFile = os.path.join(catchPath, 'single_include', 'catch2', 'catch_reporter_{}.hpp'.format(rep))
shutil.copyfile(sourceFile, destFile)