mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v4 0/2] drm/ci: Add devicetree validation and KUnit tests
@ 2025-06-23  8:50 Vignesh Raman
  2025-06-23  8:50 ` [PATCH v4 1/2] drm/ci: Add jobs to validate devicetrees Vignesh Raman
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Vignesh Raman @ 2025-06-23  8:50 UTC (permalink / raw)
  To: dri-devel
  Cc: daniels, daniel, helen.fornazier, airlied, simona.vetter,
	robdclark, robin.clark, guilherme.gallo, sergi.blanch.torne,
	valentine.burley, lumag, dmitry.baryshkov, quic_abhinavk,
	mripard, maarten.lankhorst, tzimmermann, linux-kernel

Add jobs to validate devicetrees and run KUnit tests.

Pipeline link,
https://gitlab.freedesktop.org/vigneshraman/msm/-/pipelines/1455734

Link to v1,
https://lore.kernel.org/all/20250327160117.945165-1-vignesh.raman@collabora.com/

Link to v2,
https://lore.kernel.org/all/20250409061543.311184-1-vignesh.raman@collabora.com/

Link to v3,
https://lore.kernel.org/r/20250417030439.737924-1-vignesh.raman@collabora.com

MR,
https://gitlab.freedesktop.org/drm/msm/-/merge_requests/173

This series depends on,
https://lore.kernel.org/all/20250514050340.1418448-1-vignesh.raman@collabora.com/
https://gitlab.freedesktop.org/drm/msm/-/merge_requests/169

Vignesh Raman (2):
  drm/ci: Add jobs to validate devicetrees
  drm/ci: Add jobs to run KUnit tests

 drivers/gpu/drm/ci/check-devicetrees.yml | 50 ++++++++++++++++++++++++
 drivers/gpu/drm/ci/dt-binding-check.sh   | 19 +++++++++
 drivers/gpu/drm/ci/dtbs-check.sh         | 22 +++++++++++
 drivers/gpu/drm/ci/gitlab-ci.yml         |  4 ++
 drivers/gpu/drm/ci/kunit.sh              | 16 ++++++++
 drivers/gpu/drm/ci/kunit.yml             | 37 ++++++++++++++++++
 drivers/gpu/drm/ci/setup-llvm-links.sh   | 13 ++++++
 7 files changed, 161 insertions(+)
 create mode 100644 drivers/gpu/drm/ci/check-devicetrees.yml
 create mode 100755 drivers/gpu/drm/ci/dt-binding-check.sh
 create mode 100755 drivers/gpu/drm/ci/dtbs-check.sh
 create mode 100755 drivers/gpu/drm/ci/kunit.sh
 create mode 100644 drivers/gpu/drm/ci/kunit.yml
 create mode 100755 drivers/gpu/drm/ci/setup-llvm-links.sh

-- 
2.47.2


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

* [PATCH v4 1/2] drm/ci: Add jobs to validate devicetrees
  2025-06-23  8:50 [PATCH v4 0/2] drm/ci: Add devicetree validation and KUnit tests Vignesh Raman
@ 2025-06-23  8:50 ` Vignesh Raman
  2025-06-23  8:50 ` [PATCH v4 2/2] drm/ci: Add jobs to run KUnit tests Vignesh Raman
  2025-06-23  9:44 ` [PATCH v4 0/2] drm/ci: Add devicetree validation and " Maxime Ripard
  2 siblings, 0 replies; 4+ messages in thread
From: Vignesh Raman @ 2025-06-23  8:50 UTC (permalink / raw)
  To: dri-devel
  Cc: daniels, daniel, helen.fornazier, airlied, simona.vetter,
	robdclark, robin.clark, guilherme.gallo, sergi.blanch.torne,
	valentine.burley, lumag, dmitry.baryshkov, quic_abhinavk,
	mripard, maarten.lankhorst, tzimmermann, linux-kernel

Add jobs to run dt_binding_check and dtbs_check. If warnings are seen,
exit with a non-zero error code while configuring them as warning in
the GitLab CI pipeline.

Signed-off-by: Vignesh Raman <vignesh.raman@collabora.com>
Acked-by: Helen Koike <helen.fornazier@gmail.com>
Reviewed-by: Maxime Ripard <mripard@kernel.org>
Acked-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
---

v4:
  - The minimum supported version of LLVM for building x86 kernels is 15.0.0
    (See https://lore.kernel.org/all/20250220-x86-bump-min-llvm-for-stackp-v1-1-ecb3c906e790@kernel.org/).
    Use the mesa-ci containers, where LLVM_VERSION is defined at the container
    level and is currently set to 19. Use this llvm version for compilation.
    Use a Python virtual environment to avoid the warning: “Running pip as the 'root'
    user can result in broken permissions and conflicting behavior with the system package manager.”
    Also check gpu bindings.
    
v3:
  - Add dt-binding-check and dtbs-check jobs to the static-checks stage.

v2:
  - Use LLVM/Clang instead of GCC to avoid architecture-specific
    toolchains for cross-compiling.

---
 drivers/gpu/drm/ci/check-devicetrees.yml | 50 ++++++++++++++++++++++++
 drivers/gpu/drm/ci/dt-binding-check.sh   | 19 +++++++++
 drivers/gpu/drm/ci/dtbs-check.sh         | 22 +++++++++++
 drivers/gpu/drm/ci/gitlab-ci.yml         |  2 +
 drivers/gpu/drm/ci/setup-llvm-links.sh   | 13 ++++++
 5 files changed, 106 insertions(+)
 create mode 100644 drivers/gpu/drm/ci/check-devicetrees.yml
 create mode 100755 drivers/gpu/drm/ci/dt-binding-check.sh
 create mode 100755 drivers/gpu/drm/ci/dtbs-check.sh
 create mode 100755 drivers/gpu/drm/ci/setup-llvm-links.sh

diff --git a/drivers/gpu/drm/ci/check-devicetrees.yml b/drivers/gpu/drm/ci/check-devicetrees.yml
new file mode 100644
index 000000000000..727bd56018b8
--- /dev/null
+++ b/drivers/gpu/drm/ci/check-devicetrees.yml
@@ -0,0 +1,50 @@
+.dt-check-base:
+  stage: static-checks
+  timeout: "30m"
+  variables:
+    GIT_DEPTH: 1
+    FF_USE_NEW_BASH_EVAL_STRATEGY: 'true'
+    SCHEMA: "display:gpu"
+    VENV_PATH: "/tmp/dtcheck-venv"
+  before_script:
+    - apt-get update -qq
+    # Minimum supported version of LLVM for building x86 kernels is 15.0.0.
+    # In mesa-ci containers, LLVM_VERSION is defined as a container-level property and is currently set to 19.
+    - apt-get install -y --no-install-recommends clang-${LLVM_VERSION} lld-${LLVM_VERSION} llvm-${LLVM_VERSION} python3-dev python3-venv python3-pip yamllint
+    - python3 -m venv "${VENV_PATH}"
+    - source "${VENV_PATH}/bin/activate"
+    - pip3 install dtschema
+  script:
+    - drivers/gpu/drm/ci/${SCRIPT_NAME}
+  artifacts:
+    when: on_failure
+    paths:
+      - ${ARTIFACT_FILE}
+  allow_failure:
+    exit_codes:
+      - 102
+
+dtbs-check:arm32:
+  extends:
+    - .build:arm32
+    - .dt-check-base
+  variables:
+    SCRIPT_NAME: "dtbs-check.sh"
+    ARTIFACT_FILE: "dtbs-check.log"
+
+dtbs-check:arm64:
+  extends:
+    - .build:arm64
+    - .dt-check-base
+  variables:
+    SCRIPT_NAME: "dtbs-check.sh"
+    ARTIFACT_FILE: "dtbs-check.log"
+
+dt-binding-check:
+  extends:
+    - .build
+    - .use-debian/x86_64_build
+    - .dt-check-base
+  variables:
+    SCRIPT_NAME: "dt-binding-check.sh"
+    ARTIFACT_FILE: "dt-binding-check.log"
diff --git a/drivers/gpu/drm/ci/dt-binding-check.sh b/drivers/gpu/drm/ci/dt-binding-check.sh
new file mode 100755
index 000000000000..99e1c0df84b7
--- /dev/null
+++ b/drivers/gpu/drm/ci/dt-binding-check.sh
@@ -0,0 +1,19 @@
+#!/bin/bash
+# SPDX-License-Identifier: MIT
+
+set -euxo pipefail
+
+VENV_PATH="${VENV_PATH:-/tmp/dtschema-venv}"
+source "${VENV_PATH}/bin/activate"
+
+if ! make -j"${FDO_CI_CONCURRENT:-4}" dt_binding_check \
+        DT_SCHEMA_FILES="${SCHEMA:-}" 2>dt-binding-check.log; then
+    echo "ERROR: 'make dt_binding_check' failed. Please check dt-binding-check.log for details."
+    exit 1
+fi
+
+if [[ -s dt-binding-check.log ]]; then
+    echo "WARNING: dt_binding_check reported warnings. Please check dt-binding-check.log" \
+         "for details."
+    exit 102
+fi
diff --git a/drivers/gpu/drm/ci/dtbs-check.sh b/drivers/gpu/drm/ci/dtbs-check.sh
new file mode 100755
index 000000000000..57842c452439
--- /dev/null
+++ b/drivers/gpu/drm/ci/dtbs-check.sh
@@ -0,0 +1,22 @@
+#!/bin/bash
+# SPDX-License-Identifier: MIT
+
+set -euxo pipefail
+
+: "${KERNEL_ARCH:?ERROR: KERNEL_ARCH must be set}"
+: "${LLVM_VERSION:?ERROR: LLVM_VERSION must be set}"
+
+./drivers/gpu/drm/ci/setup-llvm-links.sh
+
+make LLVM=1 ARCH="${KERNEL_ARCH}" defconfig
+
+if ! make -j"${FDO_CI_CONCURRENT:-4}" ARCH="${KERNEL_ARCH}" LLVM=1 dtbs_check \
+        DT_SCHEMA_FILES="${SCHEMA:-}" 2>dtbs-check.log; then
+    echo "ERROR: 'make dtbs_check' failed. Please check dtbs-check.log for details."
+    exit 1
+fi
+
+if [[ -s dtbs-check.log ]]; then
+    echo "WARNING: dtbs_check reported warnings. Please check dtbs-check.log for details."
+    exit 102
+fi
diff --git a/drivers/gpu/drm/ci/gitlab-ci.yml b/drivers/gpu/drm/ci/gitlab-ci.yml
index d9e1042fc140..1dddda3d24c8 100644
--- a/drivers/gpu/drm/ci/gitlab-ci.yml
+++ b/drivers/gpu/drm/ci/gitlab-ci.yml
@@ -110,6 +110,7 @@ include:
   - drivers/gpu/drm/ci/static-checks.yml
   - drivers/gpu/drm/ci/build.yml
   - drivers/gpu/drm/ci/test.yml
+  - drivers/gpu/drm/ci/check-devicetrees.yml
   - 'https://gitlab.freedesktop.org/gfx-ci/lab-status/-/raw/main/lab-status.yml'
 
 
@@ -120,6 +121,7 @@ stages:
   - git-archive
   - build-for-tests
   - build-only
+  - static-checks
   - code-validation
   - amdgpu
   - i915
diff --git a/drivers/gpu/drm/ci/setup-llvm-links.sh b/drivers/gpu/drm/ci/setup-llvm-links.sh
new file mode 100755
index 000000000000..ace33af82a3f
--- /dev/null
+++ b/drivers/gpu/drm/ci/setup-llvm-links.sh
@@ -0,0 +1,13 @@
+#!/usr/bin/env bash
+# SPDX-License-Identifier: MIT
+set -euo pipefail
+
+ln -svf "$(which clang++-${LLVM_VERSION})"      /usr/bin/clang++
+ln -svf "$(which clang-${LLVM_VERSION})"        /usr/bin/clang
+ln -svf "$(which ld.lld-${LLVM_VERSION})"       /usr/bin/ld.lld
+ln -svf "$(which lld-${LLVM_VERSION})"          /usr/bin/lld
+ln -svf "$(which llvm-ar-${LLVM_VERSION})"      /usr/bin/llvm-ar
+ln -svf "$(which llvm-nm-${LLVM_VERSION})"      /usr/bin/llvm-nm
+ln -svf "$(which llvm-objcopy-${LLVM_VERSION})" /usr/bin/llvm-objcopy
+ln -svf "$(which llvm-readelf-${LLVM_VERSION})" /usr/bin/llvm-readelf
+ln -svf "$(which llvm-strip-${LLVM_VERSION})"   /usr/bin/llvm-strip
-- 
2.47.2


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

* [PATCH v4 2/2] drm/ci: Add jobs to run KUnit tests
  2025-06-23  8:50 [PATCH v4 0/2] drm/ci: Add devicetree validation and KUnit tests Vignesh Raman
  2025-06-23  8:50 ` [PATCH v4 1/2] drm/ci: Add jobs to validate devicetrees Vignesh Raman
@ 2025-06-23  8:50 ` Vignesh Raman
  2025-06-23  9:44 ` [PATCH v4 0/2] drm/ci: Add devicetree validation and " Maxime Ripard
  2 siblings, 0 replies; 4+ messages in thread
From: Vignesh Raman @ 2025-06-23  8:50 UTC (permalink / raw)
  To: dri-devel
  Cc: daniels, daniel, helen.fornazier, airlied, simona.vetter,
	robdclark, robin.clark, guilherme.gallo, sergi.blanch.torne,
	valentine.burley, lumag, dmitry.baryshkov, quic_abhinavk,
	mripard, maarten.lankhorst, tzimmermann, linux-kernel

Add jobs to run KUnit tests using tools/testing/kunit/kunit.py tool.

Signed-off-by: Vignesh Raman <vignesh.raman@collabora.com>
Acked-by: Helen Koike <helen.fornazier@gmail.com>
Reviewed-by: Maxime Ripard <mripard@kernel.org>
---

v4:
  - The minimum supported version of LLVM for building x86 kernels is 15.0.0
    (See https://lore.kernel.org/all/20250220-x86-bump-min-llvm-for-stackp-v1-1-ecb3c906e790@kernel.org/).
    Use the mesa-ci containers, where LLVM_VERSION is defined at the container
    level and is currently set to 19. Use this llvm version for compilation.
  
v3:
  - Add KUnit tests to the kunit stage.

v2:
  - Use LLVM/Clang instead of GCC to avoid architecture-specific
    toolchains for cross-compiling.

---
 drivers/gpu/drm/ci/gitlab-ci.yml |  2 ++
 drivers/gpu/drm/ci/kunit.sh      | 16 ++++++++++++++
 drivers/gpu/drm/ci/kunit.yml     | 37 ++++++++++++++++++++++++++++++++
 3 files changed, 55 insertions(+)
 create mode 100755 drivers/gpu/drm/ci/kunit.sh
 create mode 100644 drivers/gpu/drm/ci/kunit.yml

diff --git a/drivers/gpu/drm/ci/gitlab-ci.yml b/drivers/gpu/drm/ci/gitlab-ci.yml
index 1dddda3d24c8..6f9b7beddcb3 100644
--- a/drivers/gpu/drm/ci/gitlab-ci.yml
+++ b/drivers/gpu/drm/ci/gitlab-ci.yml
@@ -111,6 +111,7 @@ include:
   - drivers/gpu/drm/ci/build.yml
   - drivers/gpu/drm/ci/test.yml
   - drivers/gpu/drm/ci/check-devicetrees.yml
+  - drivers/gpu/drm/ci/kunit.yml
   - 'https://gitlab.freedesktop.org/gfx-ci/lab-status/-/raw/main/lab-status.yml'
 
 
@@ -122,6 +123,7 @@ stages:
   - build-for-tests
   - build-only
   - static-checks
+  - kunit
   - code-validation
   - amdgpu
   - i915
diff --git a/drivers/gpu/drm/ci/kunit.sh b/drivers/gpu/drm/ci/kunit.sh
new file mode 100755
index 000000000000..7a1052fd3f17
--- /dev/null
+++ b/drivers/gpu/drm/ci/kunit.sh
@@ -0,0 +1,16 @@
+#!/bin/bash
+# SPDX-License-Identifier: MIT
+
+set -euxo pipefail
+
+: "${KERNEL_ARCH:?ERROR: KERNEL_ARCH must be set}"
+: "${LLVM_VERSION:?ERROR: LLVM_VERSION must be set}"
+
+./drivers/gpu/drm/ci/setup-llvm-links.sh
+
+export PATH="/usr/bin:$PATH"
+
+./tools/testing/kunit/kunit.py run \
+  --arch "${KERNEL_ARCH}" \
+  --make_options LLVM=1 \
+  --kunitconfig=drivers/gpu/drm/tests
diff --git a/drivers/gpu/drm/ci/kunit.yml b/drivers/gpu/drm/ci/kunit.yml
new file mode 100644
index 000000000000..0d5b2c4433d2
--- /dev/null
+++ b/drivers/gpu/drm/ci/kunit.yml
@@ -0,0 +1,37 @@
+.kunit-packages: &kunit-packages
+  - apt-get update -qq
+  # Minimum supported version of LLVM for building x86 kernels is 15.0.0.
+  # In mesa-ci containers, LLVM_VERSION is defined as a container-level property and is currently set to 19.
+  - apt-get install -y --no-install-recommends clang-${LLVM_VERSION} lld-${LLVM_VERSION} llvm-${LLVM_VERSION}
+
+.kunit-base:
+  stage: kunit
+  timeout: "30m"
+  variables:
+    GIT_DEPTH: 1
+  script:
+    - drivers/gpu/drm/ci/kunit.sh
+
+kunit:arm32:
+  extends:
+    - .build:arm32
+    - .kunit-base
+  before_script:
+    - *kunit-packages
+    - apt-get install -y --no-install-recommends qemu-system-arm
+
+kunit:arm64:
+  extends:
+    - .build:arm64
+    - .kunit-base
+  before_script:
+    - *kunit-packages
+    - apt-get install -y --no-install-recommends qemu-system-aarch64
+
+kunit:x86_64:
+  extends:
+    - .build:x86_64
+    - .kunit-base
+  before_script:
+    - *kunit-packages
+    - apt-get install -y --no-install-recommends qemu-system-x86
-- 
2.47.2


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

* Re: [PATCH v4 0/2] drm/ci: Add devicetree validation and KUnit tests
  2025-06-23  8:50 [PATCH v4 0/2] drm/ci: Add devicetree validation and KUnit tests Vignesh Raman
  2025-06-23  8:50 ` [PATCH v4 1/2] drm/ci: Add jobs to validate devicetrees Vignesh Raman
  2025-06-23  8:50 ` [PATCH v4 2/2] drm/ci: Add jobs to run KUnit tests Vignesh Raman
@ 2025-06-23  9:44 ` Maxime Ripard
  2 siblings, 0 replies; 4+ messages in thread
From: Maxime Ripard @ 2025-06-23  9:44 UTC (permalink / raw)
  To: dri-devel, Vignesh Raman
  Cc: Maxime Ripard, daniels, daniel, helen.fornazier, airlied,
	simona.vetter, robin.clark, guilherme.gallo, sergi.blanch.torne,
	valentine.burley, lumag, dmitry.baryshkov, quic_abhinavk,
	maarten.lankhorst, tzimmermann, linux-kernel

On Mon, 23 Jun 2025 14:20:26 +0530, Vignesh Raman wrote:
> Add jobs to validate devicetrees and run KUnit tests.
> 
> Pipeline link,
> https://gitlab.freedesktop.org/vigneshraman/msm/-/pipelines/1455734
> 
> Link to v1,
> https://lore.kernel.org/all/20250327160117.945165-1-vignesh.raman@collabora.com/
> 
> [...]

Applied to misc/kernel.git (drm-misc-next).

Thanks!
Maxime

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

end of thread, other threads:[~2025-06-23  9:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-06-23  8:50 [PATCH v4 0/2] drm/ci: Add devicetree validation and KUnit tests Vignesh Raman
2025-06-23  8:50 ` [PATCH v4 1/2] drm/ci: Add jobs to validate devicetrees Vignesh Raman
2025-06-23  8:50 ` [PATCH v4 2/2] drm/ci: Add jobs to run KUnit tests Vignesh Raman
2025-06-23  9:44 ` [PATCH v4 0/2] drm/ci: Add devicetree validation and " Maxime Ripard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®