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

Vedant Kumar via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 26 15:07:35 PDT 2016


Author: vedantk
Date: Wed Oct 26 17:07:35 2016
New Revision: 285247

URL: http://llvm.org/viewvc/llvm-project?rev=285247&view=rev
Log:
[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.

Modified:
    llvm/trunk/utils/prepare-code-coverage-artifact.py

Modified: llvm/trunk/utils/prepare-code-coverage-artifact.py
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/prepare-code-coverage-artifact.py?rev=285247&r1=285246&r2=285247&view=diff
==============================================================================
--- llvm/trunk/utils/prepare-code-coverage-artifact.py (original)
+++ llvm/trunk/utils/prepare-code-coverage-artifact.py Wed Oct 26 17:07:35 2016
@@ -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)




More information about the llvm-commits mailing list