@ -2,7 +2,7 @@
, perl , pixman , vde2 , alsa-lib , texinfo , flex
, bison , lzo , snappy , libaio , libtasn1 , gnutls , nettle , curl , ninja , meson , sigtool
, makeWrapper , runtimeShell
, attr , libcap , libcap_ng
, attr , libcap , libcap_ng , socat
, CoreServices , Cocoa , Hypervisor , rez , setfile
, numaSupport ? stdenv . isLinux && ! stdenv . isAarch32 , numactl
, seccompSupport ? stdenv . isLinux , libseccomp
@ -31,6 +31,8 @@
++ [ " ${ stdenv . hostPlatform . qemuArch } - s o f t m m u " ] )
else null )
, nixosTestRunner ? false
, doCheck ? false
, qemu # for passthru.tests
} :
let
@ -217,7 +219,6 @@ stdenv.mkDerivation rec {
++ lib . optional smbdSupport " - - s m b d = ${ samba } / b i n / s m b d "
++ lib . optional uringSupport " - - e n a b l e - l i n u x - i o - u r i n g " ;
doCheck = false ; # tries to access /dev
dontWrapGApps = true ;
# QEMU attaches entitlements with codesign and strip removes those,
@ -241,6 +242,40 @@ stdenv.mkDerivation rec {
'' ;
preBuild = " c d b u i l d " ;
# tests can still timeout on slower systems
inherit doCheck ;
checkInputs = [ socat ] ;
preCheck = ''
# time limits are a little meagre for a build machine that's
# potentially under load.
substituteInPlace ../tests/unit/meson.build \
- - replace ' timeout : slow_tests' ' timeout : 50 * slow_tests'
substituteInPlace ../tests/qtest/meson.build \
- - replace ' timeout : slow_qtests' ' timeout : 50 * slow_qtests'
substituteInPlace ../tests/fp/meson.build \
- - replace ' timeout : 90 ) ' ' timeout : 300 ) '
# point tests towards correct binaries
substituteInPlace ../tests/unit/test-qga.c \
- - replace ' /bin/echo ' " $ ( t y p e - P e c h o ) "
substituteInPlace ../tests/unit/test-io-channel-command.c \
- - replace ' /bin/socat ' " $ ( t y p e - P s o c a t ) "
# combined with a long package name, some temp socket paths
# can end up exceeding max socket name len
substituteInPlace ../tests/qtest/bios-tables-test.c \
- - replace ' qemu-test_acpi_ % s_tcg_ % s' ' % s_ % s'
# get-fsinfo attempts to access block devices, disallowed by sandbox
sed - i - e ' / \ /qga \ /get-fsinfo/d ' - e ' / \ /qga \ /blacklist/d ' \
../tests/unit/test-qga.c
'' + l i b . o p t i o n a l S t r i n g s t d e n v . i s D a r w i n ''
# skip test that stalls on darwin, perhaps due to subtle differences
# in fifo behaviour
substituteInPlace ../tests/unit/meson.build \
- - replace " ' t e s t - i o - c h a n n e l - c o m m a n d ' " " # ' t e s t - i o - c h a n n e l - c o m m a n d ' "
'' ;
# Add a ‘qemu-kvm’ wrapper for compatibility/convenience.
postInstall = ''
ln - s $ out/bin/qemu-system- $ { stdenv . hostPlatform . qemuArch } $ out/bin/qemu-kvm
@ -248,6 +283,9 @@ stdenv.mkDerivation rec {
passthru = {
qemu-system-i386 = " b i n / q e m u - s y s t e m - i 3 8 6 " ;
tests = {
qemu-tests = qemu . override { doCheck = true ; } ;
} ;
} ;
# Builds in ~3h with 2 cores, and ~20m with a big-parallel builder.