mirror of
https://gitlab.com/buildroot.org/buildroot.git
synced 2026-09-19 16:40:46 -09:00
support/testing: fix code style
Fix the trivial warnings from flake8: - remove modules imported but unused; - use 2 lines before class or module level method; - remove blank line at end of file. 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:
committed by
Arnout Vandecappelle (Essensium/Mind)
parent
2927f412be
commit
ef8d1f1b15
@@ -3,6 +3,7 @@ import csv
|
||||
|
||||
import infra.basetest
|
||||
|
||||
|
||||
class TestPostScripts(infra.basetest.BRTest):
|
||||
config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \
|
||||
"""
|
||||
|
||||
@@ -3,9 +3,11 @@ import subprocess
|
||||
|
||||
import infra.basetest
|
||||
|
||||
|
||||
def compare_file(file1, file2):
|
||||
return subprocess.call(["cmp", file1, file2])
|
||||
|
||||
|
||||
class TestRootfsOverlay(infra.basetest.BRTest):
|
||||
|
||||
rootfs_overlay_path = infra.filepath("tests/core/rootfs-overlay")
|
||||
|
||||
@@ -2,12 +2,14 @@ import os
|
||||
|
||||
import infra.basetest
|
||||
|
||||
|
||||
def boot_armv5_cpio(emulator, builddir):
|
||||
img = os.path.join(builddir, "images", "rootfs.cpio")
|
||||
emulator.boot(arch="armv5", kernel="builtin",
|
||||
options=["-initrd", img])
|
||||
emulator.login()
|
||||
|
||||
|
||||
class TestNoTimezone(infra.basetest.BRTest):
|
||||
config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \
|
||||
"""
|
||||
@@ -23,6 +25,7 @@ class TestNoTimezone(infra.basetest.BRTest):
|
||||
tz, _ = self.emulator.run("TZ=America/Los_Angeles date +%Z")
|
||||
self.assertEqual(tz[0].strip(), "UTC")
|
||||
|
||||
|
||||
class TestGlibcAllTimezone(infra.basetest.BRTest):
|
||||
config = \
|
||||
"""
|
||||
@@ -44,6 +47,7 @@ class TestGlibcAllTimezone(infra.basetest.BRTest):
|
||||
tz, _ = self.emulator.run("TZ=Europe/Paris date +%Z")
|
||||
self.assertEqual(tz[0].strip(), "CET")
|
||||
|
||||
|
||||
class TestGlibcNonDefaultLimitedTimezone(infra.basetest.BRTest):
|
||||
config = \
|
||||
"""
|
||||
|
||||
@@ -12,6 +12,7 @@ RESBLKCNT_PROP = "Reserved block count"
|
||||
|
||||
CHECK_FS_TYPE_CMD = "mount | grep '/dev/root on / type {}'"
|
||||
|
||||
|
||||
def dumpe2fs_run(builddir, image):
|
||||
cmd = ["host/sbin/dumpe2fs", os.path.join("images", image)]
|
||||
ret = subprocess.check_output(cmd,
|
||||
@@ -20,12 +21,14 @@ def dumpe2fs_run(builddir, image):
|
||||
env={"LANG": "C"})
|
||||
return ret.strip().splitlines()
|
||||
|
||||
|
||||
def dumpe2fs_getprop(out, prop):
|
||||
for line in out:
|
||||
fields = line.split(": ")
|
||||
if fields[0] == prop:
|
||||
return fields[1].strip()
|
||||
|
||||
|
||||
def boot_img_and_check_fs_type(emulator, builddir, fs_type):
|
||||
img = os.path.join(builddir, "images", "rootfs.{}".format(fs_type))
|
||||
emulator.boot(arch="armv7",
|
||||
@@ -37,6 +40,7 @@ def boot_img_and_check_fs_type(emulator, builddir, fs_type):
|
||||
_, exit_code = emulator.run(CHECK_FS_TYPE_CMD.format(fs_type))
|
||||
return exit_code
|
||||
|
||||
|
||||
class TestExt2(infra.basetest.BRTest):
|
||||
config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \
|
||||
"""
|
||||
@@ -55,6 +59,7 @@ class TestExt2(infra.basetest.BRTest):
|
||||
self.builddir, "ext2")
|
||||
self.assertEqual(exit_code, 0)
|
||||
|
||||
|
||||
class TestExt2r1(infra.basetest.BRTest):
|
||||
config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \
|
||||
"""
|
||||
@@ -74,6 +79,7 @@ class TestExt2r1(infra.basetest.BRTest):
|
||||
self.builddir, "ext2")
|
||||
self.assertEqual(exit_code, 0)
|
||||
|
||||
|
||||
class TestExt3(infra.basetest.BRTest):
|
||||
config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \
|
||||
"""
|
||||
@@ -92,6 +98,7 @@ class TestExt3(infra.basetest.BRTest):
|
||||
self.builddir, "ext3")
|
||||
self.assertEqual(exit_code, 0)
|
||||
|
||||
|
||||
class TestExt4(infra.basetest.BRTest):
|
||||
config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \
|
||||
"""
|
||||
@@ -116,5 +123,3 @@ class TestExt4(infra.basetest.BRTest):
|
||||
exit_code = boot_img_and_check_fs_type(self.emulator,
|
||||
self.builddir, "ext4")
|
||||
self.assertEqual(exit_code, 0)
|
||||
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@ BASIC_CONFIG = \
|
||||
# BR2_TARGET_ROOTFS_TAR is not set
|
||||
""".format(infra.filepath("conf/minimal-x86-qemu-kernel.config"))
|
||||
|
||||
|
||||
def test_mount_internal_external(emulator, builddir, internal=True):
|
||||
img = os.path.join(builddir, "images", "rootfs.iso9660")
|
||||
emulator.boot(arch="i386", options=["-cdrom", img])
|
||||
@@ -38,13 +39,14 @@ def test_mount_internal_external(emulator, builddir, internal=True):
|
||||
_, exit_code = emulator.run(cmd)
|
||||
return exit_code
|
||||
|
||||
|
||||
def test_touch_file(emulator):
|
||||
_, exit_code = emulator.run("touch test")
|
||||
return exit_code
|
||||
|
||||
#
|
||||
# Grub 2
|
||||
#
|
||||
|
||||
|
||||
class TestIso9660Grub2External(infra.basetest.BRTest):
|
||||
config = BASIC_CONFIG + \
|
||||
@@ -65,6 +67,7 @@ class TestIso9660Grub2External(infra.basetest.BRTest):
|
||||
exit_code = test_touch_file(self.emulator)
|
||||
self.assertEqual(exit_code, 1)
|
||||
|
||||
|
||||
class TestIso9660Grub2Internal(infra.basetest.BRTest):
|
||||
config = BASIC_CONFIG + \
|
||||
"""
|
||||
@@ -86,7 +89,7 @@ class TestIso9660Grub2Internal(infra.basetest.BRTest):
|
||||
|
||||
#
|
||||
# Syslinux
|
||||
#
|
||||
|
||||
|
||||
class TestIso9660SyslinuxExternal(infra.basetest.BRTest):
|
||||
config = BASIC_CONFIG + \
|
||||
@@ -106,6 +109,7 @@ class TestIso9660SyslinuxExternal(infra.basetest.BRTest):
|
||||
exit_code = test_touch_file(self.emulator)
|
||||
self.assertEqual(exit_code, 1)
|
||||
|
||||
|
||||
class TestIso9660SyslinuxInternal(infra.basetest.BRTest):
|
||||
config = BASIC_CONFIG + \
|
||||
"""
|
||||
|
||||
@@ -3,6 +3,7 @@ import subprocess
|
||||
|
||||
import infra.basetest
|
||||
|
||||
|
||||
def jffs2dump_find_file(files_list, fname):
|
||||
for file_name in files_list:
|
||||
file_name = file_name.strip()
|
||||
@@ -10,6 +11,7 @@ def jffs2dump_find_file(files_list, fname):
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
class TestJffs2(infra.basetest.BRTest):
|
||||
config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \
|
||||
"""
|
||||
|
||||
@@ -3,6 +3,7 @@ import subprocess
|
||||
|
||||
import infra.basetest
|
||||
|
||||
|
||||
class TestSquashfs(infra.basetest.BRTest):
|
||||
config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \
|
||||
"""
|
||||
|
||||
@@ -3,6 +3,7 @@ import os
|
||||
|
||||
import infra.basetest
|
||||
|
||||
|
||||
class TestUbi(infra.basetest.BRTest):
|
||||
config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \
|
||||
"""
|
||||
|
||||
@@ -2,6 +2,7 @@ import os
|
||||
|
||||
import infra.basetest
|
||||
|
||||
|
||||
class TestYaffs2(infra.basetest.BRTest):
|
||||
config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \
|
||||
infra.basetest.MINIMAL_CONFIG + \
|
||||
|
||||
@@ -2,6 +2,7 @@ import os
|
||||
import subprocess
|
||||
import infra.basetest
|
||||
|
||||
|
||||
class InitSystemBase(infra.basetest.BRTest):
|
||||
|
||||
def startEmulator(self, fs_type, kernel=None, dtb=None, init=None):
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import infra.basetest
|
||||
from tests.init.base import InitSystemBase as InitSystemBase
|
||||
|
||||
|
||||
class InitSystemBusyboxBase(InitSystemBase):
|
||||
config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \
|
||||
"""
|
||||
@@ -11,7 +12,6 @@ class InitSystemBusyboxBase(InitSystemBase):
|
||||
super(InitSystemBusyboxBase, self).checkInit("/bin/busybox")
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
class TestInitSystemBusyboxRo(InitSystemBusyboxBase):
|
||||
config = InitSystemBusyboxBase.config + \
|
||||
"""
|
||||
@@ -25,7 +25,6 @@ class TestInitSystemBusyboxRo(InitSystemBusyboxBase):
|
||||
self.checkNetwork("eth0", 1)
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
class TestInitSystemBusyboxRw(InitSystemBusyboxBase):
|
||||
config = InitSystemBusyboxBase.config + \
|
||||
"""
|
||||
@@ -38,7 +37,6 @@ class TestInitSystemBusyboxRw(InitSystemBusyboxBase):
|
||||
self.checkNetwork("eth0", 1)
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
class TestInitSystemBusyboxRoNet(InitSystemBusyboxBase):
|
||||
config = InitSystemBusyboxBase.config + \
|
||||
"""
|
||||
@@ -53,7 +51,6 @@ class TestInitSystemBusyboxRoNet(InitSystemBusyboxBase):
|
||||
self.checkNetwork("eth0")
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
class TestInitSystemBusyboxRwNet(InitSystemBusyboxBase):
|
||||
config = InitSystemBusyboxBase.config + \
|
||||
"""
|
||||
|
||||
@@ -3,6 +3,7 @@ import pexpect
|
||||
import infra.basetest
|
||||
from tests.init.base import InitSystemBase as InitSystemBase
|
||||
|
||||
|
||||
class TestInitSystemNone(InitSystemBase):
|
||||
config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \
|
||||
"""
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import infra.basetest
|
||||
from tests.init.base import InitSystemBase as InitSystemBase
|
||||
|
||||
|
||||
class InitSystemSystemdBase(InitSystemBase):
|
||||
config = \
|
||||
"""
|
||||
@@ -21,7 +22,6 @@ class InitSystemSystemdBase(InitSystemBase):
|
||||
super(InitSystemSystemdBase, self).checkInit("/lib/systemd/systemd")
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
class TestInitSystemSystemdRoNetworkd(InitSystemSystemdBase):
|
||||
config = InitSystemSystemdBase.config + \
|
||||
"""
|
||||
@@ -43,7 +43,6 @@ class TestInitSystemSystemdRoNetworkd(InitSystemSystemdBase):
|
||||
self.assertEqual(out[0], "foobar")
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
class TestInitSystemSystemdRwNetworkd(InitSystemSystemdBase):
|
||||
config = InitSystemSystemdBase.config + \
|
||||
"""
|
||||
@@ -57,7 +56,6 @@ class TestInitSystemSystemdRwNetworkd(InitSystemSystemdBase):
|
||||
self.checkNetwork("eth0")
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
class TestInitSystemSystemdRoIfupdown(InitSystemSystemdBase):
|
||||
config = InitSystemSystemdBase.config + \
|
||||
"""
|
||||
@@ -73,7 +71,6 @@ class TestInitSystemSystemdRoIfupdown(InitSystemSystemdBase):
|
||||
self.checkNetwork("eth0")
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
class TestInitSystemSystemdRwIfupdown(InitSystemSystemdBase):
|
||||
config = InitSystemSystemdBase.config + \
|
||||
"""
|
||||
@@ -89,7 +86,6 @@ class TestInitSystemSystemdRwIfupdown(InitSystemSystemdBase):
|
||||
self.checkNetwork("eth0")
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
class TestInitSystemSystemdRoFull(InitSystemSystemdBase):
|
||||
config = InitSystemSystemdBase.config + \
|
||||
"""
|
||||
@@ -121,7 +117,6 @@ class TestInitSystemSystemdRoFull(InitSystemSystemdBase):
|
||||
self.checkNetwork("eth0")
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
class TestInitSystemSystemdRwFull(InitSystemSystemdBase):
|
||||
config = InitSystemSystemdBase.config + \
|
||||
"""
|
||||
|
||||
@@ -2,6 +2,7 @@ import os
|
||||
|
||||
import infra.basetest
|
||||
|
||||
|
||||
class TestDropbear(infra.basetest.BRTest):
|
||||
config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \
|
||||
"""
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import os
|
||||
|
||||
from tests.package.test_python import TestPythonBase
|
||||
#
|
||||
# The following pythong tests are not being used here:
|
||||
@@ -8,7 +6,8 @@ from tests.package.test_python import TestPythonBase
|
||||
#
|
||||
# - zlib_test: IPython does not return a non-zero code the way CPython
|
||||
# does, so this test ends up being a false-negative
|
||||
#
|
||||
|
||||
|
||||
class TestIPythonPy2(TestPythonBase):
|
||||
config = TestPythonBase.config + \
|
||||
"""
|
||||
@@ -22,6 +21,7 @@ class TestIPythonPy2(TestPythonBase):
|
||||
self.math_floor_test(40)
|
||||
self.libc_time_test(40)
|
||||
|
||||
|
||||
class TestIPythonPy3(TestPythonBase):
|
||||
config = TestPythonBase.config + \
|
||||
"""
|
||||
@@ -34,5 +34,3 @@ class TestIPythonPy3(TestPythonBase):
|
||||
self.login()
|
||||
self.math_floor_test(40)
|
||||
self.libc_time_test(40)
|
||||
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ import os
|
||||
|
||||
import infra.basetest
|
||||
|
||||
|
||||
class TestPythonBase(infra.basetest.BRTest):
|
||||
config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \
|
||||
"""
|
||||
@@ -40,11 +41,13 @@ class TestPythonBase(infra.basetest.BRTest):
|
||||
_, exit_code = self.emulator.run(cmd, timeout)
|
||||
self.assertEqual(exit_code, 1)
|
||||
|
||||
|
||||
class TestPython2(TestPythonBase):
|
||||
config = TestPythonBase.config + \
|
||||
"""
|
||||
BR2_PACKAGE_PYTHON=y
|
||||
"""
|
||||
|
||||
def test_run(self):
|
||||
self.login()
|
||||
self.version_test("Python 2")
|
||||
@@ -52,11 +55,13 @@ class TestPython2(TestPythonBase):
|
||||
self.libc_time_test()
|
||||
self.zlib_test()
|
||||
|
||||
|
||||
class TestPython3(TestPythonBase):
|
||||
config = TestPythonBase.config + \
|
||||
"""
|
||||
BR2_PACKAGE_PYTHON3=y
|
||||
"""
|
||||
|
||||
def test_run(self):
|
||||
self.login()
|
||||
self.version_test("Python 3")
|
||||
|
||||
@@ -7,6 +7,7 @@ BASIC_CONFIG = \
|
||||
# BR2_TARGET_ROOTFS_TAR is not set
|
||||
"""
|
||||
|
||||
|
||||
def has_broken_links(path):
|
||||
for root, dirs, files in os.walk(path):
|
||||
for f in files:
|
||||
@@ -15,6 +16,7 @@ def has_broken_links(path):
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
class TestExternalToolchain(infra.basetest.BRTest):
|
||||
def common_check(self):
|
||||
# Check for broken symlinks
|
||||
@@ -30,6 +32,7 @@ class TestExternalToolchain(infra.basetest.BRTest):
|
||||
interp_path = os.path.join(self.builddir, "target", interp[1:])
|
||||
self.assertTrue(os.path.exists(interp_path))
|
||||
|
||||
|
||||
class TestExternalToolchainSourceryArmv4(TestExternalToolchain):
|
||||
config = BASIC_CONFIG + \
|
||||
"""
|
||||
@@ -61,6 +64,7 @@ class TestExternalToolchainSourceryArmv4(TestExternalToolchain):
|
||||
options=["-initrd", img])
|
||||
self.emulator.login()
|
||||
|
||||
|
||||
class TestExternalToolchainSourceryArmv5(TestExternalToolchain):
|
||||
config = BASIC_CONFIG + \
|
||||
"""
|
||||
@@ -86,6 +90,7 @@ class TestExternalToolchainSourceryArmv5(TestExternalToolchain):
|
||||
options=["-initrd", img])
|
||||
self.emulator.login()
|
||||
|
||||
|
||||
class TestExternalToolchainSourceryArmv7(TestExternalToolchain):
|
||||
config = BASIC_CONFIG + \
|
||||
"""
|
||||
@@ -124,6 +129,7 @@ class TestExternalToolchainSourceryArmv7(TestExternalToolchain):
|
||||
options=["-initrd", img])
|
||||
self.emulator.login()
|
||||
|
||||
|
||||
class TestExternalToolchainLinaroArm(TestExternalToolchain):
|
||||
config = BASIC_CONFIG + \
|
||||
"""
|
||||
@@ -155,6 +161,7 @@ class TestExternalToolchainLinaroArm(TestExternalToolchain):
|
||||
options=["-initrd", img])
|
||||
self.emulator.login()
|
||||
|
||||
|
||||
class TestExternalToolchainBuildrootMusl(TestExternalToolchain):
|
||||
config = BASIC_CONFIG + \
|
||||
"""
|
||||
@@ -180,6 +187,7 @@ class TestExternalToolchainBuildrootMusl(TestExternalToolchain):
|
||||
options=["-initrd", img])
|
||||
self.emulator.login()
|
||||
|
||||
|
||||
class TestExternalToolchainCtngMusl(TestExternalToolchain):
|
||||
config = BASIC_CONFIG + \
|
||||
"""
|
||||
@@ -206,6 +214,7 @@ class TestExternalToolchainCtngMusl(TestExternalToolchain):
|
||||
options=["-initrd", img])
|
||||
self.emulator.login()
|
||||
|
||||
|
||||
class TestExternalToolchainBuildrootuClibc(TestExternalToolchain):
|
||||
config = BASIC_CONFIG + \
|
||||
"""
|
||||
@@ -230,6 +239,7 @@ class TestExternalToolchainBuildrootuClibc(TestExternalToolchain):
|
||||
options=["-initrd", img])
|
||||
self.emulator.login()
|
||||
|
||||
|
||||
class TestExternalToolchainCCache(TestExternalToolchainBuildrootuClibc):
|
||||
extraconfig = \
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user