Updates to coverity-scan script
This commit is contained in:
parent
30236d997c
commit
c3f0fd5b62
|
@ -9,7 +9,7 @@
|
||||||
# Requires:
|
# Requires:
|
||||||
# - curl, built with SSL support, in $PATH
|
# - curl, built with SSL support, in $PATH
|
||||||
# - wget, built with SSL support, in $PATH
|
# - wget, built with SSL support, in $PATH
|
||||||
# - 7z (command line utility of 7-zip), in $PATH
|
# - tar, in $PATH
|
||||||
# - Coverity Scan Build Tool, in $PATH
|
# - Coverity Scan Build Tool, in $PATH
|
||||||
#
|
#
|
||||||
|
|
||||||
|
@ -20,10 +20,7 @@ export LANG=C
|
||||||
CURRENTDIR="$(dirname $(readlink -f $0))"
|
CURRENTDIR="$(dirname $(readlink -f $0))"
|
||||||
echo "Script path [${CURRENTDIR}]"
|
echo "Script path [${CURRENTDIR}]"
|
||||||
|
|
||||||
# Load shared functions
|
# Project title on Coverity Scan (case sensitive)
|
||||||
. $CURRENTDIR/mg_shared.sh
|
|
||||||
|
|
||||||
# Project name (case sensitive)
|
|
||||||
PROJECT=MegaGlest
|
PROJECT=MegaGlest
|
||||||
|
|
||||||
# Coverity Scan project token as listed on the Coverity Scan project page
|
# Coverity Scan project token as listed on the Coverity Scan project page
|
||||||
|
@ -47,19 +44,18 @@ fi
|
||||||
# echo "Read config values: TOKEN [$TOKEN] EMAIL [$EMAIL] COVERITY_ANALYSIS_ROOT [$COVERITY_ANALYSIS_ROOT] NUMCORES [${NUMCORES}]"
|
# echo "Read config values: TOKEN [$TOKEN] EMAIL [$EMAIL] COVERITY_ANALYSIS_ROOT [$COVERITY_ANALYSIS_ROOT] NUMCORES [${NUMCORES}]"
|
||||||
# exit 1
|
# exit 1
|
||||||
|
|
||||||
GITBRANCH=$(git rev-parse --abbrev-ref HEAD | tr '/' '_')
|
GITBRANCH=$(git rev-parse --abbrev-ref HEAD | tr '/' '-')
|
||||||
GITVERSION_SHA1=$(git log -1 --format=%h)
|
GITVERSION_SHA1=$(git log -1 --format=%h)
|
||||||
GITVERSION_REV=$(git rev-list HEAD --count)
|
GITVERSION_REV=$(git rev-list HEAD --count)
|
||||||
VERSION=${GITBRANCH}.${GITVERSION_REV}.${GITVERSION_SHA1}
|
VERSION=${GITBRANCH}.${GITVERSION_REV}.${GITVERSION_SHA1}
|
||||||
|
|
||||||
# Included from shared functions
|
distribution=$(lsb_release -si | tr '[A-Z]' '[a-z]' | tr '[._]' '-')
|
||||||
detect_system
|
dist_release=$(lsb_release -sr | tr '[A-Z]' '[a-z]' | tr '[._]' '-')
|
||||||
|
architecture=$(uname -m | tr '[A-Z]' '[a-z]' | tr '[._]' '-')
|
||||||
hostname=$(hostname)
|
hostname=$(hostname)
|
||||||
|
|
||||||
#DESCRIPTION=${distribution}-${release}-${architecture}_${hostname}
|
DESCRIPTION=${GITBRANCH}-${GITVERSION_SHA1}_${distribution}_${architecture}_${hostname}
|
||||||
DESCRIPTION=${GITBRANCH}.${GITVERSION_SHA1}.${distribution}-${architecture}.${hostname}
|
FILENAME=$(echo "${PROJECT}" | tr '/' '_')_${DESCRIPTION}
|
||||||
FILENAME=${PROJECT}.${DESCRIPTION}
|
|
||||||
# echo "FILENAME = [${FILENAME}]"
|
# echo "FILENAME = [${FILENAME}]"
|
||||||
# exit 1
|
# exit 1
|
||||||
|
|
||||||
|
@ -70,32 +66,23 @@ FILENAME=${PROJECT}.${DESCRIPTION}
|
||||||
export PATH="${PATH}:${COVERITY_ANALYSIS_ROOT}/bin"
|
export PATH="${PATH}:${COVERITY_ANALYSIS_ROOT}/bin"
|
||||||
|
|
||||||
# cleanup old build files
|
# cleanup old build files
|
||||||
# rm -rf ../../build && ../../build-mg.sh -m 1
|
|
||||||
#cd ../../
|
|
||||||
cd $CURRENTDIR
|
cd $CURRENTDIR
|
||||||
rm -rf build
|
rm -rf build
|
||||||
./build-mg.sh -m 1
|
./build-mg.sh -m 1
|
||||||
|
|
||||||
# Build megaglest using coverity build tool
|
# Build using Coverity Scan build tool
|
||||||
# cov-build --dir $BUILDTOOL ../../build-mg.sh -n 1 -c 4
|
|
||||||
cd build/
|
cd build/
|
||||||
cov-build --dir ${BUILDTOOL} make -j ${NUMCORES}
|
cov-build --dir ${BUILDTOOL} make -j ${NUMCORES}
|
||||||
|
|
||||||
# Create archive to upload to coverity
|
# Create archive to upload to coverity
|
||||||
7z a ${FILENAME}.tar ${BUILDTOOL}/
|
tar czf ${FILENAME}.tar.gz ${BUILDTOOL}/
|
||||||
7z a ${FILENAME}.tar.gz ${FILENAME}.tar
|
|
||||||
rm -rf ${FILENAME}.tar
|
|
||||||
ls -la ${FILENAME}.tar.gz
|
ls -la ${FILENAME}.tar.gz
|
||||||
# exit 1
|
# exit 1
|
||||||
|
|
||||||
echo "Running curl to upload analysis file..."
|
echo "Running curl to upload analysis file..."
|
||||||
# echo "curl --progress-bar --insecure --form \"project=${PROJECT}\" --form \"token=${TOKEN}\" --form \"email=${EMAIL}\" --form \"version=${VERSION}\" --form \"description=${DESCRIPTION}\" --form \"file=@${FILENAME}.tar.gz\" https://scan5.coverity.com/cgi-bin/upload.py"
|
curl --progress-bar --insecure --form "token=${TOKEN}" --form "email=${EMAIL}" --form "version=${VERSION}" --form "description=${DESCRIPTION}" --form "file=@${FILENAME}.tar.gz" "https://scan.coverity.com/builds?project=${PROJECT}" | tee -a "coverity-scan.log"
|
||||||
# exit 1
|
|
||||||
curl --progress-bar --insecure --form "token=${TOKEN}" --form "email=${EMAIL}" --form "version=${VERSION}" --form "description=${DESCRIPTION}" --form "file=@${FILENAME}.tar.gz" "https://scan.coverity.com/builds?project=${PROJECT}" | tee -a "coverity-scan.log" ; test ${PIPESTATUS[0]} -eq 0
|
|
||||||
|
|
||||||
echo "CURL returned: $?"
|
if [[ ${PIPESTATUS[0]} -ne 0 ]]; then
|
||||||
|
|
||||||
if [ $? != 0 ]; then
|
|
||||||
echo "An error occurred trying to send the archive to coverity. Error: $?"
|
echo "An error occurred trying to send the archive to coverity. Error: $?"
|
||||||
else
|
else
|
||||||
echo "CURL was SUCCESSFUL!"
|
echo "CURL was SUCCESSFUL!"
|
||||||
|
@ -105,4 +92,3 @@ fi
|
||||||
|
|
||||||
# This currently fails to detect the following error situation, as reported in the HTML of the HTTP response (to the upload request):
|
# This currently fails to detect the following error situation, as reported in the HTML of the HTTP response (to the upload request):
|
||||||
# ERROR: Too many build submitted. Wait for few days before submitting next build: Refer build frequency at https://scan.coverity.com/faq#frequency
|
# ERROR: Too many build submitted. Wait for few days before submitting next build: Refer build frequency at https://scan.coverity.com/faq#frequency
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue