X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;f=scripts%2Fcommon%2Fcoverity.sh;h=4c519c3d62f501a14ab7021f5bc30e4b0d7eb3b2;hb=d2c76ee58ef3d473a7d4f53163a1fd6e1b7653ab;hp=0c7848f6931848ca0db4f298df26390be5f7c73a;hpb=87b23e4919f04a9829041fda481e4c66d5455df1;p=lttng-ci.git diff --git a/scripts/common/coverity.sh b/scripts/common/coverity.sh old mode 100644 new mode 100755 index 0c7848f..4c519c3 --- a/scripts/common/coverity.sh +++ b/scripts/common/coverity.sh @@ -17,6 +17,7 @@ # along with this program. If not, see . # Coverity settings +# The project name and token have to be provided trough env variables #COVERITY_SCAN_PROJECT_NAME="" #COVERITY_SCAN_TOKEN="" COVERITY_SCAN_VERSION=`git describe --always | sed 's|-|.|g'` @@ -36,7 +37,7 @@ TOOL_BASE=/tmp/coverity-scan-analysis UPLOAD_URL="https://scan.coverity.com/builds" SCAN_URL="https://scan.coverity.com" -RESULTS_DIR="$WORKSPACE/cov-int" +RESULTS_DIR="cov-int" # liburcu dependency @@ -60,9 +61,15 @@ if [ -d "$WORKSPACE/deps/lttng-ust" ]; then export LD_LIBRARY_PATH="$UST_LIBS:${LD_LIBRARY_PATH:-}" fi +if [ -d "$WORKSPACE/linux" ]; then + export KERNELDIR="$WORKSPACE/linux" +fi + # Verify upload is permitted +set +x AUTH_RES=`curl -s --form project="$COVERITY_SCAN_PROJECT_NAME" --form token="$COVERITY_SCAN_TOKEN" $SCAN_URL/api/upload_permitted` +set -x if [ "$AUTH_RES" = "Access denied" ]; then echo -e "\033[33;1mCoverity Scan API access denied. Check COVERITY_SCAN_PROJECT_NAME and COVERITY_SCAN_TOKEN.\033[0m" exit 1 @@ -82,7 +89,9 @@ fi if [ ! -d $TOOL_BASE ]; then if [ ! -e $TOOL_ARCHIVE ]; then echo -e "\033[33;1mDownloading Coverity Scan Analysis Tool...\033[0m" + set +x wget -nv -O $TOOL_ARCHIVE $TOOL_URL --post-data "project=$COVERITY_SCAN_PROJECT_NAME&token=$COVERITY_SCAN_TOKEN" + set -x fi # Extract Coverity Scan Analysis Tool @@ -105,7 +114,7 @@ fi # Build echo -e "\033[33;1mRunning Coverity Scan Analysis Tool...\033[0m" -cov-build --dir $RESULTS_DIR $COVERITY_SCAN_BUILD_OPTIONS make -j$NPROC +cov-build --dir $RESULTS_DIR $COVERITY_SCAN_BUILD_OPTIONS make -j$NPROC V=1 cov-import-scm --dir $RESULTS_DIR --scm git --log $RESULTS_DIR/scm_log.txt # Tar results @@ -116,6 +125,7 @@ tar czf $RESULTS_ARCHIVE $RESULTS_DIR # Upload results echo -e "\033[33;1mUploading Coverity Scan Analysis results...\033[0m" +set +x response=$(curl \ --silent --write-out "\n%{http_code}\n" \ --form project=$COVERITY_SCAN_PROJECT_NAME \ @@ -125,6 +135,7 @@ response=$(curl \ --form version=$COVERITY_SCAN_VERSION \ --form description=$COVERITY_SCAN_DESCRIPTION \ $UPLOAD_URL) +set -x status_code=$(echo "$response" | sed -n '$p') if [ "$status_code" != "201" ]; then TEXT=$(echo "$response" | sed '$d')