Skip to contentSkip to conversation

automation/cirrus-ci: add smoke tests of the FreeBSD builds

PATCH In review Roger Pau Monne 2 participants 8 messages Mar 20, 2025 – Mar 21, 2025

lore
Share & tools
lore
#0 lore raw

v2 cover automation/cirrus-ci: add smoke tests of the FreeBSD builds

Hello,

The aim of the series is to introduce a basic set of smoke tests using QEMU and XTF, to ensure some minimal run-time testing of the LLVM toolchain generated Xen binary.

Thanks, Roger.

Roger Pau Monne (4):
automation/cirrus-ci: use matrix keyword to generate per-version build
tasks
automation/cirrus-ci: build XTF
automation/cirrus-ci: store XTF and Xen build artifacts automation/cirrus-ci: add smoke tests for the FreeBSD builds

 .cirrus.yml  | 152 ++++++++++++++++++++++++++++++++++++++++-----------
 CHANGELOG.md |   1 +
 2 files changed, 120 insertions(+), 33 deletions(-)
Signature · 1 line
2.48.1
#1 lore raw

PATCH v2 1/4 automation/cirrus-ci: use matrix keyword to generate per-version build tasks

Move the current logic to use the matrix keyword to generate a task for each version of FreeBSD we want to build Xen on. The matrix keyword however cannot be used in YAML aliases, so it needs to be explicitly used inside of each task, which creates a bit of duplication. At least abstract the FreeBSD minor version numbers to avoid repetition of image names.

Note that the full build uses matrix over an env variable instead of using it directly in image_family. This is so that the alias can also be set based on the FreeBSD version, in preparation for adding further tasks that will depend on the full build having finished.

---
Changes since v1:
- Use FreeBSD_{LEGACY,PRODUCTION,CURRENT} to refer to development release, current release, and current release - 1.

---
 .cirrus.yml | 78 +++++++++++++++++++++++++----------------------------
 1 file changed, 37 insertions(+), 41 deletions(-)
.cirrus.yml +37 -41
index 490f214f0460..95d2d2d3db2e 100644
@@ -1,13 +1,9 @@
 # https://cirrus-ci.org/guide/tips-and-tricks/#sharing-configuration-between-tasks
-freebsd_13: &FREEBSD_13
-  freebsd_instance:
-    image_family: freebsd-13-5
-freebsd_14: &FREEBSD_14
-  freebsd_instance:
-    image_family: freebsd-14-2
-freebsd_15: &FREEBSD_15
-  freebsd_instance:
-    image_family: freebsd-15-0-snap
+freebsd_versions: &FREEBSD_VERSIONS
+  env:
+    FREEBSD_LEGACY:     freebsd-13-5
+    FREEBSD_PRODUCTION: freebsd-14-2
+    FREEBSD_CURRENT:    freebsd-15-0-snap
 
 freebsd_template: &FREEBSD_ENV
   environment:
@@ -24,7 +20,24 @@ freebsd_configure_artifacts: &FREEBSD_CONFIGURE_ARTIFACTS
       path: xen-config
       type: text/plain
 
-freebsd_full_build_template: &FREEBSD_FULL_BUILD_TEMPLATE
+task:
+  name: 'FreeBSD: full build'
+
+  # It's not possible to use the matrix keyword in YAML aliases, as they
+  # keyword usage is restricted to task, docker_builder or pipe.  Attempting to
+  # use a YAML alias with the duplicated keys doesn't work either. Use an env
+  # variable so the version can also be appended to the task alias.
+  << : *FREEBSD_VERSIONS
+  env:
+    matrix:
+      FREEBSD_VERSION: $FREEBSD_LEGACY
+      FREEBSD_VERSION: $FREEBSD_PRODUCTION
+      FREEBSD_VERSION: $FREEBSD_CURRENT
+
+  alias: freebsd_full_$FREEBSD_VERSION
+  freebsd_instance:
+    image_family: $FREEBSD_VERSION
+
   << : *FREEBSD_ENV
 
   install_script: pkg install -y seabios gmake ninja bash
@@ -42,7 +55,20 @@ freebsd_full_build_template: &FREEBSD_FULL_BUILD_TEMPLATE
   build_script:
     - gmake -j`sysctl -n hw.ncpu` clang=y
 
-freebsd_randconfig_template: &FREEBSD_RANDCONFIG_TEMPLATE
+task:
+  name: 'FreeBSD: randconfig build'
+
+  # It's not possible to use the matrix keyword in YAML aliases, as they
+  # keyword usage is restricted to task, docker_builder or pipe.  Attempting to
+  # use a YAML alias with the duplicated `image_family` keys doesn't work
+  # either. Abstract the version numbers at least.
+  << : *FREEBSD_VERSIONS
+  freebsd_instance:
+    matrix:
+      image_family: $FREEBSD_LEGACY
+      image_family: $FREEBSD_PRODUCTION
+      image_family: $FREEBSD_CURRENT
+
   << : *FREEBSD_ENV
 
   install_script: pkg install -y gmake python3 bison
@@ -56,33 +82,3 @@ freebsd_randconfig_template: &FREEBSD_RANDCONFIG_TEMPLATE
 
   build_script:
     - gmake -j`sysctl -n hw.ncpu` build-xen clang=y
-
-task:
-  name: 'FreeBSD 13: full build'
-  << : *FREEBSD_13
-  << : *FREEBSD_FULL_BUILD_TEMPLATE
-
-task:
-  name: 'FreeBSD 14: full build'
-  << : *FREEBSD_14
-  << : *FREEBSD_FULL_BUILD_TEMPLATE
-
-task:
-  name: 'FreeBSD 15: full build'
-  << : *FREEBSD_15
-  << : *FREEBSD_FULL_BUILD_TEMPLATE
-
-task:
-  name: 'FreeBSD 13: randconfig'
-  << : *FREEBSD_13
-  << : *FREEBSD_RANDCONFIG_TEMPLATE
-
-task:
-  name: 'FreeBSD 14: randconfig'
-  << : *FREEBSD_14
-  << : *FREEBSD_RANDCONFIG_TEMPLATE
-
-task:
-  name: 'FreeBSD 15: randconfig'
-  << : *FREEBSD_15
-  << : *FREEBSD_RANDCONFIG_TEMPLATE
Signature · 1 line
2.48.1
Reviewed-by on v2 1/4
#2 lore raw

Re: [PATCH v2 1/4] automation/cirrus-ci: use matrix keyword to generate per-version build tasks

Quoted 6 lines · Roger Pau Monne

Move the current logic to use the matrix keyword to generate a task for each version of FreeBSD we want to build Xen on. The matrix keyword however cannot be used in YAML aliases, so it needs to be explicitly used inside of each task, which creates a bit of duplication. At least abstract the FreeBSD minor version numbers to avoid repetition of image names.

Quoted 6 lines

Note that the full build uses matrix over an env variable instead of using it directly in image_family. This is so that the alias can also be set based on the FreeBSD version, in preparation for adding further tasks that will depend on the full build having finished.

Quoted 116 lines

---
Changes since v1:
- Use FreeBSD_{LEGACY,PRODUCTION,CURRENT} to refer to development release, current release, and current release - 1.

---
 .cirrus.yml | 78 +++++++++++++++++++++++++----------------------------
 1 file changed, 37 insertions(+), 41 deletions(-)
.cirrus.yml +37 -41
index 490f214f0460..95d2d2d3db2e 100644
@@ -1,13 +1,9 @@
 # https://cirrus-ci.org/guide/tips-and-tricks/#sharing-configuration-between-tasks
-freebsd_13: &FREEBSD_13
-  freebsd_instance:
-    image_family: freebsd-13-5
-freebsd_14: &FREEBSD_14
-  freebsd_instance:
-    image_family: freebsd-14-2
-freebsd_15: &FREEBSD_15
-  freebsd_instance:
-    image_family: freebsd-15-0-snap
+freebsd_versions: &FREEBSD_VERSIONS
+  env:
+    FREEBSD_LEGACY:     freebsd-13-5
+    FREEBSD_PRODUCTION: freebsd-14-2
+    FREEBSD_CURRENT:    freebsd-15-0-snap
 
 freebsd_template: &FREEBSD_ENV
   environment:
@@ -24,7 +20,24 @@ freebsd_configure_artifacts: &FREEBSD_CONFIGURE_ARTIFACTS
       path: xen-config
       type: text/plain
 
-freebsd_full_build_template: &FREEBSD_FULL_BUILD_TEMPLATE
+task:
+  name: 'FreeBSD: full build'
+
+  # It's not possible to use the matrix keyword in YAML aliases, as they
+  # keyword usage is restricted to task, docker_builder or pipe.  Attempting to
+  # use a YAML alias with the duplicated keys doesn't work either. Use an env
+  # variable so the version can also be appended to the task alias.
+  << : *FREEBSD_VERSIONS
+  env:
+    matrix:
+      FREEBSD_VERSION: $FREEBSD_LEGACY
+      FREEBSD_VERSION: $FREEBSD_PRODUCTION
+      FREEBSD_VERSION: $FREEBSD_CURRENT
+
+  alias: freebsd_full_$FREEBSD_VERSION
+  freebsd_instance:
+    image_family: $FREEBSD_VERSION
+
   << : *FREEBSD_ENV
 
   install_script: pkg install -y seabios gmake ninja bash
@@ -42,7 +55,20 @@ freebsd_full_build_template: &FREEBSD_FULL_BUILD_TEMPLATE
   build_script:
     - gmake -j`sysctl -n hw.ncpu` clang=y
 
-freebsd_randconfig_template: &FREEBSD_RANDCONFIG_TEMPLATE
+task:
+  name: 'FreeBSD: randconfig build'
+
+  # It's not possible to use the matrix keyword in YAML aliases, as they
+  # keyword usage is restricted to task, docker_builder or pipe.  Attempting to
+  # use a YAML alias with the duplicated `image_family` keys doesn't work
+  # either. Abstract the version numbers at least.
+  << : *FREEBSD_VERSIONS
+  freebsd_instance:
+    matrix:
+      image_family: $FREEBSD_LEGACY
+      image_family: $FREEBSD_PRODUCTION
+      image_family: $FREEBSD_CURRENT
+
   << : *FREEBSD_ENV
 
   install_script: pkg install -y gmake python3 bison
@@ -56,33 +82,3 @@ freebsd_randconfig_template: &FREEBSD_RANDCONFIG_TEMPLATE
 
   build_script:
     - gmake -j`sysctl -n hw.ncpu` build-xen clang=y
-
-task:
-  name: 'FreeBSD 13: full build'
-  << : *FREEBSD_13
-  << : *FREEBSD_FULL_BUILD_TEMPLATE
-
-task:
-  name: 'FreeBSD 14: full build'
-  << : *FREEBSD_14
-  << : *FREEBSD_FULL_BUILD_TEMPLATE
-
-task:
-  name: 'FreeBSD 15: full build'
-  << : *FREEBSD_15
-  << : *FREEBSD_FULL_BUILD_TEMPLATE
-
-task:
-  name: 'FreeBSD 13: randconfig'
-  << : *FREEBSD_13
-  << : *FREEBSD_RANDCONFIG_TEMPLATE
-
-task:
-  name: 'FreeBSD 14: randconfig'
-  << : *FREEBSD_14
-  << : *FREEBSD_RANDCONFIG_TEMPLATE
-
-task:
-  name: 'FreeBSD 15: randconfig'
-  << : *FREEBSD_15
-  << : *FREEBSD_RANDCONFIG_TEMPLATE
Signature · 1 line
2.48.1
#3 lore raw

PATCH v2 2/4 automation/cirrus-ci: build XTF

In reply to Roger Pau Monne

In preparation for using the XTF selftests to smoke test the FreeBSD based Xen builds.

---
Changes since v1:
- Use production version.

---
 .cirrus.yml | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)
.cirrus.yml +24 -0
index 95d2d2d3db2e..a6e4a5d0308b 100644
@@ -12,6 +12,12 @@ freebsd_template: &FREEBSD_ENV
     CIRRUS_CLONE_DEPTH: 1
     CIRRUS_LOG_TIMESTAMP: true
 
+freebsd_template_latest: &FREEBSD_ENV_PRODUCTION
+  << : *FREEBSD_VERSIONS
+  freebsd_instance:
+    image_family: $FREEBSD_PRODUCTION
+  << : *FREEBSD_ENV
+
 freebsd_configure_artifacts: &FREEBSD_CONFIGURE_ARTIFACTS
   always:
     rename_script:
@@ -82,3 +88,21 @@ task:
 
   build_script:
     - gmake -j`sysctl -n hw.ncpu` build-xen clang=y
+
+task:
+  name: 'FreeBSD: XTF build'
+  alias: xtf
+
+  << : *FREEBSD_ENV_PRODUCTION
+
+  clone_script:
+    - pkg install -y git
+    - git clone --depth 1 https://xenbits.xen.org/git-http/xtf.git
+
+  install_script: pkg install -y gmake
+
+  build_script:
+    - cd xtf
+    - cc --version
+    - git rev-parse HEAD
+    - gmake -j`sysctl -n hw.ncpu` LLVM=y
Signature · 1 line
2.48.1
Reviewed-by on v2 2/4
#4 lore raw

Re: [PATCH v2 2/4] automation/cirrus-ci: build XTF

Quoted 4 lines · Roger Pau Monne

In preparation for using the XTF selftests to smoke test the FreeBSD based Xen builds.

Quoted 49 lines

---
Changes since v1:
- Use production version.

---
 .cirrus.yml | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)
.cirrus.yml +24 -0
index 95d2d2d3db2e..a6e4a5d0308b 100644
@@ -12,6 +12,12 @@ freebsd_template: &FREEBSD_ENV
     CIRRUS_CLONE_DEPTH: 1
     CIRRUS_LOG_TIMESTAMP: true
 
+freebsd_template_latest: &FREEBSD_ENV_PRODUCTION
+  << : *FREEBSD_VERSIONS
+  freebsd_instance:
+    image_family: $FREEBSD_PRODUCTION
+  << : *FREEBSD_ENV
+
 freebsd_configure_artifacts: &FREEBSD_CONFIGURE_ARTIFACTS
   always:
     rename_script:
@@ -82,3 +88,21 @@ task:
 
   build_script:
     - gmake -j`sysctl -n hw.ncpu` build-xen clang=y
+
+task:
+  name: 'FreeBSD: XTF build'
+  alias: xtf
+
+  << : *FREEBSD_ENV_PRODUCTION
+
+  clone_script:
+    - pkg install -y git
+    - git clone --depth 1 https://xenbits.xen.org/git-http/xtf.git
+
+  install_script: pkg install -y gmake
+
+  build_script:
+    - cd xtf
+    - cc --version
+    - git rev-parse HEAD
+    - gmake -j`sysctl -n hw.ncpu` LLVM=y
Signature · 1 line
2.48.1
#5 lore raw

PATCH v2 3/4 automation/cirrus-ci: store XTF and Xen build artifacts

In reply to Roger Pau Monne

In preparation for adding some smoke tests that will consume those outputs.

---
 .cirrus.yml | 12 ++++++++++++
 1 file changed, 12 insertions(+)
.cirrus.yml +12 -0
index a6e4a5d0308b..38b654f75cf2 100644
@@ -61,6 +61,14 @@ task:
   build_script:
     - gmake -j`sysctl -n hw.ncpu` clang=y
 
+  xen_artifacts:
+    path: xen/xen
+    type: application/octet-stream
+
+  debug_artifacts:
+    path: xen/xen-syms
+    type: application/octet-stream
+
 task:
   name: 'FreeBSD: randconfig build'
 
@@ -106,3 +114,7 @@ task:
     - cc --version
     - git rev-parse HEAD
     - gmake -j`sysctl -n hw.ncpu` LLVM=y
+
+  xtf_artifacts:
+    path: xtf/tests/selftest/test-*-selftest
+    type: application/octet-stream
Signature · 1 line
2.48.1
#6 lore raw

PATCH v2 4/4 automation/cirrus-ci: add smoke tests for the FreeBSD builds

In reply to Roger Pau Monne

Introduce a basic set of smoke tests using the XTF selftest image, and run them on QEMU. Use the matrix keyword to create a different task for each XTF flavor on each FreeBSD build.

---
Changes since v1:
- Use production version of FreeBSD to run tests.

---
 .cirrus.yml  | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 CHANGELOG.md |  1 +
 2 files changed, 55 insertions(+)
.cirrus.yml +54 -0
index 38b654f75cf2..3163ab8f11d8 100644
@@ -5,6 +5,8 @@ freebsd_versions: &FREEBSD_VERSIONS
     FREEBSD_PRODUCTION: freebsd-14-2
     FREEBSD_CURRENT:    freebsd-15-0-snap
 
+# Build jobs
+
 freebsd_template: &FREEBSD_ENV
   environment:
     APPEND_LIB: /usr/local/lib
@@ -118,3 +120,55 @@ task:
   xtf_artifacts:
     path: xtf/tests/selftest/test-*-selftest
     type: application/octet-stream
+
+# Test jobs
+
+task:
+  name: 'FreeBSD: XTF selftest'
+
+  << : *FREEBSD_ENV_PRODUCTION
+
+  env:
+    matrix:
+      FREEBSD_BUILD: $FREEBSD_LEGACY
+      FREEBSD_BUILD: $FREEBSD_PRODUCTION
+      FREEBSD_BUILD: $FREEBSD_CURRENT
+
+  depends_on:
+    - freebsd_full_$FREEBSD_BUILD
+    - xtf
+
+  install_script: pkg install -y qemu-nox11 expect
+
+  env:
+    matrix:
+      XTF_ARCH: hvm32
+      XTF_ARCH: hvm32pae
+      XTF_ARCH: hvm32pse
+      XTF_ARCH: hvm64
+      XTF_ARCH: pv64
+
+  fetch_script:
+    - fetch https://api.cirrus-ci.com/v1/artifact/build/$CIRRUS_BUILD_ID/xtf/xtf.zip
+    - fetch https://api.cirrus-ci.com/v1/artifact/build/$CIRRUS_BUILD_ID/freebsd_full_$FREEBSD_BUILD/xen.zip
+    - unzip xtf.zip
+    - unzip xen.zip
+
+  test_script: |
+    case "$XTF_ARCH" in \
+      *hvm*) \
+        XEN_EXTRA_CMD="dom0=pvh dom0-iommu=none" \
+        ;; \
+    esac
+    export TEST_CMD="qemu-system-x86_64 -kernel xen/xen -initrd xtf/tests/selftest/test-${XTF_ARCH}-selftest \
+                                        -append \"loglvl=all console=com1 noreboot console_timestamps=boot dom0=verbose ${XEN_EXTRA_CMD}\" \
+                                        -m 512 -nographic -monitor none -serial stdio"
+    export TEST_LOG="serial-${FREEBSD_BUILD}-${XTF_ARCH}.txt"
+    export PASSED="Test result: SUCCESS"
+    export TEST_TIMEOUT=120
+    ./automation/scripts/console.exp | sed 's/\r\+$//'
+
+  always:
+    serial_artifacts:
+      path: serial-*.txt
+      type: text/plain
CHANGELOG.md +1 -0
index 9a5919585d43..35ab6749241c 100644
@@ -14,6 +14,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
    - Resizable BARs is supported for PVH dom0.
    - Support PCI passthrough for HVM domUs when dom0 is PVH (note SR-IOV
      capability usage is not yet supported on PVH dom0).
+   - Smoke tests for the FreeBSD Xen builds in Cirrus CI.
 
 ### Removed
 
Signature · 1 line
2.48.1
Reviewed-by on v2 4/4
#7 lore raw

Re: [PATCH v2 4/4] automation/cirrus-ci: add smoke tests for the FreeBSD builds

Quoted 6 lines · Roger Pau Monne

Introduce a basic set of smoke tests using the XTF selftest image, and run them on QEMU. Use the matrix keyword to create a different task for each XTF flavor on each FreeBSD build.

Quoted 92 lines

---
Changes since v1:
- Use production version of FreeBSD to run tests.

---
 .cirrus.yml  | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 CHANGELOG.md |  1 +
 2 files changed, 55 insertions(+)
.cirrus.yml +54 -0
index 38b654f75cf2..3163ab8f11d8 100644
@@ -5,6 +5,8 @@ freebsd_versions: &FREEBSD_VERSIONS
     FREEBSD_PRODUCTION: freebsd-14-2
     FREEBSD_CURRENT:    freebsd-15-0-snap
 
+# Build jobs
+
 freebsd_template: &FREEBSD_ENV
   environment:
     APPEND_LIB: /usr/local/lib
@@ -118,3 +120,55 @@ task:
   xtf_artifacts:
     path: xtf/tests/selftest/test-*-selftest
     type: application/octet-stream
+
+# Test jobs
+
+task:
+  name: 'FreeBSD: XTF selftest'
+
+  << : *FREEBSD_ENV_PRODUCTION
+
+  env:
+    matrix:
+      FREEBSD_BUILD: $FREEBSD_LEGACY
+      FREEBSD_BUILD: $FREEBSD_PRODUCTION
+      FREEBSD_BUILD: $FREEBSD_CURRENT
+
+  depends_on:
+    - freebsd_full_$FREEBSD_BUILD
+    - xtf
+
+  install_script: pkg install -y qemu-nox11 expect
+
+  env:
+    matrix:
+      XTF_ARCH: hvm32
+      XTF_ARCH: hvm32pae
+      XTF_ARCH: hvm32pse
+      XTF_ARCH: hvm64
+      XTF_ARCH: pv64
+
+  fetch_script:
+    - fetch https://api.cirrus-ci.com/v1/artifact/build/$CIRRUS_BUILD_ID/xtf/xtf.zip
+    - fetch https://api.cirrus-ci.com/v1/artifact/build/$CIRRUS_BUILD_ID/freebsd_full_$FREEBSD_BUILD/xen.zip
+    - unzip xtf.zip
+    - unzip xen.zip
+
+  test_script: |
+    case "$XTF_ARCH" in \
+      *hvm*) \
+        XEN_EXTRA_CMD="dom0=pvh dom0-iommu=none" \
+        ;; \
+    esac
+    export TEST_CMD="qemu-system-x86_64 -kernel xen/xen -initrd xtf/tests/selftest/test-${XTF_ARCH}-selftest \
+                                        -append \"loglvl=all console=com1 noreboot console_timestamps=boot dom0=verbose ${XEN_EXTRA_CMD}\" \
+                                        -m 512 -nographic -monitor none -serial stdio"
+    export TEST_LOG="serial-${FREEBSD_BUILD}-${XTF_ARCH}.txt"
+    export PASSED="Test result: SUCCESS"
+    export TEST_TIMEOUT=120
+    ./automation/scripts/console.exp | sed 's/\r\+$//'
+
+  always:
+    serial_artifacts:
+      path: serial-*.txt
+      type: text/plain
CHANGELOG.md +1 -0
index 9a5919585d43..35ab6749241c 100644
@@ -14,6 +14,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
    - Resizable BARs is supported for PVH dom0.
    - Support PCI passthrough for HVM domUs when dom0 is PVH (note SR-IOV
      capability usage is not yet supported on PVH dom0).
+   - Smoke tests for the FreeBSD Xen builds in Cirrus CI.
 
 ### Removed
 
Signature · 1 line
2.48.1