All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Ian Campbell <ian.campbell@citrix.com>,
	ian.jackson@eu.citrix.com, jbeulich@suse.com,
	xen-devel@lists.xen.org
Subject: Re: [PATCH] scripts: Add a script to build and submit to coverity.
Date: Thu, 10 Dec 2015 17:07:33 +0000	[thread overview]
Message-ID: <5669B155.2010905@citrix.com> (raw)
In-Reply-To: <1449766401-31434-1-git-send-email-ian.campbell@citrix.com>

On 10/12/15 16:53, Ian Campbell wrote:
> From: Andrew Cooper <andrew.cooper3@citrix.com>
>
> The submission requires a token and email address, which must be
> registered as a project admin with the Coverity system. Nonetheless
> this is a convenient place to keep it.
>
> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
>
> Took Andy script and:

's

>
> - Wrote commit message.
> - Generalised the settings handling.
> - Added code to call the various steps based on the command line.
> - Refactored construction of the curl command line (mainly in order to
>   quote the email address).
> - Clone mini-os before build.
> - Make the upload stage unconditionally to the upload, but not that it
>   still isn't in the default set of actions.
>
> Signed-off-by: Ian Campbell <ian.campbell@citrix.com>

Looks good to me.

Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>, perhaps with a
few clarifications to comments for other benifits.  See below.

> ---
> ijc: Maybe we can think of a way to add this to osstest while still
> keeping the coverity token private?

This would be ideal.

> ---
>  scripts/coverity-build.sh | 108 ++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 108 insertions(+)
>  create mode 100755 scripts/coverity-build.sh
>
> diff --git a/scripts/coverity-build.sh b/scripts/coverity-build.sh
> new file mode 100755
> index 0000000..91defed
> --- /dev/null
> +++ b/scripts/coverity-build.sh
> @@ -0,0 +1,108 @@
> +#!/bin/bash -e
> +#
> +# Copyright 2015 Andrew Cooper <andrew.cooper3@citrix.com>
> +#
> +# WARNING: This script will blow away any changes in your git working
> +# directory. It should probably be run in a dedicated checkout.
> +#
> +# Requires the coverity tools (e.g. cov-build) to be in $PATH.
> +#
> +# Set $COV_EMAIL and $COV_TOKEN to credentials, otherwise it will
> +# prompt for them.
> +#
> +# ./scripts/coverity-build.sh <steps>
> +#
> +# By default <steps> is to do all the prep and build, but not to upload.
> +#
> +
> +function checktools ()
> +{
> +    if ! command -v cov-build ; then
> +        echo "Coverity tools (cov-build, ...) must be in \$PATH"
> +        exit 1
> +    fi
> +}
> +function hardclean ()
> +{
> +    echo "Cleaning working tree"
> +    git reset --hard
> +    make distclean -j8
> +}
> +
> +function update ()
> +{
> +    echo "Pulling latest staging"
> +    git fetch --all
> +    git checkout master
> +    git pull --ff
> +    git checkout staging
> +    git pull --ff
> +}
> +
> +function softclean ()
> +{
> +    echo "Removing any remaining junk"
> +    git clean -dxf
> +}
> +
> +function vars ()
> +{
> +    export COV_HEAD=$(git rev-parse HEAD)
> +    export COV_TARBALL="xen-coverity-$COV_HEAD.tgz"
> +    export COV_VERSION="Xen-$(make -C xen xenversion --no-print-directory)"
> +}
> +
> +function prebuild ()
> +{
> +    echo "Running the pre-build"

This is "all the things which might end up calling $(CC) which we don't
care about analysing"

> +
> +    ./configure
> +    make -C tools/firmware/etherboot all -j4
> +    make mini-os-dir
> +}
> +
> +function build ()
> +{
> +    echo "Starting Coverity build from $(pwd)"

And "all the things we care about analysing".

~Andrew

> +
> +    cov-build --dir cov-int make -C extras/mini-os/
> +    cov-build --dir cov-int make xen tools -j4
> +    tar czvf $COV_TARBALL cov-int
> +}
> +
> +function upload ()
> +{
> +    if [ -z "$COV_EMAIL" ] ; then
> +	read -p "Email: " COV_EMAIL
> +    fi
> +    if [ -z "$COV_TOKEN" ] ; then
> +	read -p "Form token: " COV_TOKEN
> +    fi
> +
> +    declare -a curl_args
> +    curl_args+=("--form" "token=$COV_TOKEN")
> +    curl_args+=("--form" "email=$COV_EMAIL")
> +    curl_args+=("--form" "file=@$COV_TARBALL")
> +    curl_args+=("--form" "version=$COV_VERSION")
> +    curl_args+=("--form" "description=$COV_HEAD")
> +    curl_args+=("https://scan.coverity.com/builds?project=XenProject")
> +
> +    echo "Uploading... curl ${curl_args[@]}"
> +    echo curl "${curl_args[@]}" | tee cov-upload.log
> +}
> +
> +function all ()
> +{
> +    checktools
> +    hardclean
> +    softclean
> +    update
> +    softclean
> +    vars
> +    prebuild
> +    build
> +}
> +
> +for cmd in ${@:-all} ; do
> +    eval $cmd
> +done

  parent reply	other threads:[~2015-12-10 17:07 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-10 16:53 [PATCH] scripts: Add a script to build and submit to coverity Ian Campbell
2015-12-10 17:01 ` Jan Beulich
2015-12-10 17:07 ` Andrew Cooper [this message]
2015-12-10 17:48   ` Ian Jackson
2015-12-10 17:52     ` Andrew Cooper
2015-12-10 18:02       ` Ian Jackson
2015-12-10 18:06         ` Ian Jackson
2015-12-10 18:10           ` Andrew Cooper
2015-12-14 13:50           ` Ian Campbell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5669B155.2010905@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=ian.campbell@citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=jbeulich@suse.com \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.