summaryrefslogtreecommitdiffstats
path: root/meta/lib
diff options
context:
space:
mode:
Diffstat (limited to 'meta/lib')
-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'