diff options
author | Tobias Markmann <tm@ayena.de> | 2015-05-19 08:47:04 (GMT) |
---|---|---|
committer | Kevin Smith <kevin.smith@isode.com> | 2015-05-19 10:33:54 (GMT) |
commit | ed23f4578d6a5776b77e743ad54802d55f54f7e1 (patch) | |
tree | 36bd0737bf6a9890577baa796858d1ce75b62537 /BuildTools/Coverage | |
parent | e86a46545e23ad824d7013c3c57bd83a52ade9af (diff) | |
download | swift-ed23f4578d6a5776b77e743ad54802d55f54f7e1.zip swift-ed23f4578d6a5776b77e743ad54802d55f54f7e1.tar.bz2 |
Consolidate Python and SCons files to tab based indentation
Test-Information:
Verified that SCons still runs on OS X.
Change-Id: I7e9b97f90ee5581a691a959b6f2c999d93e0be53
Diffstat (limited to 'BuildTools/Coverage')
-rwxr-xr-x | BuildTools/Coverage/FilterLCovData.py | 25 | ||||
-rwxr-xr-x | BuildTools/Coverage/GenerateSummary.py | 32 |
2 files changed, 28 insertions, 29 deletions
diff --git a/BuildTools/Coverage/FilterLCovData.py b/BuildTools/Coverage/FilterLCovData.py index a3a7ee5..33fd682 100755 --- a/BuildTools/Coverage/FilterLCovData.py +++ b/BuildTools/Coverage/FilterLCovData.py @@ -7,24 +7,23 @@ import sys, re, os.path assert(len(sys.argv) == 2) def isIgnored(file) : - return (file.find("/Swiften/") == -1 and file.find("/Slimber/") == -1 and file.find("/Swift/") == -1) or (file.find("/UnitTest/") != -1 or file.find("/QA/") != -1) - + return (file.find("/Swiften/") == -1 and file.find("/Slimber/") == -1 and file.find("/Swift/") == -1) or (file.find("/UnitTest/") != -1 or file.find("/QA/") != -1) output = [] inputFile = open(sys.argv[1]) inIgnoredFile = False for line in inputFile.readlines() : - if inIgnoredFile : - if line == "end_of_record\n" : - inIgnoredFile = False - else : - if line.startswith("SF:") and isIgnored(line) : - inIgnoredFile = True - else : - m = re.match("SF:(.*)", line) - if m : - line = "SF:" + os.path.realpath(m.group(1)) + "\n" - output.append(line) + if inIgnoredFile : + if line == "end_of_record\n" : + inIgnoredFile = False + else : + if line.startswith("SF:") and isIgnored(line) : + inIgnoredFile = True + else : + m = re.match("SF:(.*)", line) + if m : + line = "SF:" + os.path.realpath(m.group(1)) + "\n" + output.append(line) inputFile.close() outputFile = open(sys.argv[1], 'w') diff --git a/BuildTools/Coverage/GenerateSummary.py b/BuildTools/Coverage/GenerateSummary.py index ec94a4f..e572082 100755 --- a/BuildTools/Coverage/GenerateSummary.py +++ b/BuildTools/Coverage/GenerateSummary.py @@ -8,27 +8,27 @@ inputFile = open(sys.argv[1]) currentFile = "" coverage = {} for line in inputFile.readlines() : - line = line.strip() - m = re.match("^SF:(.*)", line) - if m : - currentFile = m.group(1) - else : - m = re.match("^DA:(\d+),(\d+)", line) - if m : - currentFileCoverage = coverage.get(currentFile, {}) - line = int(m.group(1)) - count = int(m.group(2)) - currentFileCoverage[line] = currentFileCoverage.get(line, 0) + count - coverage[currentFile] = currentFileCoverage + line = line.strip() + m = re.match("^SF:(.*)", line) + if m : + currentFile = m.group(1) + else : + m = re.match("^DA:(\d+),(\d+)", line) + if m : + currentFileCoverage = coverage.get(currentFile, {}) + line = int(m.group(1)) + count = int(m.group(2)) + currentFileCoverage[line] = currentFileCoverage.get(line, 0) + count + coverage[currentFile] = currentFileCoverage inputFile.close() totalLines = 0 coveredLines = 0 for c in coverage.values() : - totalLines += len(c) - for l in c.values() : - if l > 0 : - coveredLines += 1 + totalLines += len(c) + for l in c.values() : + if l > 0 : + coveredLines += 1 outputFile = open(sys.argv[2], 'w') outputFile.write(str(coveredLines) + "/" + str(totalLines)) |