Add jobs to run KUnit tests using tools/testing/kunit/kunit.py tool.
Signed-off-by: Vignesh Raman <vignesh.raman@collabora.com>
---
drivers/gpu/drm/ci/gitlab-ci.yml | 1 +
drivers/gpu/drm/ci/kunit.sh | 34 ++++++++++++++++++++++++++++++++
drivers/gpu/drm/ci/kunit.yml | 19 ++++++++++++++++++
3 files changed, 54 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 9e61b49e9960..90ae57ca86a1 100644
--- a/drivers/gpu/drm/ci/gitlab-ci.yml
+++ b/drivers/gpu/drm/ci/gitlab-ci.yml
@@ -109,6 +109,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'
diff --git a/drivers/gpu/drm/ci/kunit.sh b/drivers/gpu/drm/ci/kunit.sh
new file mode 100755
index 000000000000..197b19d05fba
--- /dev/null
+++ b/drivers/gpu/drm/ci/kunit.sh
@@ -0,0 +1,34 @@
+#!/bin/bash
+# SPDX-License-Identifier: MIT
+
+set -euxo pipefail
+
+case "${KERNEL_ARCH}" in
+ "arm")
+ QEMU_PKG="qemu-system-arm"
+ GCC_ARCH="arm-linux-gnueabihf"
+ ;;
+ "arm64")
+ QEMU_PKG="qemu-system-aarch64"
+ GCC_ARCH="aarch64-linux-gnu"
+ ;;
+ "x86_64")
+ QEMU_PKG="qemu-system-x86"
+ GCC_ARCH="x86_64-linux-gnu"
+ ;;
+ *)
+ echo "Unsupported architecture: ${KERNEL_ARCH}"
+ exit 1
+ ;;
+esac
+
+export ARCH="${KERNEL_ARCH}"
+export CROSS_COMPILE="${GCC_ARCH}-"
+
+apt-get update -qq && apt-get install -y --no-install-recommends "${QEMU_PKG}"
+
+. drivers/gpu/drm/ci/override-ld-with-bfd.sh
+
+./tools/testing/kunit/kunit.py run \
+ --arch "${ARCH}" \
+ --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..95a893b9d641
--- /dev/null
+++ b/drivers/gpu/drm/ci/kunit.yml
@@ -0,0 +1,19 @@
+.kunit-base:
+ timeout: "30m"
+ script:
+ - drivers/gpu/drm/ci/kunit.sh
+
+kunit:arm32:
+ extends:
+ - .build:arm32
+ - .kunit-base
+
+kunit:arm64:
+ extends:
+ - .build:arm64
+ - .kunit-base
+
+kunit:x86_64:
+ extends:
+ - .build:x86_64
+ - .kunit-base
--
2.47.2
On Thu, Mar 27, 2025 at 09:31:12PM +0530, Vignesh Raman wrote:
> Add jobs to run KUnit tests using tools/testing/kunit/kunit.py tool.
>
> Signed-off-by: Vignesh Raman <vignesh.raman@collabora.com>
> ---
> drivers/gpu/drm/ci/gitlab-ci.yml | 1 +
> drivers/gpu/drm/ci/kunit.sh | 34 ++++++++++++++++++++++++++++++++
> drivers/gpu/drm/ci/kunit.yml | 19 ++++++++++++++++++
> 3 files changed, 54 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 9e61b49e9960..90ae57ca86a1 100644
> --- a/drivers/gpu/drm/ci/gitlab-ci.yml
> +++ b/drivers/gpu/drm/ci/gitlab-ci.yml
> @@ -109,6 +109,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'
>
>
> diff --git a/drivers/gpu/drm/ci/kunit.sh b/drivers/gpu/drm/ci/kunit.sh
> new file mode 100755
> index 000000000000..197b19d05fba
> --- /dev/null
> +++ b/drivers/gpu/drm/ci/kunit.sh
> @@ -0,0 +1,34 @@
> +#!/bin/bash
> +# SPDX-License-Identifier: MIT
> +
> +set -euxo pipefail
> +
> +case "${KERNEL_ARCH}" in
> + "arm")
> + QEMU_PKG="qemu-system-arm"
> + GCC_ARCH="arm-linux-gnueabihf"
> + ;;
> + "arm64")
> + QEMU_PKG="qemu-system-aarch64"
> + GCC_ARCH="aarch64-linux-gnu"
> + ;;
> + "x86_64")
> + QEMU_PKG="qemu-system-x86"
> + GCC_ARCH="x86_64-linux-gnu"
> + ;;
> + *)
> + echo "Unsupported architecture: ${KERNEL_ARCH}"
> + exit 1
> + ;;
> +esac
> +
> +export ARCH="${KERNEL_ARCH}"
> +export CROSS_COMPILE="${GCC_ARCH}-"
> +
> +apt-get update -qq && apt-get install -y --no-install-recommends "${QEMU_PKG}"
Thanks for working on that.
I'm a bit concerned about using making it entirely debian specific here.
Between the call to apt, the gcc triplet and the qemu package name, this
not really a script to run kunit tests, but to run them on Debian :)
We should make it pretty explicit and / or just assume the runner has
the right packages and call kunit directly.
Maxime
Hi Maxime,
On 28/03/25 20:40, Maxime Ripard wrote:
> On Thu, Mar 27, 2025 at 09:31:12PM +0530, Vignesh Raman wrote:
>> Add jobs to run KUnit tests using tools/testing/kunit/kunit.py tool.
>>
>> Signed-off-by: Vignesh Raman <vignesh.raman@collabora.com>
>> ---
>> drivers/gpu/drm/ci/gitlab-ci.yml | 1 +
>> drivers/gpu/drm/ci/kunit.sh | 34 ++++++++++++++++++++++++++++++++
>> drivers/gpu/drm/ci/kunit.yml | 19 ++++++++++++++++++
>> 3 files changed, 54 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 9e61b49e9960..90ae57ca86a1 100644
>> --- a/drivers/gpu/drm/ci/gitlab-ci.yml
>> +++ b/drivers/gpu/drm/ci/gitlab-ci.yml
>> @@ -109,6 +109,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'
>>
>>
>> diff --git a/drivers/gpu/drm/ci/kunit.sh b/drivers/gpu/drm/ci/kunit.sh
>> new file mode 100755
>> index 000000000000..197b19d05fba
>> --- /dev/null
>> +++ b/drivers/gpu/drm/ci/kunit.sh
>> @@ -0,0 +1,34 @@
>> +#!/bin/bash
>> +# SPDX-License-Identifier: MIT
>> +
>> +set -euxo pipefail
>> +
>> +case "${KERNEL_ARCH}" in
>> + "arm")
>> + QEMU_PKG="qemu-system-arm"
>> + GCC_ARCH="arm-linux-gnueabihf"
>> + ;;
>> + "arm64")
>> + QEMU_PKG="qemu-system-aarch64"
>> + GCC_ARCH="aarch64-linux-gnu"
>> + ;;
>> + "x86_64")
>> + QEMU_PKG="qemu-system-x86"
>> + GCC_ARCH="x86_64-linux-gnu"
>> + ;;
>> + *)
>> + echo "Unsupported architecture: ${KERNEL_ARCH}"
>> + exit 1
>> + ;;
>> +esac
>> +
>> +export ARCH="${KERNEL_ARCH}"
>> +export CROSS_COMPILE="${GCC_ARCH}-"
>> +
>> +apt-get update -qq && apt-get install -y --no-install-recommends "${QEMU_PKG}"
>
> Thanks for working on that.
>
> I'm a bit concerned about using making it entirely debian specific here.
> Between the call to apt, the gcc triplet and the qemu package name, this
> not really a script to run kunit tests, but to run them on Debian :)
>
> We should make it pretty explicit and / or just assume the runner has
> the right packages and call kunit directly.
Agree. This script is debian specific. I will move the debian bits to
yaml job and make the script generic.
Regards,
Vignesh
>
> Maxime
On Tue, Apr 01, 2025 at 07:47:16AM +0530, Vignesh Raman wrote:
> On 28/03/25 20:40, Maxime Ripard wrote:
> > On Thu, Mar 27, 2025 at 09:31:12PM +0530, Vignesh Raman wrote:
> > > Add jobs to run KUnit tests using tools/testing/kunit/kunit.py tool.
> > >
> > > Signed-off-by: Vignesh Raman <vignesh.raman@collabora.com>
> > > ---
> > > drivers/gpu/drm/ci/gitlab-ci.yml | 1 +
> > > drivers/gpu/drm/ci/kunit.sh | 34 ++++++++++++++++++++++++++++++++
> > > drivers/gpu/drm/ci/kunit.yml | 19 ++++++++++++++++++
> > > 3 files changed, 54 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 9e61b49e9960..90ae57ca86a1 100644
> > > --- a/drivers/gpu/drm/ci/gitlab-ci.yml
> > > +++ b/drivers/gpu/drm/ci/gitlab-ci.yml
> > > @@ -109,6 +109,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'
> > > diff --git a/drivers/gpu/drm/ci/kunit.sh b/drivers/gpu/drm/ci/kunit.sh
> > > new file mode 100755
> > > index 000000000000..197b19d05fba
> > > --- /dev/null
> > > +++ b/drivers/gpu/drm/ci/kunit.sh
> > > @@ -0,0 +1,34 @@
> > > +#!/bin/bash
> > > +# SPDX-License-Identifier: MIT
> > > +
> > > +set -euxo pipefail
> > > +
> > > +case "${KERNEL_ARCH}" in
> > > + "arm")
> > > + QEMU_PKG="qemu-system-arm"
> > > + GCC_ARCH="arm-linux-gnueabihf"
> > > + ;;
> > > + "arm64")
> > > + QEMU_PKG="qemu-system-aarch64"
> > > + GCC_ARCH="aarch64-linux-gnu"
> > > + ;;
> > > + "x86_64")
> > > + QEMU_PKG="qemu-system-x86"
> > > + GCC_ARCH="x86_64-linux-gnu"
> > > + ;;
> > > + *)
> > > + echo "Unsupported architecture: ${KERNEL_ARCH}"
> > > + exit 1
> > > + ;;
> > > +esac
> > > +
> > > +export ARCH="${KERNEL_ARCH}"
> > > +export CROSS_COMPILE="${GCC_ARCH}-"
> > > +
> > > +apt-get update -qq && apt-get install -y --no-install-recommends "${QEMU_PKG}"
> >
> > Thanks for working on that.
> >
> > I'm a bit concerned about using making it entirely debian specific here.
> > Between the call to apt, the gcc triplet and the qemu package name, this
> > not really a script to run kunit tests, but to run them on Debian :)
> >
> > We should make it pretty explicit and / or just assume the runner has
> > the right packages and call kunit directly.
>
> Agree. This script is debian specific. I will move the debian bits to yaml
> job and make the script generic.
Using LLVM there is probably more convenient, since you don't have to
deal with the triplet at all when cross-compiling.
Maxime
© 2016 - 2025 Red Hat, Inc.