qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Fam Zheng" <fam@euphon.net>, "Thomas Huth" <thuth@redhat.com>,
	"Vladimir Sementsov-Ogievskiy" <vsementsov@virtuozzo.com>,
	"Philippe Mathieu-Daudé" <philmd@redhat.com>,
	"Markus Armbruster" <armbru@redhat.com>,
	"Wainer dos Santos Moschetta" <wainersm@redhat.com>,
	"Alex Bennée" <alex.bennee@linaro.org>
Subject: [PATCH] gitlab-ci: Add a job to run common coccinelle checks
Date: Thu, 11 Mar 2021 20:30:06 +0100	[thread overview]
Message-ID: <20210311193006.1442775-1-philmd@redhat.com> (raw)

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



             reply	other threads:[~2021-03-11 19:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-11 19:30 Philippe Mathieu-Daudé [this message]
2021-03-12  9:07 ` [PATCH] gitlab-ci: Add a job to run common coccinelle checks 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=20210311193006.1442775-1-philmd@redhat.com \
    --to=philmd@redhat.com \
    --cc=alex.bennee@linaro.org \
    --cc=armbru@redhat.com \
    --cc=fam@euphon.net \
    --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 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).