This test started failing at commit 0cad947b964be5612a182413da136fcf0dc5a1f2 "support/testing/infra/emulator.py: fix qemu prompt detection" with the error message AttributeError: 'NoneType' object has no attribute 'run_command' This is because we changed emulator.run() so that emulator.login() must be called first. But this test skips the login and goes directly to a shell. Use the new emulator.connect_shell() function which prepares the shell without logging in. Signed-off-by: Brandon Maier <brandon.maier@collins.com> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com> (cherry picked from commit 5ed1fab018db9a001b072fd7bcb3dd3db280aabe) Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
31 lines
958 B
Python
31 lines
958 B
Python
import pexpect
|
|
|
|
import infra.basetest
|
|
from tests.init.base import InitSystemBase as InitSystemBase
|
|
|
|
|
|
class TestInitSystemNone(InitSystemBase):
|
|
config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \
|
|
"""
|
|
BR2_INIT_NONE=y
|
|
# BR2_TARGET_ROOTFS_TAR is not set
|
|
BR2_TARGET_ROOTFS_SQUASHFS=y
|
|
"""
|
|
|
|
def test_run(self):
|
|
self.start_emulator(fs_type="squashfs", init="/bin/sh")
|
|
index = self.emulator.qemu.expect(["/bin/sh: can't access tty; job control turned off", pexpect.TIMEOUT], timeout=60)
|
|
if index != 0:
|
|
self.emulator.logfile.write("==> System does not boot")
|
|
raise SystemError("System does not boot")
|
|
|
|
self.emulator.connect_shell()
|
|
|
|
out, exit_code = self.emulator.run("sh -c 'echo $PPID'")
|
|
self.assertEqual(exit_code, 0)
|
|
self.assertEqual(out[0], "1")
|
|
|
|
self.assertRunOk("mount -t proc none /proc")
|
|
|
|
self.check_init("/bin/sh")
|