Skip to contentSkip to conversation

xtf: introduce recipe for the Xen Test Framework

PATCH In review Christopher Clark 3 participants 5 messages Apr 13, 2021 – Apr 14, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 xtf: introduce recipe for the Xen Test Framework

---
 recipes-extended/xen/xtf_git.bb | 61 +++++++++++++++++++++++++++++++++
 1 file changed, 61 insertions(+)
 create mode 100644 recipes-extended/xen/xtf_git.bb
recipes-extended/xen/xtf_git.bb new file +61 -0
new file mode 100644
index 0000000..6dc0f8d
@@ -0,0 +1,61 @@
+SUMMARY = "Xen Test Framework"
+HOMEPAGE = "https://xenbits.xenproject.org/docs/xtf/"
+LICENSE = "BSD-2-Clause"
+
+SRC_URI = "git://xenbits.xen.org/xtf"
+SRCREV = "8ab15139728a8efd3ebbb60beb16a958a6a93fa1"
+
+COMPATIBLE_HOST = '(x86_64.*).*-linux'
+
+LIC_FILES_CHKSUM = "file://COPYING;md5=a5680865974e05cf0510615ee1d745d8"
+
+PV = "0+git${SRCPV}"
+
+S = "${WORKDIR}/git"
+
+inherit python3native
+
+# To build 32-bit binaries some files from 32-bit glibc are needed.
+# To enable multilib, please add the following to your local.conf -:
+#
+#    require conf/multilib.conf
+#    MULTILIBS = "multilib:lib32"
+#    DEFAULTTUNE_virtclass-multilib-lib32 = "x86"
+
+# Use this multilib prefix for x86 32-bit to match local.conf:
+MLPREFIX32 = "lib32-"
+# Add the multilib 32-bit glibc to DEPENDS only when necessary:
+# The DEPENDS on a multilib 32-bit glibc is only added when target is x86-64
+# This x86-64 override is never intended for native use, so clear that.
+GLIBC32 = ""
+GLIBC32_x86-64 = "${MLPREFIX32}glibc"
+GLIBC32_class-native = ""
+DEPENDS += "${GLIBC32}"
+
+PACKAGES = "${PN}"
+
+FILES_${PN} = " \
+    ${libexecdir}/* \
+    "
+
+RDEPENDS_${PN} = " \
+    xen-tools-xl \
+    python3 \
+    "
+
+do_compile() {
+    oe_runmake CC="${TARGET_PREFIX}gcc ${TOOLCHAIN_OPTIONS} -I${RECIPE_SYSROOT}/../${MLPREFIX32}recipe-sysroot/usr/include" \
+               CPP="${CPP}" \
+               OBJCOPY="${OBJCOPY}" \
+               PYTHON="${PYTHON}"
+    # switch the shebang to python3
+    sed 's,^\(#!/usr/bin/env python\)$,\13,' -i "${B}/xtf-runner"
+}
+
+do_install() {
+    oe_runmake install DESTDIR="${D}" xtfdir="${libexecdir}/${BPN}" PYTHON="${PYTHON}"
+}
+
+INSANE_SKIP = "arch"
+INHIBIT_PACKAGE_STRIP = "1"
+INHIBIT_PACKAGE_DEBUG_SPLIT = "1"
Signature · 1 line
2.25.1
#1 lore raw

PATCH 2/2 xtf-image: add a new image for the Xen Test Framework

Testing the Xen hypervisor, with the qemux86-64 MACHINE:
runqemu xtf-image nographic slirp
(login as root)
cd /usr/libexec/xtf
./xtf-runner --list pv
# run an example test:
./xtf-runner test-pv64-livepatch-priv-check

---
 recipes-extended/images/xtf-image.bb | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
 create mode 100644 recipes-extended/images/xtf-image.bb
recipes-extended/images/xtf-image.bb new file +14 -0
new file mode 100644
index 0000000..24bf504
@@ -0,0 +1,14 @@
+require recipes-extended/images/xen-image-minimal.bb
+
+IMAGE_NAME="xtf"
+
+IMAGE_INSTALL_append = " xtf"
+
+WKS_FILE_DEPENDS_remove = "grub-efi"
+
+QB_DEFAULT_FSTYPE = "wic"
+
+# Set the dom0 memory level lower than that assigned to qemu
+# to leave enough free for the XTF microkernels to run.
+QB_MEM = "-m 400"
+SYSLINUX_XEN_ARGS_append = " dom0_mem=256M"
Signature · 1 line
2.25.1
#2 lore raw

Re: [meta-virtualization][PATCH 2/2] xtf-image: add a new image for the Xen Test Framework

Quoted 9 lines · Christopher Clark

Testing the Xen hypervisor, with the qemux86-64 MACHINE:
runqemu xtf-image nographic slirp
(login as root)
cd /usr/libexec/xtf
./xtf-runner --list pv
# run an example test:
./xtf-runner test-pv64-livepatch-priv-check

I like it!

But I'm not all that bright at times, and forget things in about a month.

Can you put the description of the image and how to run it in the .bb itself ? That way when I pop it open, I'll remember what it was.

Bruce

Quoted 29 lines
---
 recipes-extended/images/xtf-image.bb | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
 create mode 100644 recipes-extended/images/xtf-image.bb
recipes-extended/images/xtf-image.bb new file +14 -1
new file mode 100644
index 0000000..24bf504
@@ -0,0 +1,14 @@
+require recipes-extended/images/xen-image-minimal.bb
+
+IMAGE_NAME="xtf"
+
+IMAGE_INSTALL_append = " xtf"
+
+WKS_FILE_DEPENDS_remove = "grub-efi"
+
+QB_DEFAULT_FSTYPE = "wic"
+
+# Set the dom0 memory level lower than that assigned to qemu
+# to leave enough free for the XTF microkernels to run.
+QB_MEM = "-m 400"
+SYSLINUX_XEN_ARGS_append = " dom0_mem=256M"
--

2.25.1

Signature · 3 lines
- Thou shalt not follow the NULL pointer, for chaos and madness await
thee at its end
- "Use the force Harry" - Gandalf, Star Trek II
#3 lore raw
In reply to Christopher Clark

Hi Christopher,

Quoted 2 lines · Christopher Clark via lists.yoctoproject.org

Very nice feature, we are working on adding support for arm on XTF and this will be really usefull.

On my test I have some errors during the packing of XTF:

ERROR: xtf-0+gitAUTOINC+8ab1513972-r0 do_package_write_rpm: Error executing a python function in exec_python_func() autogenerated:

The stack trace of python calls that resulted in this exception/failure was:
File: 'exec_python_func() autogenerated', lineno: 2, function: <module>

     0001:
 *** 0002:do_package_rpm(d)
     0003:
File: '/home/bermar01/Development/xen-dev/yocto-master/poky/meta/classes/package_rpm.bbclass', lineno: 718, function: do_package_rpm
     0714:
     0715:    # Build the rpm package!
     0716:    d.setVar('BUILDSPEC', cmd + "\n" + cleanupcmd + "\n")
     0717:    d.setVarFlag('BUILDSPEC', 'func', '1')
 *** 0718:    bb.build.exec_func('BUILDSPEC', d)
     0719:
     0720:    if d.getVar('RPM_SIGN_PACKAGES') == '1':
     0721:        bb.build.exec_func("sign_rpm", d)
     0722:}

File: '/home/bermar01/Development/xen-dev/yocto-master/poky/bitbake/lib/bb/build.py', lineno: 256, function: exec_func
0252: with bb.utils.fileslocked(lockfiles):
0253: if ispython:
0254: exec_func_python(func, d, runfile, cwd=adir)
0255: else:
*** 0256: exec_func_shell(func, d, runfile, cwd=adir)

     0257:
     0258:    try:
     0259:        curcwd = os.getcwd()
     0260:    except:

File: '/home/bermar01/Development/xen-dev/yocto-master/poky/bitbake/lib/bb/build.py', lineno: 503, function: exec_func_shell
0499: with open(fifopath, 'r+b', buffering=0) as fifo:
0500: try:
0501: bb.debug(2, "Executing shell function %s" % func)
0502: with open(os.devnull, 'r+') as stdin, logfile:
*** 0503: bb.process.run(cmd, shell=False, stdin=stdin, log=logfile, extrafiles=[(fifo,readfifo)])
0504: except bb.process.ExecutionError as exe:
0505: # Find the backtrace that the shell trap generated
0506: backtrace_marker_regex = re.compile(r"WARNING: Backtrace \(BB generated script\)")
0507: stdout_lines = (exe.stdout or "").split("\n")
File: '/home/bermar01/Development/xen-dev/yocto-master/poky/bitbake/lib/bb/process.py', lineno: 184, function: run

     0180:        if not stderr is None:
     0181:            stderr = stderr.decode("utf-8")
     0182:
     0183:    if pipe.returncode != 0:

*** 0184: raise ExecutionError(cmd, pipe.returncode, stdout, stderr)
0185: return stdout, stderr
Exception: bb.process.ExecutionError: Execution of '/home/bermar01/Development/xen-dev/build-master/metavirt-host-x86_64-4.14-release.prj/tmp/work/core2-64-poky-linux/xtf/0+gitAUTOINC+8ab1513972-r0/temp/run.BUILDSPEC.25424' failed with exit code 1:

Processing files: xtf-0+git0+8ab1513972-r0.core2_64
error: Recognition of file "/home/bermar01/Development/xen-dev/build-master/metavirt-host-x86_64-4.14-release.prj/tmp/work/core2-64-poky-linux/xtf/0+gitAUTOINC+8ab1513972-r0/package/usr/libexec/xtf/tests/xsa-170/test-hvm64-xsa-170" failed: mode 100755 Bad magic format `, bad note description size %#lx' (bad format char: #)
error: Recognition of file "/home/bermar01/Development/xen-dev/build-master/metavirt-host-x86_64-4.14-release.prj/tmp/work/core2-64-poky-linux/xtf/0+gitAUTOINC+8ab1513972-r0/package/usr/libexec/xtf/tests/fpu-exception-emulation/test-hvm64-fpu-exception-emulation" failed: mode 100755 Bad magic format `, bad note description size %#lx' (bad format char: #)
error: Recognition of file "/home/bermar01/Development/xen-dev/build-master/metavirt-host-x86_64-4.14-release.prj/tmp/work/core2-64-poky-linux/xtf/0+gitAUTOINC+8ab1513972-r0/package/usr/libexec/xtf/tests/xsa-269/test-hvm64-xsa-269" failed: mode 100755 Bad magic format `, bad note description size %#lx' (bad format char: #)
error: Recognition of file "/home/bermar01/Development/xen-dev/build-master/metavirt-host-x86_64-4.14-release.prj/tmp/work/core2-64-poky-linux/xtf/0+gitAUTOINC+8ab1513972-r0/package/usr/libexec/xtf/tests/xsa-188/test-hvm64-xsa-188" failed: mode 100755 Bad magic format `, bad note description size %#lx' (bad format char: #)
error: Recognition of file "/home/bermar01/Development/xen-dev/build-master/metavirt-host-x86_64-4.14-release.prj/tmp/work/core2-64-poky-linux/xtf/0+gitAUTOINC+8ab1513972-r0/package/usr/libexec/xtf/tests/xsa-221/test-hvm64-xsa-221" failed: mode 100755 Bad magic format `, bad note description size %#lx' (bad format char: #)

I cannot really confirm where this is coming from and it can really be that this is a consequence of something changed in poky or oe.

Cheers
Bertrand

Quoted 74 lines

---
recipes-extended/xen/xtf_git.bb | 61 +++++++++++++++++++++++++++++++++

1 file changed, 61 insertions(+)

create mode 100644 recipes-extended/xen/xtf_git.bb

recipes-extended/xen/xtf_git.bb new file +61 -1
new file mode 100644
index 0000000..6dc0f8d
@@ -0,0 +1,61 @@
+SUMMARY = "Xen Test Framework"
+HOMEPAGE = "https://xenbits.xenproject.org/docs/xtf/"
+LICENSE = "BSD-2-Clause"
+
+SRC_URI = "git://xenbits.xen.org/xtf"
+SRCREV = "8ab15139728a8efd3ebbb60beb16a958a6a93fa1"
+
+COMPATIBLE_HOST = '(x86_64.*).*-linux'
+
+LIC_FILES_CHKSUM = "file://COPYING;md5=a5680865974e05cf0510615ee1d745d8"
+
+PV = "0+git${SRCPV}"
+
+S = "${WORKDIR}/git"
+
+inherit python3native
+
+# To build 32-bit binaries some files from 32-bit glibc are needed.
+# To enable multilib, please add the following to your local.conf -:
+#
+#    require conf/multilib.conf
+#    MULTILIBS = "multilib:lib32"
+#    DEFAULTTUNE_virtclass-multilib-lib32 = "x86"
+
+# Use this multilib prefix for x86 32-bit to match local.conf:
+MLPREFIX32 = "lib32-"
+# Add the multilib 32-bit glibc to DEPENDS only when necessary:
+# The DEPENDS on a multilib 32-bit glibc is only added when target is x86-64
+# This x86-64 override is never intended for native use, so clear that.
+GLIBC32 = ""
+GLIBC32_x86-64 = "${MLPREFIX32}glibc"
+GLIBC32_class-native = ""
+DEPENDS += "${GLIBC32}"
+
+PACKAGES = "${PN}"
+
+FILES_${PN} = " \
+    ${libexecdir}/* \
+    "
+
+RDEPENDS_${PN} = " \
+    xen-tools-xl \
+    python3 \
+    "
+
+do_compile() {
+    oe_runmake CC="${TARGET_PREFIX}gcc ${TOOLCHAIN_OPTIONS} -I${RECIPE_SYSROOT}/../${MLPREFIX32}recipe-sysroot/usr/include" \
+               CPP="${CPP}" \
+               OBJCOPY="${OBJCOPY}" \
+               PYTHON="${PYTHON}"
+    # switch the shebang to python3
+    sed 's,^\(#!/usr/bin/env python\)$,\13,' -i "${B}/xtf-runner"
+}
+
+do_install() {
+    oe_runmake install DESTDIR="${D}" xtfdir="${libexecdir}/${BPN}" PYTHON="${PYTHON}"
+}
+
+INSANE_SKIP = "arch"
+INHIBIT_PACKAGE_STRIP = "1"
+INHIBIT_PACKAGE_DEBUG_SPLIT = "1"
--
Quoted 5 lines

2.25.1

IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.

#4 lore raw
Quoted 11 lines · Bertrand Marquis

Hi Christopher,

Quoted 2 lines · Christopher Clark via lists.yoctoproject.org

Very nice feature, we are working on adding support for arm on XTF and this will be really usefull.

On my test I have some errors during the packing of XTF:

ERROR: xtf-0+gitAUTOINC+8ab1513972-r0 do_package_write_rpm: Error executing a python function in exec_python_func() autogenerated:

oh wow! - thanks for trying it and for this bug report. I've been building with ipk packaging rather than rpm, so maybe that's why I haven't encountered this - I'm not sure - I will take a look.

Christopher

Quoted 138 lines

The stack trace of python calls that resulted in this exception/failure was:
File: 'exec_python_func() autogenerated', lineno: 2, function: <module>

     0001:
 *** 0002:do_package_rpm(d)
     0003:
File: '/home/bermar01/Development/xen-dev/yocto-master/poky/meta/classes/package_rpm.bbclass', lineno: 718, function: do_package_rpm
     0714:
     0715:    # Build the rpm package!
     0716:    d.setVar('BUILDSPEC', cmd + "\n" + cleanupcmd + "\n")
     0717:    d.setVarFlag('BUILDSPEC', 'func', '1')
 *** 0718:    bb.build.exec_func('BUILDSPEC', d)
     0719:
     0720:    if d.getVar('RPM_SIGN_PACKAGES') == '1':
     0721:        bb.build.exec_func("sign_rpm", d)
     0722:}

File: '/home/bermar01/Development/xen-dev/yocto-master/poky/bitbake/lib/bb/build.py', lineno: 256, function: exec_func
0252: with bb.utils.fileslocked(lockfiles):
0253: if ispython:
0254: exec_func_python(func, d, runfile, cwd=adir)
0255: else:
*** 0256: exec_func_shell(func, d, runfile, cwd=adir)

     0257:
     0258:    try:
     0259:        curcwd = os.getcwd()
     0260:    except:

File: '/home/bermar01/Development/xen-dev/yocto-master/poky/bitbake/lib/bb/build.py', lineno: 503, function: exec_func_shell
0499: with open(fifopath, 'r+b', buffering=0) as fifo:
0500: try:
0501: bb.debug(2, "Executing shell function %s" % func)
0502: with open(os.devnull, 'r+') as stdin, logfile:
*** 0503: bb.process.run(cmd, shell=False, stdin=stdin, log=logfile, extrafiles=[(fifo,readfifo)])
0504: except bb.process.ExecutionError as exe:
0505: # Find the backtrace that the shell trap generated
0506: backtrace_marker_regex = re.compile(r"WARNING: Backtrace \(BB generated script\)")
0507: stdout_lines = (exe.stdout or "").split("\n")
File: '/home/bermar01/Development/xen-dev/yocto-master/poky/bitbake/lib/bb/process.py', lineno: 184, function: run

     0180:        if not stderr is None:
     0181:            stderr = stderr.decode("utf-8")
     0182:
     0183:    if pipe.returncode != 0:

*** 0184: raise ExecutionError(cmd, pipe.returncode, stdout, stderr)
0185: return stdout, stderr
Exception: bb.process.ExecutionError: Execution of '/home/bermar01/Development/xen-dev/build-master/metavirt-host-x86_64-4.14-release.prj/tmp/work/core2-64-poky-linux/xtf/0+gitAUTOINC+8ab1513972-r0/temp/run.BUILDSPEC.25424' failed with exit code 1:

Processing files: xtf-0+git0+8ab1513972-r0.core2_64
error: Recognition of file "/home/bermar01/Development/xen-dev/build-master/metavirt-host-x86_64-4.14-release.prj/tmp/work/core2-64-poky-linux/xtf/0+gitAUTOINC+8ab1513972-r0/package/usr/libexec/xtf/tests/xsa-170/test-hvm64-xsa-170" failed: mode 100755 Bad magic format `, bad note description size %#lx' (bad format char: #)
error: Recognition of file "/home/bermar01/Development/xen-dev/build-master/metavirt-host-x86_64-4.14-release.prj/tmp/work/core2-64-poky-linux/xtf/0+gitAUTOINC+8ab1513972-r0/package/usr/libexec/xtf/tests/fpu-exception-emulation/test-hvm64-fpu-exception-emulation" failed: mode 100755 Bad magic format `, bad note description size %#lx' (bad format char: #)
error: Recognition of file "/home/bermar01/Development/xen-dev/build-master/metavirt-host-x86_64-4.14-release.prj/tmp/work/core2-64-poky-linux/xtf/0+gitAUTOINC+8ab1513972-r0/package/usr/libexec/xtf/tests/xsa-269/test-hvm64-xsa-269" failed: mode 100755 Bad magic format `, bad note description size %#lx' (bad format char: #)
error: Recognition of file "/home/bermar01/Development/xen-dev/build-master/metavirt-host-x86_64-4.14-release.prj/tmp/work/core2-64-poky-linux/xtf/0+gitAUTOINC+8ab1513972-r0/package/usr/libexec/xtf/tests/xsa-188/test-hvm64-xsa-188" failed: mode 100755 Bad magic format `, bad note description size %#lx' (bad format char: #)
error: Recognition of file "/home/bermar01/Development/xen-dev/build-master/metavirt-host-x86_64-4.14-release.prj/tmp/work/core2-64-poky-linux/xtf/0+gitAUTOINC+8ab1513972-r0/package/usr/libexec/xtf/tests/xsa-221/test-hvm64-xsa-221" failed: mode 100755 Bad magic format `, bad note description size %#lx' (bad format char: #)

I cannot really confirm where this is coming from and it can really be that this is a consequence of something changed in poky or oe.

Cheers
Bertrand

Quoted 74 lines

---
recipes-extended/xen/xtf_git.bb | 61 +++++++++++++++++++++++++++++++++

1 file changed, 61 insertions(+)

create mode 100644 recipes-extended/xen/xtf_git.bb

recipes-extended/xen/xtf_git.bb new file +61 -1
new file mode 100644
index 0000000..6dc0f8d
@@ -0,0 +1,61 @@
+SUMMARY = "Xen Test Framework"
+HOMEPAGE = "https://xenbits.xenproject.org/docs/xtf/"
+LICENSE = "BSD-2-Clause"
+
+SRC_URI = "git://xenbits.xen.org/xtf"
+SRCREV = "8ab15139728a8efd3ebbb60beb16a958a6a93fa1"
+
+COMPATIBLE_HOST = '(x86_64.*).*-linux'
+
+LIC_FILES_CHKSUM = "file://COPYING;md5=a5680865974e05cf0510615ee1d745d8"
+
+PV = "0+git${SRCPV}"
+
+S = "${WORKDIR}/git"
+
+inherit python3native
+
+# To build 32-bit binaries some files from 32-bit glibc are needed.
+# To enable multilib, please add the following to your local.conf -:
+#
+#    require conf/multilib.conf
+#    MULTILIBS = "multilib:lib32"
+#    DEFAULTTUNE_virtclass-multilib-lib32 = "x86"
+
+# Use this multilib prefix for x86 32-bit to match local.conf:
+MLPREFIX32 = "lib32-"
+# Add the multilib 32-bit glibc to DEPENDS only when necessary:
+# The DEPENDS on a multilib 32-bit glibc is only added when target is x86-64
+# This x86-64 override is never intended for native use, so clear that.
+GLIBC32 = ""
+GLIBC32_x86-64 = "${MLPREFIX32}glibc"
+GLIBC32_class-native = ""
+DEPENDS += "${GLIBC32}"
+
+PACKAGES = "${PN}"
+
+FILES_${PN} = " \
+    ${libexecdir}/* \
+    "
+
+RDEPENDS_${PN} = " \
+    xen-tools-xl \
+    python3 \
+    "
+
+do_compile() {
+    oe_runmake CC="${TARGET_PREFIX}gcc ${TOOLCHAIN_OPTIONS} -I${RECIPE_SYSROOT}/../${MLPREFIX32}recipe-sysroot/usr/include" \
+               CPP="${CPP}" \
+               OBJCOPY="${OBJCOPY}" \
+               PYTHON="${PYTHON}"
+    # switch the shebang to python3
+    sed 's,^\(#!/usr/bin/env python\)$,\13,' -i "${B}/xtf-runner"
+}
+
+do_install() {
+    oe_runmake install DESTDIR="${D}" xtfdir="${libexecdir}/${BPN}" PYTHON="${PYTHON}"
+}
+
+INSANE_SKIP = "arch"
+INHIBIT_PACKAGE_STRIP = "1"
+INHIBIT_PACKAGE_DEBUG_SPLIT = "1"
--
Quoted 5 lines

2.25.1

IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.