diff options
Diffstat (limited to 'bitbake')
-rw-r--r-- | bitbake/lib/bb/tests/fetch.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/bitbake/lib/bb/tests/fetch.py b/bitbake/lib/bb/tests/fetch.py index d6c0af788f..dc45eb2e13 100644 --- a/bitbake/lib/bb/tests/fetch.py +++ b/bitbake/lib/bb/tests/fetch.py | |||
@@ -626,6 +626,9 @@ class FetcherLocalTest(FetcherTest): | |||
626 | os.makedirs(os.path.join(self.localsrcdir, 'dir', 'subdir')) | 626 | os.makedirs(os.path.join(self.localsrcdir, 'dir', 'subdir')) |
627 | touch(os.path.join(self.localsrcdir, 'dir', 'subdir', 'e')) | 627 | touch(os.path.join(self.localsrcdir, 'dir', 'subdir', 'e')) |
628 | touch(os.path.join(self.localsrcdir, r'backslash\x2dsystemd-unit.device')) | 628 | touch(os.path.join(self.localsrcdir, r'backslash\x2dsystemd-unit.device')) |
629 | bb.process.run('tar cf archive.tar -C dir .', cwd=self.localsrcdir) | ||
630 | bb.process.run('tar czf archive.tar.gz -C dir .', cwd=self.localsrcdir) | ||
631 | bb.process.run('tar cjf archive.tar.bz2 -C dir .', cwd=self.localsrcdir) | ||
629 | self.d.setVar("FILESPATH", self.localsrcdir) | 632 | self.d.setVar("FILESPATH", self.localsrcdir) |
630 | 633 | ||
631 | def fetchUnpack(self, uris): | 634 | def fetchUnpack(self, uris): |
@@ -680,6 +683,18 @@ class FetcherLocalTest(FetcherTest): | |||
680 | with self.assertRaises(bb.fetch2.UnpackError): | 683 | with self.assertRaises(bb.fetch2.UnpackError): |
681 | self.fetchUnpack(['file://a;subdir=/bin/sh']) | 684 | self.fetchUnpack(['file://a;subdir=/bin/sh']) |
682 | 685 | ||
686 | def test_local_striplevel(self): | ||
687 | tree = self.fetchUnpack(['file://archive.tar;subdir=bar;striplevel=1']) | ||
688 | self.assertEqual(tree, ['bar/c', 'bar/d', 'bar/subdir/e']) | ||
689 | |||
690 | def test_local_striplevel_gzip(self): | ||
691 | tree = self.fetchUnpack(['file://archive.tar.gz;subdir=bar;striplevel=1']) | ||
692 | self.assertEqual(tree, ['bar/c', 'bar/d', 'bar/subdir/e']) | ||
693 | |||
694 | def test_local_striplevel_bzip2(self): | ||
695 | tree = self.fetchUnpack(['file://archive.tar.bz2;subdir=bar;striplevel=1']) | ||
696 | self.assertEqual(tree, ['bar/c', 'bar/d', 'bar/subdir/e']) | ||
697 | |||
683 | def dummyGitTest(self, suffix): | 698 | def dummyGitTest(self, suffix): |
684 | # Create dummy local Git repo | 699 | # Create dummy local Git repo |
685 | src_dir = tempfile.mkdtemp(dir=self.tempdir, | 700 | src_dir = tempfile.mkdtemp(dir=self.tempdir, |