All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] gitlab-ci: Add a job to run common coccinelle checks
@ 2021-03-11 19:30 Philippe Mathieu-Daudé
  2021-03-12  9:07 ` Markus Armbruster
  0 siblings, 1 reply; 2+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-03-11 19:30 UTC (permalink / raw)
  To: qemu-devel
  Cc: Fam Zheng, Thomas Huth, Vladimir Sementsov-Ogievskiy,
	Philippe Mathieu-Daudé,
	Markus Armbruster, Wainer dos Santos Moschetta, Alex Bennée

Add a job to run common coccinelle checks.

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
+            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
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] gitlab-ci: Add a job to run common coccinelle checks
  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
  0 siblings, 0 replies; 2+ messages in thread
From: Markus Armbruster @ 2021-03-12  9:07 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: Fam Zheng, Thomas Huth, Vladimir Sementsov-Ogievskiy, qemu-devel,
	Wainer dos Santos Moschetta, Alex Bennée

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



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-03-12  9:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 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.