summaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa/selftest/devtool.py
diff options
context:
space:
mode:
Diffstat (limited to 'meta/lib/oeqa/selftest/devtool.py')
-rw-r--r--meta/lib/oeqa/selftest/devtool.py71
1 files changed, 71 insertions, 0 deletions
diff --git a/meta/lib/oeqa/selftest/devtool.py b/meta/lib/oeqa/selftest/devtool.py
index 92cd0e230d..baa56d6dc1 100644
--- a/meta/lib/oeqa/selftest/devtool.py
+++ b/meta/lib/oeqa/selftest/devtool.py
@@ -723,6 +723,77 @@ class DevtoolTests(DevtoolBase):
723 self.assertEqual(expectedlines, f.readlines()) 723 self.assertEqual(expectedlines, f.readlines())
724 # Deleting isn't expected to work under these circumstances 724 # Deleting isn't expected to work under these circumstances
725 725
726 @testcase(1173)
727 def test_devtool_update_recipe_local_files(self):
728 """Check that local source files are copied over instead of patched"""
729 testrecipe = 'makedevs'
730 recipefile = get_bb_var('FILE', testrecipe)
731 # Setup srctree for modifying the recipe
732 tempdir = tempfile.mkdtemp(prefix='devtoolqa')
733 self.track_for_cleanup(tempdir)
734 self.track_for_cleanup(self.workspacedir)
735 self.add_command_to_tearDown('bitbake-layers remove-layer */workspace')
736 # (don't bother with cleaning the recipe on teardown, we won't be
737 # building it)
738 result = runCmd('devtool modify %s -x %s' % (testrecipe, tempdir))
739 # Check git repo
740 self._check_src_repo(tempdir)
741 # Edit / commit local source
742 runCmd('echo "/* Foobar */" >> oe-local-files/makedevs.c', cwd=tempdir)
743 runCmd('echo "Foo" > oe-local-files/new-local', cwd=tempdir)
744 runCmd('echo "Bar" > new-file', cwd=tempdir)
745 runCmd('git add new-file', cwd=tempdir)
746 runCmd('git commit -m "Add new file"', cwd=tempdir)
747 self.add_command_to_tearDown('cd %s; git clean -fd .; git checkout .' %
748 os.path.dirname(recipefile))
749 runCmd('devtool update-recipe %s' % testrecipe)
750 expected_status = [(' M', '.*/%s$' % os.path.basename(recipefile)),
751 (' M', '.*/makedevs/makedevs.c$'),
752 ('??', '.*/makedevs/new-local$'),
753 ('??', '.*/makedevs/0001-Add-new-file.patch$')]
754 self._check_repo_status(os.path.dirname(recipefile), expected_status)
755
756 @testcase(1174)
757 def test_devtool_update_recipe_local_files_2(self):
758 """Check local source files support when oe-local-files is in Git"""
759 testrecipe = 'lzo'
760 recipefile = get_bb_var('FILE', testrecipe)
761 # Setup srctree for modifying the recipe
762 tempdir = tempfile.mkdtemp(prefix='devtoolqa')
763 self.track_for_cleanup(tempdir)
764 self.track_for_cleanup(self.workspacedir)
765 self.add_command_to_tearDown('bitbake-layers remove-layer */workspace')
766 result = runCmd('devtool modify %s -x %s' % (testrecipe, tempdir))
767 # Check git repo
768 self._check_src_repo(tempdir)
769 # Add oe-local-files to Git
770 runCmd('rm oe-local-files/.gitignore', cwd=tempdir)
771 runCmd('git add oe-local-files', cwd=tempdir)
772 runCmd('git commit -m "Add local sources"', cwd=tempdir)
773 # Edit / commit local sources
774 runCmd('echo "# Foobar" >> oe-local-files/acinclude.m4', cwd=tempdir)
775 runCmd('git commit -am "Edit existing file"', cwd=tempdir)
776 runCmd('git rm oe-local-files/run-ptest', cwd=tempdir)
777 runCmd('git commit -m"Remove file"', cwd=tempdir)
778 runCmd('echo "Foo" > oe-local-files/new-local', cwd=tempdir)
779 runCmd('git add oe-local-files/new-local', cwd=tempdir)
780 runCmd('git commit -m "Add new local file"', cwd=tempdir)
781 runCmd('echo "Gar" > new-file', cwd=tempdir)
782 runCmd('git add new-file', cwd=tempdir)
783 runCmd('git commit -m "Add new file"', cwd=tempdir)
784 self.add_command_to_tearDown('cd %s; git clean -fd .; git checkout .' %
785 os.path.dirname(recipefile))
786 # Checkout unmodified file to working copy -> devtool should still pick
787 # the modified version from HEAD
788 runCmd('git checkout HEAD^ -- oe-local-files/acinclude.m4', cwd=tempdir)
789 runCmd('devtool update-recipe %s' % testrecipe)
790 expected_status = [(' M', '.*/%s$' % os.path.basename(recipefile)),
791 (' M', '.*/acinclude.m4$'),
792 (' D', '.*/run-ptest$'),
793 ('??', '.*/new-local$'),
794 ('??', '.*/0001-Add-new-file.patch$')]
795 self._check_repo_status(os.path.dirname(recipefile), expected_status)
796
726 @testcase(1163) 797 @testcase(1163)
727 def test_devtool_extract(self): 798 def test_devtool_extract(self):
728 tempdir = tempfile.mkdtemp(prefix='devtoolqa') 799 tempdir = tempfile.mkdtemp(prefix='devtoolqa')