trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zw...@apache.org
Subject [trafficserver] branch master updated: Better github PR support, and per-branch rules
Date Wed, 19 Apr 2017 22:36:16 GMT
This is an automated email from the ASF dual-hosted git repository.

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

The following commit(s) were added to refs/heads/master by this push:
       new  78d919d   Better github PR support, and per-branch rules
78d919d is described below

commit 78d919dc78e4582ecc0d6220659b9185065020ea
Author: Leif Hedstrom <zwoop@apache.org>
AuthorDate: Wed Apr 19 08:50:26 2017 -0600

    Better github PR support, and per-branch rules
---
 .clang-analyzer                  | 25 +++++++++++++++++++++++++
 ci/jenkins/bin/clang-analyzer.sh | 28 ++++++++++++++++++++++++++--
 2 files changed, 51 insertions(+), 2 deletions(-)

diff --git a/.clang-analyzer b/.clang-analyzer
new file mode 100644
index 0000000..96a71be
--- /dev/null
+++ b/.clang-analyzer
@@ -0,0 +1,25 @@
+#!/bin/sh
+#
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+
+
+# Additional checkers
+checkers="-enable-checker alpha.unix.cstring.BufferOverlap \
+          -enable-checker alpha.unix.PthreadLock\
+          -enable-checker alpha.core.BoolAssignment \
+          -enable-checker alpha.core.CastSize \
+          -enable-checker alpha.core.SizeofPtr"
diff --git a/ci/jenkins/bin/clang-analyzer.sh b/ci/jenkins/bin/clang-analyzer.sh
index 81e6ba4..9ff8e04 100755
--- a/ci/jenkins/bin/clang-analyzer.sh
+++ b/ci/jenkins/bin/clang-analyzer.sh
@@ -25,6 +25,7 @@
 LLVM_BASE=${LLVM:-/opt/llvm}
 NPROCS=${NPROCS:-$(getconf _NPROCESSORS_ONLN)}
 NOCLEAN=${NOCLEAN:-}
+OUTPUT_BASE=${OUTPUT_BASE:-/home/jenkins/clang-analyzer}
 
 # Options
 options="--status-bugs --keep-empty"
@@ -48,13 +49,33 @@ test "${JOB_NAME#*-github}" != "${JOB_NAME}" && ATS_BRANCH="github"
 
 # Where to store the results, special case for the CI
 output="/tmp"
-test -w "/home/jenkins/clang-analyzer/${ATS_BRANCH}" && output="/home/jenkins/clang-analyzer/${ATS_BRANCH}"
+
+# Find a Jenkins output tree if possible
+if [ "${JOB_NAME#*-github}" != "${JOB_NAME}" ]; then
+    # This is a Github PR build, override the branch name accordingly
+    ATS_BRANCH="github"
+    if [ -w "${OUTPUT_BASE}/${ATS_BRANCH}" ]; then
+	output="${OUTPUT_BASE}/${ATS_BRANCH}/${ghprbPullId}"
+	[ ! -d "${output}}"] && mkdir "${output}"
+    fi
+    github_pr=" PR #${ghprbPullId}"
+    results_url="https://ci.trafficserver.apache.org/files/clang-analyzer/${ATS_BRANCH}/${ghprbPullId}/"
+else
+    test -w "${OUTPUT_BASE}/${ATS_BRANCH}" && output="${OUTPUT_BASE}/${ATS_BRANCH}"
+    github_pr=""
+    results_url="https://ci.trafficserver.apache.org/files/clang-analyzer/${ATS_BRANCH}/"
+fi
 
 # Tell scan-build to use clang as the underlying compiler to actually build
 # source. If you don't do this, it will default to GCC.
 export CCC_CC=${LLVM_BASE}/bin/clang
 export CCC_CXX=${LLVM_BASE}/bin/clang++
 
+# This can be used to override any of those settings above
+[ -f .clang-analyzer ] && source .clang-analyzer
+
+# Start the build / scan
+[ "$output" != "/tmp" ] && echo "Results (if any) can be found at ${results_url}"
 autoreconf -fi
 ${LLVM_BASE}/bin/scan-build ./configure ${configure}
 
@@ -62,7 +83,9 @@ ${LLVM_BASE}/bin/scan-build ./configure ${configure}
 # without scan-build. The subsequent make will then skip it.
 ${ATS_MAKE} -j $NPROCS -C lib all-local V=1 Q=
 
-${LLVM_BASE}/bin/scan-build ${checkers} ${options} -o ${output} --html-title="clang-analyzer:
${ATS_BRANCH}" ${ATS_MAKE} -j $NPROCS V=1 Q=
+${LLVM_BASE}/bin/scan-build ${checkers} ${options} -o ${output} \
+	    --html-title="clang-analyzer: ${ATS_BRANCH}${github_pr}"\
+	    ${ATS_MAKE} -j $NPROCS V=1 Q=
 status=$?
 
 # Clean the work area unless NOCLEAN is set. This is jsut for debugging when you
@@ -70,6 +93,7 @@ status=$?
 if [ ! -z "$NOCLEAN" ]; then
   ${ATS_MAKE} distclean
 fi
+[ "$output" != "/tmp" ] && echo "Results (if any) can be found at ${results_url}"
 
 # Cleanup old reports, for main clang and github as well (if the local helper script is available)
 if [ -x "/admin/bin/clean-clang.sh" ]; then

-- 
To stop receiving notification emails like this one, please contact
['"commits@trafficserver.apache.org" <commits@trafficserver.apache.org>'].

Mime
View raw message