All of lore.kernel.org
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: "Philippe Mathieu-Daudé" <philmd@redhat.com>
Cc: "Fam Zheng" <fam@euphon.net>, "Thomas Huth" <thuth@redhat.com>,
	"Vladimir Sementsov-Ogievskiy" <vsementsov@virtuozzo.com>,
	qemu-devel@nongnu.org,
	"Wainer dos Santos Moschetta" <wainersm@redhat.com>,
	"Alex Bennée" <alex.bennee@linaro.org>
Subject: Re: [PATCH] gitlab-ci: Add a job to run common coccinelle checks
Date: Fri, 12 Mar 2021 10:07:16 +0100	[thread overview]
Message-ID: <878s6s68qj.fsf@dusky.pond.sub.org> (raw)
In-Reply-To: <20210311193006.1442775-1-philmd@redhat.com> ("Philippe =?utf-8?Q?Mathieu-Daud=C3=A9=22's?= message of "Thu, 11 Mar 2021 20:30:06 +0100")

Philippe Mathieu-Daudé <philmd@redhat.com> writes:

> Add a job to run common coccinelle checks.

This makes sense only for coccinelle scripts that come up clean and have
a reasonably high confidence.

Come up clean: we get no reports for master.  Otherwise new reports will
drown in the old reports, and soon enough nobody will bother to look.

Reasonably high confidence: when the scripts complain, the complaint is
valid often enough, and when they propose a change, the change is good
enough often enough.

How do the scripts proposed in this patch score?

> We use spatch tool from Fedora 32 (Docker image) because
> more recent versions are failing.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
> Based-on: <20210311192700.1441263-1-philmd@redhat.com>
> ---
>  .gitlab-ci.d/containers.yml                   |  5 ++++
>  .gitlab-ci.yml                                | 26 +++++++++++++++++++
>  .../dockerfiles/fedora-coccinelle.docker      | 16 ++++++++++++
>  3 files changed, 47 insertions(+)
>  create mode 100644 tests/docker/dockerfiles/fedora-coccinelle.docker
>
> diff --git a/.gitlab-ci.d/containers.yml b/.gitlab-ci.d/containers.yml
> index 33e4046e233..8f14afdccab 100644
> --- a/.gitlab-ci.d/containers.yml
> +++ b/.gitlab-ci.d/containers.yml
> @@ -249,3 +249,8 @@ amd64-opensuse-leap-container:
>    <<: *container_job_definition
>    variables:
>      NAME: opensuse-leap
> +
> +cocci-fedora-container:
> +  <<: *container_job_definition
> +  variables:
> +    NAME: fedora-coccinelle
> diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
> index 07202f6ffb2..615a0b98fe2 100644
> --- a/.gitlab-ci.yml
> +++ b/.gitlab-ci.yml
> @@ -746,6 +746,32 @@ build-libvhost-user:
>      - meson
>      - ninja
>  
> +check-cocci:
> +  stage: build
> +  needs: ['cocci-fedora-container']
> +  image: $CI_REGISTRY_IMAGE/qemu/fedora-coccinelle:latest
> +  script:
> +    - for script in
> +            scripts/coccinelle/errp-guard.cocci

I doubt the tree's state permits this one.  Its output should not be
applied blindly.

> +            scripts/coccinelle/exec_rw_const.cocci
> +            scripts/coccinelle/inplace-byteswaps.cocci
> +            scripts/coccinelle/overflow_muldiv64.cocci
> +            scripts/coccinelle/qom-parent-type.cocci
> +            scripts/coccinelle/qom-parent-type.cocci
> +            scripts/coccinelle/remove_local_err.cocci
> +            scripts/coccinelle/remove_muldiv64.cocci
> +            scripts/coccinelle/return_directly.cocci
> +            scripts/coccinelle/typecast.cocci
> +            scripts/coccinelle/use-after-abort-fatal-errp.cocci
> +      ; do
> +        spatch --macro-file scripts/cocci-macro-file.h
> +               --sp-file $script
> +               --timeout 137
> +               --jobs 2
> +               --use-gitgrep
> +               --dir .
> +      ; done
> +
>  # Prepare for GitLab pages deployment. Anything copied into the
>  # "public" directory will be deployed to $USER.gitlab.io/$PROJECT
>  pages:
> diff --git a/tests/docker/dockerfiles/fedora-coccinelle.docker b/tests/docker/dockerfiles/fedora-coccinelle.docker
> new file mode 100644
> index 00000000000..5392c73fcb2
> --- /dev/null
> +++ b/tests/docker/dockerfiles/fedora-coccinelle.docker
> @@ -0,0 +1,16 @@
> +#
> +# Docker image to run Coccinelle spatch
> +# (program matching and transformation engine)
> +#
> +# Copyright (C) 2021 Red Hat, Inc.
> +#
> +# SPDX-License-Identifier: GPL-2.0-or-later
> +
> +FROM fedora:32
> +
> +# Please keep this list sorted alphabetically
> +RUN dnf install -y \
> +    coccinelle \
> +    diffutils \
> +    findutils \
> +    git-core



      reply	other threads:[~2021-03-12  9:13 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-11 19:30 [PATCH] gitlab-ci: Add a job to run common coccinelle checks Philippe Mathieu-Daudé
2021-03-12  9:07 ` Markus Armbruster [this message]

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=878s6s68qj.fsf@dusky.pond.sub.org \
    --to=armbru@redhat.com \
    --cc=alex.bennee@linaro.org \
    --cc=fam@euphon.net \
    --cc=philmd@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=thuth@redhat.com \
    --cc=vsementsov@virtuozzo.com \
    --cc=wainersm@redhat.com \
    /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.