summaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa
diff options
context:
space:
mode:
authorAlexander Kanavin <alex.kanavin@gmail.com>2019-11-23 08:18:44 -0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-11-25 21:34:50 +0000
commitc84b0dbcd8a36a216a5c7719b462f4d813baa6bc (patch)
tree5442f8fecb5189bab982df9c85b4ef0e87864252 /meta/lib/oeqa
parent67e155c209050acbbe3e263de394e686ad0ebad2 (diff)
downloadpoky-c84b0dbcd8a36a216a5c7719b462f4d813baa6bc.tar.gz
selftest: check that 'devtool upgrade' correctly drops backported patches
There was a regression in this functionality that went unnoticed due to lack of tests. (From OE-Core rev: da4c28d5fdc6501a7d3b256cb62cba778e81d16e) Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> Signed-off-by: Armin Kuster <akuster808@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oeqa')
-rw-r--r--meta/lib/oeqa/selftest/cases/devtool.py25
1 files changed, 22 insertions, 3 deletions
diff --git a/meta/lib/oeqa/selftest/cases/devtool.py b/meta/lib/oeqa/selftest/cases/devtool.py
index 3a25da2033..21e6002f06 100644
--- a/meta/lib/oeqa/selftest/cases/devtool.py
+++ b/meta/lib/oeqa/selftest/cases/devtool.py
@@ -1496,11 +1496,13 @@ class DevtoolUpgradeTests(DevtoolBase):
1496 recipedir = os.path.dirname(oldrecipefile) 1496 recipedir = os.path.dirname(oldrecipefile)
1497 olddir = os.path.join(recipedir, recipe + '-' + oldversion) 1497 olddir = os.path.join(recipedir, recipe + '-' + oldversion)
1498 patchfn = '0001-Add-a-note-line-to-the-quick-reference.patch' 1498 patchfn = '0001-Add-a-note-line-to-the-quick-reference.patch'
1499 backportedpatchfn = 'backported.patch'
1499 self.assertExists(os.path.join(olddir, patchfn), 'Original patch file does not exist') 1500 self.assertExists(os.path.join(olddir, patchfn), 'Original patch file does not exist')
1500 return recipe, oldrecipefile, recipedir, olddir, newversion, patchfn 1501 self.assertExists(os.path.join(olddir, backportedpatchfn), 'Backported patch file does not exist')
1502 return recipe, oldrecipefile, recipedir, olddir, newversion, patchfn, backportedpatchfn
1501 1503
1502 def test_devtool_finish_upgrade_origlayer(self): 1504 def test_devtool_finish_upgrade_origlayer(self):
1503 recipe, oldrecipefile, recipedir, olddir, newversion, patchfn = self._setup_test_devtool_finish_upgrade() 1505 recipe, oldrecipefile, recipedir, olddir, newversion, patchfn, backportedpatchfn = self._setup_test_devtool_finish_upgrade()
1504 # Ensure the recipe is where we think it should be (so that cleanup doesn't trash things) 1506 # Ensure the recipe is where we think it should be (so that cleanup doesn't trash things)
1505 self.assertIn('/meta-selftest/', recipedir) 1507 self.assertIn('/meta-selftest/', recipedir)
1506 # Try finish to the original layer 1508 # Try finish to the original layer
@@ -1511,14 +1513,23 @@ class DevtoolUpgradeTests(DevtoolBase):
1511 self.assertNotExists(os.path.join(self.workspacedir, 'recipes', recipe), 'Recipe directory should not exist after finish') 1513 self.assertNotExists(os.path.join(self.workspacedir, 'recipes', recipe), 'Recipe directory should not exist after finish')
1512 self.assertNotExists(oldrecipefile, 'Old recipe file should have been deleted but wasn\'t') 1514 self.assertNotExists(oldrecipefile, 'Old recipe file should have been deleted but wasn\'t')
1513 self.assertNotExists(os.path.join(olddir, patchfn), 'Old patch file should have been deleted but wasn\'t') 1515 self.assertNotExists(os.path.join(olddir, patchfn), 'Old patch file should have been deleted but wasn\'t')
1516 self.assertNotExists(os.path.join(olddir, backportedpatchfn), 'Old backported patch file should have been deleted but wasn\'t')
1514 newrecipefile = os.path.join(recipedir, '%s_%s.bb' % (recipe, newversion)) 1517 newrecipefile = os.path.join(recipedir, '%s_%s.bb' % (recipe, newversion))
1515 newdir = os.path.join(recipedir, recipe + '-' + newversion) 1518 newdir = os.path.join(recipedir, recipe + '-' + newversion)
1516 self.assertExists(newrecipefile, 'New recipe file should have been copied into existing layer but wasn\'t') 1519 self.assertExists(newrecipefile, 'New recipe file should have been copied into existing layer but wasn\'t')
1517 self.assertExists(os.path.join(newdir, patchfn), 'Patch file should have been copied into new directory but wasn\'t') 1520 self.assertExists(os.path.join(newdir, patchfn), 'Patch file should have been copied into new directory but wasn\'t')
1521 self.assertNotExists(os.path.join(newdir, backportedpatchfn), 'Backported patch file should not have been copied into new directory but was')
1518 self.assertExists(os.path.join(newdir, '0002-Add-a-comment-to-the-code.patch'), 'New patch file should have been created but wasn\'t') 1522 self.assertExists(os.path.join(newdir, '0002-Add-a-comment-to-the-code.patch'), 'New patch file should have been created but wasn\'t')
1523 with open(newrecipefile, 'r') as f:
1524 newcontent = f.read()
1525 self.assertNotIn(backportedpatchfn, newcontent, "Backported patch should have been removed from the recipe but wasn't")
1526 self.assertIn(patchfn, newcontent, "Old patch should have not been removed from the recipe but was")
1527 self.assertIn("0002-Add-a-comment-to-the-code.patch", newcontent, "New patch should have been added to the recipe but wasn't")
1528 self.assertIn("http://www.ivarch.com/programs/sources/pv-${PV}.tar.gz", newcontent, "New recipe no longer has upstream source in SRC_URI")
1529
1519 1530
1520 def test_devtool_finish_upgrade_otherlayer(self): 1531 def test_devtool_finish_upgrade_otherlayer(self):
1521 recipe, oldrecipefile, recipedir, olddir, newversion, patchfn = self._setup_test_devtool_finish_upgrade() 1532 recipe, oldrecipefile, recipedir, olddir, newversion, patchfn, backportedpatchfn = self._setup_test_devtool_finish_upgrade()
1522 # Ensure the recipe is where we think it should be (so that cleanup doesn't trash things) 1533 # Ensure the recipe is where we think it should be (so that cleanup doesn't trash things)
1523 self.assertIn('/meta-selftest/', recipedir) 1534 self.assertIn('/meta-selftest/', recipedir)
1524 # Try finish to a different layer - should create a bbappend 1535 # Try finish to a different layer - should create a bbappend
@@ -1534,10 +1545,18 @@ class DevtoolUpgradeTests(DevtoolBase):
1534 self.assertNotExists(os.path.join(self.workspacedir, 'recipes', recipe), 'Recipe directory should not exist after finish') 1545 self.assertNotExists(os.path.join(self.workspacedir, 'recipes', recipe), 'Recipe directory should not exist after finish')
1535 self.assertExists(oldrecipefile, 'Old recipe file should not have been deleted') 1546 self.assertExists(oldrecipefile, 'Old recipe file should not have been deleted')
1536 self.assertExists(os.path.join(olddir, patchfn), 'Old patch file should not have been deleted') 1547 self.assertExists(os.path.join(olddir, patchfn), 'Old patch file should not have been deleted')
1548 self.assertExists(os.path.join(olddir, backportedpatchfn), 'Old backported patch file should not have been deleted')
1537 newdir = os.path.join(newrecipedir, recipe + '-' + newversion) 1549 newdir = os.path.join(newrecipedir, recipe + '-' + newversion)
1538 self.assertExists(newrecipefile, 'New recipe file should have been copied into existing layer but wasn\'t') 1550 self.assertExists(newrecipefile, 'New recipe file should have been copied into existing layer but wasn\'t')
1539 self.assertExists(os.path.join(newdir, patchfn), 'Patch file should have been copied into new directory but wasn\'t') 1551 self.assertExists(os.path.join(newdir, patchfn), 'Patch file should have been copied into new directory but wasn\'t')
1552 self.assertNotExists(os.path.join(newdir, backportedpatchfn), 'Backported patch file should not have been copied into new directory but was')
1540 self.assertExists(os.path.join(newdir, '0002-Add-a-comment-to-the-code.patch'), 'New patch file should have been created but wasn\'t') 1553 self.assertExists(os.path.join(newdir, '0002-Add-a-comment-to-the-code.patch'), 'New patch file should have been created but wasn\'t')
1554 with open(newrecipefile, 'r') as f:
1555 newcontent = f.read()
1556 self.assertNotIn(backportedpatchfn, newcontent, "Backported patch should have been removed from the recipe but wasn't")
1557 self.assertIn(patchfn, newcontent, "Old patch should have not been removed from the recipe but was")
1558 self.assertIn("0002-Add-a-comment-to-the-code.patch", newcontent, "New patch should have been added to the recipe but wasn't")
1559 self.assertIn("http://www.ivarch.com/programs/sources/pv-${PV}.tar.gz", newcontent, "New recipe no longer has upstream source in SRC_URI")
1541 1560
1542 def _setup_test_devtool_finish_modify(self): 1561 def _setup_test_devtool_finish_modify(self):
1543 # Check preconditions 1562 # Check preconditions