mirror of
https://github.com/motioneye-project/motioneyeos.git
synced 2025-07-27 21:26:36 +00:00
testing/tests/init: use lowercase method names
Use method naming convention from PEP8 as other test cases already do. sed \ -e 's,startEmulator,start_emulator,g' \ -e 's,checkInit,check_init,g' \ -e 's,checkNetwork,check_network,g' \ -i support/testing/tests/init/*.py Signed-off-by: Ricardo Martincoski <ricardo.martincoski@gmail.com> Acked-by: "Yann E. MORIN" <yann.morin.1998@free.fr> Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
This commit is contained in:
parent
ef8d1f1b15
commit
847d6d1e85
@ -5,7 +5,7 @@ import infra.basetest
|
|||||||
|
|
||||||
class InitSystemBase(infra.basetest.BRTest):
|
class InitSystemBase(infra.basetest.BRTest):
|
||||||
|
|
||||||
def startEmulator(self, fs_type, kernel=None, dtb=None, init=None):
|
def start_emulator(self, fs_type, kernel=None, dtb=None, init=None):
|
||||||
img = os.path.join(self.builddir, "images", "rootfs.{}".format(fs_type))
|
img = os.path.join(self.builddir, "images", "rootfs.{}".format(fs_type))
|
||||||
subprocess.call(["truncate", "-s", "%1M", img])
|
subprocess.call(["truncate", "-s", "%1M", img])
|
||||||
|
|
||||||
@ -37,12 +37,12 @@ class InitSystemBase(infra.basetest.BRTest):
|
|||||||
if init is None:
|
if init is None:
|
||||||
self.emulator.login()
|
self.emulator.login()
|
||||||
|
|
||||||
def checkInit(self, path):
|
def check_init(self, path):
|
||||||
cmd = "cmp /proc/1/exe {}".format(path)
|
cmd = "cmp /proc/1/exe {}".format(path)
|
||||||
_, exit_code = self.emulator.run(cmd)
|
_, exit_code = self.emulator.run(cmd)
|
||||||
self.assertEqual(exit_code, 0)
|
self.assertEqual(exit_code, 0)
|
||||||
|
|
||||||
def checkNetwork(self, interface, exitCode=0):
|
def check_network(self, interface, exitCode=0):
|
||||||
cmd = "ip addr show {} |grep inet".format(interface)
|
cmd = "ip addr show {} |grep inet".format(interface)
|
||||||
_, exit_code = self.emulator.run(cmd)
|
_, exit_code = self.emulator.run(cmd)
|
||||||
self.assertEqual(exit_code, exitCode)
|
self.assertEqual(exit_code, exitCode)
|
||||||
|
@ -8,8 +8,8 @@ class InitSystemBusyboxBase(InitSystemBase):
|
|||||||
# BR2_TARGET_ROOTFS_TAR is not set
|
# BR2_TARGET_ROOTFS_TAR is not set
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def checkInit(self):
|
def check_init(self):
|
||||||
super(InitSystemBusyboxBase, self).checkInit("/bin/busybox")
|
super(InitSystemBusyboxBase, self).check_init("/bin/busybox")
|
||||||
|
|
||||||
|
|
||||||
class TestInitSystemBusyboxRo(InitSystemBusyboxBase):
|
class TestInitSystemBusyboxRo(InitSystemBusyboxBase):
|
||||||
@ -20,9 +20,9 @@ class TestInitSystemBusyboxRo(InitSystemBusyboxBase):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
def test_run(self):
|
def test_run(self):
|
||||||
self.startEmulator("squashfs")
|
self.start_emulator("squashfs")
|
||||||
self.checkInit()
|
self.check_init()
|
||||||
self.checkNetwork("eth0", 1)
|
self.check_network("eth0", 1)
|
||||||
|
|
||||||
|
|
||||||
class TestInitSystemBusyboxRw(InitSystemBusyboxBase):
|
class TestInitSystemBusyboxRw(InitSystemBusyboxBase):
|
||||||
@ -32,9 +32,9 @@ class TestInitSystemBusyboxRw(InitSystemBusyboxBase):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
def test_run(self):
|
def test_run(self):
|
||||||
self.startEmulator("ext2")
|
self.start_emulator("ext2")
|
||||||
self.checkInit()
|
self.check_init()
|
||||||
self.checkNetwork("eth0", 1)
|
self.check_network("eth0", 1)
|
||||||
|
|
||||||
|
|
||||||
class TestInitSystemBusyboxRoNet(InitSystemBusyboxBase):
|
class TestInitSystemBusyboxRoNet(InitSystemBusyboxBase):
|
||||||
@ -46,9 +46,9 @@ class TestInitSystemBusyboxRoNet(InitSystemBusyboxBase):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
def test_run(self):
|
def test_run(self):
|
||||||
self.startEmulator("squashfs")
|
self.start_emulator("squashfs")
|
||||||
self.checkInit()
|
self.check_init()
|
||||||
self.checkNetwork("eth0")
|
self.check_network("eth0")
|
||||||
|
|
||||||
|
|
||||||
class TestInitSystemBusyboxRwNet(InitSystemBusyboxBase):
|
class TestInitSystemBusyboxRwNet(InitSystemBusyboxBase):
|
||||||
@ -59,6 +59,6 @@ class TestInitSystemBusyboxRwNet(InitSystemBusyboxBase):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
def test_run(self):
|
def test_run(self):
|
||||||
self.startEmulator("ext2")
|
self.start_emulator("ext2")
|
||||||
self.checkInit()
|
self.check_init()
|
||||||
self.checkNetwork("eth0")
|
self.check_network("eth0")
|
||||||
|
@ -13,7 +13,7 @@ class TestInitSystemNone(InitSystemBase):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
def test_run(self):
|
def test_run(self):
|
||||||
self.startEmulator(fs_type="squashfs", init="/bin/sh")
|
self.start_emulator(fs_type="squashfs", init="/bin/sh")
|
||||||
index = self.emulator.qemu.expect(["/bin/sh: can't access tty; job control turned off", pexpect.TIMEOUT], timeout=60)
|
index = self.emulator.qemu.expect(["/bin/sh: can't access tty; job control turned off", pexpect.TIMEOUT], timeout=60)
|
||||||
if index != 0:
|
if index != 0:
|
||||||
self.emulator.logfile.write("==> System does not boot")
|
self.emulator.logfile.write("==> System does not boot")
|
||||||
@ -30,4 +30,4 @@ class TestInitSystemNone(InitSystemBase):
|
|||||||
_, exit_code = self.emulator.run("mount -t proc none /proc")
|
_, exit_code = self.emulator.run("mount -t proc none /proc")
|
||||||
self.assertEqual(exit_code, 0)
|
self.assertEqual(exit_code, 0)
|
||||||
|
|
||||||
self.checkInit("/bin/sh")
|
self.check_init("/bin/sh")
|
||||||
|
@ -18,8 +18,8 @@ class InitSystemSystemdBase(InitSystemBase):
|
|||||||
# BR2_TARGET_ROOTFS_TAR is not set
|
# BR2_TARGET_ROOTFS_TAR is not set
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def checkInit(self):
|
def check_init(self):
|
||||||
super(InitSystemSystemdBase, self).checkInit("/lib/systemd/systemd")
|
super(InitSystemSystemdBase, self).check_init("/lib/systemd/systemd")
|
||||||
|
|
||||||
|
|
||||||
class TestInitSystemSystemdRoNetworkd(InitSystemSystemdBase):
|
class TestInitSystemSystemdRoNetworkd(InitSystemSystemdBase):
|
||||||
@ -32,9 +32,9 @@ class TestInitSystemSystemdRoNetworkd(InitSystemSystemdBase):
|
|||||||
""".format(infra.filepath("tests/init/systemd-factory"))
|
""".format(infra.filepath("tests/init/systemd-factory"))
|
||||||
|
|
||||||
def test_run(self):
|
def test_run(self):
|
||||||
self.startEmulator("squashfs", "zImage", "vexpress-v2p-ca9")
|
self.start_emulator("squashfs", "zImage", "vexpress-v2p-ca9")
|
||||||
self.checkInit()
|
self.check_init()
|
||||||
self.checkNetwork("eth0")
|
self.check_network("eth0")
|
||||||
|
|
||||||
# This one must be executed on the target, to check that
|
# This one must be executed on the target, to check that
|
||||||
# the factory feature works as expected
|
# the factory feature works as expected
|
||||||
@ -51,9 +51,9 @@ class TestInitSystemSystemdRwNetworkd(InitSystemSystemdBase):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
def test_run(self):
|
def test_run(self):
|
||||||
self.startEmulator("ext2", "zImage", "vexpress-v2p-ca9")
|
self.start_emulator("ext2", "zImage", "vexpress-v2p-ca9")
|
||||||
self.checkInit()
|
self.check_init()
|
||||||
self.checkNetwork("eth0")
|
self.check_network("eth0")
|
||||||
|
|
||||||
|
|
||||||
class TestInitSystemSystemdRoIfupdown(InitSystemSystemdBase):
|
class TestInitSystemSystemdRoIfupdown(InitSystemSystemdBase):
|
||||||
@ -66,9 +66,9 @@ class TestInitSystemSystemdRoIfupdown(InitSystemSystemdBase):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
def test_run(self):
|
def test_run(self):
|
||||||
self.startEmulator("squashfs", "zImage", "vexpress-v2p-ca9")
|
self.start_emulator("squashfs", "zImage", "vexpress-v2p-ca9")
|
||||||
self.checkInit()
|
self.check_init()
|
||||||
self.checkNetwork("eth0")
|
self.check_network("eth0")
|
||||||
|
|
||||||
|
|
||||||
class TestInitSystemSystemdRwIfupdown(InitSystemSystemdBase):
|
class TestInitSystemSystemdRwIfupdown(InitSystemSystemdBase):
|
||||||
@ -81,9 +81,9 @@ class TestInitSystemSystemdRwIfupdown(InitSystemSystemdBase):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
def test_run(self):
|
def test_run(self):
|
||||||
self.startEmulator("ext2", "zImage", "vexpress-v2p-ca9")
|
self.start_emulator("ext2", "zImage", "vexpress-v2p-ca9")
|
||||||
self.checkInit()
|
self.check_init()
|
||||||
self.checkNetwork("eth0")
|
self.check_network("eth0")
|
||||||
|
|
||||||
|
|
||||||
class TestInitSystemSystemdRoFull(InitSystemSystemdBase):
|
class TestInitSystemSystemdRoFull(InitSystemSystemdBase):
|
||||||
@ -112,9 +112,9 @@ class TestInitSystemSystemdRoFull(InitSystemSystemdBase):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
def test_run(self):
|
def test_run(self):
|
||||||
self.startEmulator("squashfs", "zImage", "vexpress-v2p-ca9")
|
self.start_emulator("squashfs", "zImage", "vexpress-v2p-ca9")
|
||||||
self.checkInit()
|
self.check_init()
|
||||||
self.checkNetwork("eth0")
|
self.check_network("eth0")
|
||||||
|
|
||||||
|
|
||||||
class TestInitSystemSystemdRwFull(InitSystemSystemdBase):
|
class TestInitSystemSystemdRwFull(InitSystemSystemdBase):
|
||||||
@ -142,6 +142,6 @@ class TestInitSystemSystemdRwFull(InitSystemSystemdBase):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
def test_run(self):
|
def test_run(self):
|
||||||
self.startEmulator("ext2", "zImage", "vexpress-v2p-ca9")
|
self.start_emulator("ext2", "zImage", "vexpress-v2p-ca9")
|
||||||
self.checkInit()
|
self.check_init()
|
||||||
self.checkNetwork("eth0")
|
self.check_network("eth0")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user