run-coverity-scan: add --no-update-tools option

Provide a quick way to skip building the container while we figure out how
to get caching right.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
Paolo Bonzini 2020-04-22 11:37:55 -04:00
parent 7265905940
commit b99b007905

View File

@ -33,6 +33,7 @@
# --docker-engine : specify the container engine to use (docker/podman/auto); # --docker-engine : specify the container engine to use (docker/podman/auto);
# implies --docker # implies --docker
# --update-tools-only : update the cached copy of the tools, but don't run them # --update-tools-only : update the cached copy of the tools, but don't run them
# --no-update-tools : do not update the cached copy of the tools
# --tokenfile : file to read Coverity token from # --tokenfile : file to read Coverity token from
# --version ver : specify version being analyzed (default: ask git) # --version ver : specify version being analyzed (default: ask git)
# --description desc : specify description of this version (default: ask git) # --description desc : specify description of this version (default: ask git)
@ -130,7 +131,7 @@ update_coverity_tools () {
# Check user-provided environment variables and arguments # Check user-provided environment variables and arguments
DRYRUN=no DRYRUN=no
UPDATE_ONLY=no UPDATE=yes
DOCKER=no DOCKER=no
while [ "$#" -ge 1 ]; do while [ "$#" -ge 1 ]; do
@ -139,9 +140,13 @@ while [ "$#" -ge 1 ]; do
shift shift
DRYRUN=yes DRYRUN=yes
;; ;;
--no-update-tools)
shift
UPDATE=no
;;
--update-tools-only) --update-tools-only)
shift shift
UPDATE_ONLY=yes UPDATE=only
;; ;;
--version) --version)
shift shift
@ -245,12 +250,12 @@ fi
PROJNAME=QEMU PROJNAME=QEMU
TARBALL=cov-int.tar.xz TARBALL=cov-int.tar.xz
if [ "$UPDATE_ONLY" = yes ] && [ "$DOCKER" = yes ]; then if [ "$UPDATE" = only ] && [ "$DOCKER" = yes ]; then
echo "Combining --docker and --update-only is not supported" echo "Combining --docker and --update-only is not supported"
exit 1 exit 1
fi fi
if [ "$UPDATE_ONLY" = yes ]; then if [ "$UPDATE" = only ]; then
# Just do the tools update; we don't need to check whether # Just do the tools update; we don't need to check whether
# we are in a source tree or have upload rights for this, # we are in a source tree or have upload rights for this,
# so do it before some of the command line and source tree checks. # so do it before some of the command line and source tree checks.
@ -293,7 +298,6 @@ fi
# Run ourselves inside docker if that's what the user wants # Run ourselves inside docker if that's what the user wants
if [ "$DOCKER" = yes ]; then if [ "$DOCKER" = yes ]; then
# build docker container including the coverity-scan tools
# Put the Coverity token into a temporary file that only # Put the Coverity token into a temporary file that only
# we have read access to, and then pass it to docker build # we have read access to, and then pass it to docker build
# using a volume. A volume is enough for the token not to # using a volume. A volume is enough for the token not to
@ -308,6 +312,8 @@ if [ "$DOCKER" = yes ]; then
echo "Created temporary directory $SECRETDIR" echo "Created temporary directory $SECRETDIR"
SECRET="$SECRETDIR/token" SECRET="$SECRETDIR/token"
echo "$COVERITY_TOKEN" > "$SECRET" echo "$COVERITY_TOKEN" > "$SECRET"
if [ "$UPDATE" != no ]; then
# build docker container including the coverity-scan tools
echo "Building docker container..." echo "Building docker container..."
# TODO: This re-downloads the tools every time, rather than # TODO: This re-downloads the tools every time, rather than
# caching and reusing the image produced with the downloaded tools. # caching and reusing the image produced with the downloaded tools.
@ -316,6 +322,7 @@ if [ "$DOCKER" = yes ]; then
-t coverity-scanner -f scripts/coverity-scan/coverity-scan.docker \ -t coverity-scanner -f scripts/coverity-scan/coverity-scan.docker \
-v "$SECRETDIR:/work" \ -v "$SECRETDIR:/work" \
--extra-files scripts/coverity-scan/run-coverity-scan --extra-files scripts/coverity-scan/run-coverity-scan
fi
echo "Archiving sources to be analyzed..." echo "Archiving sources to be analyzed..."
./scripts/archive-source.sh "$SECRETDIR/qemu-sources.tgz" ./scripts/archive-source.sh "$SECRETDIR/qemu-sources.tgz"
if [ "$DRYRUN" = yes ]; then if [ "$DRYRUN" = yes ]; then
@ -350,7 +357,9 @@ fi
check_upload_permissions check_upload_permissions
if [ "$UPDATE" != no ]; then
update_coverity_tools update_coverity_tools
fi
TOOLBIN="$(cd "$COVERITY_TOOL_BASE" && echo $PWD/coverity_tool/cov-analysis-*/bin)" TOOLBIN="$(cd "$COVERITY_TOOL_BASE" && echo $PWD/coverity_tool/cov-analysis-*/bin)"