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