Add test case for bug 486580
authorSebastian Luther <SebastianLuther@gmx.de>
Tue, 26 Nov 2013 09:03:11 +0000 (10:03 +0100)
committerSebastian Luther <SebastianLuther@gmx.de>
Tue, 26 Nov 2013 09:14:54 +0000 (10:14 +0100)
pym/portage/tests/resolver/test_slot_conflict_rebuild.py

index 3cd86bd32135e5913d676d4aadf1532c43ecb3a5..b1fd20889979c5c86cb1ebfae6b695dee2c6b480 100644 (file)
@@ -105,3 +105,78 @@ class SlotConflictRebuildTestCase(TestCase):
                                self.assertEqual(test_case.test_success, True, test_case.fail_msg)
                finally:
                        playground.cleanup()
+
+
+       def testSlotConflictMassRebuild(self):
+               """
+               Bug 486580
+               Before this bug was fixed, emerge would backtrack for each package that needs
+               a rebuild. This could cause it to hit the backtrack limit and not rebuild all
+               needed packages.
+               """
+               ebuilds = {
+
+                       "app-misc/A-1" : {
+                               "EAPI": "5",
+                               "DEPEND": "app-misc/B:=",
+                               "RDEPEND": "app-misc/B:="
+                       },
+
+                       "app-misc/B-1" : {
+                               "EAPI": "5",
+                               "SLOT": "1"
+                       },
+
+                       "app-misc/B-2" : {
+                               "EAPI": "5",
+                               "SLOT": "2/2"
+                       },
+               }
+
+               installed = {
+                       "app-misc/B-1" : {
+                               "EAPI": "5",
+                               "SLOT": "1"
+                       },
+               }
+
+               expected_mergelist = ['app-misc/A-1', 'app-misc/B-2']
+
+               for i in xrange(5):
+                       ebuilds["app-misc/C%sC-1" % i] = {
+                               "EAPI": "5",
+                               "DEPEND": "app-misc/B:=",
+                               "RDEPEND": "app-misc/B:="
+                       }
+
+                       installed["app-misc/C%sC-1" % i] = {
+                               "EAPI": "5",
+                               "DEPEND": "app-misc/B:1/1=",
+                               "RDEPEND": "app-misc/B:1/1="
+                       }
+                       for x in ("DEPEND", "RDEPEND"):
+                               ebuilds["app-misc/A-1"][x] += " app-misc/C%sC" % i
+
+                       expected_mergelist.append("app-misc/C%sC-1" % i)
+
+
+               test_cases = (
+                       ResolverPlaygroundTestCase(
+                               ["app-misc/A"],
+                               ignore_mergelist_order=True,
+                               all_permutations=True,
+                               options = {"--backtrack": 3, '--deep': True},
+                               success = True,
+                               mergelist = expected_mergelist),
+               )
+
+               world = []
+
+               playground = ResolverPlayground(ebuilds=ebuilds,
+                       installed=installed, world=world, debug=True)
+               try:
+                       for test_case in test_cases:
+                               playground.run_TestCase(test_case)
+                               self.assertEqual(test_case.test_success, True, test_case.fail_msg)
+               finally:
+                       playground.cleanup()