]> rtime.felk.cvut.cz Git - coffee/buildroot.git/blob - support/testing/tests/init/test_none.py
support/testing: fix code style
[coffee/buildroot.git] / support / testing / tests / init / test_none.py
1 import pexpect
2
3 import infra.basetest
4 from tests.init.base import InitSystemBase as InitSystemBase
5
6
7 class 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.startEmulator(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         _, exit_code = self.emulator.run("mount -t proc none /proc")
31         self.assertEqual(exit_code, 0)
32
33         self.checkInit("/bin/sh")