mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-11-28 12:39:29 +01:00
test-runner: run prepare_environment with --start
The --start option was directly passed to the kernel init parameter, preventing any environment setup from happening. Intead always use 'run-tests' as the init process but detect --start and execute that binary/script once inside the environment.
This commit is contained in:
parent
b7664c7970
commit
6022ebaa36
@ -1011,5 +1011,10 @@ runner = Runner()
|
|||||||
|
|
||||||
atexit.register(exit_vm)
|
atexit.register(exit_vm)
|
||||||
runner.prepare_environment()
|
runner.prepare_environment()
|
||||||
run_tests(runner.args)
|
|
||||||
|
if runner.args.start:
|
||||||
|
os.system(runner.args.start)
|
||||||
|
else:
|
||||||
|
run_tests(runner.args)
|
||||||
|
|
||||||
runner.cleanup_environment()
|
runner.cleanup_environment()
|
||||||
|
@ -197,14 +197,6 @@ class Runner:
|
|||||||
else:
|
else:
|
||||||
args.testhome = os.getcwd()
|
args.testhome = os.getcwd()
|
||||||
|
|
||||||
if args.start is None:
|
|
||||||
if os.path.exists('run-tests'):
|
|
||||||
args.start = os.path.abspath('run-tests')
|
|
||||||
elif os.path.exists('tools/run-tests'):
|
|
||||||
args.start = os.path.abspath('tools/run-tests')
|
|
||||||
else:
|
|
||||||
raise Exception("Cannot locate run-tests binary")
|
|
||||||
|
|
||||||
# If no runner is specified but we have a kernel image assume
|
# If no runner is specified but we have a kernel image assume
|
||||||
# if the kernel is executable its UML, otherwise qemu
|
# if the kernel is executable its UML, otherwise qemu
|
||||||
if not args.runner:
|
if not args.runner:
|
||||||
@ -231,6 +223,16 @@ class RunnerAbstract:
|
|||||||
def __init__(self, args):
|
def __init__(self, args):
|
||||||
self.args = args
|
self.args = args
|
||||||
|
|
||||||
|
if len(sys.argv) <= 1:
|
||||||
|
return
|
||||||
|
|
||||||
|
if os.path.exists('run-tests'):
|
||||||
|
self.init = os.path.abspath('run-tests')
|
||||||
|
elif os.path.exists('tools/run-tests'):
|
||||||
|
self.init = os.path.abspath('tools/run-tests')
|
||||||
|
else:
|
||||||
|
raise Exception("Cannot locate run-tests binary")
|
||||||
|
|
||||||
def start(self):
|
def start(self):
|
||||||
print("Starting %s" % self.name)
|
print("Starting %s" % self.name)
|
||||||
os.execlpe(self.cmdline[0], *self.cmdline, self.env)
|
os.execlpe(self.cmdline[0], *self.cmdline, self.env)
|
||||||
@ -279,6 +281,8 @@ class RunnerAbstract:
|
|||||||
|
|
||||||
fcntl.ioctl(STDIN_FILENO, TIOCSTTY, 1)
|
fcntl.ioctl(STDIN_FILENO, TIOCSTTY, 1)
|
||||||
|
|
||||||
|
os.system('ip link set dev lo up')
|
||||||
|
|
||||||
def cleanup_environment(self):
|
def cleanup_environment(self):
|
||||||
rmtree('/tmp/iwd')
|
rmtree('/tmp/iwd')
|
||||||
rmtree('/tmp/certs')
|
rmtree('/tmp/certs')
|
||||||
@ -413,7 +417,7 @@ class QemuRunner(RunnerAbstract):
|
|||||||
rootflags=trans=virtio \
|
rootflags=trans=virtio \
|
||||||
acpi=off pci=noacpi %s ro \
|
acpi=off pci=noacpi %s ro \
|
||||||
mac80211_hwsim.radios=0 init=%s %s' %
|
mac80211_hwsim.radios=0 init=%s %s' %
|
||||||
(kern_log, args.start, args.to_cmd()),
|
(kern_log, self.init, args.to_cmd()),
|
||||||
]
|
]
|
||||||
|
|
||||||
# Add two ethernet devices for testing EAD
|
# Add two ethernet devices for testing EAD
|
||||||
@ -516,7 +520,7 @@ class UmlRunner(RunnerAbstract):
|
|||||||
|
|
||||||
cmd = [args.kernel, 'rootfstype=hostfs', 'ro', 'mem=256M', 'mac80211_hwsim.radios=0',
|
cmd = [args.kernel, 'rootfstype=hostfs', 'ro', 'mem=256M', 'mac80211_hwsim.radios=0',
|
||||||
'time-travel=inf-cpu', 'eth0=mcast', 'eth1=mcast',
|
'time-travel=inf-cpu', 'eth0=mcast', 'eth1=mcast',
|
||||||
'%s '% kern_log, 'init=%s' % args.start]
|
'%s' % kern_log, 'init=%s' % self.init]
|
||||||
cmd.extend(args.to_cmd().split(' '))
|
cmd.extend(args.to_cmd().split(' '))
|
||||||
|
|
||||||
self.cmdline = cmd
|
self.cmdline = cmd
|
||||||
|
Loading…
Reference in New Issue
Block a user