From: Eduardo Habkost <ehabkost@redhat.com>
To: "Philippe Mathieu-Daudé" <f4bug@amsat.org>
Cc: qemu-devel@nongnu.org, "Peter Maydell" <peter.maydell@linaro.org>,
"Markus Armbruster" <armbru@redhat.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Marc-André Lureau" <marcandre.lureau@redhat.com>,
"Eric Blake" <eblake@redhat.com>,
"Laurent Vivier" <lvivier@redhat.com>,
"Cornelia Huck" <cornelia.huck@de.ibm.com>,
"Alex Bennée" <alex.bennee@linaro.org>,
"Fam Zheng" <famz@redhat.com>
Subject: Re: [Qemu-devel] [RFC PATCH 3/4] coccinelle: script to run them all
Date: Mon, 26 Jun 2017 23:17:34 -0300 [thread overview]
Message-ID: <20170627021734.GS12152@localhost.localdomain> (raw)
In-Reply-To: <20170625192950.17677-4-f4bug@amsat.org>
On Sun, Jun 25, 2017 at 04:29:49PM -0300, Philippe Mathieu-Daudé wrote:
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
> scripts/check-cocci-scripts.sh | 47 ++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 47 insertions(+)
> create mode 100755 scripts/check-cocci-scripts.sh
>
> diff --git a/scripts/check-cocci-scripts.sh b/scripts/check-cocci-scripts.sh
> new file mode 100755
> index 0000000000..ec3a8b39ef
> --- /dev/null
> +++ b/scripts/check-cocci-scripts.sh
> @@ -0,0 +1,47 @@
> +#! /usr/bin/env bash
> +
> +test -d scripts/coccinelle || exit 1
> +
> +SPATCH_IMAGE="philmd/coccinelle:1.0.4"
> +
> +GIT_AUTHOR_NAME="Coccinelle Spatch"
> +GIT_COMMITTER_NAME="Coccinelle Spatch"
> +
> +if [ -n "$TRAVIS" ]; then
> + # avoid stalling builds: https://docs.travis-ci.com/user/common-build-problems/#Build-times-out-because-no-output-was-received
> + TIMEOUT_S=530
> + TIMEOUT_CMD="timeout -k 550 500"
> + EXTRA_ARGS="--timeout ${TIMEOUT_S}"
> +else
> + TIMEOUT_S=0
> +fi
> +
> +HEAD=19 #`echo -n scripts/coccinelle/ | wc -c`
> +TAIL=6 #`echo -n .cocci | wc -c`
> +
> +test -z "$(${SUDO} docker images -q ${SPATCH_IMAGE})" && ${SUDO} docker pull ${SPATCH_IMAGE}
> +
Can the docker magic be made optional (and disabled by default), so
people who already have Coccinelle installed can run this script more
quickly?
> +LOG=/tmp/cocci-spatch-$$
> +for script in scripts/coccinelle/*.cocci; do
> + desc=${script:$HEAD:-$TAIL}
> + echo -e "\nRunning ${script}...\n"
> + echo -e "coccinelle: committing changes after running \"$desc\" script\n" > ${LOG}.topic
> + ${TIMEOUT_CMD} ${SUDO} \
> + docker run --rm -v `pwd`:`pwd` -w `pwd` -u `id -u` \
> + ${SPATCH_IMAGE} --use-cache --use-gitgrep --keep-comments \
> + --very-quiet ${EXTRA_ARGS} \
> + --sp-file ${script} \
> + --macro-file scripts/cocci-macro-file.h \
> + --dir . \
> + --in-place | tee ${LOG}.content
> + git add -u
> + git diff --cached --exit-code -s
> + if [ $? -ne 0 ]; then
> + :> ${LOG}.content
> + else
> + test -s ${LOG}.content || continue
> + fi
> + cat ${LOG}.{topic,content} | git commit --allow-empty -F -
> +done
> +
> +rm -f ${LOG}.{topic,content}
> --
> 2.13.1
>
--
Eduardo
next prev parent reply other threads:[~2017-06-27 2:17 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-25 19:29 [Qemu-devel] [RFC PATCH 0/4] travis: run all coccinelle scripts Philippe Mathieu-Daudé
2017-06-25 19:29 ` [Qemu-devel] [RFC PATCH 1/4] XXX travis: simplify matrix Philippe Mathieu-Daudé
2017-06-25 19:29 ` [Qemu-devel] [RFC PATCH 2/4] coccinelle: ignore ASTs pre-parsed cached C files Philippe Mathieu-Daudé
2017-06-25 19:29 ` [Qemu-devel] [RFC PATCH 3/4] coccinelle: script to run them all Philippe Mathieu-Daudé
2017-06-27 2:17 ` Eduardo Habkost [this message]
2017-06-27 2:33 ` Philippe Mathieu-Daudé
2017-06-27 2:48 ` Fam Zheng
2017-06-25 19:29 ` [Qemu-devel] [RFC PATCH 4/4] travis: add job to run coccinelle scripts Philippe Mathieu-Daudé
2017-06-26 4:58 ` [Qemu-devel] [RFC PATCH 0/4] travis: run all " Philippe Mathieu-Daudé
2017-06-27 8:12 ` Markus Armbruster
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=20170627021734.GS12152@localhost.localdomain \
--to=ehabkost@redhat.com \
--cc=alex.bennee@linaro.org \
--cc=armbru@redhat.com \
--cc=cornelia.huck@de.ibm.com \
--cc=eblake@redhat.com \
--cc=f4bug@amsat.org \
--cc=famz@redhat.com \
--cc=lvivier@redhat.com \
--cc=marcandre.lureau@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).