Browse Source

selftest: add test for recipes with patches in overrides

devtool doesn't quite behave right when a recipe has patches applied in overrides, so
add a test case to exercise that behaviour.

Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Ross Burton 3 years ago
parent
commit
ad89c3254c

+ 8 - 0
meta-selftest/recipes-test/devtool/devtool-patch-overrides.bb

@@ -0,0 +1,8 @@
+SUMMARY = "devtool test for overrides and patches"
+LICENSE = "CLOSED"
+INHIBIT_DEFAULT_DEPS = "1"
+EXCLUDE_FROM_WORLD = "1"
+
+SRC_URI = "file://source;subdir=${BP}"
+SRC_URI_append_qemuarm = " file://arm.patch;striplevel=0"
+SRC_URI_append_qemux86 = " file://x86.patch;striplevel=0"

+ 5 - 0
meta-selftest/recipes-test/devtool/devtool-patch-overrides/qemuarm/arm.patch

@@ -0,0 +1,5 @@
+--- source.orig	2020-10-06 13:26:10.792688630 +0100
++++ source	2020-10-06 13:26:18.853424694 +0100
+@@ -1 +1 @@
+-This is a test for something
++This is a test for qemuarm

+ 5 - 0
meta-selftest/recipes-test/devtool/devtool-patch-overrides/qemux86/x86.patch

@@ -0,0 +1,5 @@
+--- source.orig	2020-10-06 13:26:10.792688630 +0100
++++ source	2020-10-06 13:26:18.853424694 +0100
+@@ -1 +1 @@
+-This is a test for something
++This is a test for qemux86

+ 1 - 0
meta-selftest/recipes-test/devtool/devtool-patch-overrides/source

@@ -0,0 +1 @@
+This is a test for something

+ 20 - 0
meta/lib/oeqa/selftest/cases/devtool.py

@@ -784,6 +784,26 @@ class DevtoolModifyTests(DevtoolBase):
         self._check_src_repo(tempdir)
         # This is probably sufficient
 
+    def test_devtool_modify_overrides(self):
+        # Try modifying a recipe with patches in overrides
+        tempdir = tempfile.mkdtemp(prefix='devtoolqa')
+        self.track_for_cleanup(tempdir)
+        self.track_for_cleanup(self.workspacedir)
+        self.add_command_to_tearDown('bitbake-layers remove-layer */workspace')
+        result = runCmd('devtool modify devtool-patch-overrides -x %s' % (tempdir))
+
+        self._check_src_repo(tempdir)
+        source = os.path.join(tempdir, "source")
+        def check(branch, expected):
+            runCmd('git -C %s checkout %s' % (tempdir, branch))
+            with open(source, "rt") as f:
+                content = f.read()
+            self.assertEquals(content, expected)
+        check('devtool', 'This is a test for something\n')
+        check('devtool-no-overrides', 'This is a test for something\n')
+        check('devtool-override-qemuarm', 'This is a test for qemuarm\n')
+        check('devtool-override-qemux86', 'This is a test for qemux86\n')
+
 class DevtoolUpdateTests(DevtoolBase):
 
     def test_devtool_update_recipe(self):