summaryrefslogtreecommitdiffstats
path: root/coverity-scan.sh
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2018-11-07 12:19:29 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2018-11-07 12:20:17 +0000
commita64a253794ac64cb40befee54db53bde17dd0d49 (patch)
treec1024acc5f6e508814b944d99f112259bb28b1be /coverity-scan.sh
parentNew upstream version 1.10.0+dfsg (diff)
downloadnetdata-a64a253794ac64cb40befee54db53bde17dd0d49.tar.xz
netdata-a64a253794ac64cb40befee54db53bde17dd0d49.zip
New upstream version 1.11.0+dfsgupstream/1.11.0+dfsg
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rwxr-xr-xcoverity-scan.sh62
1 files changed, 41 insertions, 21 deletions
diff --git a/coverity-scan.sh b/coverity-scan.sh
index 5ca093140..1bf0a5804 100755
--- a/coverity-scan.sh
+++ b/coverity-scan.sh
@@ -1,47 +1,67 @@
#!/usr/bin/env bash
+# shellcheck disable=SC2235
-cpus=$(grep ^processor </proc/cpuinfo| wc -l)
+# To run this script you need to provide API token. This can be done either by:
+# - Putting token in ".coverity-token" file
+# - Assigning token value to COVERITY_SCAN_TOKEN environment variable
+# Additionally script can install coverity tool on your computer. To do this just set environment variable INSTALL_COVERITY to "true"
+
+cpus=$(grep -c ^processor </proc/cpuinfo)
[ -z "${cpus}" ] && cpus=1
-token=
-[ -f .coverity-token ] && token="$(<.coverity-token)"
-[ -z "${token}" ] && \
- echo >&2 "Save the coverity token to .coverity-token" && \
+token="${COVERITY_SCAN_TOKEN}"
+([ -z "${token}" ] && [ -f .coverity-token ]) && token="$(<.coverity-token)"
+if [ -z "${token}" ]; then
+ echo >&2 "Save the coverity token to .coverity-token or export it as COVERITY_SCAN_TOKEN."
exit 1
+fi
-echo >&2 "Coverity token: ${token}"
-
+# shellcheck disable=SC2230
covbuild="$(which cov-build 2>/dev/null || command -v cov-build 2>/dev/null)"
-[ -z "${covbuild}" -a -f .coverity-build ] && covbuild="$(<.coverity-build)"
-[ -z "${covbuild}" ] && \
- echo "Save command the full filename of cov-build in .coverity-build" && \
- exit 1
+([ -z "${covbuild}" ] && [ -f .coverity-build ]) && covbuild="$(<.coverity-build)"
+if [ -z "${covbuild}" ]; then
+ echo "Cannot find 'cov-build' binary in \$PATH."
+ if [ "${INSTALL_COVERITY}" != "" ]; then
+ echo "Installing coverity..."
+ mkdir /tmp/coverity
+ curl -SL --data "token=${token}&project=netdata%2Fnetdata" https://scan.coverity.com/download/linux64 > /tmp/coverity_tool.tar.gz
+ tar -x -C /tmp/coverity/ -f /tmp/coverity_tool.tar.gz
+ sudo mv /tmp/coverity/cov-analysis-linux64-2017.07 /opt/coverity
+ export PATH=${PATH}:/opt/coverity/bin/
+ # shellcheck disable=SC2230
+ covbuild="$(which cov-build 2>/dev/null || command -v cov-build 2>/dev/null)"
+ else
+ echo "Save command the full filename of cov-build in .coverity-build"
+ exit 1
+ fi
+fi
-[ ! -x "${covbuild}" ] && \
- echo "The command ${covbuild} is not executable. Save command the full filename of cov-build in .coverity-build" && \
+if [ ! -x "${covbuild}" ]; then
+ echo "The command ${covbuild} is not executable. Save command the full filename of cov-build in .coverity-build"
exit 1
+fi
-version="$(cat config.h | grep "^#define PACKAGE_VERSION" | cut -d '"' -f 2)"
+version="$(grep "^#define PACKAGE_VERSION" config.h | cut -d '"' -f 2)"
echo >&2 "Working on netdata version: ${version}"
echo >&2 "Cleaning up old builds..."
-make clean || exit 1
+make clean || echo "Nothing to clean"
-[ -d "cov-int" ] && \
- rm -rf "cov-int"
+[ -d "cov-int" ] && rm -rf "cov-int"
-[ -f netdata-coverity-analysis.tgz ] && \
- rm netdata-coverity-analysis.tgz
+[ -f netdata-coverity-analysis.tgz ] && rm netdata-coverity-analysis.tgz
+autoreconf -ivf
+./configure --enable-plugin-nfacct --enable-plugin-freeipmi
"${covbuild}" --dir cov-int make -j${cpus} || exit 1
echo >&2 "Compressing data..."
tar czvf netdata-coverity-analysis.tgz cov-int || exit 1
-echo >&2 "Sending analysis..."
+echo >&2 "Sending analysis for version ${version} ..."
curl --progress-bar --form token="${token}" \
--form email=costa@tsaousis.gr \
--form file=@netdata-coverity-analysis.tgz \
--form version="${version}" \
--form description="netdata, real-time performance monitoring, done right." \
- https://scan.coverity.com/builds?project=firehol%2Fnetdata
+ https://scan.coverity.com/builds?project=netdata%2Fnetdata