1import pexpect 2 3import infra.basetest 4from tests.init.base import InitSystemBase as InitSystemBase 5 6 7class TestInitSystemNone(InitSystemBase): 8 config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \ 9 """ 10 BR2_INIT_NONE=y 11 # BR2_TARGET_ROOTFS_TAR is not set 12 BR2_TARGET_ROOTFS_SQUASHFS=y 13 """ 14 15 def test_run(self): 16 self.start_emulator(fs_type="squashfs", init="/bin/sh") 17 index = self.emulator.qemu.expect(["/bin/sh: can't access tty; job control turned off", pexpect.TIMEOUT], timeout=60) 18 if index != 0: 19 self.emulator.logfile.write("==> System does not boot") 20 raise SystemError("System does not boot") 21 index = self.emulator.qemu.expect(["#", pexpect.TIMEOUT], timeout=60) 22 if index != 0: 23 self.emulator.logfile.write("==> System does not boot") 24 raise SystemError("System does not boot") 25 26 out, exit_code = self.emulator.run("sh -c 'echo $PPID'") 27 self.assertEqual(exit_code, 0) 28 self.assertEqual(out[0], "1") 29 30 self.assertRunOk("mount -t proc none /proc") 31 32 self.check_init("/bin/sh") 33