aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGleb Popov <arrowd@FreeBSD.org>2026-02-25 15:23:52 +0000
committerGleb Popov <arrowd@FreeBSD.org>2026-03-02 19:11:06 +0000
commit28d3c9802b4210bb96a07277715b77d9b28e9cbd (patch)
tree73922c80dd2ba2e742ce76135f4f65f3b6169d90
parent629b3c1d034d712ac28fa82b6d375a84228542ff (diff)
emulators/qemu-devel: Make the port a bit more in line with emulators/qemu and enable testing
Approved by: bofh (maintainer) Differential Revision: https://reviews.freebsd.org/D55511
-rw-r--r--emulators/qemu-devel/Makefile11
-rw-r--r--emulators/qemu-devel/files/patch-tests_functional_qemu__test_____init____.py11
-rw-r--r--emulators/qemu-devel/files/patch-tests_functional_qemu__test_decorators.py35
-rw-r--r--emulators/qemu-devel/files/patch-tests_functional_x86__64_test__memlock.py18
4 files changed, 71 insertions, 4 deletions
diff --git a/emulators/qemu-devel/Makefile b/emulators/qemu-devel/Makefile
index 16bd4f7a9ad3..58c4617a073f 100644
--- a/emulators/qemu-devel/Makefile
+++ b/emulators/qemu-devel/Makefile
@@ -23,7 +23,7 @@ LIB_DEPENDS= libepoxy.so:graphics/libepoxy \
libslirp.so:net/libslirp
USES= bison compiler:c11 cpe gmake gnome iconv:wchar_t localbase:ldflags \
- ninja perl5 pkgconfig python:build shebangfix tar:xz xorg
+ ninja:build perl5 pkgconfig python:build shebangfix tar:xz xorg
USE_GITLAB= yes
GL_ACCOUNT= qemu-project
GL_TAGNAME= 9ef49528b5286f078061b52ac41e0ca19fa10e36
@@ -35,7 +35,6 @@ GL_TUPLE= qemu-project:keycodemapdb:f5772a62ec52591ff6870b7e8ef32482371f22c6:key
qemu-project:berkeley-testfloat-3:e7af9751d9f9fd3b47911f51a5cfd08af256a9ab:berkeleytestfloat3/subprojects/berkeley-testfloat-3
USE_GNOME= cairo glib20
USE_PERL5= build
-USE_PYTHON= distutils noflavors
USE_XORG= pixman
SHEBANG_FILES= scripts/xml-preprocess.py
@@ -155,10 +154,11 @@ post-patch-CDROM_DMA-off:
@${REINPLACE_CMD} -e '/USE_DMA_CDROM/d' ${WRKSRC}/include/hw/ide/internal.h
do-build:
- cd ${WRKSRC} && ${GMAKE}
+# Don't build with -j, because the development branch of QEMU regresses from time to time
+ cd ${WRKSRC} && ${SETENVI} ${WRK_ENV} ${GMAKE}
do-install:
- cd ${WRKSRC} && ${SETENV} DESTDIR=${STAGEDIR} ${GMAKE} install
+ cd ${WRKSRC} && ${SETENVI} ${WRK_ENV} DESTDIR=${STAGEDIR} ${GMAKE} install
.if !target(post-install)
post-install:
@@ -170,4 +170,7 @@ post-install-DOCS-on:
@(cd ${WRKSRC} && ${COPYTREE_SHARE} docs ${STAGEDIR}${DOCSDIR}/)
.endif
+do-test:
+ cd ${WRKSRC} && ${SETENVI} ${WRK_ENV} ${GMAKE} test
+
.include <bsd.port.mk>
diff --git a/emulators/qemu-devel/files/patch-tests_functional_qemu__test_____init____.py b/emulators/qemu-devel/files/patch-tests_functional_qemu__test_____init____.py
new file mode 100644
index 000000000000..ece7c08f4235
--- /dev/null
+++ b/emulators/qemu-devel/files/patch-tests_functional_qemu__test_____init____.py
@@ -0,0 +1,11 @@
+--- tests/functional/qemu_test/__init__.py.orig 2025-11-25 22:22:39 UTC
++++ tests/functional/qemu_test/__init__.py
+@@ -16,7 +16,7 @@ from .decorators import skipIfMissingCommands, skipIfN
+ from .decorators import skipIfMissingCommands, skipIfNotMachine, \
+ skipFlakyTest, skipUntrustedTest, skipBigDataTest, skipSlowTest, \
+ skipIfMissingImports, skipIfOperatingSystem, skipLockedMemoryTest, \
+- skipIfMissingEnv
++ skipIfMissingEnv, skipIfInsideFreeBSDJail
+ from .archive import archive_extract
+ from .uncompress import uncompress
+ from .gdb import GDB
diff --git a/emulators/qemu-devel/files/patch-tests_functional_qemu__test_decorators.py b/emulators/qemu-devel/files/patch-tests_functional_qemu__test_decorators.py
new file mode 100644
index 000000000000..d5901a0da1a2
--- /dev/null
+++ b/emulators/qemu-devel/files/patch-tests_functional_qemu__test_decorators.py
@@ -0,0 +1,35 @@
+--- tests/functional/qemu_test/decorators.py.orig 2025-11-25 22:22:39 UTC
++++ tests/functional/qemu_test/decorators.py
+@@ -6,6 +6,7 @@ import resource
+ import os
+ import platform
+ import resource
++import subprocess
+ from unittest import skipIf, skipUnless
+
+ from .cmd import which
+@@ -165,3 +166,24 @@ def skipLockedMemoryTest(locked_memory):
+ ulimit_memory == resource.RLIM_INFINITY or ulimit_memory >= locked_memory * 1024,
+ f'Test required {locked_memory} kB of available locked memory',
+ )
++
++def skipIfInsideFreeBSDJail():
++ '''
++ Decorator to skip execution in a FreeBSD jail
++
++ @skipIfInsideFreeBSDJail()
++ '''
++ jailed = False
++ try:
++ result = subprocess.run(
++ ['sysctl', '-n', 'security.jail.jailed'],
++ capture_output=True,
++ text=True,
++ check=True
++ )
++ jailed = result.stdout.strip() == '1'
++ except Exception:
++ pass
++
++ return skipIf(platform.system() == 'FreeBSD' and jailed,
++ 'running inside the FreeBSD jail')
diff --git a/emulators/qemu-devel/files/patch-tests_functional_x86__64_test__memlock.py b/emulators/qemu-devel/files/patch-tests_functional_x86__64_test__memlock.py
new file mode 100644
index 000000000000..135f238fa18c
--- /dev/null
+++ b/emulators/qemu-devel/files/patch-tests_functional_x86__64_test__memlock.py
@@ -0,0 +1,18 @@
+--- tests/functional/x86_64/test_memlock.py.orig 2025-11-25 22:22:39 UTC
++++ tests/functional/x86_64/test_memlock.py
+@@ -14,13 +14,14 @@ from qemu_test import QemuSystemTest
+ from typing import Dict
+
+ from qemu_test import QemuSystemTest
+-from qemu_test import skipLockedMemoryTest
++from qemu_test import skipLockedMemoryTest, skipIfInsideFreeBSDJail
+
+
+ STATUS_VALUE_PATTERN = re.compile(r'^(\w+):\s+(\d+) kB', re.MULTILINE)
+
+
+ @skipLockedMemoryTest(2_097_152) # 2GB
++@skipIfInsideFreeBSDJail()
+ class MemlockTest(QemuSystemTest):
+ """
+ Runs a guest with memlock options.