3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-29 05:39:24 +01:00

test-runner: add initial UmlRunner implementation

This allows test-runner to run inside a UML binary which has some
advantages, specifically time-travel/infinite CPU speed. This should
fix any scheduler related failures we have on slower systems.

Currently this runner does not suppor the same features as the Qemu
runner, specifically:

 - No hardware passthrough
 - No logging/monitor (UML -> host mounting isn't implemented yet)
This commit is contained in:
James Prestwood 2022-03-31 16:16:31 -07:00 committed by Denis Kenzior
parent 2894f2e3eb
commit b5df2e27be

View File

@ -213,7 +213,9 @@ class Runner:
else: else:
args.runner = 'qemu' args.runner = 'qemu'
if args.runner == 'qemu': if args.runner == 'uml':
return UmlRunner(args)
elif args.runner == 'qemu':
return QemuRunner(args) return QemuRunner(args)
else: else:
raise Exception("Unknown runner %s" % args.runner) raise Exception("Unknown runner %s" % args.runner)
@ -483,3 +485,29 @@ class QemuRunner(RunnerAbstract):
# gracefully. # gracefully.
# #
libc.reboot(RB_AUTOBOOT) libc.reboot(RB_AUTOBOOT)
class UmlRunner(RunnerAbstract):
name = "UML Runner"
def __init__(self, args):
super().__init__(args)
if len(sys.argv) <= 1:
return
if not which(args.kernel):
raise Exception('Cannot locate UML binary %s' % args.kernel)
kern_log = "ignore_loglevel" if "kernel" in args.verbose else "quiet"
cmd = [args.kernel, 'rootfstype=hostfs', 'ro', 'mem=256M', 'mac80211_hwsim.radios=0',
'time-travel=inf-cpu', 'eth0=mcast', 'eth1=mcast',
'%s '% kern_log, 'init=%s' % args.start]
cmd.extend(args.to_cmd().split(' '))
self.cmdline = cmd
def prepare_environment(self):
self._prepare_mounts()
super().prepare_environment()