Commit 36593a9b authored by Ben Cooksley's avatar Ben Cooksley

Finish preparing LCov handling

parent 2902e1ab
"cmake-options": "-DKWIN_BUILD_COVERAGE=ON"
"lcov-extractor-arguments": '-e "autotests/.*" -e "tabbox/autotests/.*" -e "libkwineffects/autotests/.*"'
import os
import sys
import argparse
import subprocess
from helperslib import BuildSpecs, CommonUtils
# Parse the command line arguments we've been given
parser = argparse.ArgumentParser(description='Utility to execute gcovr to extract LCov results (in Cobertura format).')
parser.add_argument('--product', type=str, required=True)
parser.add_argument('--project', type=str, required=True)
parser.add_argument('--branchGroup', type=str, required=True)
parser.add_argument('--platform', type=str, required=True)
arguments = parser.parse_args()
# Load our build specification, which governs how we handle running GCovr
buildSpecification = BuildSpecs.Loader( product=arguments.product, project=arguments.project, branchGroup=arguments.branchGroup, platform=arguments.platform )
# Determine where our source code is checked out to
# We'll assume that the directory we're running from is where the sources are located
sourcesLocation = os.getcwd()
# If we aren't running on Linux then bail as it's not known if GCovr works outside Linux
if sys.platform != "linux" or not buildSpecification['extract-lcov-results']:
# Bail!
# Determine the command we need to run
# We ask GCovr to exclude the build directory by default as we don't want generated artifacts (like moc files) getting included as well
# Sometimes projects will want to customise things slightly so we provide for that as well
commandToRun = 'gcovr -x -e "build/.*" -r {sources} {otherArguments}'
commandToRun = commandToRun.format( sources=sourcesLocation, otherArguments=buildSpecification['lcov-extractor-arguments'] )
# Now run it!
subprocess.check_call( commandToRun, stdout=sys.stdout, stderr=sys.stderr, shell=True )
except Exception:
# LCov extraction was successful
......@@ -117,6 +117,10 @@ node( currentPlatform ) {
// See
// Perform Cobertura Processing
// First, run the LCov extraction
sh "python3 -u ci-tooling/helpers/ --product ${productName} --project ${projectName} --branchGroup ${branchGroup} --platform ${currentPlatform}"
// Collect the results from the LCov extraction
$class: 'CoberturaPublisher',
autoUpdateHealth: false, autoUpdateStability: false,
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment