[utils] Add an '--only-merge' option to the code coverage prep script

In --only-merge mode, the script terminates after the profile merging
step.  This makes the script less stateful: it's more natural to split
the merge out into a separate step instead of relying on the first
invocation of the script to do it.

This should not break any existing users of the script.

llvm-svn: 285247
This commit is contained in:
Vedant Kumar 2016-10-26 22:07:35 +00:00
parent ca8370396a
commit 273b6dc3e2
1 changed files with 11 additions and 3 deletions

View File

@ -58,8 +58,11 @@ if __name__ == '__main__':
help='Path to the directory containing the raw profiles')
parser.add_argument('report_dir',
help='Path to the output directory for html reports')
parser.add_argument('binaries', metavar='B', type=str, nargs='+',
parser.add_argument('binaries', metavar='B', type=str, nargs='*',
help='Path to an instrumented binary')
parser.add_argument('--only-merge', action='store_true',
help='Only merge raw profiles together, skip report '
'generation')
parser.add_argument('--preserve-profiles',
help='Do not delete raw profiles', action='store_true')
parser.add_argument('--use-existing-profdata',
@ -69,6 +72,10 @@ if __name__ == '__main__':
help='Restrict the reporting to the given source paths')
args = parser.parse_args()
if args.use_existing_profdata and args.only_merge:
print '--use-existing-profdata and --only-merge are incompatible'
exit(1)
if args.use_existing_profdata:
profdata_path = args.use_existing_profdata
else:
@ -76,5 +83,6 @@ if __name__ == '__main__':
args.profile_data_dir,
args.preserve_profiles)
prepare_html_reports(args.host_llvm_cov, profdata_path, args.report_dir,
args.binaries, args.restrict)
if not args.only_merge:
prepare_html_reports(args.host_llvm_cov, profdata_path, args.report_dir,
args.binaries, args.restrict)