diff options
Diffstat (limited to 'meta/lib/oeqa')
-rw-r--r-- | meta/lib/oeqa/selftest/cases/package.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/meta/lib/oeqa/selftest/cases/package.py b/meta/lib/oeqa/selftest/cases/package.py index b87f8dc3e2..3010b1af49 100644 --- a/meta/lib/oeqa/selftest/cases/package.py +++ b/meta/lib/oeqa/selftest/cases/package.py | |||
@@ -148,3 +148,26 @@ class PackageTests(OESelftestTestCase): | |||
148 | '/usr/libexec/hello4']: | 148 | '/usr/libexec/hello4']: |
149 | if not gdbtest(qemu, binary): | 149 | if not gdbtest(qemu, binary): |
150 | self.fail('GDB %s failed' % binary) | 150 | self.fail('GDB %s failed' % binary) |
151 | |||
152 | def test_preserve_ownership(self): | ||
153 | import os, stat, oe.cachedpath | ||
154 | features = 'IMAGE_INSTALL_append = " selftest-chown"\n' | ||
155 | self.write_config(features) | ||
156 | bitbake("core-image-minimal") | ||
157 | |||
158 | sysconfdir = get_bb_var('sysconfdir', 'selftest-chown') | ||
159 | def check_ownership(qemu, gid, uid, path): | ||
160 | self.logger.info("Check ownership of %s", path) | ||
161 | status, output = qemu.run_serial(r'/bin/stat -c "%U %G" ' + path, timeout=60) | ||
162 | output = output.split(" ") | ||
163 | if output[0] != uid or output[1] != gid : | ||
164 | self.logger.error("Incrrect ownership %s [%s:%s]", path, output[0], output[1]) | ||
165 | return False | ||
166 | return True | ||
167 | |||
168 | with runqemu('core-image-minimal') as qemu: | ||
169 | for path in [ sysconfdir + "/selftest-chown/file", | ||
170 | sysconfdir + "/selftest-chown/dir", | ||
171 | sysconfdir + "/selftest-chown/symlink"]: | ||
172 | if not check_ownership(qemu, "test", "test", path): | ||
173 | self.fail('Test ownership %s failed' % path) | ||