Skip to content
This repository was archived by the owner on Mar 22, 2023. It is now read-only.

Commit 4b840ed

Browse files
update run-coverity.sh script
based on PMDK's commit 96db274c7, added: - '-j' param to coverity command (make) - necessary vars for coverity script (used for Travis CI) - Coverity certificate download - skip for forked repos
1 parent 46bb288 commit 4b840ed

1 file changed

Lines changed: 35 additions & 3 deletions

File tree

utils/docker/run-coverity.sh

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,32 @@
3636

3737
set -e
3838

39-
./prepare-for-build.sh
39+
if [[ "$CI_REPO_SLUG" != "$GITHUB_REPO" \
40+
&& ( "$COVERITY_SCAN_NOTIFICATION_EMAIL" == "" \
41+
|| "$COVERITY_SCAN_TOKEN" == "" ) ]]; then
42+
echo
43+
echo "Skipping Coverity build:"\
44+
"COVERITY_SCAN_TOKEN=\"$COVERITY_SCAN_TOKEN\" or"\
45+
"COVERITY_SCAN_NOTIFICATION_EMAIL="\
46+
"\"$COVERITY_SCAN_NOTIFICATION_EMAIL\" is not set"
47+
exit 0
48+
fi
4049

41-
cd $WORKDIR
50+
# Prepare build environment
51+
source `dirname $0`/prepare-for-build.sh
52+
53+
CERT_FILE=/etc/ssl/certs/ca-certificates.crt
54+
TEMP_CF=$(mktemp)
55+
cp $CERT_FILE $TEMP_CF
56+
57+
# Download Coverity certificate
58+
echo -n | openssl s_client -connect scan.coverity.com:443 | \
59+
sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' | \
60+
tee -a $TEMP_CF
4261

62+
sudo_password mv $TEMP_CF $CERT_FILE
63+
64+
cd $WORKDIR
4365
mkdir build
4466
cd build
4567
PKG_CONFIG_PATH=/opt/pmdk/lib/pkgconfig/ cmake .. -DCMAKE_BUILD_TYPE=Debug
@@ -48,9 +70,19 @@ export COVERITY_SCAN_PROJECT_NAME="$CI_REPO_SLUG"
4870
[[ "$CI_EVENT_TYPE" == "cron" ]] \
4971
&& export COVERITY_SCAN_BRANCH_PATTERN="master" \
5072
|| export COVERITY_SCAN_BRANCH_PATTERN="coverity_scan"
51-
export COVERITY_SCAN_BUILD_COMMAND="make"
73+
export COVERITY_SCAN_BUILD_COMMAND="make -j$(nproc)"
5274

75+
#
5376
# Run the Coverity scan
77+
#
78+
79+
# The 'travisci_build_coverity_scan.sh' script requires the following
80+
# environment variables to be set:
81+
# - TRAVIS_BRANCH - has to contain the name of the current branch
82+
# - TRAVIS_PULL_REQUEST - has to be set to 'true' in case of pull requests
83+
#
84+
export TRAVIS_BRANCH=${CI_BRANCH}
85+
[ "${CI_EVENT_TYPE}" == "pull_request" ] && export TRAVIS_PULL_REQUEST="true"
5486

5587
# XXX: Patch the Coverity script.
5688
# Recently, this script regularly exits with an error, even though

0 commit comments

Comments
 (0)