[llvm] [Code Coverage] Add a tool to check test coverage of a patch (PR #71841)

Aiden Grossman via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 13 19:16:58 PST 2023


================
@@ -0,0 +1,722 @@
+#!/usr/bin/env python3
+#
+# ===- git-check-coverage - CheckCoverage Git Integration ---------*- python -*--===#
+#
+# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+# See https://llvm.org/LICENSE.txt for license information.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+#
+# ===------------------------------------------------------------------------===#
+
+r"""
+code-coverage git integration
+============================
+This file provides a code-coverage integration for git. Put it in your
+llvm-project root directory and ensure that it is executable. Code
+coverage information will be provided for the last commit/HEAD by
+runing below command.
+Example uses -
+          git check-coverage -b build bin/opt llvm/test
+Here b is build directory (optional, default is build)
+next we have binray
+and then test suite path
+"""
+
+import argparse
+import logging
+import os
+import subprocess
+import re
+import sys
+from unidiff import PatchSet
----------------
boomanaiden154 wrote:

Since this uses external dependencies, you should put a `requirements.txt` generated with `pip freeze` somewhere so that we can use the exact transitive closure that you used for testing/development (especially in CI).

Also, `git-clang-format` (https://github.com/llvm/llvm-project/blob/1f3d13c415a2a92e5a3811740ed55c4bcff3f539/clang/tools/clang-format/git-clang-format) seems to be able to achieve similar functionality without external dependencies. Not sure if that is worth the effort though.

https://github.com/llvm/llvm-project/pull/71841


More information about the llvm-commits mailing list