2020-03-04 12:35:06 +03:00
#!/usr/bin/env bash
2021-01-27 15:37:10 +03:00
# SPDX-License-Identifier: LGPL-2.1-or-later
2018-01-11 13:41:35 +03:00
2022-08-09 15:43:28 +03:00
set -eux
2018-06-05 09:31:41 +03:00
2022-08-09 15:43:28 +03:00
COVERITY_SCAN_TOOL_BASE = "/tmp/coverity-scan-analysis"
COVERITY_SCAN_PROJECT_NAME = "systemd/systemd"
2018-06-05 09:31:41 +03:00
2022-08-09 15:43:28 +03:00
function coverity_install_script {
local platform tool_url tool_archive
2018-01-11 13:41:35 +03:00
2022-08-09 15:43:28 +03:00
platform = $( uname)
tool_url = " https://scan.coverity.com/download/ ${ platform } "
tool_archive = " /tmp/cov-analysis- ${ platform } .tgz "
2018-01-11 13:41:35 +03:00
2022-08-09 15:43:28 +03:00
set +x # this is supposed to hide COVERITY_SCAN_TOKEN
echo -e "\033[33;1mDownloading Coverity Scan Analysis Tool...\033[0m"
wget -nv -O " $tool_archive " " $tool_url " --post-data " project= $COVERITY_SCAN_PROJECT_NAME &token= ${ COVERITY_SCAN_TOKEN : ? } "
set -x
2018-01-11 13:41:35 +03:00
2022-08-09 15:43:28 +03:00
mkdir -p " $COVERITY_SCAN_TOOL_BASE "
pushd " $COVERITY_SCAN_TOOL_BASE "
tar xzf " $tool_archive "
popd
2018-01-11 13:41:35 +03:00
}
2022-08-09 15:43:28 +03:00
function run_coverity {
local results_dir tool_dir results_archive sha response status_code
2018-01-11 13:41:35 +03:00
2022-08-09 15:43:28 +03:00
results_dir = "cov-int"
tool_dir = $( find " $COVERITY_SCAN_TOOL_BASE " -type d -name 'cov-analysis*' )
results_archive = "analysis-results.tgz"
sha = $( git rev-parse --short HEAD)
scripts: use 4 space indentation
We had all kinds of indentation: 2 sp, 3 sp, 4 sp, 8 sp, and mixed.
4 sp was the most common, in particular the majority of scripts under test/
used that. Let's standarize on 4 sp, because many commandlines are long and
there's a lot of nesting, and with 8sp indentation less stuff fits. 4 sp
also seems to be the default indentation, so this will make it less likely
that people will mess up if they don't load the editor config. (I think people
often use vi, and vi has no support to load project-wide configuration
automatically. We distribute a .vimrc file, but it is not loaded by default,
and even the instructions in it seem to discourage its use for security
reasons.)
Also remove the few vim config lines that were left. We should either have them
on all files, or none.
Also remove some strange stuff like '#!/bin/env bash', yikes.
2019-04-04 15:10:42 +03:00
2022-08-09 15:43:28 +03:00
meson -Dman= false build
COVERITY_UNSUPPORTED = 1 " $tool_dir /bin/cov-build " --dir " $results_dir " sh -c "ninja -C ./build -v"
" $tool_dir /bin/cov-import-scm " --dir " $results_dir " --scm git --log " $results_dir /scm_log.txt "
scripts: use 4 space indentation
We had all kinds of indentation: 2 sp, 3 sp, 4 sp, 8 sp, and mixed.
4 sp was the most common, in particular the majority of scripts under test/
used that. Let's standarize on 4 sp, because many commandlines are long and
there's a lot of nesting, and with 8sp indentation less stuff fits. 4 sp
also seems to be the default indentation, so this will make it less likely
that people will mess up if they don't load the editor config. (I think people
often use vi, and vi has no support to load project-wide configuration
automatically. We distribute a .vimrc file, but it is not loaded by default,
and even the instructions in it seem to discourage its use for security
reasons.)
Also remove the few vim config lines that were left. We should either have them
on all files, or none.
Also remove some strange stuff like '#!/bin/env bash', yikes.
2019-04-04 15:10:42 +03:00
2022-08-09 15:43:28 +03:00
tar czf " $results_archive " " $results_dir "
2018-01-11 13:41:35 +03:00
2022-08-09 15:43:28 +03:00
set +x # this is supposed to hide COVERITY_SCAN_TOKEN
scripts: use 4 space indentation
We had all kinds of indentation: 2 sp, 3 sp, 4 sp, 8 sp, and mixed.
4 sp was the most common, in particular the majority of scripts under test/
used that. Let's standarize on 4 sp, because many commandlines are long and
there's a lot of nesting, and with 8sp indentation less stuff fits. 4 sp
also seems to be the default indentation, so this will make it less likely
that people will mess up if they don't load the editor config. (I think people
often use vi, and vi has no support to load project-wide configuration
automatically. We distribute a .vimrc file, but it is not loaded by default,
and even the instructions in it seem to discourage its use for security
reasons.)
Also remove the few vim config lines that were left. We should either have them
on all files, or none.
Also remove some strange stuff like '#!/bin/env bash', yikes.
2019-04-04 15:10:42 +03:00
echo -e "\033[33;1mUploading Coverity Scan Analysis results...\033[0m"
response = $( curl \
2022-08-09 15:43:28 +03:00
--silent --write-out "\n%{http_code}\n" \
--form project = " $COVERITY_SCAN_PROJECT_NAME " \
--form token = " ${ COVERITY_SCAN_TOKEN : ? } " \
--form email = " ${ COVERITY_SCAN_NOTIFICATION_EMAIL : ? } " \
--form file = " @ $results_archive " \
--form version = " $sha " \
--form description = "Daily build" \
https://scan.coverity.com/builds)
scripts: use 4 space indentation
We had all kinds of indentation: 2 sp, 3 sp, 4 sp, 8 sp, and mixed.
4 sp was the most common, in particular the majority of scripts under test/
used that. Let's standarize on 4 sp, because many commandlines are long and
there's a lot of nesting, and with 8sp indentation less stuff fits. 4 sp
also seems to be the default indentation, so this will make it less likely
that people will mess up if they don't load the editor config. (I think people
often use vi, and vi has no support to load project-wide configuration
automatically. We distribute a .vimrc file, but it is not loaded by default,
and even the instructions in it seem to discourage its use for security
reasons.)
Also remove the few vim config lines that were left. We should either have them
on all files, or none.
Also remove some strange stuff like '#!/bin/env bash', yikes.
2019-04-04 15:10:42 +03:00
printf "\033[33;1mThe response is\033[0m\n%s\n" " $response "
status_code = $( echo " $response " | sed -n '$p' )
if [ " $status_code " != "200" ] ; then
2022-08-09 15:43:28 +03:00
echo -e " \033[33;1mCoverity Scan upload failed: $( echo " $response " | sed '$d' ) .\033[0m "
return 1
scripts: use 4 space indentation
We had all kinds of indentation: 2 sp, 3 sp, 4 sp, 8 sp, and mixed.
4 sp was the most common, in particular the majority of scripts under test/
used that. Let's standarize on 4 sp, because many commandlines are long and
there's a lot of nesting, and with 8sp indentation less stuff fits. 4 sp
also seems to be the default indentation, so this will make it less likely
that people will mess up if they don't load the editor config. (I think people
often use vi, and vi has no support to load project-wide configuration
automatically. We distribute a .vimrc file, but it is not loaded by default,
and even the instructions in it seem to discourage its use for security
reasons.)
Also remove the few vim config lines that were left. We should either have them
on all files, or none.
Also remove some strange stuff like '#!/bin/env bash', yikes.
2019-04-04 15:10:42 +03:00
fi
2022-08-09 15:43:28 +03:00
set -x
2018-01-11 13:41:35 +03:00
}
2022-08-09 15:43:28 +03:00
coverity_install_script
run_coverity