You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kudu.apache.org by al...@apache.org on 2019/02/14 04:26:13 UTC

[kudu] 02/02: [build-support] KUDU-2699 introduce TIDY build type

This is an automated email from the ASF dual-hosted git repository.

alexey pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kudu.git

commit 4e2451dbf18db1faf9545ac1f9663d378b9f5efe
Author: Alexey Serbin <al...@apache.org>
AuthorDate: Wed Feb 13 13:38:03 2019 -0800

    [build-support] KUDU-2699 introduce TIDY build type
    
    This changelist introduces a new TIDY build type to facilitate running
    clang_tidy_gerrit.py from the kudu-tidy-bot Jenkins job by
    jenkins.kudu.apache.org.  The idea is to make sure all auto-generated
    header files are present before running the clang-tidy tool on the
    Kudu C++ source files.
    
    As Adar noticed, our development process is such that new work goes
    into master and any commits to release branches are pure backports.
    There's not much point in running clang-tidy on those backports.
    So, the proposal is to simply run the kudu-tidy-bot job only on
    the changes in the master branch.  That entails updating the
    configuration of the kudu-tidy-bot Jenkins job after this change
    is pushed into the repo.
    
    The corresponding command for the config for the kudu-tidy-bot job is:
    ----------------------------------------------------------------------
    \#!/bin/bash
    export TIDYBOT_PASSWORD=<hidden>
    export PATH=/usr/lib/ccache:$PATH
    ccache -M 50G
    
    set -ex
    
    export BUILD_TYPE=TIDY
    build-support/jenkins/build-and-test.sh
    ----------------------------------------------------------------------
    
    Change-Id: I9b364620c9fb92202cacf0286df292dd4cc9952b
    Reviewed-on: http://gerrit.cloudera.org:8080/12471
    Reviewed-by: Adar Dembo <ad...@cloudera.com>
    Tested-by: Kudu Jenkins
---
 CMakeLists.txt                          | 16 +++++++++++-----
 build-support/jenkins/build-and-test.sh | 18 +++++++++++++++++-
 2 files changed, 28 insertions(+), 6 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index c9b0394..6c08e4c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1363,15 +1363,21 @@ if (UNIX)
 endif (UNIX)
 
 ############################################################
-# "make iwyu" and "make iwyu-fix" target
+# "generated-headers" target
 ############################################################
 if (UNIX)
-  add_custom_target(iwyu-generated-headers
+  add_custom_target(generated-headers
     DEPENDS pb-gen krpc-gen hms_thrift sentry_thrift)
+endif (UNIX)
+
+############################################################
+# "make iwyu" and "make iwyu-fix" target
+############################################################
+if (UNIX)
   add_custom_target(iwyu ${BUILD_SUPPORT_DIR}/iwyu.py --from-git
-    DEPENDS iwyu-generated-headers)
+    DEPENDS generated-headers)
   add_custom_target(iwyu-fix ${BUILD_SUPPORT_DIR}/iwyu.py --fix --from-git
-    DEPENDS iwyu-generated-headers)
+    DEPENDS generated-headers)
 endif (UNIX)
 
 ############################################################
@@ -1379,7 +1385,7 @@ endif (UNIX)
 ############################################################
 if (UNIX)
   add_custom_target(tidy ${BUILD_SUPPORT_DIR}/tidy.sh)
-  add_dependencies(tidy pb-gen krpc-gen)
+  add_dependencies(tidy generated-headers)
 endif (UNIX)
 
 ############################################################
diff --git a/build-support/jenkins/build-and-test.sh b/build-support/jenkins/build-and-test.sh
index 5051ce6..9c0c956 100755
--- a/build-support/jenkins/build-and-test.sh
+++ b/build-support/jenkins/build-and-test.sh
@@ -22,7 +22,7 @@
 #
 # Environment variables may be used to customize operation:
 #   BUILD_TYPE: Default: DEBUG
-#     Maybe be one of ASAN|TSAN|DEBUG|RELEASE|COVERAGE|LINT|IWYU
+#     Maybe be one of ASAN|TSAN|DEBUG|RELEASE|COVERAGE|LINT|IWYU|TIDY
 #
 #   KUDU_ALLOW_SLOW_TESTS   Default: 1
 #     Runs the "slow" version of the unit tests. Set to 0 to
@@ -186,6 +186,13 @@ elif [ "$BUILD_TYPE" = "LINT" ]; then
 elif [ "$BUILD_TYPE" = "IWYU" ]; then
   USE_CLANG=1
   CMAKE_BUILD=debug
+elif [ "$BUILD_TYPE" = "TIDY" ]; then
+  USE_CLANG=1
+  CMAKE_BUILD=debug
+  BUILD_JAVA=0
+  BUILD_PYTHON=0
+  BUILD_PYTHON3=0
+  BUILD_GRADLE=0
 else
   # Must be DEBUG or RELEASE
   CMAKE_BUILD=$BUILD_TYPE
@@ -298,6 +305,15 @@ if [ "$BUILD_TYPE" = "IWYU" ]; then
   exit $?
 fi
 
+# Short circuit for TIDY builds: run the clang-tidy tool on the C++ source
+# files in the HEAD revision for the gerrit branch.
+if [ "$BUILD_TYPE" = "TIDY" ]; then
+  make -j$NUM_PROCS generated-headers 2>&1 | tee $TEST_LOGDIR/tidy.log
+  $SOURCE_ROOT/build-support/clang_tidy_gerrit.py HEAD 2>&1 | \
+      tee -a $TEST_LOGDIR/tidy.log
+  exit $?
+fi
+
 # Only enable test core dumps for certain build types.
 if [ "$BUILD_TYPE" != "ASAN" ]; then
   export KUDU_TEST_ULIMIT_CORE=unlimited