summaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa
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 14:00:50 +0100
commit01619c9acbf8ac5c66817a5cdfe9a8819891989b (patch)
tree78512bc0b1275ba215fe1eca995d71615dd7a71d /meta/lib/oeqa
parent31b14186e90d8ce28ce0b088dbafc637a902db97 (diff)
downloadpoky-01619c9acbf8ac5c66817a5cdfe9a8819891989b.tar.gz
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>
Diffstat (limited to 'meta/lib/oeqa')
-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 41cf23f778..c8765e5330 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"""
486 res = runCmd("debugfs -R 'ls -p' %s 2>/dev/null" % (part1)) 486 res = runCmd("debugfs -R 'ls -p' %s 2>/dev/null" % (part1))
487 files = extract_files(res.output) 487 files = extract_files(res.output)
488 self.assertNotIn('test-file', files) 488 self.assertNotIn('test-file', files)
489 self.assertEqual(True, files_own_by_root(res.output))
489 490
490 # Test partition 2, should not contain 'test-file' 491 # Test partition 2, should contain 'test-file'
491 res = runCmd("debugfs -R 'ls -p' %s 2>/dev/null" % (part2)) 492 res = runCmd("debugfs -R 'ls -p' %s 2>/dev/null" % (part2))
492 files = extract_files(res.output) 493 files = extract_files(res.output)
493 self.assertIn('test-file', files) 494 self.assertIn('test-file', files)
495 self.assertEqual(True, files_own_by_root(res.output))
494 496
495 finally: 497 finally:
496 os.environ['PATH'] = oldpath 498 os.environ['PATH'] = oldpath
497 499
500 def test_include_path_embeded(self):
501 """Test --include-path wks option."""
502
503 oldpath = os.environ['PATH']
504 os.environ['PATH'] = get_bb_var("PATH", "wic-tools")
505
506 try:
507 include_path = os.path.join(self.resultdir, 'test-include')
508 os.makedirs(include_path)
509 with open(os.path.join(include_path, 'test-file'), 'w') as t:
510 t.write("test\n")
511 wks_file = os.path.join(include_path, 'temp.wks')
512 with open(wks_file, 'w') as wks:
513 wks.write("""
514part / --source rootfs --fstype=ext4 --include-path %s --include-path core-image-minimal-mtdutils export/"""
515 % (include_path))
516 runCmd("wic create %s -e core-image-minimal -o %s" \
517 % (wks_file, self.resultdir))
518
519 part1 = glob(os.path.join(self.resultdir, 'temp-*.direct.p1'))[0]
520
521 res = runCmd("debugfs -R 'ls -p' %s 2>/dev/null" % (part1))
522 files = extract_files(res.output)
523 self.assertIn('test-file', files)
524 self.assertEqual(True, files_own_by_root(res.output))
525
526 res = runCmd("debugfs -R 'ls -p /export/etc/' %s 2>/dev/null" % (part1))
527 files = extract_files(res.output)
528 self.assertIn('passwd', files)
529 self.assertEqual(True, files_own_by_root(res.output))
530
531 finally:
532 os.environ['PATH'] = oldpath
533
534 def test_include_path_errors(self):
535 """Test --include-path wks option error handling."""
536 wks_file = 'temp.wks'
537
538 # Absolute argument.
539 with open(wks_file, 'w') as wks:
540 wks.write("part / --source rootfs --fstype=ext4 --include-path core-image-minimal-mtdutils /export")
541 self.assertNotEqual(0, runCmd("wic create %s -e core-image-minimal -o %s" \
542 % (wks_file, self.resultdir), ignore_status=True).status)
543 os.remove(wks_file)
544
545 # Argument pointing to parent directory.
546 with open(wks_file, 'w') as wks:
547 wks.write("part / --source rootfs --fstype=ext4 --include-path core-image-minimal-mtdutils ././..")
548 self.assertNotEqual(0, runCmd("wic create %s -e core-image-minimal -o %s" \
549 % (wks_file, self.resultdir), ignore_status=True).status)
550 os.remove(wks_file)
551
552 # 3 Argument pointing to parent directory.
553 with open(wks_file, 'w') as wks:
554 wks.write("part / --source rootfs --fstype=ext4 --include-path core-image-minimal-mtdutils export/ dummy")
555 self.assertNotEqual(0, runCmd("wic create %s -e core-image-minimal -o %s" \
556 % (wks_file, self.resultdir), ignore_status=True).status)
557 os.remove(wks_file)
558
498 def test_exclude_path_errors(self): 559 def test_exclude_path_errors(self):
499 """Test --exclude-path wks option error handling.""" 560 """Test --exclude-path wks option error handling."""
500 wks_file = 'temp.wks' 561 wks_file = 'temp.wks'