From bddf3b851e19b448d0bafb7a3b43d320731ce296 Mon Sep 17 00:00:00 2001 From: "Rafael G. Martins" Date: Tue, 13 Mar 2018 23:43:55 +0100 Subject: travis: add clang-analyzer --- .travis.yml | 8 ++++++++ .travis/targets/clang-analyzer.sh | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 .travis/targets/clang-analyzer.sh diff --git a/.travis.yml b/.travis.yml index b1086d7..7f574c9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -41,6 +41,14 @@ matrix: - realpath - libcmocka-dev - valgrind + - compiler: clang + env: + - TARGET=clang-analyzer + addons: + apt: + packages: + - realpath + - libcmocka-dev - compiler: gcc env: - TARGET=dist-srpm diff --git a/.travis/targets/clang-analyzer.sh b/.travis/targets/clang-analyzer.sh new file mode 100644 index 0000000..e0c172e --- /dev/null +++ b/.travis/targets/clang-analyzer.sh @@ -0,0 +1,38 @@ +build() { + default_configure \ + --enable-silent-rules + + local pn="$(grep PACKAGE_TARNAME config.h | cut -d\" -f2)" + local pv="$(grep PACKAGE_VERSION config.h | cut -d\" -f2)" + local p="${pn}-clang-analyzer-${pv}" + + set +e + scan-build \ + --use-cc="${CC}" \ + -o reports \ + make + #src/blogc/libblogc_la-debug.lo + local rv=$? + set -e + + local num_reports=$(ls -1 reports | wc -l) + [[ ${num_reports} -eq 0 ]] && return ${rv} + [[ ${num_reports} -eq 1 ]] + + local reports="reports/$(ls -1 reports)" + + if [[ -d "${reports}" ]]; then + mv "${reports}" clang-analyzer + tar \ + -cvJf "${p}.tar.xz" \ + clang-analyzer + rv=1 + fi + + return ${rv} +} + +deploy() { + FILES=( *.tar.xz ) + [[ ${RV} -ne 0 ]] && [[ "x${CC}" = "xclang" ]] +} -- cgit v1.2.3-18-g5258