diff options
author | Vyacheslav Yurkov <uvv.mail@gmail.com> | 2021-10-17 10:08:56 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2021-10-30 22:31:52 +0100 |
commit | 8eb35a9558b9e1a05ab111f3c8cb7dbafdc23018 (patch) | |
tree | adec4d0bb896082951c8735e89c4f0de8c5baff0 | |
parent | 9c8ea9dcf1ea1b5b4c5212a306a6dd89d86b1d5a (diff) | |
download | poky-8eb35a9558b9e1a05ab111f3c8cb7dbafdc23018.tar.gz |
oeqa/selftest: refactor common functions
(From OE-Core rev: 66de5de793f3c86502d193f7e3abc8fa17642369)
Signed-off-by: Vyacheslav Yurkov <uvv.mail@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | meta/lib/oeqa/selftest/cases/overlayfs.py | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/meta/lib/oeqa/selftest/cases/overlayfs.py b/meta/lib/oeqa/selftest/cases/overlayfs.py index 0184d52494..f0c9860b48 100644 --- a/meta/lib/oeqa/selftest/cases/overlayfs.py +++ b/meta/lib/oeqa/selftest/cases/overlayfs.py | |||
@@ -8,11 +8,14 @@ from oeqa.utils.commands import runCmd, bitbake, get_bb_var, runqemu | |||
8 | class OverlayFSTests(OESelftestTestCase): | 8 | class OverlayFSTests(OESelftestTestCase): |
9 | """Overlayfs class usage tests""" | 9 | """Overlayfs class usage tests""" |
10 | 10 | ||
11 | def getline(self, res, line): | 11 | def getline_qemu(self, out, line): |
12 | for l in res.output.split('\n'): | 12 | for l in out.split('\n'): |
13 | if line in l: | 13 | if line in l: |
14 | return l | 14 | return l |
15 | 15 | ||
16 | def getline(self, res, line): | ||
17 | return self.getline_qemu(res.output, line) | ||
18 | |||
16 | def add_overlay_conf_to_machine(self): | 19 | def add_overlay_conf_to_machine(self): |
17 | machine_inc = """ | 20 | machine_inc = """ |
18 | OVERLAYFS_MOUNT_POINT[mnt-overlay] = "/mnt/overlay" | 21 | OVERLAYFS_MOUNT_POINT[mnt-overlay] = "/mnt/overlay" |
@@ -154,18 +157,13 @@ EOT | |||
154 | 157 | ||
155 | bitbake('core-image-minimal') | 158 | bitbake('core-image-minimal') |
156 | 159 | ||
157 | def getline_qemu(out, line): | ||
158 | for l in out.split('\n'): | ||
159 | if line in l: | ||
160 | return l | ||
161 | |||
162 | with runqemu('core-image-minimal') as qemu: | 160 | with runqemu('core-image-minimal') as qemu: |
163 | # Check that we have /mnt/overlay fs mounted as tmpfs and | 161 | # Check that we have /mnt/overlay fs mounted as tmpfs and |
164 | # /usr/share/my-application as an overlay (see overlayfs-user recipe) | 162 | # /usr/share/my-application as an overlay (see overlayfs-user recipe) |
165 | status, output = qemu.run_serial("/bin/mount -t tmpfs,overlay") | 163 | status, output = qemu.run_serial("/bin/mount -t tmpfs,overlay") |
166 | 164 | ||
167 | line = getline_qemu(output, "on /mnt/overlay") | 165 | line = self.getline_qemu(output, "on /mnt/overlay") |
168 | self.assertTrue(line and line.startswith("tmpfs"), msg=output) | 166 | self.assertTrue(line and line.startswith("tmpfs"), msg=output) |
169 | 167 | ||
170 | line = getline_qemu(output, "upperdir=/mnt/overlay/upper/usr/share/my-application") | 168 | line = self.getline_qemu(output, "upperdir=/mnt/overlay/upper/usr/share/my-application") |
171 | self.assertTrue(line and line.startswith("overlay"), msg=output) | 169 | self.assertTrue(line and line.startswith("overlay"), msg=output) |