-
-
Notifications
You must be signed in to change notification settings - Fork 245
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #627 from andreasfertig/codecov
- Loading branch information
Showing
5 changed files
with
144 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
fixes: | ||
- "cppinsights/::" | ||
- "/home/runner/work/cppinsights/cppinsights/::" | ||
- "/Users/runner/work/cppinsights/cppinsights/::" | ||
- "github/workspace/::" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
#! /usr/bin/env python3 | ||
#------------------------------------------------------------------------------ | ||
|
||
import os | ||
import sys | ||
import argparse | ||
import glob | ||
import subprocess | ||
#------------------------------------------------------------------------------ | ||
|
||
def runCmd(cmd, data=None): | ||
if input is None: | ||
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) | ||
stdout, stderr = p.communicate() | ||
else: | ||
p = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE) | ||
stdout, stderr = p.communicate(input=data) | ||
|
||
return stdout.decode('utf-8'), stderr.decode('utf-8'), p.returncode | ||
#------------------------------------------------------------------------------ | ||
|
||
def main(): | ||
parser = argparse.ArgumentParser(description='llvm-coverage') | ||
parser.add_argument('--insights', help='C++ Insights binary', required=True) | ||
parser.add_argument('--llvm-prof-dir', help='LLVM profiles data dir', default='') | ||
parser.add_argument('--format', help='Output format: html/text', default='text') | ||
parser.add_argument('--output', help='Output filename', required=True) | ||
parser.add_argument('args', nargs=argparse.REMAINDER) | ||
args = vars(parser.parse_args()) | ||
|
||
insightsPath = args['insights'] | ||
rawProfiles = glob.glob(os.path.join(args['llvm_prof_dir'], "*.profraw")) | ||
profilesManifest = os.path.join(args['llvm_prof_dir'], 'profiles.manifest') | ||
profilesData = os.path.join(args['llvm_prof_dir'], 'insights.profdata') | ||
|
||
with open(profilesManifest, "w") as manifest: | ||
manifest.write("\n".join(rawProfiles)) | ||
|
||
cmd = ['llvm-profdata', 'merge', '-sparse', '-f', profilesManifest, '-o', profilesData] | ||
stdout, stderr, returncode = runCmd(cmd) | ||
print(stderr) | ||
|
||
cmd = ['llvm-cov', 'show', insightsPath, f'-instr-profile={profilesData}', f'--format={args["format"]}', '-ignore-filename-regex=build/'] | ||
stdout, stderr, returncode = runCmd(cmd) | ||
print(stderr) | ||
|
||
open(args['output'], 'w').write(stdout) | ||
#------------------------------------------------------------------------------ | ||
|
||
|
||
sys.exit(main()) | ||
#------------------------------------------------------------------------------ | ||
|
||
|
Oops, something went wrong.