commit ada46fb2dbcae2919e884b2155b7f0e7630c62e3
parent d40cac403fd178fc8b1e056b58d1986011f9ae48
Author: James Prestwood <prestwoj@gmail.com>
Date: Thu, 10 Dec 2020 09:45:25 -0800
test-runner: set processor count for VM
For better reliability the processor count is now set to qemu.
In cases of low CPU count (< 2) hosts the processor count is
limited to 1. Otherwise half of the host cores will be used for
the VM.
Diffstat:
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/tools/test-runner b/tools/test-runner
@@ -1402,6 +1402,19 @@ class Main:
'kernel'
]
+ nproc = multiprocessing.cpu_count()
+
+ #
+ # Specially handle CPU systems with minimal cores, otherwise
+ # use half the host cores.
+ #
+ if nproc < 2:
+ smp = 1
+ else:
+ smp = int(nproc / 2)
+
+ print("Using %d cores for VM" % smp)
+
#
# This passes through most of the command line options to
# the kernel command line. Some are not relevant (e.g. qemu)
@@ -1440,7 +1453,7 @@ class Main:
rootflags=trans=virtio,version=9p2000.u \
acpi=off pci=noacpi %s ro \
mac80211_hwsim.radios=0 %s' % (kern_log, options),
- '-cpu', 'host'
+ '-cpu', 'host', '-smp', str(smp)
]
# Add two ethernet devices for testing EAD