support/testing: fix TestInitSystemNone for non-login shell

This test started failing at commit
0cad947b96
"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>
This commit is contained in:
Brandon Maier
2024-07-15 14:50:40 +00:00
committed by Thomas Petazzoni
parent a1a2f498d7
commit 5ed1fab018

View File

@@ -18,10 +18,8 @@ class TestInitSystemNone(InitSystemBase):
if index != 0:
self.emulator.logfile.write("==> System does not boot")
raise SystemError("System does not boot")
index = self.emulator.qemu.expect(["#", 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)