[libcamera-ci,v1] Move kvm tests and cross compilation to debian 13
diff mbox series

Message ID 20260122170256.4048314-1-barnabas.pocze@ideasonboard.com
State New
Headers show
Series
  • [libcamera-ci,v1] Move kvm tests and cross compilation to debian 13
Related show

Commit Message

Barnabás Pőcze Jan. 22, 2026, 5:02 p.m. UTC
Debian 13 is the current stable edition, and virtme-ng 1.18 no longer
compiles on debian 12 due to rustc version incompatibilities. So move
the kvm tests (and kernel compilation), as well as cross compilation
tests to debian 13.

Also update virtme-ng to the latest version (1.40), and remove the
exit code workaround since the exit code is now propagated to the
host[0]. Furthermore, the addition is `--overlay-rwdir` is necessary
otherwise virtme-ng refuses to start:

  error: cannot initialize <path> inside the guest (path must be defined inside a valid overlay)

And moreover, since virtme-ng now creates an overlay for /tmp by
default[1], and some tests require a /tmp with `O_TMPFILE` support,
/tmp needs to be mounted as tmpfs before running the tests.

Unfortunately, there is a debian peculiarity that has to be worked
around. In contrast to debian 12, the `libclang-rt-dev` package does
not exist for armhf. So its versioned variant needs to be used.

[0]: https://github.com/arighi/virtme-ng/pull/61
[1]: https://github.com/arighi/virtme-ng/pull/114

Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
---
 .gitlab-ci/setup-container.sh     | 12 ++++++------
 .gitlab-ci/test-lc-compliance.sh  |  5 ++---
 .gitlab-ci/test-libcamera-qemu.sh | 10 +++++++---
 gitlab-ci.yml                     | 22 +++++++++++-----------
 4 files changed, 26 insertions(+), 23 deletions(-)

--
2.52.0

Comments

Laurent Pinchart Jan. 22, 2026, 5:52 p.m. UTC | #1
Hi Barnabás,

Thank you for the patch.

I would have split this in two, one patch for kvm and one for
cross-compilation. No need to split now, just keep it in mind for the
next time.

On Thu, Jan 22, 2026 at 06:02:56PM +0100, Barnabás Pőcze wrote:
> Debian 13 is the current stable edition, and virtme-ng 1.18 no longer
> compiles on debian 12 due to rustc version incompatibilities. So move
> the kvm tests (and kernel compilation), as well as cross compilation
> tests to debian 13.
> 
> Also update virtme-ng to the latest version (1.40), and remove the
> exit code workaround since the exit code is now propagated to the
> host[0].

Nice.

> Furthermore, the addition is `--overlay-rwdir` is necessary
> otherwise virtme-ng refuses to start:
> 
>   error: cannot initialize <path> inside the guest (path must be defined inside a valid overlay)
> 
> And moreover, since virtme-ng now creates an overlay for /tmp by
> default[1], and some tests require a /tmp with `O_TMPFILE` support,
> /tmp needs to be mounted as tmpfs before running the tests.

Should we replace O_TMPFILE usage in tests with memfd_create() ?

> 
> Unfortunately, there is a debian peculiarity that has to be worked
> around. In contrast to debian 12, the `libclang-rt-dev` package does
> not exist for armhf. So its versioned variant needs to be used.
> 
> [0]: https://github.com/arighi/virtme-ng/pull/61
> [1]: https://github.com/arighi/virtme-ng/pull/114
> 
> Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
> ---
>  .gitlab-ci/setup-container.sh     | 12 ++++++------
>  .gitlab-ci/test-lc-compliance.sh  |  5 ++---
>  .gitlab-ci/test-libcamera-qemu.sh | 10 +++++++---
>  gitlab-ci.yml                     | 22 +++++++++++-----------
>  4 files changed, 26 insertions(+), 23 deletions(-)
> 
> diff --git a/.gitlab-ci/setup-container.sh b/.gitlab-ci/setup-container.sh
> index 2ba94bb..3506271 100755
> --- a/.gitlab-ci/setup-container.sh
> +++ b/.gitlab-ci/setup-container.sh
> @@ -132,9 +132,6 @@ case $FDO_DISTRIBUTION_VERSION in
>  	PKGS_LIBCAMERA_RUNTIME_MULTIARCH+=( libclang-rt-dev )
>  	# For the Android camera HAL and the virtual pipeline handler.
>  	PKGS_LIBCAMERA_RUNTIME_MULTIARCH+=( libyuv-dev )
> -	# For cam and lc-compliance
> -	# libevent-dev cannot be used here, see build-libcamera-common.sh
> -	PKGS_LIBCAMERA_RUNTIME_MULTIARCH+=( libevent-2.1-7 libevent-pthreads-2.1-7 )
>  	;;
>  'trixie')
>  	# gcc 13 to expand compilation testing coverage.
> @@ -142,15 +139,18 @@ case $FDO_DISTRIBUTION_VERSION in
>  	# Sphinx theme for the documentation.
>  	PKGS_LIBCAMERA_RUNTIME+=( python3-sphinx-book-theme )
>  	# libclang-rt-dev for the clang ASan runtime.
> -	PKGS_LIBCAMERA_RUNTIME_MULTIARCH+=( libclang-rt-dev )
> +	PKGS_LIBCAMERA_RUNTIME_MULTIARCH+=( libclang-rt-19-dev )
>  	# For the Android camera HAL and the virtual pipeline handler.
>  	PKGS_LIBCAMERA_RUNTIME_MULTIARCH+=( libyuv-dev )
> +	# For lc-compliance in the `test-lc-compliance:virtual` job
> +	# libevent-dev cannot be used here, see build-libcamera-common.sh
> +	PKGS_LIBCAMERA_RUNTIME_MULTIARCH+=( libevent-2.1-7t64 libevent-pthreads-2.1-7t64 )
>  	;;
>  esac
> 
> -# We use Debian bookworm containers to produce ARM binaries and run unit tests
> +# We use Debian 13 (trixie) containers to produce ARM binaries and run unit tests
>  # with virtme, and other Debian versions for compilation-testing on amd64 only.
> -if [[ $FDO_DISTRIBUTION_VERSION == 'bookworm' ]] ; then
> +if [[ $FDO_DISTRIBUTION_VERSION == 'trixie' ]] ; then
>  	archs+=( arm64 armhf )
>  	components['kernel']=1
>  	components['virtme']=1
> diff --git a/.gitlab-ci/test-lc-compliance.sh b/.gitlab-ci/test-lc-compliance.sh
> index 6208723..d4ae838 100755
> --- a/.gitlab-ci/test-lc-compliance.sh
> +++ b/.gitlab-ci/test-lc-compliance.sh
> @@ -14,6 +14,7 @@ libcamera_compliance() {
>  		--verbose \
>  		--skip-modules \
>  		--force-9p \
> +		--overlay-rwdir "$PWD" \
>  		--rwdir "$PWD/build" \
>  		--run /opt/linux/bzImage \
>  		--exec " \
> @@ -25,12 +26,10 @@ libcamera_compliance() {
>  			UBSAN_OPTIONS=halt_on_error=1:abort_on_error=1:print_summary=1:print_stacktrace=1 \
>  			GTEST_OUTPUT=xml:./build/lc-compliance-report.xml \
>  			lc-compliance -c Virtual0; \
> -			echo \\\$? > ./build/.test-status; \
>  		"
> 
> -	local status=$(cat build/.test-status)
> +	local status=$?
>  	echo "Test result exit state: $status"
> -	rm build/.test-status
> 
>  	if [[ $status != 0 ]] ; then
>  		exit $status
> diff --git a/.gitlab-ci/test-libcamera-qemu.sh b/.gitlab-ci/test-libcamera-qemu.sh
> index f9de5ab..8a588a5 100755
> --- a/.gitlab-ci/test-libcamera-qemu.sh
> +++ b/.gitlab-ci/test-libcamera-qemu.sh
> @@ -24,13 +24,17 @@ libcamera_unit_test() {
>  	echo "Running libcamera tests in a qemu VM"
> 
>  	virtme-ng --verbose --skip-modules --force-9p \
> +		--overlay-rwdir "$PWD" \
>  		--rwdir "$PWD/build" \
>  		--run /opt/linux/bzImage \
> -		--exec "meson test -C build --no-rebuild --print-errorlogs; echo \\\$? > build/.test-status"
> +		--exec " \
> +			set -ex;
> +			mount -t tmpfs tmpfs /tmp/;
> +			meson test -C build --no-rebuild --print-errorlogs; \

You're using \ on some lines only, let's use it everywhere.

> +		"
> 
> -	local status=$(cat build/.test-status)
> +	local status=$?
>  	echo "Test result exit state: $status"
> -	rm build/.test-status
> 
>  	if [[ $status != 0 ]] ; then
>  		exit $status
> diff --git a/gitlab-ci.yml b/gitlab-ci.yml
> index b1d5f0e..50fc6c6 100644
> --- a/gitlab-ci.yml
> +++ b/gitlab-ci.yml
> @@ -34,7 +34,7 @@ variables:
>      ca-certificates
>      git
>    VIRTME_GIT_URL: 'https://github.com/arighi/virtme-ng.git'
> -  VIRTME_GIT_REF: 'v1.18'
> +  VIRTME_GIT_REF: 'v1.40'
> 
>  # Jobs that test individual commits need more history to find the common
>  # ancestor of the branch being tested and the default branch. Fetch up to 100
> @@ -65,12 +65,12 @@ include:
>  .libcamera-ci.debian:12:
>    variables:
>      FDO_DISTRIBUTION_VERSION: 'bookworm'
> -    FDO_DISTRIBUTION_TAG: '2025-11-02.0'
> +    FDO_DISTRIBUTION_TAG: '2026-01-22.0'
> 
>  .libcamera-ci.debian:13:
>    variables:
>      FDO_DISTRIBUTION_VERSION: 'trixie'
> -    FDO_DISTRIBUTION_TAG: '2025-11-02.0'
> +    FDO_DISTRIBUTION_TAG: '2026-01-22.0'
> 
>  .container-debian:
>    extends:
> @@ -208,8 +208,6 @@ build-full:debian:12:
>            ${MESON_ALL_OPTIONS}
>            ${MESON_CLANG_OPTIONS}
>            -D qcam=disabled
> -      - ARCH: armhf
> -      - ARCH: arm64
> 
>  build-full:debian:13:
>    extends:
> @@ -241,6 +239,8 @@ build-full:debian:13:
>            -D cpp_debugstl=false
>          # `cpp_debugstl=false` needed approximately between meson 1.4.0 and 1.9.3
>          # with clang 18 or later due to https://github.com/mesonbuild/meson/issues/13812
> +      - ARCH: armhf
> +      - ARCH: arm64
> 
>  # Build each commit in the branch individually to detect compilation breakages.
>  build-history:
> @@ -267,11 +267,11 @@ build-history:
>  build-package:debug:
>    extends:
>      - .fdo.distribution-image@debian
> -    - .libcamera-ci.debian:12
> +    - .libcamera-ci.debian:13
>      - .libcamera-ci.scripts
>    stage: build
>    needs:
> -    - job: container-debian:12
> +    - job: container-debian:13
>        artifacts: false
>    script:
>      - $CI_PROJECT_DIR/.gitlab-ci/build-libcamera.sh
> @@ -366,11 +366,11 @@ merge-check:
>  test-unit:
>    extends:
>      - .fdo.distribution-image@debian
> -    - .libcamera-ci.debian:12
> +    - .libcamera-ci.debian:13
>      - .libcamera-ci.scripts
>    stage: test
>    needs:
> -    - job: container-debian:12
> +    - job: container-debian:13
>        artifacts: false
>    tags:
>      - kvm
> @@ -404,7 +404,7 @@ test-unit:
>  test-lc-compliance:virtual:
>    extends:
>      - .fdo.distribution-image@debian
> -    - .libcamera-ci.debian:12
> +    - .libcamera-ci.debian:13
>      - .libcamera-ci.scripts
>    stage: test
>    needs:
> @@ -412,7 +412,7 @@ test-lc-compliance:virtual:
>        parallel:
>          matrix:
>            - ARCH: amd64
> -    - job: container-debian:12
> +    - job: container-debian:13
>        artifacts: false
>    tags:
>      - kvm

Patch
diff mbox series

diff --git a/.gitlab-ci/setup-container.sh b/.gitlab-ci/setup-container.sh
index 2ba94bb..3506271 100755
--- a/.gitlab-ci/setup-container.sh
+++ b/.gitlab-ci/setup-container.sh
@@ -132,9 +132,6 @@  case $FDO_DISTRIBUTION_VERSION in
 	PKGS_LIBCAMERA_RUNTIME_MULTIARCH+=( libclang-rt-dev )
 	# For the Android camera HAL and the virtual pipeline handler.
 	PKGS_LIBCAMERA_RUNTIME_MULTIARCH+=( libyuv-dev )
-	# For cam and lc-compliance
-	# libevent-dev cannot be used here, see build-libcamera-common.sh
-	PKGS_LIBCAMERA_RUNTIME_MULTIARCH+=( libevent-2.1-7 libevent-pthreads-2.1-7 )
 	;;
 'trixie')
 	# gcc 13 to expand compilation testing coverage.
@@ -142,15 +139,18 @@  case $FDO_DISTRIBUTION_VERSION in
 	# Sphinx theme for the documentation.
 	PKGS_LIBCAMERA_RUNTIME+=( python3-sphinx-book-theme )
 	# libclang-rt-dev for the clang ASan runtime.
-	PKGS_LIBCAMERA_RUNTIME_MULTIARCH+=( libclang-rt-dev )
+	PKGS_LIBCAMERA_RUNTIME_MULTIARCH+=( libclang-rt-19-dev )
 	# For the Android camera HAL and the virtual pipeline handler.
 	PKGS_LIBCAMERA_RUNTIME_MULTIARCH+=( libyuv-dev )
+	# For lc-compliance in the `test-lc-compliance:virtual` job
+	# libevent-dev cannot be used here, see build-libcamera-common.sh
+	PKGS_LIBCAMERA_RUNTIME_MULTIARCH+=( libevent-2.1-7t64 libevent-pthreads-2.1-7t64 )
 	;;
 esac

-# We use Debian bookworm containers to produce ARM binaries and run unit tests
+# We use Debian 13 (trixie) containers to produce ARM binaries and run unit tests
 # with virtme, and other Debian versions for compilation-testing on amd64 only.
-if [[ $FDO_DISTRIBUTION_VERSION == 'bookworm' ]] ; then
+if [[ $FDO_DISTRIBUTION_VERSION == 'trixie' ]] ; then
 	archs+=( arm64 armhf )
 	components['kernel']=1
 	components['virtme']=1
diff --git a/.gitlab-ci/test-lc-compliance.sh b/.gitlab-ci/test-lc-compliance.sh
index 6208723..d4ae838 100755
--- a/.gitlab-ci/test-lc-compliance.sh
+++ b/.gitlab-ci/test-lc-compliance.sh
@@ -14,6 +14,7 @@  libcamera_compliance() {
 		--verbose \
 		--skip-modules \
 		--force-9p \
+		--overlay-rwdir "$PWD" \
 		--rwdir "$PWD/build" \
 		--run /opt/linux/bzImage \
 		--exec " \
@@ -25,12 +26,10 @@  libcamera_compliance() {
 			UBSAN_OPTIONS=halt_on_error=1:abort_on_error=1:print_summary=1:print_stacktrace=1 \
 			GTEST_OUTPUT=xml:./build/lc-compliance-report.xml \
 			lc-compliance -c Virtual0; \
-			echo \\\$? > ./build/.test-status; \
 		"

-	local status=$(cat build/.test-status)
+	local status=$?
 	echo "Test result exit state: $status"
-	rm build/.test-status

 	if [[ $status != 0 ]] ; then
 		exit $status
diff --git a/.gitlab-ci/test-libcamera-qemu.sh b/.gitlab-ci/test-libcamera-qemu.sh
index f9de5ab..8a588a5 100755
--- a/.gitlab-ci/test-libcamera-qemu.sh
+++ b/.gitlab-ci/test-libcamera-qemu.sh
@@ -24,13 +24,17 @@  libcamera_unit_test() {
 	echo "Running libcamera tests in a qemu VM"

 	virtme-ng --verbose --skip-modules --force-9p \
+		--overlay-rwdir "$PWD" \
 		--rwdir "$PWD/build" \
 		--run /opt/linux/bzImage \
-		--exec "meson test -C build --no-rebuild --print-errorlogs; echo \\\$? > build/.test-status"
+		--exec " \
+			set -ex;
+			mount -t tmpfs tmpfs /tmp/;
+			meson test -C build --no-rebuild --print-errorlogs; \
+		"

-	local status=$(cat build/.test-status)
+	local status=$?
 	echo "Test result exit state: $status"
-	rm build/.test-status

 	if [[ $status != 0 ]] ; then
 		exit $status
diff --git a/gitlab-ci.yml b/gitlab-ci.yml
index b1d5f0e..50fc6c6 100644
--- a/gitlab-ci.yml
+++ b/gitlab-ci.yml
@@ -34,7 +34,7 @@  variables:
     ca-certificates
     git
   VIRTME_GIT_URL: 'https://github.com/arighi/virtme-ng.git'
-  VIRTME_GIT_REF: 'v1.18'
+  VIRTME_GIT_REF: 'v1.40'

 # Jobs that test individual commits need more history to find the common
 # ancestor of the branch being tested and the default branch. Fetch up to 100
@@ -65,12 +65,12 @@  include:
 .libcamera-ci.debian:12:
   variables:
     FDO_DISTRIBUTION_VERSION: 'bookworm'
-    FDO_DISTRIBUTION_TAG: '2025-11-02.0'
+    FDO_DISTRIBUTION_TAG: '2026-01-22.0'

 .libcamera-ci.debian:13:
   variables:
     FDO_DISTRIBUTION_VERSION: 'trixie'
-    FDO_DISTRIBUTION_TAG: '2025-11-02.0'
+    FDO_DISTRIBUTION_TAG: '2026-01-22.0'

 .container-debian:
   extends:
@@ -208,8 +208,6 @@  build-full:debian:12:
           ${MESON_ALL_OPTIONS}
           ${MESON_CLANG_OPTIONS}
           -D qcam=disabled
-      - ARCH: armhf
-      - ARCH: arm64

 build-full:debian:13:
   extends:
@@ -241,6 +239,8 @@  build-full:debian:13:
           -D cpp_debugstl=false
         # `cpp_debugstl=false` needed approximately between meson 1.4.0 and 1.9.3
         # with clang 18 or later due to https://github.com/mesonbuild/meson/issues/13812
+      - ARCH: armhf
+      - ARCH: arm64

 # Build each commit in the branch individually to detect compilation breakages.
 build-history:
@@ -267,11 +267,11 @@  build-history:
 build-package:debug:
   extends:
     - .fdo.distribution-image@debian
-    - .libcamera-ci.debian:12
+    - .libcamera-ci.debian:13
     - .libcamera-ci.scripts
   stage: build
   needs:
-    - job: container-debian:12
+    - job: container-debian:13
       artifacts: false
   script:
     - $CI_PROJECT_DIR/.gitlab-ci/build-libcamera.sh
@@ -366,11 +366,11 @@  merge-check:
 test-unit:
   extends:
     - .fdo.distribution-image@debian
-    - .libcamera-ci.debian:12
+    - .libcamera-ci.debian:13
     - .libcamera-ci.scripts
   stage: test
   needs:
-    - job: container-debian:12
+    - job: container-debian:13
       artifacts: false
   tags:
     - kvm
@@ -404,7 +404,7 @@  test-unit:
 test-lc-compliance:virtual:
   extends:
     - .fdo.distribution-image@debian
-    - .libcamera-ci.debian:12
+    - .libcamera-ci.debian:13
     - .libcamera-ci.scripts
   stage: test
   needs:
@@ -412,7 +412,7 @@  test-lc-compliance:virtual:
       parallel:
         matrix:
           - ARCH: amd64
-    - job: container-debian:12
+    - job: container-debian:13
       artifacts: false
   tags:
     - kvm