commit:     4e83e35467741535463c2f9284dcf21ab4229391
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sat Dec 21 22:55:34 2019 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sat Dec 21 23:54:15 2019 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=4e83e354

test_circular_choices: add cases for bug 703440

The testCircularJsoncppCmakeBootstrapOrDeps method fails due to circular
dependencies triggered when it ignores cmake-bootstrap in order to
eliminate redundant packages.

Meanwhile, the testVirtualCmakeBootstrapUseConditional method solves the
problem by using a dependency conditional on the bootstrap USE flag.

Bug: https://bugs.gentoo.org/703440
Signed-off-by: Zac Medico <zmedico <AT> gentoo.org>

 .../tests/resolver/test_circular_choices.py        | 75 ++++++++++++++++++++++
 1 file changed, 75 insertions(+)

diff --git a/lib/portage/tests/resolver/test_circular_choices.py 
b/lib/portage/tests/resolver/test_circular_choices.py
index 418173689..366f2bc27 100644
--- a/lib/portage/tests/resolver/test_circular_choices.py
+++ b/lib/portage/tests/resolver/test_circular_choices.py
@@ -5,6 +5,81 @@ from portage.tests import TestCase
 from portage.tests.resolver.ResolverPlayground import (ResolverPlayground,
        ResolverPlaygroundTestCase)
 
+class CircularJsoncppCmakeBootstrapTestCase(TestCase):
+
+       def testCircularJsoncppCmakeBootstrapOrDeps(self):
+
+               ebuilds = {
+                       'dev-libs/jsoncpp-1.9.2': {
+                               'EAPI': '7',
+                               'BDEPEND': '|| ( dev-util/cmake-bootstrap 
dev-util/cmake )'
+                       },
+                       'dev-util/cmake-bootstrap-3.16.2': {
+                               'EAPI': '7',
+                       },
+                       'dev-util/cmake-3.16.2': {
+                               'EAPI': '7',
+                               'BDEPEND': '>=dev-libs/jsoncpp-0.6.0_rc2:0=',
+                       },
+               }
+
+               test_cases = (
+                       # Demonstrate bug 703440. It ignores cmake-bootstrap in 
order to eliminate redundant packages.
+                       #
+                       #  * Error: circular dependencies:
+                       #
+                       # (dev-libs/jsoncpp-1.9.2:0/0::test_repo, ebuild 
scheduled for merge) depends on
+                       #  (dev-util/cmake-3.16.2:0/0::test_repo, ebuild 
scheduled for merge) (buildtime)
+                       #    (dev-libs/jsoncpp-1.9.2:0/0::test_repo, ebuild 
scheduled for merge) (buildtime_slot_op)
+                       ResolverPlaygroundTestCase(
+                               ['dev-util/cmake'],
+                               circular_dependency_solutions = {},
+                               success = False,
+                       ),
+               )
+
+               playground = ResolverPlayground(ebuilds=ebuilds)
+               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()
+
+       def testVirtualCmakeBootstrapUseConditional(self):
+
+               ebuilds = {
+                       'dev-libs/jsoncpp-1.9.2': {
+                               'EAPI': '7',
+                               'IUSE': '+bootstrap',
+                               'BDEPEND': 'bootstrap? ( 
dev-util/cmake-bootstrap ) !bootstrap? ( dev-util/cmake )'
+                       },
+                       'dev-util/cmake-bootstrap-3.16.2': {
+                               'EAPI': '7',
+                       },
+                       'dev-util/cmake-3.16.2': {
+                               'EAPI': '7',
+                               'BDEPEND': '>=dev-libs/jsoncpp-0.6.0_rc2:0=',
+                       },
+               }
+
+               test_cases = (
+                       # Solve bug 703440 with a dependency conditional on the 
bootstrap USE flag.
+                       ResolverPlaygroundTestCase(
+                               ['dev-util/cmake'],
+                               mergelist = ['dev-util/cmake-bootstrap-3.16.2', 
'dev-libs/jsoncpp-1.9.2', 'dev-util/cmake-3.16.2'],
+                               success = True,
+                       ),
+               )
+
+               playground = ResolverPlayground(ebuilds=ebuilds)
+               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()
+
 class CircularChoicesTestCase(TestCase):
 
        def testDirectCircularDependency(self):

Reply via email to