Start making code quality tests : cmake .. -DENABLE_CODE_QUALITY=1 && ninja && ctest

This commit is contained in:
proller 2018-08-29 22:43:58 +03:00
parent 7bac9698f6
commit 0ce1a9c095
4 changed files with 13 additions and 5 deletions

4
debian/.pbuilderrc vendored
View File

@ -53,7 +53,7 @@ DEBIAN_SUITES=($UNSTABLE_CODENAME $TESTING_CODENAME $STABLE_CODENAME $STABLE_BAC
"experimental" "unstable" "testing" "stable")
# List of Ubuntu suites. Update these when needed.
UBUNTU_SUITES=("bionic" "artful" "zesty" "xenial" "trusty" "devel")
UBUNTU_SUITES=("cosmic" "bionic" "artful" "zesty" "xenial" "trusty" "devel")
# Set a default distribution if none is used. Note that you can set your own default (i.e. ${DIST:="unstable"}).
HOST_DIST=`lsb_release --short --codename`
@ -161,7 +161,7 @@ esac
if [ "$ARCH" != arm64 ]; then
case "$DIST" in
"bionic" | "experimental" | "unstable" | "testing")
"cosmic" | "bionic" | "experimental" | "unstable" | "testing")
EXTRAPACKAGES+=" liblld-6.0-dev libclang-6.0-dev liblld-6.0 "
export CMAKE_FLAGS="-DLLVM_VERSION_POSTFIX=-6.0 $CMAKE_FLAGS"
;;

View File

@ -21,3 +21,7 @@ if (NOT DEFINED ENABLE_UTILS OR ENABLE_UTILS)
add_subdirectory (check-marks)
add_subdirectory (test-data-generator)
endif ()
if (ENABLE_CODE_QUALITY)
add_subdirectory (check-style)
endif ()

View File

@ -0,0 +1,2 @@
add_test(NAME check-style COMMAND bash -c "${CMAKE_CURRENT_SOURCE_DIR}/check-style")
add_test(NAME check-include COMMAND bash -c "env RUN_DIR=${CMAKE_CURRENT_SOURCE_DIR} ROOT_DIR=${ClickHouse_SOURCE_DIR} BUILD_DIR=${ClickHouse_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/check-include")

View File

@ -1,10 +1,12 @@
#!/bin/sh
set -e
#set -x
# sudo apt install time
# Small .h isolated compile checker
# Finds missing #include <...>
# prints compile time, number of includes, use with sort: ./check_include.sh 2>&1 | sort -rk3
# use with clang: CXX=`which clang++-7 clang++-7.0 clang++-6.0 clang++-5.0 | head -n1` ./check_include.sh
pwd=`pwd`
RUN_DIR=${RUN_DIR=`pwd`}
BUILD_DIR=${BUILD_DIR:=./build}
inc="-I. \
-I./contrib/libdivide \
@ -46,8 +48,8 @@ inc="-I. \
-I${BUILD_DIR}/dbms/src"
if [ -z $1 ]; then
cd ..
find dbms libs utils \( -name *.h -and -not -name *.inl.h \) -exec sh $pwd/$0 {} \; ;
cd ${ROOT_DIR=../..}
find dbms libs utils \( -name *.h -and -not -name *.inl.h \) -exec sh $RUN_DIR/`basename $0` {} \; ;
else
echo -n "$1 "
echo -n `grep "#include" $1| wc -l` " "