aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRicardo Ribalda Delgado <ricardo.ribalda@gmail.com>2020-04-19 08:35:38 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2020-04-26 13:58:59 +0100
commit33785be3c7eb4d5684cded08f955412a0c008929 (patch)
tree14b5dbb211ad7578455c3526cae8a3e762356dd2
parentebd12b10d17db0b4176b0188407d7e9b8420eab1 (diff)
downloadopenembedded-core-contrib-33785be3c7eb4d5684cded08f955412a0c008929.tar.gz
openembedded-core-contrib-33785be3c7eb4d5684cded08f955412a0c008929.tar.bz2
openembedded-core-contrib-33785be3c7eb4d5684cded08f955412a0c008929.zip
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> Signed-off-by: Ricardo Ribalda Delgado <ricardo@ribalda.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/lib/oeqa/selftest/cases/wic.py63
1 files changed, 62 insertions, 1 deletions
diff --git a/meta/lib/oeqa/selftest/cases/wic.py b/meta/lib/oeqa/selftest/cases/wic.py
index 41cf23f7789..c8765e5330e 100644
--- a/meta/lib/oeqa/selftest/cases/wic.py
+++ b/meta/lib/oeqa/selftest/cases/wic.py
@@ -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'