diff options
author | Ed Bartosh <ed.bartosh@linux.intel.com> | 2017-03-22 15:42:33 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-03-22 15:07:37 +0000 |
commit | a6dbe6e1630067164881c8d7efb44cb650cd043c (patch) | |
tree | 367a38f22d6dab5fbcb8a87cd1e516680cecddb2 /meta/lib | |
parent | db1f511228e26aaeeff452427637942747bbf42b (diff) | |
download | openembedded-core-a6dbe6e1630067164881c8d7efb44cb650cd043c.tar.gz openembedded-core-a6dbe6e1630067164881c8d7efb44cb650cd043c.tar.bz2 openembedded-core-a6dbe6e1630067164881c8d7efb44cb650cd043c.zip |
selftest: pylinted wic test suite.
Fixed long lines, indentation and one unused variable.
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib')
-rw-r--r-- | meta/lib/oeqa/selftest/wic.py | 52 |
1 files changed, 28 insertions, 24 deletions
diff --git a/meta/lib/oeqa/selftest/wic.py b/meta/lib/oeqa/selftest/wic.py index 2e22362e42..327dd073ca 100644 --- a/meta/lib/oeqa/selftest/wic.py +++ b/meta/lib/oeqa/selftest/wic.py @@ -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") |