mirror of
https://git.yoctoproject.org/poky
synced 2026-05-01 15:32:12 +02:00
oeqa: wic: Add more tests for include_path
Make sure permissions are respected. Add new test for orig/destination option. Cc: Paul Barker <pbarker@konsulko.com> (From OE-Core rev: 33785be3c7eb4d5684cded08f955412a0c008929) Signed-off-by: Ricardo Ribalda Delgado <ricardo@ribalda.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
31b14186e9
commit
01619c9acb
@@ -486,15 +486,76 @@ part /part2 --source rootfs --ondisk mmcblk0 --fstype=ext4 --include-path %s"""
|
||||
res = runCmd("debugfs -R 'ls -p' %s 2>/dev/null" % (part1))
|
||||
files = extract_files(res.output)
|
||||
self.assertNotIn('test-file', files)
|
||||
self.assertEqual(True, files_own_by_root(res.output))
|
||||
|
||||
# Test partition 2, should not contain 'test-file'
|
||||
# Test partition 2, should contain 'test-file'
|
||||
res = runCmd("debugfs -R 'ls -p' %s 2>/dev/null" % (part2))
|
||||
files = extract_files(res.output)
|
||||
self.assertIn('test-file', files)
|
||||
self.assertEqual(True, files_own_by_root(res.output))
|
||||
|
||||
finally:
|
||||
os.environ['PATH'] = oldpath
|
||||
|
||||
def test_include_path_embeded(self):
|
||||
"""Test --include-path wks option."""
|
||||
|
||||
oldpath = os.environ['PATH']
|
||||
os.environ['PATH'] = get_bb_var("PATH", "wic-tools")
|
||||
|
||||
try:
|
||||
include_path = os.path.join(self.resultdir, 'test-include')
|
||||
os.makedirs(include_path)
|
||||
with open(os.path.join(include_path, 'test-file'), 'w') as t:
|
||||
t.write("test\n")
|
||||
wks_file = os.path.join(include_path, 'temp.wks')
|
||||
with open(wks_file, 'w') as wks:
|
||||
wks.write("""
|
||||
part / --source rootfs --fstype=ext4 --include-path %s --include-path core-image-minimal-mtdutils export/"""
|
||||
% (include_path))
|
||||
runCmd("wic create %s -e core-image-minimal -o %s" \
|
||||
% (wks_file, self.resultdir))
|
||||
|
||||
part1 = glob(os.path.join(self.resultdir, 'temp-*.direct.p1'))[0]
|
||||
|
||||
res = runCmd("debugfs -R 'ls -p' %s 2>/dev/null" % (part1))
|
||||
files = extract_files(res.output)
|
||||
self.assertIn('test-file', files)
|
||||
self.assertEqual(True, files_own_by_root(res.output))
|
||||
|
||||
res = runCmd("debugfs -R 'ls -p /export/etc/' %s 2>/dev/null" % (part1))
|
||||
files = extract_files(res.output)
|
||||
self.assertIn('passwd', files)
|
||||
self.assertEqual(True, files_own_by_root(res.output))
|
||||
|
||||
finally:
|
||||
os.environ['PATH'] = oldpath
|
||||
|
||||
def test_include_path_errors(self):
|
||||
"""Test --include-path wks option error handling."""
|
||||
wks_file = 'temp.wks'
|
||||
|
||||
# Absolute argument.
|
||||
with open(wks_file, 'w') as wks:
|
||||
wks.write("part / --source rootfs --fstype=ext4 --include-path core-image-minimal-mtdutils /export")
|
||||
self.assertNotEqual(0, runCmd("wic create %s -e core-image-minimal -o %s" \
|
||||
% (wks_file, self.resultdir), ignore_status=True).status)
|
||||
os.remove(wks_file)
|
||||
|
||||
# Argument pointing to parent directory.
|
||||
with open(wks_file, 'w') as wks:
|
||||
wks.write("part / --source rootfs --fstype=ext4 --include-path core-image-minimal-mtdutils ././..")
|
||||
self.assertNotEqual(0, runCmd("wic create %s -e core-image-minimal -o %s" \
|
||||
% (wks_file, self.resultdir), ignore_status=True).status)
|
||||
os.remove(wks_file)
|
||||
|
||||
# 3 Argument pointing to parent directory.
|
||||
with open(wks_file, 'w') as wks:
|
||||
wks.write("part / --source rootfs --fstype=ext4 --include-path core-image-minimal-mtdutils export/ dummy")
|
||||
self.assertNotEqual(0, runCmd("wic create %s -e core-image-minimal -o %s" \
|
||||
% (wks_file, self.resultdir), ignore_status=True).status)
|
||||
os.remove(wks_file)
|
||||
|
||||
def test_exclude_path_errors(self):
|
||||
"""Test --exclude-path wks option error handling."""
|
||||
wks_file = 'temp.wks'
|
||||
|
||||
Reference in New Issue
Block a user