summaryrefslogtreecommitdiffstats
path: root/meta/lib
diff options
context:
space:
mode:
authorVyacheslav Yurkov <uvv.mail@gmail.com>2021-12-10 14:01:42 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2021-12-12 11:27:24 +0000
commitae56b390210678cbf95593080d9385725b8a958f (patch)
treee206d1f82315aec9b2be3e48f979464f32bcd46b /meta/lib
parent51c0965c1361444bb1a8b13eae7e460715fa3934 (diff)
downloadpoky-ae56b390210678cbf95593080d9385725b8a958f.tar.gz
oeqa/selftest: overlayfs helper function
Move helper functions out of class scope so they can be used in other tests (From OE-Core rev: 439a5a575b8ca27910431c71f01bf310122ff7ab) Signed-off-by: Vyacheslav Yurkov <uvv.mail@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib')
-rw-r--r--meta/lib/oeqa/selftest/cases/overlayfs.py32
1 files changed, 16 insertions, 16 deletions
diff --git a/meta/lib/oeqa/selftest/cases/overlayfs.py b/meta/lib/oeqa/selftest/cases/overlayfs.py
index 84242a1605..43415778ce 100644
--- a/meta/lib/oeqa/selftest/cases/overlayfs.py
+++ b/meta/lib/oeqa/selftest/cases/overlayfs.py
@@ -5,16 +5,16 @@
5from oeqa.selftest.case import OESelftestTestCase 5from oeqa.selftest.case import OESelftestTestCase
6from oeqa.utils.commands import runCmd, bitbake, get_bb_var, runqemu 6from oeqa.utils.commands import runCmd, bitbake, get_bb_var, runqemu
7 7
8class OverlayFSTests(OESelftestTestCase): 8def getline_qemu(out, line):
9 """Overlayfs class usage tests""" 9 for l in out.split('\n'):
10 if line in l:
11 return l
10 12
11 def getline_qemu(self, out, line): 13def getline(res, line):
12 for l in out.split('\n'): 14 return getline_qemu(res.output, line)
13 if line in l:
14 return l
15 15
16 def getline(self, res, line): 16class OverlayFSTests(OESelftestTestCase):
17 return self.getline_qemu(res.output, line) 17 """Overlayfs class usage tests"""
18 18
19 def add_overlay_conf_to_machine(self): 19 def add_overlay_conf_to_machine(self):
20 machine_inc = """ 20 machine_inc = """
@@ -40,7 +40,7 @@ inherit overlayfs
40 self.write_recipeinc('overlayfs-user', overlayfs_recipe_append) 40 self.write_recipeinc('overlayfs-user', overlayfs_recipe_append)
41 41
42 res = bitbake('core-image-minimal', ignore_status=True) 42 res = bitbake('core-image-minimal', ignore_status=True)
43 line = self.getline(res, "overlayfs-user was skipped: missing required distro features") 43 line = getline(res, "overlayfs-user was skipped: missing required distro features")
44 self.assertTrue("overlayfs" in res.output, msg=res.output) 44 self.assertTrue("overlayfs" in res.output, msg=res.output)
45 self.assertTrue("systemd" in res.output, msg=res.output) 45 self.assertTrue("systemd" in res.output, msg=res.output)
46 self.assertTrue("ERROR: Required build target 'core-image-minimal' has no buildable providers." in res.output, msg=res.output) 46 self.assertTrue("ERROR: Required build target 'core-image-minimal' has no buildable providers." in res.output, msg=res.output)
@@ -61,9 +61,9 @@ DISTRO_FEATURES += "systemd overlayfs"
61 self.add_overlay_conf_to_machine() 61 self.add_overlay_conf_to_machine()
62 62
63 res = bitbake('core-image-minimal', ignore_status=True) 63 res = bitbake('core-image-minimal', ignore_status=True)
64 line = self.getline(res, "Unit name mnt-overlay.mount not found in systemd unit directories") 64 line = getline(res, "Unit name mnt-overlay.mount not found in systemd unit directories")
65 self.assertTrue(line and line.startswith("WARNING:"), msg=res.output) 65 self.assertTrue(line and line.startswith("WARNING:"), msg=res.output)
66 line = self.getline(res, "Not all mount units are installed by the BSP") 66 line = getline(res, "Not all mount units are installed by the BSP")
67 self.assertTrue(line and line.startswith("ERROR:"), msg=res.output) 67 self.assertTrue(line and line.startswith("ERROR:"), msg=res.output)
68 68
69 def test_mount_unit_not_set(self): 69 def test_mount_unit_not_set(self):
@@ -81,7 +81,7 @@ DISTRO_FEATURES += "systemd overlayfs"
81 self.write_config(config) 81 self.write_config(config)
82 82
83 res = bitbake('core-image-minimal', ignore_status=True) 83 res = bitbake('core-image-minimal', ignore_status=True)
84 line = self.getline(res, "A recipe uses overlayfs class but there is no OVERLAYFS_MOUNT_POINT set in your MACHINE configuration") 84 line = getline(res, "A recipe uses overlayfs class but there is no OVERLAYFS_MOUNT_POINT set in your MACHINE configuration")
85 self.assertTrue(line and line.startswith("Parsing recipes...ERROR:"), msg=res.output) 85 self.assertTrue(line and line.startswith("Parsing recipes...ERROR:"), msg=res.output)
86 86
87 def test_wrong_mount_unit_set(self): 87 def test_wrong_mount_unit_set(self):
@@ -104,7 +104,7 @@ OVERLAYFS_MOUNT_POINT[usr-share-overlay] = "/usr/share/overlay"
104 self.set_machine_config(wrong_machine_config) 104 self.set_machine_config(wrong_machine_config)
105 105
106 res = bitbake('core-image-minimal', ignore_status=True) 106 res = bitbake('core-image-minimal', ignore_status=True)
107 line = self.getline(res, "Missing required mount point for OVERLAYFS_MOUNT_POINT[mnt-overlay] in your MACHINE configuration") 107 line = getline(res, "Missing required mount point for OVERLAYFS_MOUNT_POINT[mnt-overlay] in your MACHINE configuration")
108 self.assertTrue(line and line.startswith("Parsing recipes...ERROR:"), msg=res.output) 108 self.assertTrue(line and line.startswith("Parsing recipes...ERROR:"), msg=res.output)
109 109
110 def test_correct_image(self): 110 def test_correct_image(self):
@@ -201,11 +201,11 @@ EOT
201 # /usr/share/my-application as an overlay (see overlayfs-user recipe) 201 # /usr/share/my-application as an overlay (see overlayfs-user recipe)
202 status, output = qemu.run_serial("/bin/mount -t tmpfs,overlay") 202 status, output = qemu.run_serial("/bin/mount -t tmpfs,overlay")
203 203
204 line = self.getline_qemu(output, "on /mnt/overlay") 204 line = getline_qemu(output, "on /mnt/overlay")
205 self.assertTrue(line and line.startswith("tmpfs"), msg=output) 205 self.assertTrue(line and line.startswith("tmpfs"), msg=output)
206 206
207 line = self.getline_qemu(output, "upperdir=/mnt/overlay/upper/usr/share/my-application") 207 line = getline_qemu(output, "upperdir=/mnt/overlay/upper/usr/share/my-application")
208 self.assertTrue(line and line.startswith("overlay"), msg=output) 208 self.assertTrue(line and line.startswith("overlay"), msg=output)
209 209
210 line = self.getline_qemu(output, "upperdir=/mnt/overlay/upper/usr/share/another-overlay-mount") 210 line = getline_qemu(output, "upperdir=/mnt/overlay/upper/usr/share/another-overlay-mount")
211 self.assertTrue(line and line.startswith("overlay"), msg=output) 211 self.assertTrue(line and line.startswith("overlay"), msg=output)