diff options
Diffstat (limited to 'meta/lib/oeqa')
-rw-r--r-- | meta/lib/oeqa/selftest/cases/package.py | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/meta/lib/oeqa/selftest/cases/package.py b/meta/lib/oeqa/selftest/cases/package.py index 482a7c02ad..4f7cd10658 100644 --- a/meta/lib/oeqa/selftest/cases/package.py +++ b/meta/lib/oeqa/selftest/cases/package.py | |||
@@ -153,25 +153,25 @@ class PackageTests(OESelftestTestCase): | |||
153 | self.fail('GDB %s failed' % binary) | 153 | self.fail('GDB %s failed' % binary) |
154 | 154 | ||
155 | def test_preserve_ownership(self): | 155 | def test_preserve_ownership(self): |
156 | import os, stat, oe.cachedpath | ||
157 | features = 'IMAGE_INSTALL:append = " selftest-chown"\n' | 156 | features = 'IMAGE_INSTALL:append = " selftest-chown"\n' |
158 | self.write_config(features) | 157 | self.write_config(features) |
159 | bitbake("core-image-minimal") | 158 | bitbake("core-image-minimal") |
160 | 159 | ||
161 | sysconfdir = get_bb_var('sysconfdir', 'selftest-chown') | 160 | def check_ownership(qemu, expected_gid, expected_uid, path): |
162 | def check_ownership(qemu, gid, uid, path): | ||
163 | self.logger.info("Check ownership of %s", path) | 161 | self.logger.info("Check ownership of %s", path) |
164 | status, output = qemu.run_serial(r'/bin/stat -c "%U %G" ' + path, timeout=60) | 162 | status, output = qemu.run_serial('stat -c "%U %G" ' + path) |
165 | output = output.split(" ") | 163 | self.assertEqual(status, 1, "stat failed: " + output) |
166 | if output[0] != uid or output[1] != gid : | 164 | try: |
167 | self.logger.error("Incrrect ownership %s [%s:%s]", path, output[0], output[1]) | 165 | uid, gid = output.split() |
168 | return False | 166 | self.assertEqual(uid, expected_uid) |
169 | return True | 167 | self.assertEqual(gid, expected_gid) |
168 | except ValueError: | ||
169 | self.fail("Cannot parse output: " + output) | ||
170 | 170 | ||
171 | sysconfdir = get_bb_var('sysconfdir', 'selftest-chown') | ||
171 | with runqemu('core-image-minimal') as qemu: | 172 | with runqemu('core-image-minimal') as qemu: |
172 | for path in [ sysconfdir + "/selftest-chown/file", | 173 | for path in [ sysconfdir + "/selftest-chown/file", |
173 | sysconfdir + "/selftest-chown/dir", | 174 | sysconfdir + "/selftest-chown/dir", |
174 | sysconfdir + "/selftest-chown/symlink", | 175 | sysconfdir + "/selftest-chown/symlink", |
175 | sysconfdir + "/selftest-chown/fifotest/fifo"]: | 176 | sysconfdir + "/selftest-chown/fifotest/fifo"]: |
176 | if not check_ownership(qemu, "test", "test", path): | 177 | check_ownership(qemu, "test", "test", path) |
177 | self.fail('Test ownership %s failed' % path) | ||