diff options
author | Alexander Kanavin <alex.kanavin@gmail.com> | 2019-11-18 19:59:03 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2019-11-21 23:08:20 +0000 |
commit | 7081beeb18cf332cb4297ae73a2c432bc40f8b5d (patch) | |
tree | 4adc6e9fcafd8a766a4ba69501bea1b67d18c1ee /meta | |
parent | 505f7f05a7a66815790182cae48c52d5f72dc100 (diff) | |
download | poky-7081beeb18cf332cb4297ae73a2c432bc40f8b5d.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: a75e4eceb703b2b13ddd4ba3dea3a86af0b0a9eb)
Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r-- | meta/lib/oeqa/selftest/cases/devtool.py | 25 |
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 f4b303bd1c..57e6662e4a 100644 --- a/meta/lib/oeqa/selftest/cases/devtool.py +++ b/meta/lib/oeqa/selftest/cases/devtool.py | |||
@@ -1497,11 +1497,13 @@ class DevtoolUpgradeTests(DevtoolBase): | |||
1497 | recipedir = os.path.dirname(oldrecipefile) | 1497 | recipedir = os.path.dirname(oldrecipefile) |
1498 | olddir = os.path.join(recipedir, recipe + '-' + oldversion) | 1498 | olddir = os.path.join(recipedir, recipe + '-' + oldversion) |
1499 | patchfn = '0001-Add-a-note-line-to-the-quick-reference.patch' | 1499 | patchfn = '0001-Add-a-note-line-to-the-quick-reference.patch' |
1500 | backportedpatchfn = 'backported.patch' | ||
1500 | self.assertExists(os.path.join(olddir, patchfn), 'Original patch file does not exist') | 1501 | self.assertExists(os.path.join(olddir, patchfn), 'Original patch file does not exist') |
1501 | return recipe, oldrecipefile, recipedir, olddir, newversion, patchfn | 1502 | self.assertExists(os.path.join(olddir, backportedpatchfn), 'Backported patch file does not exist') |
1503 | return recipe, oldrecipefile, recipedir, olddir, newversion, patchfn, backportedpatchfn | ||
1502 | 1504 | ||
1503 | def test_devtool_finish_upgrade_origlayer(self): | 1505 | def test_devtool_finish_upgrade_origlayer(self): |
1504 | recipe, oldrecipefile, recipedir, olddir, newversion, patchfn = self._setup_test_devtool_finish_upgrade() | 1506 | recipe, oldrecipefile, recipedir, olddir, newversion, patchfn, backportedpatchfn = self._setup_test_devtool_finish_upgrade() |
1505 | # Ensure the recipe is where we think it should be (so that cleanup doesn't trash things) | 1507 | # Ensure the recipe is where we think it should be (so that cleanup doesn't trash things) |
1506 | self.assertIn('/meta-selftest/', recipedir) | 1508 | self.assertIn('/meta-selftest/', recipedir) |
1507 | # Try finish to the original layer | 1509 | # Try finish to the original layer |
@@ -1512,14 +1514,23 @@ class DevtoolUpgradeTests(DevtoolBase): | |||
1512 | self.assertNotExists(os.path.join(self.workspacedir, 'recipes', recipe), 'Recipe directory should not exist after finish') | 1514 | self.assertNotExists(os.path.join(self.workspacedir, 'recipes', recipe), 'Recipe directory should not exist after finish') |
1513 | self.assertNotExists(oldrecipefile, 'Old recipe file should have been deleted but wasn\'t') | 1515 | self.assertNotExists(oldrecipefile, 'Old recipe file should have been deleted but wasn\'t') |
1514 | self.assertNotExists(os.path.join(olddir, patchfn), 'Old patch file should have been deleted but wasn\'t') | 1516 | self.assertNotExists(os.path.join(olddir, patchfn), 'Old patch file should have been deleted but wasn\'t') |
1517 | self.assertNotExists(os.path.join(olddir, backportedpatchfn), 'Old backported patch file should have been deleted but wasn\'t') | ||
1515 | newrecipefile = os.path.join(recipedir, '%s_%s.bb' % (recipe, newversion)) | 1518 | newrecipefile = os.path.join(recipedir, '%s_%s.bb' % (recipe, newversion)) |
1516 | newdir = os.path.join(recipedir, recipe + '-' + newversion) | 1519 | newdir = os.path.join(recipedir, recipe + '-' + newversion) |
1517 | self.assertExists(newrecipefile, 'New recipe file should have been copied into existing layer but wasn\'t') | 1520 | self.assertExists(newrecipefile, 'New recipe file should have been copied into existing layer but wasn\'t') |
1518 | self.assertExists(os.path.join(newdir, patchfn), 'Patch file should have been copied into new directory but wasn\'t') | 1521 | self.assertExists(os.path.join(newdir, patchfn), 'Patch file should have been copied into new directory but wasn\'t') |
1522 | self.assertNotExists(os.path.join(newdir, backportedpatchfn), 'Backported patch file should not have been copied into new directory but was') | ||
1519 | 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 | self.assertExists(os.path.join(newdir, '0002-Add-a-comment-to-the-code.patch'), 'New patch file should have been created but wasn\'t') |
1524 | with open(newrecipefile, 'r') as f: | ||
1525 | newcontent = f.read() | ||
1526 | self.assertNotIn(backportedpatchfn, newcontent, "Backported patch should have been removed from the recipe but wasn't") | ||
1527 | self.assertIn(patchfn, newcontent, "Old patch should have not been removed from the recipe but was") | ||
1528 | self.assertIn("0002-Add-a-comment-to-the-code.patch", newcontent, "New patch should have been added to the recipe but wasn't") | ||
1529 | self.assertIn("http://www.ivarch.com/programs/sources/pv-${PV}.tar.gz", newcontent, "New recipe no longer has upstream source in SRC_URI") | ||
1530 | |||
1520 | 1531 | ||
1521 | def test_devtool_finish_upgrade_otherlayer(self): | 1532 | def test_devtool_finish_upgrade_otherlayer(self): |
1522 | recipe, oldrecipefile, recipedir, olddir, newversion, patchfn = self._setup_test_devtool_finish_upgrade() | 1533 | recipe, oldrecipefile, recipedir, olddir, newversion, patchfn, backportedpatchfn = self._setup_test_devtool_finish_upgrade() |
1523 | # Ensure the recipe is where we think it should be (so that cleanup doesn't trash things) | 1534 | # Ensure the recipe is where we think it should be (so that cleanup doesn't trash things) |
1524 | self.assertIn('/meta-selftest/', recipedir) | 1535 | self.assertIn('/meta-selftest/', recipedir) |
1525 | # Try finish to a different layer - should create a bbappend | 1536 | # Try finish to a different layer - should create a bbappend |
@@ -1535,10 +1546,18 @@ class DevtoolUpgradeTests(DevtoolBase): | |||
1535 | self.assertNotExists(os.path.join(self.workspacedir, 'recipes', recipe), 'Recipe directory should not exist after finish') | 1546 | self.assertNotExists(os.path.join(self.workspacedir, 'recipes', recipe), 'Recipe directory should not exist after finish') |
1536 | self.assertExists(oldrecipefile, 'Old recipe file should not have been deleted') | 1547 | self.assertExists(oldrecipefile, 'Old recipe file should not have been deleted') |
1537 | self.assertExists(os.path.join(olddir, patchfn), 'Old patch file should not have been deleted') | 1548 | self.assertExists(os.path.join(olddir, patchfn), 'Old patch file should not have been deleted') |
1549 | self.assertExists(os.path.join(olddir, backportedpatchfn), 'Old backported patch file should not have been deleted') | ||
1538 | newdir = os.path.join(newrecipedir, recipe + '-' + newversion) | 1550 | newdir = os.path.join(newrecipedir, recipe + '-' + newversion) |
1539 | self.assertExists(newrecipefile, 'New recipe file should have been copied into existing layer but wasn\'t') | 1551 | self.assertExists(newrecipefile, 'New recipe file should have been copied into existing layer but wasn\'t') |
1540 | self.assertExists(os.path.join(newdir, patchfn), 'Patch file should have been copied into new directory but wasn\'t') | 1552 | self.assertExists(os.path.join(newdir, patchfn), 'Patch file should have been copied into new directory but wasn\'t') |
1553 | self.assertNotExists(os.path.join(newdir, backportedpatchfn), 'Backported patch file should not have been copied into new directory but was') | ||
1541 | 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 | self.assertExists(os.path.join(newdir, '0002-Add-a-comment-to-the-code.patch'), 'New patch file should have been created but wasn\'t') |
1555 | with open(newrecipefile, 'r') as f: | ||
1556 | newcontent = f.read() | ||
1557 | self.assertNotIn(backportedpatchfn, newcontent, "Backported patch should have been removed from the recipe but wasn't") | ||
1558 | self.assertIn(patchfn, newcontent, "Old patch should have not been removed from the recipe but was") | ||
1559 | self.assertIn("0002-Add-a-comment-to-the-code.patch", newcontent, "New patch should have been added to the recipe but wasn't") | ||
1560 | self.assertIn("http://www.ivarch.com/programs/sources/pv-${PV}.tar.gz", newcontent, "New recipe no longer has upstream source in SRC_URI") | ||
1542 | 1561 | ||
1543 | def _setup_test_devtool_finish_modify(self): | 1562 | def _setup_test_devtool_finish_modify(self): |
1544 | # Check preconditions | 1563 | # Check preconditions |