From 5ed1fab018db9a001b072fd7bcb3dd3db280aabe Mon Sep 17 00:00:00 2001 From: Brandon Maier Date: Mon, 15 Jul 2024 14:50:40 +0000 Subject: [PATCH] support/testing: fix TestInitSystemNone for non-login shell 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 Signed-off-by: Thomas Petazzoni --- support/testing/tests/init/test_none.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/support/testing/tests/init/test_none.py b/support/testing/tests/init/test_none.py index fc4a46efd9..5bfcc3d5c9 100644 --- a/support/testing/tests/init/test_none.py +++ b/support/testing/tests/init/test_none.py @@ -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)