diff mbox series

[05/16] utils/check-package: add --failed-only

Message ID 20220724054912.2354219-6-ricardo.martincoski@gmail.com
State Changes Requested
Headers show
Series Preventing style regressions using check-package | expand

Commit Message

Ricardo Martincoski July 24, 2022, 5:49 a.m. UTC
Add a debug/test purpose option that generates output in the format:
<filename> <check_function> [<check_function> ...]
This is the very same format used by check-package ignore file.

So one can update the ignore file using:
$ ./utils/docker-run
br-user@...$ ./utils/check-package --failed-only \
               `git ls-tree -r --name-only HEAD` > .checkpackageignore

Signed-off-by: Ricardo Martincoski <ricardo.martincoski@gmail.com>
---
 utils/check-package | 11 +++++++++++
 1 file changed, 11 insertions(+)
diff mbox series

Patch

diff --git a/utils/check-package b/utils/check-package
index 00be29d02a..1508e39c37 100755
--- a/utils/check-package
+++ b/utils/check-package
@@ -72,11 +72,17 @@  def parse_args():
                         help="do not run the specified functions (debug)")
     parser.add_argument("--dry-run", action="store_true", help="print the "
                         "functions that would be called for each file (debug)")
+    parser.add_argument("--failed-only", action="store_true", help="print only"
+                        " the name of the functions that failed (debug)")
 
     flags = parser.parse_args()
 
     flags.ignore_list = get_ignored_parsers_per_file(flags.intree_only, flags.ignore_filename)
 
+    if flags.failed_only:
+        flags.dry_run = False
+        flags.verbose = -1
+
     return flags
 
 
@@ -230,6 +236,11 @@  def check_file_using_lib(fname):
                   .format(fname, should_fail, IGNORE_FILENAME))
             nwarnings += 1
 
+    if flags.failed_only:
+        if len(failed) > 0:
+            f = " ".join(sorted(failed))
+            print("{} {}".format(fname, f))
+
     return nwarnings, nlines