[4.1] e6f46cf Add script to run Coverity.

PÃ¥l Hermunn Johansen hermunn at varnish-software.com
Mon Sep 12 15:48:17 CEST 2016


commit e6f46cf3c3d346a483b91b8dc8a7ccde27ddb973
Author: Lasse Karstensen <lkarsten at varnish-software.com>
Date:   Thu Aug 25 11:40:08 2016 +0200

    Add script to run Coverity.
    
    This will allow anyone with the Coverity scanner installed and our
    authtoken to upload their own feature branch if they want to.
    
    Main point is to get this out of the Jenkins job definition and into
    something that is more developer accessible.
    
    Doing my best to keep it /bin/sh compatible.

diff --git a/.gitignore b/.gitignore
index 0cfaa04..fb7114f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -109,3 +109,7 @@ cscope.*out
 /bin/varnishtest/tests/*.log
 /bin/varnishtest/tests/*.log-t
 /bin/varnishtest/test-suite.log
+#
+# Coverity output
+/cov-int
+/myproject.tgz
diff --git a/devscripts/coverity-run b/devscripts/coverity-run
new file mode 100755
index 0000000..a1d6263
--- /dev/null
+++ b/devscripts/coverity-run
@@ -0,0 +1,54 @@
+#!/bin/sh
+#
+# Build Varnish under Coverity, and upload the output to Coverity Scan.
+#
+# Requires the Coverity scanner in $PATH and the upload token set in $COVTOKEN.
+#
+# See https://github.com/varnishcache/varnish-cache/wiki/Coverity-scans for overview.
+#
+
+
+if [ -z "$COVTOKEN" ]; then
+	echo "ERROR: No COVTOKEN in environment"
+	exit 1
+fi
+
+if [ -z "`which cov-build`" ]; then
+	echo "ERROR: No Coverity (cov-build) in \$PATH. Download: https://scan.coverity.com/download?tab=cxx"
+	exit 1
+fi
+
+if [ -z "$EMAIL" ]; then
+	EMAIL="varnish-dev at varnish-cache.org"
+fi
+
+
+GITREF=`git rev-parse --short HEAD`
+GITBRANCH=`git rev-parse --abbrev-ref HEAD`
+
+# Do a dirty check.
+DIRT=`git status --porcelain 2>/dev/null | egrep '^(\ M|M)' | grep -v coverity-run`
+if [ -n "$DIRT" ]; then
+	printf "ERROR: Refusing to analyse a dirty tree.\n$DIRT\n"
+	exit 2
+fi
+
+test "`basename $PWD`" = "devscripts" && cd ..
+
+make distclean || true
+test -f configure || ./autogen.sh
+./configure
+
+cov-build --dir cov-int make
+
+# the web ui seems to require the file to be called myproject.tgz. Very cute.
+tar cvfz myproject.tgz cov-int
+
+curl --form token=$COVTOKEN \
+  --form "email=$EMAIL" \
+  --form "file=@myproject.tgz" \
+  --form version="$GITREF" \
+  --form description="description=${GITBRANCH}_branch" \
+  'https://scan.coverity.com/builds?project=varnish'
+
+rm myproject.tgz



More information about the varnish-commit mailing list