From: Bruce Ashfield <bruce.ashfield@gmail.com>
To: Haitao.Liu@windriver.com
Cc: meta-virtualization@lists.yoctoproject.org
Subject: Re: [meta-virtualization][wrynose][PATCH 2/2] libvirt: re-add ptest support for meson build system
Date: Fri, 5 Jun 2026 03:31:04 +0000 [thread overview]
Message-ID: <aiJC-KJDCjsCNBjN@gmail.com> (raw)
In-Reply-To: <20260529030040.1487113-2-haitao.liu@windriver.com>
This isn't strictly within bounds of "no new features", but since
it will help maintain the LTS branch, I'll mege it once I'm through
feature testing and a few other items.
Bruce"
In message: [meta-virtualization][wrynose][PATCH 2/2] libvirt: re-add ptest support for meson build system
on 29/05/2026 jason.lau via lists.yoctoproject.org wrote:
> libvirt has switched its build system from Makefile to meson, so the
> original run-ptest which relied on "make -C tests -k check-TESTS" no
> longer works. Re-add ptest support based on the meson build system:
>
> - Rewrite run-ptest to directly execute the compiled test binaries
> instead of invoking make.
> - Patch meson.build at configure time to replace absolute build/source
> paths with the ptest install paths, removing the need for separate
> path-stripping patches.
> - Install test binaries and their required data files into the ptest
> directory.
>
> Test results on genericx86-64:
>
> All 120 tests passed (0 failures, 0 skips).
>
> root@genericx86-64:/usr/lib/libvirt/ptest# ./run-ptest
> PASS: chxml2xmltest
> PASS: nssguestlinktest
> PASS: virbuftest
> PASS: viracpitest
> PASS: esxutilstest
> PASS: ssh
> PASS: storagepoolxml2xmltest
> PASS: commandtest
> ...
> ...
> PASS: nwfilterebiptablestest
> PASS: cputest
>
> === Test Summary ===
> PASS: 120
> FAIL: 0
> SKIP: 0
> TOTAL: 120
>
> Signed-off-by: Haitao Liu <haitao.liu@windriver.com>
> ---
> recipes-extended/libvirt/libvirt/run-ptest | 32 ++++++++++++++-
> recipes-extended/libvirt/libvirt_git.bb | 45 ++++++++++++++++++++--
> 2 files changed, 73 insertions(+), 4 deletions(-)
>
> diff --git a/recipes-extended/libvirt/libvirt/run-ptest b/recipes-extended/libvirt/libvirt/run-ptest
> index a434b186..dd1f94d3 100644
> --- a/recipes-extended/libvirt/libvirt/run-ptest
> +++ b/recipes-extended/libvirt/libvirt/run-ptest
> @@ -1,3 +1,33 @@
> #!/bin/sh
>
> -make -C tests -k check-TESTS
> +PTEST_DIR="/usr/lib/libvirt/ptest/tests"
> +export LD_LIBRARY_PATH="${PTEST_DIR}:${LD_LIBRARY_PATH}"
> +PASS=0
> +FAIL=0
> +SKIP=0
> +
> +run_test() {
> + tname="$1"
> + tpath="$2"
> + "$tpath" >/dev/null 2>&1
> + rc=$?
> + case $rc in
> + 0) echo "PASS: $tname"; PASS=$((PASS + 1)) ;;
> + 77) echo "SKIP: $tname"; SKIP=$((SKIP + 1)) ;;
> + *) echo "FAIL: $tname"; FAIL=$((FAIL + 1)) ;;
> + esac
> +}
> +
> +# Skip run-ptest (self), commandhelper and qemucapsprobe are middleware
> +# used by other test cases, not test cases themselves.
> +for t in $(find ${PTEST_DIR} -maxdepth 1 -type f -executable ! -name "*.so" ! -name "run-ptest" ! -name "commandhelper" ! -name "qemucapsprobe"); do
> + run_test "$(basename $t)" "$t"
> +done
> +
> +# Summary
> +echo ""
> +echo "=== Test Summary ==="
> +echo "PASS: $PASS"
> +echo "FAIL: $FAIL"
> +echo "SKIP: $SKIP"
> +echo "TOTAL: $((PASS + FAIL + SKIP))"
> diff --git a/recipes-extended/libvirt/libvirt_git.bb b/recipes-extended/libvirt/libvirt_git.bb
> index cb5d3482..0052f527 100644
> --- a/recipes-extended/libvirt/libvirt_git.bb
> +++ b/recipes-extended/libvirt/libvirt_git.bb
> @@ -34,17 +34,16 @@ PV = "v${LIBVIRT_VERSION}+git"
> SRC_URI = "gitsm://github.com/libvirt/libvirt.git;name=libvirt;protocol=https;branch=master \
> file://libvirtd.sh \
> file://libvirtd.conf \
> + file://run-ptest \
> file://dnsmasq.conf \
> file://hook_support.py \
> file://gnutls-helper.py;subdir=${BP} \
> file://libvirt-qemu.conf \
> file://0001-prevent-gendispatch.pl-generating-build-path-in-code.patch \
> - file://0001-messon.build-remove-build-path-information-to-avoid-.patch \
> - file://0001-tests-meson-clear-absolute-directory-paths.patch \
> file://0001-qemu_nbdkit.c-use-llu-to-print-time_t.patch \
> "
>
> -inherit meson gettext update-rc.d pkgconfig systemd useradd perlnative
> +inherit meson gettext update-rc.d pkgconfig systemd useradd perlnative ptest
> USERADD_PACKAGES = "${PN}"
> GROUPADD_PARAM:${PN} = "-r qemu; -r kvm; -r libvirt; -r virtlogin"
> USERADD_PARAM:${PN} = "-r -g qemu -G kvm qemu"
> @@ -188,6 +187,46 @@ CVE_STATUS[CVE-2023-3750] = "fixed-version: Fixed in 9.6.0, NVD tracks this as v
> # Enable the Python tool support
> require libvirt-python.inc
>
> +do_configure:prepend() {
> + sed -i \
> + -e "s|meson.current_build_dir()|'${PTEST_PATH}/tests'|g" \
> + -e "s|meson.project_build_root()|'${PTEST_PATH}'|g" \
> + -e "s|meson.current_source_dir()|'${PTEST_PATH}/datas/tests'|g" \
> + -e "s|meson.project_source_root()|'${PTEST_PATH}/datas'|g" \
> + ${S}/tests/meson.build ${S}/scripts/rpcgen/tests/meson.build ${S}/tests/schemas/meson.build
> +}
> +
> +# Guard abs_top_builddir/abs_top_srcdir defines with #ifndef to avoid
> +# -Werror redefinition conflict when tests pass them via -D compile flags.
> +do_configure:append() {
> + sed -i '/^#define abs_top_builddir/c\#ifndef abs_top_builddir\n#define abs_top_builddir " "\n#endif' ${B}/meson-config.h
> + sed -i '/^#define abs_top_srcdir/c\#ifndef abs_top_srcdir\n#define abs_top_srcdir " "\n#endif' ${B}/meson-config.h
> +}
> +
> +
> +do_install_ptest() {
> + install -d ${D}${PTEST_PATH}/tests
> + install -d ${D}${PTEST_PATH}/datas/tests
> + # The virshtest expects virsh at ${PTEST_PATH}/tests/tools/virsh, but it is
> + # installed to /usr/bin/virsh by libvirt-virsh. Create a symlink to satisfy
> + # the test's expected path.
> + install -d ${D}${PTEST_PATH}/tools
> + ln -sf /usr/bin/virsh ${D}${PTEST_PATH}/tools/virsh
> + find ${B}/tests/ -type f -executable -print -maxdepth 1 | xargs -i cp {} ${D}${PTEST_PATH}/tests -rf
> + cd ${S}/tests && find . -mindepth 1 -maxdepth 1 -type d | xargs -i cp {} ${D}${PTEST_PATH}/datas/tests -a
> + install -m 0755 ${B}/scripts/rpcgen/tests/test_demo ${D}${PTEST_PATH}/tests
> + install -m 0644 ${S}/scripts/rpcgen/tests/*.bin ${D}${PTEST_PATH}/datas/tests
> + install -D -m 0644 -t ${D}${PTEST_PATH}/datas/examples/xml/test/ ${S}/examples/xml/test/*.xml
> + install -D -m 0644 -t ${D}${PTEST_PATH}/datas/examples/xml/storage/ ${S}/examples/xml/storage/*.xml
> + install -D -m 0644 -t ${D}${PTEST_PATH}/datas/src/conf/schemas/ ${S}/src/conf/schemas/*.rng
> + install -D -m 0644 -t ${D}${PTEST_PATH}/datas/src/nwfilter/xml/ ${S}/src/nwfilter/xml/*.xml
> + install -D -m 0644 -t ${D}${PTEST_PATH}/tests/schemas/ ${B}/tests/schemas/*.rng
> + install -m 0644 ${S}/tests/openvzutilstest.conf ${D}${PTEST_PATH}/datas/tests
> + install -d ${D}${PTEST_PATH}/datas/src/network
> +}
> +
> +RDEPENDS:${PN}-ptest += " ${PN}-virsh"
> +
> do_compile() {
> cd ${B}/src
> # There may be race condition, but without creating these directories
> --
> 2.34.1
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#9824): https://lists.yoctoproject.org/g/meta-virtualization/message/9824
> Mute This Topic: https://lists.yoctoproject.org/mt/119542053/1050810
> Group Owner: meta-virtualization+owner@lists.yoctoproject.org
> Unsubscribe: https://lists.yoctoproject.org/g/meta-virtualization/unsub [bruce.ashfield@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
next prev parent reply other threads:[~2026-06-05 3:31 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-29 3:00 [meta-virtualization][wrynose][PATCH 1/2] libvirt: update to v12.2.0 Haitao Liu
2026-05-29 3:00 ` [meta-virtualization][wrynose][PATCH 2/2] libvirt: re-add ptest support for meson build system Haitao Liu
2026-06-05 3:31 ` Bruce Ashfield [this message]
2026-06-05 3:27 ` [meta-virtualization][wrynose][PATCH 1/2] libvirt: update to v12.2.0 Bruce Ashfield
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aiJC-KJDCjsCNBjN@gmail.com \
--to=bruce.ashfield@gmail.com \
--cc=Haitao.Liu@windriver.com \
--cc=meta-virtualization@lists.yoctoproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.