selftest: pylinted wic test suite.
Fixed long lines, indentation and one unused variable. (From OE-Core rev: a6dbe6e1630067164881c8d7efb44cb650cd043c) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
parent
d2e0209866
commit
32c59203ce
|
@ -210,7 +210,7 @@ class Wic(oeSelfTest):
|
|||
|
||||
@testcase(1385)
|
||||
@only_for_arch(['i586', 'i686', 'x86_64'])
|
||||
def test_directdisk_bootloader_config(self):
|
||||
def test_bootloader_config(self):
|
||||
"""Test creation of directdisk-bootloader-config image"""
|
||||
cmd = "wic create directdisk-bootloader-config -e core-image-minimal -o %s" % self.resultdir
|
||||
self.assertEqual(0, runCmd(cmd).status)
|
||||
|
@ -252,9 +252,9 @@ class Wic(oeSelfTest):
|
|||
def test_build_artifacts(self):
|
||||
"""Test wic create directdisk providing all artifacts."""
|
||||
bb_vars = get_bb_vars(['STAGING_DATADIR', 'RECIPE_SYSROOT_NATIVE'],
|
||||
'wic-tools')
|
||||
'wic-tools')
|
||||
bb_vars.update(get_bb_vars(['DEPLOY_DIR_IMAGE', 'IMAGE_ROOTFS'],
|
||||
'core-image-minimal'))
|
||||
'core-image-minimal'))
|
||||
bbvars = {key.lower(): value for key, value in bb_vars.items()}
|
||||
bbvars['resultdir'] = self.resultdir
|
||||
status = runCmd("wic create directdisk "
|
||||
|
@ -362,9 +362,9 @@ class Wic(oeSelfTest):
|
|||
def test_rootfs_artifacts(self):
|
||||
"""Test usage of rootfs plugin with rootfs paths"""
|
||||
bb_vars = get_bb_vars(['STAGING_DATADIR', 'RECIPE_SYSROOT_NATIVE'],
|
||||
'wic-tools')
|
||||
'wic-tools')
|
||||
bb_vars.update(get_bb_vars(['DEPLOY_DIR_IMAGE', 'IMAGE_ROOTFS'],
|
||||
'core-image-minimal'))
|
||||
'core-image-minimal'))
|
||||
bbvars = {key.lower(): value for key, value in bb_vars.items()}
|
||||
bbvars['wks'] = "directdisk-multi-rootfs"
|
||||
bbvars['resultdir'] = self.resultdir
|
||||
|
@ -388,7 +388,8 @@ class Wic(oeSelfTest):
|
|||
wks_file = 'temp.wks'
|
||||
with open(wks_file, 'w') as wks:
|
||||
rootfs_dir = get_bb_var('IMAGE_ROOTFS', 'core-image-minimal')
|
||||
wks.write("""part / --source rootfs --ondisk mmcblk0 --fstype=ext4 --exclude-path usr
|
||||
wks.write("""
|
||||
part / --source rootfs --ondisk mmcblk0 --fstype=ext4 --exclude-path usr
|
||||
part /usr --source rootfs --ondisk mmcblk0 --fstype=ext4 --rootfs-dir %s/usr
|
||||
part /etc --source rootfs --ondisk mmcblk0 --fstype=ext4 --exclude-path bin/ --rootfs-dir %s/usr"""
|
||||
% (rootfs_dir, rootfs_dir))
|
||||
|
@ -423,25 +424,27 @@ part /etc --source rootfs --ondisk mmcblk0 --fstype=ext4 --exclude-path bin/ --r
|
|||
(wicimg, part_file, start, length)).status)
|
||||
|
||||
def extract_files(debugfs_output):
|
||||
# extract file names from the output of debugfs -R 'ls -p',
|
||||
# which looks like this:
|
||||
#
|
||||
# /2/040755/0/0/.//\n
|
||||
# /2/040755/0/0/..//\n
|
||||
# /11/040700/0/0/lost+found^M//\n
|
||||
# /12/040755/1002/1002/run//\n
|
||||
# /13/040755/1002/1002/sys//\n
|
||||
# /14/040755/1002/1002/bin//\n
|
||||
# /80/040755/1002/1002/var//\n
|
||||
# /92/040755/1002/1002/tmp//\n
|
||||
#
|
||||
"""
|
||||
extract file names from the output of debugfs -R 'ls -p',
|
||||
which looks like this:
|
||||
|
||||
/2/040755/0/0/.//\n
|
||||
/2/040755/0/0/..//\n
|
||||
/11/040700/0/0/lost+found^M//\n
|
||||
/12/040755/1002/1002/run//\n
|
||||
/13/040755/1002/1002/sys//\n
|
||||
/14/040755/1002/1002/bin//\n
|
||||
/80/040755/1002/1002/var//\n
|
||||
/92/040755/1002/1002/tmp//\n
|
||||
"""
|
||||
# NOTE the occasional ^M in file names
|
||||
return [line.split('/')[5].strip() for line in \
|
||||
debugfs_output.strip().split('/\n')]
|
||||
|
||||
# Test partition 1, should contain the normal root directories, except
|
||||
# /usr.
|
||||
res = runCmd("debugfs -R 'ls -p' %s 2>/dev/null" % os.path.join(self.resultdir, "selftest_img.part1"))
|
||||
res = runCmd("debugfs -R 'ls -p' %s 2>/dev/null" % \
|
||||
os.path.join(self.resultdir, "selftest_img.part1"))
|
||||
self.assertEqual(0, res.status)
|
||||
files = extract_files(res.output)
|
||||
self.assertIn("etc", files)
|
||||
|
@ -449,7 +452,8 @@ part /etc --source rootfs --ondisk mmcblk0 --fstype=ext4 --exclude-path bin/ --r
|
|||
|
||||
# Partition 2, should contain common directories for /usr, not root
|
||||
# directories.
|
||||
res = runCmd("debugfs -R 'ls -p' %s 2>/dev/null" % os.path.join(self.resultdir, "selftest_img.part2"))
|
||||
res = runCmd("debugfs -R 'ls -p' %s 2>/dev/null" % \
|
||||
os.path.join(self.resultdir, "selftest_img.part2"))
|
||||
self.assertEqual(0, res.status)
|
||||
files = extract_files(res.output)
|
||||
self.assertNotIn("etc", files)
|
||||
|
@ -458,14 +462,16 @@ part /etc --source rootfs --ondisk mmcblk0 --fstype=ext4 --exclude-path bin/ --r
|
|||
|
||||
# Partition 3, should contain the same as partition 2, including the bin
|
||||
# directory, but not the files inside it.
|
||||
res = runCmd("debugfs -R 'ls -p' %s 2>/dev/null" % os.path.join(self.resultdir, "selftest_img.part3"))
|
||||
res = runCmd("debugfs -R 'ls -p' %s 2>/dev/null" % \
|
||||
os.path.join(self.resultdir, "selftest_img.part3"))
|
||||
self.assertEqual(0, res.status)
|
||||
files = extract_files(res.output)
|
||||
self.assertNotIn("etc", files)
|
||||
self.assertNotIn("usr", files)
|
||||
self.assertIn("share", files)
|
||||
self.assertIn("bin", files)
|
||||
res = runCmd("debugfs -R 'ls -p bin' %s 2>/dev/null" % os.path.join(self.resultdir, "selftest_img.part3"))
|
||||
res = runCmd("debugfs -R 'ls -p bin' %s 2>/dev/null" % \
|
||||
os.path.join(self.resultdir, "selftest_img.part3"))
|
||||
self.assertEqual(0, res.status)
|
||||
files = extract_files(res.output)
|
||||
self.assertIn(".", files)
|
||||
|
@ -483,8 +489,6 @@ part /etc --source rootfs --ondisk mmcblk0 --fstype=ext4 --exclude-path bin/ --r
|
|||
"""Test --exclude-path wks option error handling."""
|
||||
wks_file = 'temp.wks'
|
||||
|
||||
rootfs_dir = get_bb_var('IMAGE_ROOTFS', 'core-image-minimal')
|
||||
|
||||
# Absolute argument.
|
||||
with open(wks_file, 'w') as wks:
|
||||
wks.write("part / --source rootfs --ondisk mmcblk0 --fstype=ext4 --exclude-path /usr")
|
||||
|
|
Loading…
Reference in New Issue