]> code.ossystems Code Review - openembedded-core.git/commitdiff
oeqa/selftest: refactor common functions
authorVyacheslav Yurkov <uvv.mail@gmail.com>
Sun, 17 Oct 2021 08:08:56 +0000 (10:08 +0200)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Sat, 30 Oct 2021 21:31:49 +0000 (22:31 +0100)
Signed-off-by: Vyacheslav Yurkov <uvv.mail@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/lib/oeqa/selftest/cases/overlayfs.py

index 0184d52494a5c33043f582ded1ab49c9c13864a7..f0c9860b48a4d28336deaec0b194c772be075979 100644 (file)
@@ -8,11 +8,14 @@ from oeqa.utils.commands import runCmd, bitbake, get_bb_var, runqemu
 class OverlayFSTests(OESelftestTestCase):
     """Overlayfs class usage tests"""
 
-    def getline(self, res, line):
-        for l in res.output.split('\n'):
+    def getline_qemu(self, out, line):
+        for l in out.split('\n'):
             if line in l:
                 return l
 
+    def getline(self, res, line):
+        return self.getline_qemu(res.output, line)
+
     def add_overlay_conf_to_machine(self):
         machine_inc = """
 OVERLAYFS_MOUNT_POINT[mnt-overlay] = "/mnt/overlay"
@@ -154,18 +157,13 @@ EOT
 
         bitbake('core-image-minimal')
 
-        def getline_qemu(out, line):
-            for l in out.split('\n'):
-                if line in l:
-                    return l
-
         with runqemu('core-image-minimal') as qemu:
             # Check that we have /mnt/overlay fs mounted as tmpfs and
             # /usr/share/my-application as an overlay (see overlayfs-user recipe)
             status, output = qemu.run_serial("/bin/mount -t tmpfs,overlay")
 
-            line = getline_qemu(output, "on /mnt/overlay")
+            line = self.getline_qemu(output, "on /mnt/overlay")
             self.assertTrue(line and line.startswith("tmpfs"), msg=output)
 
-            line = getline_qemu(output, "upperdir=/mnt/overlay/upper/usr/share/my-application")
+            line = self.getline_qemu(output, "upperdir=/mnt/overlay/upper/usr/share/my-application")
             self.assertTrue(line and line.startswith("overlay"), msg=output)