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-23 13:19:49 +0000 |
commit | 32c59203cef92d8ee79e03c87a70636301f50154 (patch) | |
tree | 2b856adf3ce44ee66ee851fe179f3b476b44ba76 /meta | |
parent | d2e02098669a43bf6fc61a963850c276d6884fce (diff) | |
download | poky-32c59203cef92d8ee79e03c87a70636301f50154.tar.gz |
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>
Diffstat (limited to 'meta')
-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): | |||
210 | 210 | ||
211 | @testcase(1385) | 211 | @testcase(1385) |
212 | @only_for_arch(['i586', 'i686', 'x86_64']) | 212 | @only_for_arch(['i586', 'i686', 'x86_64']) |
213 | def test_directdisk_bootloader_config(self): | 213 | def test_bootloader_config(self): |
214 | """Test creation of directdisk-bootloader-config image""" | 214 | """Test creation of directdisk-bootloader-config image""" |
215 | cmd = "wic create directdisk-bootloader-config -e core-image-minimal -o %s" % self.resultdir | 215 | cmd = "wic create directdisk-bootloader-config -e core-image-minimal -o %s" % self.resultdir |
216 | self.assertEqual(0, runCmd(cmd).status) | 216 | self.assertEqual(0, runCmd(cmd).status) |
@@ -252,9 +252,9 @@ class Wic(oeSelfTest): | |||
252 | def test_build_artifacts(self): | 252 | def test_build_artifacts(self): |
253 | """Test wic create directdisk providing all artifacts.""" | 253 | """Test wic create directdisk providing all artifacts.""" |
254 | bb_vars = get_bb_vars(['STAGING_DATADIR', 'RECIPE_SYSROOT_NATIVE'], | 254 | bb_vars = get_bb_vars(['STAGING_DATADIR', 'RECIPE_SYSROOT_NATIVE'], |
255 | 'wic-tools') | 255 | 'wic-tools') |
256 | bb_vars.update(get_bb_vars(['DEPLOY_DIR_IMAGE', 'IMAGE_ROOTFS'], | 256 | bb_vars.update(get_bb_vars(['DEPLOY_DIR_IMAGE', 'IMAGE_ROOTFS'], |
257 | 'core-image-minimal')) | 257 | 'core-image-minimal')) |
258 | bbvars = {key.lower(): value for key, value in bb_vars.items()} | 258 | bbvars = {key.lower(): value for key, value in bb_vars.items()} |
259 | bbvars['resultdir'] = self.resultdir | 259 | bbvars['resultdir'] = self.resultdir |
260 | status = runCmd("wic create directdisk " | 260 | status = runCmd("wic create directdisk " |
@@ -362,9 +362,9 @@ class Wic(oeSelfTest): | |||
362 | def test_rootfs_artifacts(self): | 362 | def test_rootfs_artifacts(self): |
363 | """Test usage of rootfs plugin with rootfs paths""" | 363 | """Test usage of rootfs plugin with rootfs paths""" |
364 | bb_vars = get_bb_vars(['STAGING_DATADIR', 'RECIPE_SYSROOT_NATIVE'], | 364 | bb_vars = get_bb_vars(['STAGING_DATADIR', 'RECIPE_SYSROOT_NATIVE'], |
365 | 'wic-tools') | 365 | 'wic-tools') |
366 | bb_vars.update(get_bb_vars(['DEPLOY_DIR_IMAGE', 'IMAGE_ROOTFS'], | 366 | bb_vars.update(get_bb_vars(['DEPLOY_DIR_IMAGE', 'IMAGE_ROOTFS'], |
367 | 'core-image-minimal')) | 367 | 'core-image-minimal')) |
368 | bbvars = {key.lower(): value for key, value in bb_vars.items()} | 368 | bbvars = {key.lower(): value for key, value in bb_vars.items()} |
369 | bbvars['wks'] = "directdisk-multi-rootfs" | 369 | bbvars['wks'] = "directdisk-multi-rootfs" |
370 | bbvars['resultdir'] = self.resultdir | 370 | bbvars['resultdir'] = self.resultdir |
@@ -388,7 +388,8 @@ class Wic(oeSelfTest): | |||
388 | wks_file = 'temp.wks' | 388 | wks_file = 'temp.wks' |
389 | with open(wks_file, 'w') as wks: | 389 | with open(wks_file, 'w') as wks: |
390 | rootfs_dir = get_bb_var('IMAGE_ROOTFS', 'core-image-minimal') | 390 | rootfs_dir = get_bb_var('IMAGE_ROOTFS', 'core-image-minimal') |
391 | wks.write("""part / --source rootfs --ondisk mmcblk0 --fstype=ext4 --exclude-path usr | 391 | wks.write(""" |
392 | part / --source rootfs --ondisk mmcblk0 --fstype=ext4 --exclude-path usr | ||
392 | part /usr --source rootfs --ondisk mmcblk0 --fstype=ext4 --rootfs-dir %s/usr | 393 | part /usr --source rootfs --ondisk mmcblk0 --fstype=ext4 --rootfs-dir %s/usr |
393 | part /etc --source rootfs --ondisk mmcblk0 --fstype=ext4 --exclude-path bin/ --rootfs-dir %s/usr""" | 394 | part /etc --source rootfs --ondisk mmcblk0 --fstype=ext4 --exclude-path bin/ --rootfs-dir %s/usr""" |
394 | % (rootfs_dir, rootfs_dir)) | 395 | % (rootfs_dir, rootfs_dir)) |
@@ -423,25 +424,27 @@ part /etc --source rootfs --ondisk mmcblk0 --fstype=ext4 --exclude-path bin/ --r | |||
423 | (wicimg, part_file, start, length)).status) | 424 | (wicimg, part_file, start, length)).status) |
424 | 425 | ||
425 | def extract_files(debugfs_output): | 426 | def extract_files(debugfs_output): |
426 | # extract file names from the output of debugfs -R 'ls -p', | 427 | """ |
427 | # which looks like this: | 428 | extract file names from the output of debugfs -R 'ls -p', |
428 | # | 429 | which looks like this: |
429 | # /2/040755/0/0/.//\n | 430 | |
430 | # /2/040755/0/0/..//\n | 431 | /2/040755/0/0/.//\n |
431 | # /11/040700/0/0/lost+found^M//\n | 432 | /2/040755/0/0/..//\n |
432 | # /12/040755/1002/1002/run//\n | 433 | /11/040700/0/0/lost+found^M//\n |
433 | # /13/040755/1002/1002/sys//\n | 434 | /12/040755/1002/1002/run//\n |
434 | # /14/040755/1002/1002/bin//\n | 435 | /13/040755/1002/1002/sys//\n |
435 | # /80/040755/1002/1002/var//\n | 436 | /14/040755/1002/1002/bin//\n |
436 | # /92/040755/1002/1002/tmp//\n | 437 | /80/040755/1002/1002/var//\n |
437 | # | 438 | /92/040755/1002/1002/tmp//\n |
439 | """ | ||
438 | # NOTE the occasional ^M in file names | 440 | # NOTE the occasional ^M in file names |
439 | return [line.split('/')[5].strip() for line in \ | 441 | return [line.split('/')[5].strip() for line in \ |
440 | debugfs_output.strip().split('/\n')] | 442 | debugfs_output.strip().split('/\n')] |
441 | 443 | ||
442 | # Test partition 1, should contain the normal root directories, except | 444 | # Test partition 1, should contain the normal root directories, except |
443 | # /usr. | 445 | # /usr. |
444 | res = runCmd("debugfs -R 'ls -p' %s 2>/dev/null" % os.path.join(self.resultdir, "selftest_img.part1")) | 446 | res = runCmd("debugfs -R 'ls -p' %s 2>/dev/null" % \ |
447 | os.path.join(self.resultdir, "selftest_img.part1")) | ||
445 | self.assertEqual(0, res.status) | 448 | self.assertEqual(0, res.status) |
446 | files = extract_files(res.output) | 449 | files = extract_files(res.output) |
447 | self.assertIn("etc", files) | 450 | self.assertIn("etc", files) |
@@ -449,7 +452,8 @@ part /etc --source rootfs --ondisk mmcblk0 --fstype=ext4 --exclude-path bin/ --r | |||
449 | 452 | ||
450 | # Partition 2, should contain common directories for /usr, not root | 453 | # Partition 2, should contain common directories for /usr, not root |
451 | # directories. | 454 | # directories. |
452 | res = runCmd("debugfs -R 'ls -p' %s 2>/dev/null" % os.path.join(self.resultdir, "selftest_img.part2")) | 455 | res = runCmd("debugfs -R 'ls -p' %s 2>/dev/null" % \ |
456 | os.path.join(self.resultdir, "selftest_img.part2")) | ||
453 | self.assertEqual(0, res.status) | 457 | self.assertEqual(0, res.status) |
454 | files = extract_files(res.output) | 458 | files = extract_files(res.output) |
455 | self.assertNotIn("etc", files) | 459 | self.assertNotIn("etc", files) |
@@ -458,14 +462,16 @@ part /etc --source rootfs --ondisk mmcblk0 --fstype=ext4 --exclude-path bin/ --r | |||
458 | 462 | ||
459 | # Partition 3, should contain the same as partition 2, including the bin | 463 | # Partition 3, should contain the same as partition 2, including the bin |
460 | # directory, but not the files inside it. | 464 | # directory, but not the files inside it. |
461 | res = runCmd("debugfs -R 'ls -p' %s 2>/dev/null" % os.path.join(self.resultdir, "selftest_img.part3")) | 465 | res = runCmd("debugfs -R 'ls -p' %s 2>/dev/null" % \ |
466 | os.path.join(self.resultdir, "selftest_img.part3")) | ||
462 | self.assertEqual(0, res.status) | 467 | self.assertEqual(0, res.status) |
463 | files = extract_files(res.output) | 468 | files = extract_files(res.output) |
464 | self.assertNotIn("etc", files) | 469 | self.assertNotIn("etc", files) |
465 | self.assertNotIn("usr", files) | 470 | self.assertNotIn("usr", files) |
466 | self.assertIn("share", files) | 471 | self.assertIn("share", files) |
467 | self.assertIn("bin", files) | 472 | self.assertIn("bin", files) |
468 | res = runCmd("debugfs -R 'ls -p bin' %s 2>/dev/null" % os.path.join(self.resultdir, "selftest_img.part3")) | 473 | res = runCmd("debugfs -R 'ls -p bin' %s 2>/dev/null" % \ |
474 | os.path.join(self.resultdir, "selftest_img.part3")) | ||
469 | self.assertEqual(0, res.status) | 475 | self.assertEqual(0, res.status) |
470 | files = extract_files(res.output) | 476 | files = extract_files(res.output) |
471 | self.assertIn(".", files) | 477 | self.assertIn(".", files) |
@@ -483,8 +489,6 @@ part /etc --source rootfs --ondisk mmcblk0 --fstype=ext4 --exclude-path bin/ --r | |||
483 | """Test --exclude-path wks option error handling.""" | 489 | """Test --exclude-path wks option error handling.""" |
484 | wks_file = 'temp.wks' | 490 | wks_file = 'temp.wks' |
485 | 491 | ||
486 | rootfs_dir = get_bb_var('IMAGE_ROOTFS', 'core-image-minimal') | ||
487 | |||
488 | # Absolute argument. | 492 | # Absolute argument. |
489 | with open(wks_file, 'w') as wks: | 493 | with open(wks_file, 'w') as wks: |
490 | wks.write("part / --source rootfs --ondisk mmcblk0 --fstype=ext4 --exclude-path /usr") | 494 | wks.write("part / --source rootfs --ondisk mmcblk0 --fstype=ext4 --exclude-path /usr") |