Skip to contentSkip to conversation

testing/next: macos updates

PATCH In review Alex Bennée 5 participants 15 messages May 5 – May 11

lore
Share & tools
lore
#0 lore raw

cover testing/next: macos updates

These patches are mostly dealing with the loss of the CirrusCI MacOS images by porting to gitlab. So far only one of the images works but I thought it was worth posting in case anyone else has any ideas.

There is also a fix for getting watchpoints working so we can have the basic TCG gdb tests.

Alex.

Alex Bennée (5):
configure: report unsigned qemu binaries for check-tcg accel/tcg: move jit thread manipulation into do_tb_phys_invalidate
ci: drop cirrus MacOS build
gitlab: add initial MacOS 15 on gitlab runner
gitlab: add MacOS 26 job on gitlab runner (!broken)

 configure                               |  6 ++-
 accel/tcg/tb-maint.c                    |  5 +-
 .gitlab-ci.d/cirrus.yml                 | 14 ------
 .gitlab-ci.d/{cirrus => }/macos-14.vars |  0
 .gitlab-ci.d/macos.yml                  | 65 +++++++++++++++++++++++++
 .gitlab-ci.d/qemu-project.yml           |  1 +
 tests/lcitool/refresh                   | 12 ++++-
 7 files changed, 85 insertions(+), 18 deletions(-)
 rename .gitlab-ci.d/{cirrus => }/macos-14.vars (100%)
 create mode 100644 .gitlab-ci.d/macos.yml
Signature · 1 line
2.47.3
#1 lore raw

PATCH 1/5 configure: report unsigned qemu binaries for check-tcg

On MacOS the initial binaries are created with the unsigned suffix. The user is expected to sign them before they can access the hypervisor APIs. However for TCG testing we can run the unsigned binaries so lets make sure the make variable is correctly set so we can run the TCG tests.

---
 configure | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
configure +5 -1
index eea90306728..c0090b60d1a 100755
@@ -1800,7 +1800,11 @@ for target in $target_list; do
       ;;
     *-softmmu)
       test -f "$source_path/tests/tcg/$arch/Makefile.softmmu-target" || continue
-      qemu="qemu-system-$arch"
+      if test "$host_os" == "darwin"; then
+          qemu="qemu-system-$arch-unsigned"
+      else
+          qemu="qemu-system-$arch"
+      fi
       ;;
     *-linux-user|*-bsd-user)
       qemu="qemu-$arch"
Signature · 1 line
2.47.3
#2 lore raw

Re: [PATCH 1/5] configure: report unsigned qemu binaries for check-tcg

Quoted 6 lines · Alex Bennée

On MacOS the initial binaries are created with the unsigned suffix. The user is expected to sign them before they can access the hypervisor APIs. However for TCG testing we can run the unsigned binaries so lets make sure the make variable is correctly set so we can run the TCG tests.

We have a scripts/entitlement.sh, and this seems to have at least some plumbing into meson.build. What stops us from running this at build time so that macos users, like everybody else, have a working "qemu-system-foo" in the build tree ? Having to work around this by knowing that you have an "-unsigned" suffix until install is awkward for our own scripts and for humans.

thanks
-- PMM

#3 lore raw

Re: [PATCH 1/5] configure: report unsigned qemu binaries for check-tcg

Quoted 8 lines · Peter Maydell
Quoted 6 lines · Alex Bennée

On MacOS the initial binaries are created with the unsigned suffix. The user is expected to sign them before they can access the hypervisor APIs. However for TCG testing we can run the unsigned binaries so lets make sure the make variable is correctly set so we can run the TCG tests.

Quoted 7 lines

We have a scripts/entitlement.sh, and this seems to have at least some plumbing into meson.build. What stops us from running this at build time so that macos users, like everybody else, have a working "qemu-system-foo" in the build tree ? Having to work around this by knowing that you have an "-unsigned" suffix until install is awkward for our own scripts and for humans.

Hmm it gets built if you do:

➜ make qemu-system-aarch64
[1/6] Generating qemu-version.h with a custom command (wrapped by meson to capture output)

and there seems to be logic in that refers to test_emulator = emulators['qemu-system-' + target_base] which ensures the other targets have it built. I'll see if there is a good place to hook that requirement in for check-tcg.

Quoted 3 lines

thanks
-- PMM

Signature · 2 lines
Alex Bennée
Virtualisation Tech Lead @ Linaro
#4 lore raw

Re: [PATCH 1/5] configure: report unsigned qemu binaries for check-tcg

Quoted 21 lines · Alex Bennée
Quoted 8 lines · Peter Maydell
Quoted 6 lines · Alex Bennée

On MacOS the initial binaries are created with the unsigned suffix. The user is expected to sign them before they can access the hypervisor APIs. However for TCG testing we can run the unsigned binaries so lets make sure the make variable is correctly set so we can run the TCG tests.

Quoted 7 lines

We have a scripts/entitlement.sh, and this seems to have at least some plumbing into meson.build. What stops us from running this at build time so that macos users, like everybody else, have a working "qemu-system-foo" in the build tree ? Having to work around this by knowing that you have an "-unsigned" suffix until install is awkward for our own scripts and for humans.

Hmm it gets built if you do:

Quoted 7 lines

➜ make qemu-system-aarch64
[1/6] Generating qemu-version.h with a custom command (wrapped by meson to capture output)

and there seems to be logic in that refers to test_emulator = emulators['qemu-system-' + target_base] which ensures the other targets have it built. I'll see if there is a good place to hook that requirement in for check-tcg.

We should build it on just "make". Neither check-tcg nor the user ought to have to do anything special here. This seems like a bug in the meson.build file handling to me.

-- PMM

#5 lore raw

PATCH 2/5 accel/tcg: move jit thread manipulation into do_tb_phys_invalidate

In reply to Alex Bennée

To invalidate a TB on MacOS we need to enable write access to the JIT buffer. We were doing this for tb_phys_invalidate__locked but that is not the only path into do_tb_phys_invalidate. Move the manipulation into the shared function that does the work.

This enables watchpoints to work in MacOS TCG guests.

Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/3444

---
 accel/tcg/tb-maint.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
accel/tcg/tb-maint.c +3 -2
index cd7c32361bb..9a648f97865 100644
@@ -925,6 +925,7 @@ static void do_tb_phys_invalidate(TranslationBlock *tb, bool rm_from_page_list)
     uint32_t orig_cflags = tb_cflags(tb);
 
     assert_memory_lock();
+    qemu_thread_jit_write();
 
     /* make sure no further incoming jumps will be chained to this TB */
     qemu_spin_lock(&tb->jmp_lock);
@@ -954,15 +955,15 @@ static void do_tb_phys_invalidate(TranslationBlock *tb, bool rm_from_page_list)
     /* suppress any remaining jumps to this TB */
     tb_jmp_unlink(tb);
 
+    qemu_thread_jit_execute();
+
     qatomic_set(&tb_ctx.tb_phys_invalidate_count,
                 tb_ctx.tb_phys_invalidate_count + 1);
 }
 
 static void tb_phys_invalidate__locked(TranslationBlock *tb)
 {
-    qemu_thread_jit_write();
     do_tb_phys_invalidate(tb, true);
-    qemu_thread_jit_execute();
 }
 
 /*
Signature · 1 line
2.47.3
#6 lore raw

Re: [PATCH 2/5] accel/tcg: move jit thread manipulation into do_tb_phys_invalidate

Quoted 26 lines · Alex Bennée

To invalidate a TB on MacOS we need to enable write access to the JIT buffer. We were doing this for tb_phys_invalidate__locked but that is not the only path into do_tb_phys_invalidate. Move the manipulation into the shared function that does the work.

This enables watchpoints to work in MacOS TCG guests.

Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/3444

---
  accel/tcg/tb-maint.c | 5 +++--
  1 file changed, 3 insertions(+), 2 deletions(-)
accel/tcg/tb-maint.c +1 -0
index cd7c32361bb..9a648f97865 100644
@@ -925,6 +925,7 @@ static void do_tb_phys_invalidate(TranslationBlock *tb, bool rm_from_page_list)
      uint32_t orig_cflags = tb_cflags(tb);
 
      assert_memory_lock();
+    qemu_thread_jit_write();
 
      /* make sure no further incoming jumps will be chained to this TB */
      qemu_spin_lock(&tb->jmp_lock);

accel/tcg/tb-maint.c static void do_tb_phys_invalidate(TranslationBlock *tb, bool rm_from_page_list) · line 958

Quoted 4 lines
accel/tcg/tb-maint.c +1 -0
@@ -954,15 +955,15 @@ static void do_tb_phys_invalidate(TranslationBlock *tb, bool rm_from_page_list)
      /* suppress any remaining jumps to this TB */
      tb_jmp_unlink(tb);
 
+    qemu_thread_jit_execute();

You've missed the early return path from the middle of the function, which should be fatal.

But the place that needs this is tb_reset_jump, which is called from tb_remove_from_jmp_list and tb_jmp_unlink. Which is entirely covered by moving this down toward the end of the function like so:

---
+ qemu_thread_jit_write();

    /* suppress this TB from the two jump lists */
    tb_remove_from_jmp_list(tb, 0);
    tb_remove_from_jmp_list(tb, 1);

    /* suppress any remaining jumps to this TB */
    tb_jmp_unlink(tb);

+ qemu_thread_jit_execute();
---

accel/tcg/tb-maint.c static void do_tb_phys_invalidate(TranslationBlock *tb, bool rm_from_page_list) · line 967

Quoted 11 lines
accel/tcg/tb-maint.c +1 -2
+
      qatomic_set(&tb_ctx.tb_phys_invalidate_count,
                  tb_ctx.tb_phys_invalidate_count + 1);
  }
 
  static void tb_phys_invalidate__locked(TranslationBlock *tb)
  {
-    qemu_thread_jit_write();
      do_tb_phys_invalidate(tb, true);
-    qemu_thread_jit_execute();
  }

Might as well remove tb_phys_invalidate__locked entirely, and propagate the direct call to do_tb_phys_invalidate.

The __locked suffix does appear to be for the user assert_memory_locked(). As evidenced by tb_phys_invalidate, for system mode, we only sometimes take the page lock.

Given that this jit protection is via pthread_jit_write_protect_np, I assume the W^X protection is a magic Apple per-thread bit. If so, we don't actually require cross-thread locking at all, and all is well.

r~

#7 lore raw

Re: [PATCH 2/5] accel/tcg: move jit thread manipulation into do_tb_phys_invalidate

Quoted 29 lines · Richard Henderson
Quoted 22 lines · Alex Bennée

To invalidate a TB on MacOS we need to enable write access to the JIT buffer. We were doing this for tb_phys_invalidate__locked but that is not the only path into do_tb_phys_invalidate. Move the manipulation into the shared function that does the work.
This enables watchpoints to work in MacOS TCG guests.
Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/3444

---
  accel/tcg/tb-maint.c | 5 +++--
  1 file changed, 3 insertions(+), 2 deletions(-)
accel/tcg/tb-maint.c +1 -0
index cd7c32361bb..9a648f97865 100644
@@ -925,6 +925,7 @@ static void do_tb_phys_invalidate(TranslationBlock *tb, bool rm_from_page_list)
      uint32_t orig_cflags = tb_cflags(tb);
        assert_memory_lock();
+    qemu_thread_jit_write();
        /* make sure no further incoming jumps will be chained to

this TB */

      qemu_spin_lock(&tb->jmp_lock);

accel/tcg/tb-maint.c static void do_tb_phys_invalidate(TranslationBlock *tb, bool rm_from_page_list) · line 957

Quoted 3 lines
accel/tcg/tb-maint.c +0 -0
@@ -954,15 +955,15 @@ static void do_tb_phys_invalidate(TranslationBlock *tb, bool rm_from_page_list)
      /* suppress any remaining jumps to this TB */
      tb_jmp_unlink(tb);
  +    qemu_thread_jit_execute();

You've missed the early return path from the middle of the function, which should be fatal.

Quoted 6 lines

But the place that needs this is tb_reset_jump, which is called from tb_remove_from_jmp_list and tb_jmp_unlink. Which is entirely covered by moving this down toward the end of the function like so:

---
+ qemu_thread_jit_write();

I think we also need to cover the spinlock:

    /* make sure no further incoming jumps will be chained to this TB */
    qemu_spin_lock(&tb->jmp_lock);
    qatomic_set(&tb->cflags, tb->cflags | CF_INVALID);
    qemu_spin_unlock(&tb->jmp_lock);

as that is what the original bug reported it was stuck spinning on.

Quoted 36 lines
    /* suppress this TB from the two jump lists */
    tb_remove_from_jmp_list(tb, 0);
    tb_remove_from_jmp_list(tb, 1);

    /* suppress any remaining jumps to this TB */
    tb_jmp_unlink(tb);

+ qemu_thread_jit_execute();
---

accel/tcg/tb-maint.c static void do_tb_phys_invalidate(TranslationBlock *tb, bool rm_from_page_list) · line 967

Quoted 10 lines
accel/tcg/tb-maint.c +1 -2
+
      qatomic_set(&tb_ctx.tb_phys_invalidate_count,
                  tb_ctx.tb_phys_invalidate_count + 1);
  }
    static void tb_phys_invalidate__locked(TranslationBlock *tb)
  {
-    qemu_thread_jit_write();
      do_tb_phys_invalidate(tb, true);
-    qemu_thread_jit_execute();
  }

Might as well remove tb_phys_invalidate__locked entirely, and propagate the direct call to do_tb_phys_invalidate.

The __locked suffix does appear to be for the user assert_memory_locked(). As evidenced by tb_phys_invalidate, for system mode, we only sometimes take the page lock.

Given that this jit protection is via pthread_jit_write_protect_np, I assume the W^X protection is a magic Apple per-thread bit. If so, we don't actually require cross-thread locking at all, and all is well.

r~

Signature · 2 lines
Alex Bennée
Virtualisation Tech Lead @ Linaro
#8 lore raw

PATCH 3/5 ci: drop cirrus MacOS build

In reply to Alex Bennée

CirrusCI is closing down soon so time to migrate.

---
 .gitlab-ci.d/cirrus.yml           | 14 --------------
 .gitlab-ci.d/cirrus/macos-14.vars | 16 ----------------
 tests/lcitool/refresh             |  1 -
 3 files changed, 31 deletions(-)
 delete mode 100644 .gitlab-ci.d/cirrus/macos-14.vars
.gitlab-ci.d/cirrus.yml +0 -14
index f2a9a64b76a..b71ab090b65 100644
@@ -44,17 +44,3 @@ x64-freebsd-14-build:
     INSTALL_COMMAND: pkg install -y
     CONFIGURE_ARGS: --target-list-exclude=arm-softmmu,i386-softmmu,mips64el-softmmu,mipsel-softmmu,mips-softmmu,ppc-softmmu,sh4eb-softmmu,xtensa-softmmu --enable-rust
     TEST_TARGETS: check
-
-aarch64-macos-build:
-  extends: .cirrus_build_job
-  variables:
-    NAME: macos-14
-    CIRRUS_VM_INSTANCE_TYPE: macos_instance
-    CIRRUS_VM_IMAGE_SELECTOR: image
-    CIRRUS_VM_IMAGE_NAME: ghcr.io/cirruslabs/macos-runner:sonoma
-    UPDATE_COMMAND: brew update
-    INSTALL_COMMAND: brew install
-    PATH_EXTRA: /opt/homebrew/ccache/libexec:/opt/homebrew/gettext/bin
-    PKG_CONFIG_PATH: /opt/homebrew/curl/lib/pkgconfig:/opt/homebrew/ncurses/lib/pkgconfig:/opt/homebrew/readline/lib/pkgconfig
-    CONFIGURE_ARGS: --target-list-exclude=arm-softmmu,i386-softmmu,mips64-softmmu,mipsel-softmmu,mips-softmmu,ppc-softmmu,sh4-softmmu,xtensaeb-softmmu --enable-rust
-    TEST_TARGETS: check-unit check-block check-qapi-schema check-softfloat check-qtest-x86_64
.gitlab-ci.d/cirrus/macos-14.vars deleted +0 -16
deleted file mode 100644
index def77cfdea5..00000000000
@@ -1,16 +0,0 @@
-# THIS FILE WAS AUTO-GENERATED
-#
-#  $ lcitool variables macos-14 qemu
-#
-# https://gitlab.com/libvirt/libvirt-ci
-
-CCACHE='/opt/homebrew/bin/ccache'
-CPAN_PKGS=''
-CROSS_PKGS=''
-MAKE='/opt/homebrew/bin/gmake'
-NINJA='/opt/homebrew/bin/ninja'
-PACKAGING_COMMAND='brew'
-PIP3='/opt/homebrew/bin/pip3'
-PKGS='bash bc bindgen bison bzip2 capstone ccache cmocka coreutils ctags curl dbus diffutils dtc flex gcovr gettext git glib gnu-sed gnutls gtk+3 gtk-vnc jemalloc jpeg-turbo json-c libcbor libepoxy libffi libgcrypt libiscsi libnfs libpng libslirp libssh libtasn1 libusb llvm lzo make meson mtools ncurses nettle ninja pixman pkg-config python-setuptools python3 rpm2cpio rust sdl2 sdl2_image snappy socat sparse spice-protocol swtpm tesseract usbredir vde vte3 vulkan-tools xorriso zlib zstd'
-PYPI_PKGS='PyYAML numpy pillow sphinx sphinx-rtd-theme tomli'
-PYTHON='/opt/homebrew/bin/python3'
tests/lcitool/refresh +0 -1
index e4d01d792b7..fa4a16e3583 100755
@@ -311,7 +311,6 @@ try:
     # Cirrus packages lists for GitLab
     #
     generate_cirrus("freebsd-14")
-    generate_cirrus("macos-14")
 
     #
     # VM packages lists
Signature · 1 line
2.47.3
Reviewed-by on v1 3/5
#9 lore raw

Re: [PATCH 3/5] ci: drop cirrus MacOS build

Quoted 9 lines · Alex Bennée

CirrusCI is closing down soon so time to migrate.

---
  .gitlab-ci.d/cirrus.yml           | 14 --------------
  .gitlab-ci.d/cirrus/macos-14.vars | 16 ----------------
  tests/lcitool/refresh             |  1 -
  3 files changed, 31 deletions(-)

delete mode 100644 .gitlab-ci.d/cirrus/macos-14.vars

Reviewed-by on v1 3/5
#10 lore raw

Re: [PATCH 3/5] ci: drop cirrus MacOS build

In reply to Alex Bennée
Quoted 9 lines · Alex Bennée

CirrusCI is closing down soon so time to migrate.

---
  .gitlab-ci.d/cirrus.yml           | 14 --------------
  .gitlab-ci.d/cirrus/macos-14.vars | 16 ----------------
  tests/lcitool/refresh             |  1 -
  3 files changed, 31 deletions(-)

delete mode 100644 .gitlab-ci.d/cirrus/macos-14.vars

#11 lore raw

PATCH 4/5 gitlab: add initial MacOS 15 on gitlab runner

In reply to Alex Bennée

The gitlab runners are currently in beta but available to projects on the Premium and Ultimate plans (which QEMU is via the Open Source program).

We install some compilers via brew so we can run some of the check-tcg softmmu test cases.

We disable rust as the version is too old.

We disable plugins because we haven't taught the test harness about .dynlib vs .so yet.

There is a discrepancy between the vars and version of MacOS because lcitool needs teaching about other versions (although I don't think it matters as brew is shared across versions).

---
 .gitlab-ci.d/macos-14.vars    | 16 ++++++++++++
 .gitlab-ci.d/macos.yml        | 49 +++++++++++++++++++++++++++++++++++
 .gitlab-ci.d/qemu-project.yml |  1 +
 tests/lcitool/refresh         | 11 ++++++++
 4 files changed, 77 insertions(+)
 create mode 100644 .gitlab-ci.d/macos-14.vars
 create mode 100644 .gitlab-ci.d/macos.yml
.gitlab-ci.d/macos-14.vars new file +16 -0
new file mode 100644
index 00000000000..def77cfdea5
@@ -0,0 +1,16 @@
+# THIS FILE WAS AUTO-GENERATED
+#
+#  $ lcitool variables macos-14 qemu
+#
+# https://gitlab.com/libvirt/libvirt-ci
+
+CCACHE='/opt/homebrew/bin/ccache'
+CPAN_PKGS=''
+CROSS_PKGS=''
+MAKE='/opt/homebrew/bin/gmake'
+NINJA='/opt/homebrew/bin/ninja'
+PACKAGING_COMMAND='brew'
+PIP3='/opt/homebrew/bin/pip3'
+PKGS='bash bc bindgen bison bzip2 capstone ccache cmocka coreutils ctags curl dbus diffutils dtc flex gcovr gettext git glib gnu-sed gnutls gtk+3 gtk-vnc jemalloc jpeg-turbo json-c libcbor libepoxy libffi libgcrypt libiscsi libnfs libpng libslirp libssh libtasn1 libusb llvm lzo make meson mtools ncurses nettle ninja pixman pkg-config python-setuptools python3 rpm2cpio rust sdl2 sdl2_image snappy socat sparse spice-protocol swtpm tesseract usbredir vde vte3 vulkan-tools xorriso zlib zstd'
+PYPI_PKGS='PyYAML numpy pillow sphinx sphinx-rtd-theme tomli'
+PYTHON='/opt/homebrew/bin/python3'
.gitlab-ci.d/macos.yml new file +49 -0

49 lines not on this page · raw message

.gitlab-ci.d/qemu-project.yml +1 -0
index 4d914c4897b..9cbb5fe787f 100644
@@ -19,3 +19,4 @@ include:
   - local: '/.gitlab-ci.d/custom-runners.yml'
   - local: '/.gitlab-ci.d/cirrus.yml'
   - local: '/.gitlab-ci.d/windows.yml'
+  - local: '/.gitlab-ci.d/macos.yml'
tests/lcitool/refresh +11 -0
index fa4a16e3583..4289cc381a6 100755
@@ -87,6 +87,12 @@ def generate_cirrus(target, trailer=None):
     generate(filename, cmd, trailer)
 
 
+def generate_vars(target, trailer=None):
+    filename = Path(src_dir, ".gitlab-ci.d", target + ".vars")
+    cmd = lcitool_cmd + ["variables", "--format", "shell", target, "qemu"]
+    generate(filename, cmd, trailer)
+
+
 def generate_pkglist(vm, target, project="qemu"):
     filename = Path(src_dir, "tests", "vm", "generated", vm + ".json")
     cmd = lcitool_cmd + ["variables", "--format", "json", target, project]
@@ -312,6 +318,11 @@ try:
     #
     generate_cirrus("freebsd-14")
 
+    #
+    # GitLab packages lists
+    #
+    generate_vars("macos-14")
+
     #
     # VM packages lists
     #
Signature · 1 line
2.47.3
#12 lore raw

Re: [PATCH 4/5] gitlab: add initial MacOS 15 on gitlab runner

Quoted 70 lines · Alex Bennée

The gitlab runners are currently in beta but available to projects on the Premium and Ultimate plans (which QEMU is via the Open Source program).

We install some compilers via brew so we can run some of the check-tcg softmmu test cases.

We disable rust as the version is too old.

We disable plugins because we haven't taught the test harness about .dynlib vs .so yet.

There is a discrepancy between the vars and version of MacOS because lcitool needs teaching about other versions (although I don't think it matters as brew is shared across versions).

---
  .gitlab-ci.d/macos-14.vars    | 16 ++++++++++++
  .gitlab-ci.d/macos.yml        | 49 +++++++++++++++++++++++++++++++++++
  .gitlab-ci.d/qemu-project.yml |  1 +
  tests/lcitool/refresh         | 11 ++++++++
  4 files changed, 77 insertions(+)

create mode 100644 .gitlab-ci.d/macos-14.vars
create mode 100644 .gitlab-ci.d/macos.yml

.gitlab-ci.d/macos-14.vars new file +16 -0
new file mode 100644
index 00000000000..def77cfdea5
@@ -0,0 +1,16 @@
+# THIS FILE WAS AUTO-GENERATED
+#
+#  $ lcitool variables macos-14 qemu
+#
+# https://gitlab.com/libvirt/libvirt-ci
+
+CCACHE='/opt/homebrew/bin/ccache'
+CPAN_PKGS=''
+CROSS_PKGS=''
+MAKE='/opt/homebrew/bin/gmake'
+NINJA='/opt/homebrew/bin/ninja'
+PACKAGING_COMMAND='brew'
+PIP3='/opt/homebrew/bin/pip3'
+PKGS='bash bc bindgen bison bzip2 capstone ccache cmocka coreutils ctags curl dbus diffutils dtc flex gcovr gettext git glib gnu-sed gnutls gtk+3 gtk-vnc jemalloc jpeg-turbo json-c libcbor libepoxy libffi libgcrypt libiscsi libnfs libpng libslirp libssh libtasn1 libusb llvm lzo make meson mtools ncurses nettle ninja pixman pkg-config python-setuptools python3 rpm2cpio rust sdl2 sdl2_image snappy socat sparse spice-protocol swtpm tesseract usbredir vde vte3 vulkan-tools xorriso zlib zstd'
+PYPI_PKGS='PyYAML numpy pillow sphinx sphinx-rtd-theme tomli'
+PYTHON='/opt/homebrew/bin/python3'
.gitlab-ci.d/macos.yml new file +16 -0
new file mode 100644
index 00000000000..edb500e937b
@@ -0,0 +1,49 @@
+.macos_job_template:
+  extends: .base_job_template
+  stage: build
+  tags:
+    - saas-macos-large-m2pro
+  needs: []
+  timeout: 80m
+  artifacts:
+    name: "$CI_JOB_NAME-$CI_COMMIT_REF_SLUG"
+    expire_in: 7 days
+    paths:
+      - build/meson-logs/
+      - build/tests/tcg/
+    reports:
+      junit: build/meson-logs/*.junit.xml
+    when: always

.gitlab-ci.d/macos.yml line 26

Quoted 10 lines
.gitlab-ci.d/macos.yml new file +10 -0
+  before_script:
+    - set -o allexport
+    - source .gitlab-ci.d/macos-14.vars
+    - set +o allexport
+    - export PATH="$PATH_EXTRA:$PATH"
+    - export PKG_CONFIG_PATH="$PKG_CONFIG_PATH"
+    - brew update
+    - brew install $PKGS
+    - brew install gdb aarch64-elf-gcc i686-elf-gcc x86_64-elf-gcc
+    - python3 ./scripts/probe-gdb-support.py $(which gdb)

Is the probe-gdb-support.py required here? If not, I'd rather remove that line again.

.gitlab-ci.d/macos.yml line 31

Quoted 5 lines
.gitlab-ci.d/macos.yml new file +5 -0
+    - if test -n "$PYPI_PKGS" ; then PYLIB=$($PYTHON -c 'import sysconfig; print(sysconfig.get_path("stdlib"))'); rm -f $PYLIB/EXTERNALLY-MANAGED; $PIP3 install --break-system-packages $PYPI_PKGS ; fi
+  script:
+    - mkdir build
+    - cd build
+    - env

dito, the "env" looks like debugging leftovers ... I'd rather drop it.

.gitlab-ci.d/macos.yml line 41

Quoted 10 lines
.gitlab-ci.d/macos.yml new file +10 -0
+    - ../configure --enable-werror $CONFIGURE_ARGS || { cat config.log meson-logs/meson-log.txt; exit 1; }
+    - $MAKE -j$(sysctl -n hw.ncpu)
+    - for TARGET in $TEST_TARGETS ; do $MAKE $TARGET ; done
+
+aarch64-macos-15-build:
+  extends: .macos_job_template
+  image: macos-15-xcode-16
+  variables:
+    NAME: macos-15
+    PATH_EXTRA: /opt/homebrew/ccache/libexec:/opt/homebrew/gettext/bin

As far as I can see, there is no cache configured for this runner ... so could you please drop the ccache stuff from this patch? It will only slow down compilation if the results get thrown away afterwards.

Thomas

Quoted 46 lines
.gitlab-ci.d/macos.yml new file +8 -0
+    PKG_CONFIG_PATH: /opt/homebrew/curl/lib/pkgconfig:/opt/homebrew/ncurses/lib/pkgconfig:/opt/homebrew/readline/lib/pkgconfig
+    CONFIGURE_ARGS:
+        --target-list=aarch64-softmmu,i386-softmmu,x86_64-softmmu
+        --cross-prefix-aarch64=aarch64-elf-
+        --cross-prefix-i386=i686-elf-
+        --cross-prefix-x86_64=x86_64-elf-
+        --disable-plugins
+    TEST_TARGETS: check-unit check-tcg
.gitlab-ci.d/qemu-project.yml +1 -0
index 4d914c4897b..9cbb5fe787f 100644
@@ -19,3 +19,4 @@ include:
    - local: '/.gitlab-ci.d/custom-runners.yml'
    - local: '/.gitlab-ci.d/cirrus.yml'
    - local: '/.gitlab-ci.d/windows.yml'
+  - local: '/.gitlab-ci.d/macos.yml'
tests/lcitool/refresh +11 -0
index fa4a16e3583..4289cc381a6 100755
@@ -87,6 +87,12 @@ def generate_cirrus(target, trailer=None):
      generate(filename, cmd, trailer)
 
 
+def generate_vars(target, trailer=None):
+    filename = Path(src_dir, ".gitlab-ci.d", target + ".vars")
+    cmd = lcitool_cmd + ["variables", "--format", "shell", target, "qemu"]
+    generate(filename, cmd, trailer)
+
+
  def generate_pkglist(vm, target, project="qemu"):
      filename = Path(src_dir, "tests", "vm", "generated", vm + ".json")
      cmd = lcitool_cmd + ["variables", "--format", "json", target, project]
@@ -312,6 +318,11 @@ try:
      #
      generate_cirrus("freebsd-14")
 
+    #
+    # GitLab packages lists
+    #
+    generate_vars("macos-14")
+
      #
      # VM packages lists
      #
#13 lore raw

Re: [PATCH 4/5] gitlab: add initial MacOS 15 on gitlab runner

Quoted 87 lines · Thomas Huth
Quoted 72 lines · Alex Bennée

The gitlab runners are currently in beta but available to projects on the Premium and Ultimate plans (which QEMU is via the Open Source program).
We install some compilers via brew so we can run some of the check-tcg
softmmu test cases.
We disable rust as the version is too old.
We disable plugins because we haven't taught the test harness about .dynlib vs .so yet.
There is a discrepancy between the vars and version of MacOS because lcitool needs teaching about other versions (although I don't think it matters as brew is shared across versions).

---
  .gitlab-ci.d/macos-14.vars    | 16 ++++++++++++
  .gitlab-ci.d/macos.yml        | 49 +++++++++++++++++++++++++++++++++++
  .gitlab-ci.d/qemu-project.yml |  1 +
  tests/lcitool/refresh         | 11 ++++++++
  4 files changed, 77 insertions(+)

create mode 100644 .gitlab-ci.d/macos-14.vars
create mode 100644 .gitlab-ci.d/macos.yml

.gitlab-ci.d/macos-14.vars new file +14 -0
new file mode 100644
index 00000000000..def77cfdea5
@@ -0,0 +1,16 @@
+# THIS FILE WAS AUTO-GENERATED
+#
+#  $ lcitool variables macos-14 qemu
+#
+# https://gitlab.com/libvirt/libvirt-ci
+
+CCACHE='/opt/homebrew/bin/ccache'
+CPAN_PKGS=''
+CROSS_PKGS=''
+MAKE='/opt/homebrew/bin/gmake'
+NINJA='/opt/homebrew/bin/ninja'
+PACKAGING_COMMAND='brew'
+PIP3='/opt/homebrew/bin/pip3'
+PKGS='bash bc bindgen bison bzip2 capstone ccache cmocka coreutils

ctags curl dbus diffutils dtc flex gcovr gettext git glib gnu-sed gnutls gtk+3 gtk-vnc jemalloc jpeg-turbo json-c libcbor libepoxy libffi libgcrypt libiscsi libnfs libpng libslirp libssh libtasn1 libusb llvm lzo make meson mtools ncurses nettle ninja pixman pkg-config python-setuptools python3 rpm2cpio rust sdl2 sdl2_image snappy socat sparse spice-protocol swtpm tesseract usbredir vde vte3 vulkan-tools xorriso zlib zstd'

.gitlab-ci.d/macos-14.vars new file +2 -0
+PYPI_PKGS='PyYAML numpy pillow sphinx sphinx-rtd-theme tomli'
+PYTHON='/opt/homebrew/bin/python3'
.gitlab-ci.d/macos.yml new file +16 -0
new file mode 100644
index 00000000000..edb500e937b
@@ -0,0 +1,49 @@
+.macos_job_template:
+  extends: .base_job_template
+  stage: build
+  tags:
+    - saas-macos-large-m2pro
+  needs: []
+  timeout: 80m
+  artifacts:
+    name: "$CI_JOB_NAME-$CI_COMMIT_REF_SLUG"
+    expire_in: 7 days
+    paths:
+      - build/meson-logs/
+      - build/tests/tcg/
+    reports:
+      junit: build/meson-logs/*.junit.xml
+    when: always

.gitlab-ci.d/macos.yml line 26

Quoted 10 lines
.gitlab-ci.d/macos.yml new file +10 -0
+  before_script:
+    - set -o allexport
+    - source .gitlab-ci.d/macos-14.vars
+    - set +o allexport
+    - export PATH="$PATH_EXTRA:$PATH"
+    - export PKG_CONFIG_PATH="$PKG_CONFIG_PATH"
+    - brew update
+    - brew install $PKGS
+    - brew install gdb aarch64-elf-gcc i686-elf-gcc x86_64-elf-gcc
+    - python3 ./scripts/probe-gdb-support.py $(which gdb)

Is the probe-gdb-support.py required here? If not, I'd rather remove that line again.

Quoted 8 lines

.gitlab-ci.d/macos.yml line 31

Quoted 5 lines
.gitlab-ci.d/macos.yml new file +5 -0
+    - if test -n "$PYPI_PKGS" ; then PYLIB=$($PYTHON -c 'import sysconfig; print(sysconfig.get_path("stdlib"))'); rm -f $PYLIB/EXTERNALLY-MANAGED; $PIP3 install --break-system-packages $PYPI_PKGS ; fi
+  script:
+    - mkdir build
+    - cd build
+    - env

dito, the "env" looks like debugging leftovers ... I'd rather drop it.

Yes both are debug left overs. Will fix.

Quoted 6 lines
Quoted 6 lines
.gitlab-ci.d/macos.yml new file +6 -0
+    - ../configure --enable-werror $CONFIGURE_ARGS || { cat config.log meson-logs/meson-log.txt; exit 1; }
+    - $MAKE -j$(sysctl -n hw.ncpu)
+    - for TARGET in $TEST_TARGETS ; do $MAKE $TARGET ; done
+
+aarch64-macos-15-build:
+  extends: .macos_job_template
Quoted 8 lines

.gitlab-ci.d/macos.yml line 41

Quoted 4 lines
.gitlab-ci.d/macos.yml new file +4 -0
+  image: macos-15-xcode-16
+  variables:
+    NAME: macos-15
+    PATH_EXTRA: /opt/homebrew/ccache/libexec:/opt/homebrew/gettext/bin

As far as I can see, there is no cache configured for this runner ... so could you please drop the ccache stuff from this patch? It will only slow down compilation if the results get thrown away afterwards.

Yeah will drop that. The machine is beefy enough and the job duration is ~12 mins and most of that is installing brew bits.

Quoted 46 lines

Thomas

Quoted 43 lines
.gitlab-ci.d/macos.yml new file +8 -0
+    PKG_CONFIG_PATH: /opt/homebrew/curl/lib/pkgconfig:/opt/homebrew/ncurses/lib/pkgconfig:/opt/homebrew/readline/lib/pkgconfig
+    CONFIGURE_ARGS:
+        --target-list=aarch64-softmmu,i386-softmmu,x86_64-softmmu
+        --cross-prefix-aarch64=aarch64-elf-
+        --cross-prefix-i386=i686-elf-
+        --cross-prefix-x86_64=x86_64-elf-
+        --disable-plugins
+    TEST_TARGETS: check-unit check-tcg
.gitlab-ci.d/qemu-project.yml +1 -0
index 4d914c4897b..9cbb5fe787f 100644
@@ -19,3 +19,4 @@ include:
    - local: '/.gitlab-ci.d/custom-runners.yml'
    - local: '/.gitlab-ci.d/cirrus.yml'
    - local: '/.gitlab-ci.d/windows.yml'
+  - local: '/.gitlab-ci.d/macos.yml'
tests/lcitool/refresh +9 -0
index fa4a16e3583..4289cc381a6 100755
@@ -87,6 +87,12 @@ def generate_cirrus(target, trailer=None):
      generate(filename, cmd, trailer)
    +def generate_vars(target, trailer=None):
+    filename = Path(src_dir, ".gitlab-ci.d", target + ".vars")
+    cmd = lcitool_cmd + ["variables", "--format", "shell", target, "qemu"]
+    generate(filename, cmd, trailer)
+
+
  def generate_pkglist(vm, target, project="qemu"):
      filename = Path(src_dir, "tests", "vm", "generated", vm + ".json")
      cmd = lcitool_cmd + ["variables", "--format", "json", target, project]
@@ -312,6 +318,11 @@ try:
      #
      generate_cirrus("freebsd-14")
  +    #
+    # GitLab packages lists
+    #
+    generate_vars("macos-14")
+
      #
      # VM packages lists
      #
Signature · 2 lines
Alex Bennée
Virtualisation Tech Lead @ Linaro
#14 lore raw

PATCH 5/5 gitlab: add MacOS 26 job on gitlab runner (!broken)

In reply to Alex Bennée

gitlab supports 3 MacOS images with 15 and 26 being the current supported ones. To get ahead of the curve lets enable 26 as well.

It re-uses the same brew list but also attempts to work around python configure failure by setting DYLD_LIBRARY_PATH:
/opt/homebrew/opt/expat/lib/

---
This is currently broken, I'm still seeing:

$ if test -n "$PYPI_PKGS" ; then PYLIB=$($PYTHON -c 'import sysconfig; print(sysconfig.get_path("stdlib"))'); rm -f $PYLIB/EXTERNALLY-MANAGED; $PIP3 install --break-system-packages $PYPI_PKGS ; fi
Traceback (most recent call last):
  File "/opt/homebrew/bin/pip3", line 6, in <module>
    sys.exit(main())
             ~~~~^^
  File "/opt/homebrew/lib/python3.14/site-packages/pip/_internal/cli/main.py", line 83, in main
    command = create_command(cmd_name, isolated=("--isolated" in cmd_args))
  File "/opt/homebrew/lib/python3.14/site-packages/pip/_internal/commands/__init__.py", line 121, in create_command
    module = importlib.import_module(module_path)
  File "/opt/homebrew/Cellar/[email protected]/3.14.4_1/Frameworks/Python.framework/Versions/3.14/lib/python3.14/importlib/__init__.py", line 88, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1406, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1371, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1342, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 938, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 759, in exec_module
  File "<frozen importlib._bootstrap>", line 491, in _call_with_frames_removed
  File "/opt/homebrew/lib/python3.14/site-packages/pip/_internal/commands/install.py", line 27, in <module>
    import pip._internal.self_outdated_check  # noqa: F401
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.14/site-packages/pip/_internal/self_outdated_check.py", line 19, in <module>
    from pip._internal.index.package_finder import PackageFinder
  File "/opt/homebrew/lib/python3.14/site-packages/pip/_internal/index/package_finder.py", line 42, in <module>
    from pip._internal.req import InstallRequirement
  File "/opt/homebrew/lib/python3.14/site-packages/pip/_internal/req/__init__.py", line 12, in <module>
    from .req_install import InstallRequirement
  File "/opt/homebrew/lib/python3.14/site-packages/pip/_internal/req/req_install.py", line 37, in <module>
    from pip._internal.operations.install.wheel import install_wheel
  File "/opt/homebrew/lib/python3.14/site-packages/pip/_internal/operations/install/wheel.py", line 33, in <module>
    from pip._vendor.distlib.scripts import ScriptMaker
  File "/opt/homebrew/lib/python3.14/site-packages/pip/_vendor/distlib/scripts.py", line 16, in <module>
    from .compat import sysconfig, detect_encoding, ZipFile
  File "/opt/homebrew/lib/python3.14/site-packages/pip/_vendor/distlib/compat.py", line 81, in <module>
    import xmlrpc.client as xmlrpclib
  File "/opt/homebrew/Cellar/[email protected]/3.14.4_1/Frameworks/Python.framework/Versions/3.14/lib/python3.14/xmlrpc/client.py", line 138, in <module>
    from xml.parsers import expat
  File "/opt/homebrew/Cellar/[email protected]/3.14.4_1/Frameworks/Python.framework/Versions/3.14/lib/python3.14/xml/parsers/expat.py", line 4, in <module>
    from pyexpat import *
ImportError: dlopen(/opt/homebrew/Cellar/[email protected]/3.14.4_1/Frameworks/Python.framework/Versions/3.14/lib/python3.14/lib-dynload/pyexpat.cpython-314-darwin.so, 0x0002): Symbol not found: _XML_SetAllocTrackerActivationThreshold
  Referenced from: <44AFDBDF-C9C3-35EF-A723-C0C54E2C9C3F> /opt/homebrew/Cellar/[email protected]/3.14.4_1/Frameworks/Python.framework/Versions/3.14/lib/python3.14/lib-dynload/pyexpat.cpython-314-darwin.so
  Expected in:     <4D62FA9D-D86A-3DD0-98F2-C6D0718849E8> /usr/lib/libexpat.1.dylib
---
 .gitlab-ci.d/macos.yml | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
.gitlab-ci.d/macos.yml +16 -0
index edb500e937b..aae42ca88f9 100644
@@ -47,3 +47,19 @@ aarch64-macos-15-build:
         --cross-prefix-x86_64=x86_64-elf-
         --disable-plugins
     TEST_TARGETS: check-unit check-tcg
+
+aarch64-macos-26-build:
+  extends: .macos_job_template
+  image: macos-26-xcode-26
+  variables:
+    NAME: macos-26
+    DYLD_LIBRARY_PATH: /opt/homebrew/opt/expat/lib/
+    PATH_EXTRA: /opt/homebrew/ccache/libexec:/opt/homebrew/gettext/bin
+    PKG_CONFIG_PATH: /opt/homebrew/curl/lib/pkgconfig:/opt/homebrew/ncurses/lib/pkgconfig:/opt/homebrew/readline/lib/pkgconfig
+    CONFIGURE_ARGS:
+        --target-list=aarch64-softmmu,i386-softmmu,x86_64-softmmu
+        --cross-prefix-aarch64=aarch64-elf-
+        --cross-prefix-i386=i686-elf-
+        --cross-prefix-x86_64=x86_64-elf-
+        --disable-plugins
+    TEST_TARGETS: check-unit check-tcg
Signature · 1 line
2.47.3