kudu-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject kudu git commit: clang_tidy_gerrit.py: fix output when no changes found in first path
Date Tue, 18 Sep 2018 20:21:42 GMT
Repository: kudu
Updated Branches:
  refs/heads/master d4ded71bc -> 80ebaeda8


clang_tidy_gerrit.py: fix output when no changes found in first path

For a while now some patches weren't getting any Tidy Bot comments. These
comments originate in a standalone Jenkins job that runs clang-tidy and
converts its output into comments that are posted back to gerrit. Here's
what I saw in the console output of one such failed job run:

  Clang output
  No relevant changes found.
  No relevant changes found.
  ... <actual clang-tidy changes>
  Traceback (most recent call last):
    File "build-support/clang_tidy_gerrit.py", line 209, in <module>
      parsed = parse_clang_output(clang_output)
    File "build-support/clang_tidy_gerrit.py", line 103, in parse_clang_output
      raise Exception("bad warning: " + w)
  Exception: bad warning: No relevant changes found.
  No relevant changes found.

The "No relevant changes found." line is what clang-tidy prints when it has
no recommendations. That won't happen when clang-tidy's input includes at
least one "dirty" file, but as of commit a9271b05d we run clang-tidy in
parallel on a per-file basis, which makes it quite likely that a given patch
will include at least one completely tidy file.

Turns out that when the very first line of output parsed by this script is
that "No relevant..." line, split_warnings() generates a warning with a
non-warning string, which causes parse_clang_output() to raise an exception
and for the job to fail silently.

Change-Id: I111dff7508f841489ba1625a4ca4b7af92f3d8d0
Reviewed-on: http://gerrit.cloudera.org:8080/11457
Tested-by: Kudu Jenkins
Reviewed-by: Alexey Serbin <aserbin@cloudera.com>
Reviewed-by: Andrew Wong <awong@cloudera.com>


Project: http://git-wip-us.apache.org/repos/asf/kudu/repo
Commit: http://git-wip-us.apache.org/repos/asf/kudu/commit/80ebaeda
Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/80ebaeda
Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/80ebaeda

Branch: refs/heads/master
Commit: 80ebaeda8a8cbe2b39f6b686badf860bc30cac21
Parents: d4ded71
Author: Adar Dembo <adar@cloudera.com>
Authored: Mon Sep 17 15:54:29 2018 -0700
Committer: Adar Dembo <adar@cloudera.com>
Committed: Tue Sep 18 20:21:14 2018 +0000

----------------------------------------------------------------------
 build-support/clang_tidy_gerrit.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kudu/blob/80ebaeda/build-support/clang_tidy_gerrit.py
----------------------------------------------------------------------
diff --git a/build-support/clang_tidy_gerrit.py b/build-support/clang_tidy_gerrit.py
index d29a792..9c8552e 100755
--- a/build-support/clang_tidy_gerrit.py
+++ b/build-support/clang_tidy_gerrit.py
@@ -84,7 +84,7 @@ def run_tidy(sha="HEAD", is_rev_range=False):
 def split_warnings(clang_output):
     accumulated = ""
     for l in clang_output.splitlines():
-        if l == "":
+        if l == "" or l == "No relevant changes found.":
             continue
         if l.startswith(ROOT) and re.search(r'(warning|error): ', l):
             if accumulated:
@@ -149,11 +149,15 @@ def post_comments(revision_url_base, gerrit_json_obj):
 class TestClangTidyGerrit(unittest.TestCase):
     TEST_INPUT = \
 """
+No relevant changes found.
+
 /home/todd/git/kudu/src/kudu/integration-tests/tablet_history_gc-itest.cc:579:55: warning:
some warning [warning-name]
    some example line of code
 
 /home/todd/git/kudu/foo/../src/kudu/blah.cc:123:55: error: some error
    blah blah
+
+No relevant changes found.
 """
 
     def test_parse_clang_output(self):


Mime
View raw message