From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1QNjSM-00083A-OE for garchives@archives.gentoo.org; Sat, 21 May 2011 10:30:51 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 403D51C02E; Sat, 21 May 2011 10:30:43 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 02C9B1C02E for ; Sat, 21 May 2011 10:30:42 +0000 (UTC) Received: from pelican.gentoo.org (unknown [66.219.59.40]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 6FAA21B4016 for ; Sat, 21 May 2011 10:30:42 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id 9E9368001F for ; Sat, 21 May 2011 10:30:41 +0000 (UTC) From: "Zac Medico" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Zac Medico" Message-ID: Subject: [gentoo-commits] proj/portage:master commit in: pym/portage/tests/resolver/ X-VCS-Repository: proj/portage X-VCS-Files: pym/portage/tests/resolver/ResolverPlayground.py pym/portage/tests/resolver/test_merge_order.py X-VCS-Directories: pym/portage/tests/resolver/ X-VCS-Committer: zmedico X-VCS-Committer-Name: Zac Medico X-VCS-Revision: ffd08be66d09bf98b25957ac8b99d414f4549d17 Date: Sat, 21 May 2011 10:30:41 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: X-Archives-Hash: 456f508953a7ddb496d278a7a6ebcccf commit: ffd08be66d09bf98b25957ac8b99d414f4549d17 Author: Zac Medico gentoo org> AuthorDate: Sat May 21 10:30:05 2011 +0000 Commit: Zac Medico gentoo org> CommitDate: Sat May 21 10:30:05 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/portage.git;a= =3Dcommit;h=3Dffd08be6 test_merge_order: test satisfied circular DEPEND --- pym/portage/tests/resolver/ResolverPlayground.py | 13 ++++++- pym/portage/tests/resolver/test_merge_order.py | 43 ++++++++++++++++= ++++++ 2 files changed, 55 insertions(+), 1 deletions(-) diff --git a/pym/portage/tests/resolver/ResolverPlayground.py b/pym/porta= ge/tests/resolver/ResolverPlayground.py index 2fc37dc..dd3a944 100644 --- a/pym/portage/tests/resolver/ResolverPlayground.py +++ b/pym/portage/tests/resolver/ResolverPlayground.py @@ -476,6 +476,7 @@ class ResolverPlaygroundTestCase(object): self.ignore_mergelist_order =3D kwargs.pop("ignore_mergelist_order", F= alse) self.ambigous_merge_order =3D kwargs.pop("ambigous_merge_order", False= ) self.check_repo_names =3D kwargs.pop("check_repo_names", False) + self.merge_order_assertions =3D kwargs.pop("merge_order_assertions", F= alse) =20 if self.all_permutations: self.requests =3D list(permutations(request)) @@ -538,6 +539,7 @@ class ResolverPlaygroundTestCase(object): expected_stack =3D list(reversed(expected)) got_stack =3D list(reversed(got)) new_expected =3D [] + match =3D True while got_stack and expected_stack: got_token =3D got_stack.pop() expected_obj =3D expected_stack.pop() @@ -554,7 +556,6 @@ class ResolverPlaygroundTestCase(object): # result doesn't match, so stop early break new_expected.append(got_token) - match =3D True while got_stack and expected_obj: got_token =3D got_stack.pop() try: @@ -568,14 +569,24 @@ class ResolverPlaygroundTestCase(object): break if expected_obj: # result does not match, so stop early + match =3D False new_expected.append(tuple(expected_obj)) break if expected_stack: # result does not match, add leftovers to new_expected + match =3D False expected_stack.reverse() new_expected.extend(expected_stack) expected =3D new_expected =20 + if match and self.merge_order_assertions: + for node1, node2 in self.merge_order_assertions: + if not (got.index(node1) < got.index(node2)): + fail_msgs.append("atoms: (" + \ + ", ".join(result.atoms) + "), key: " + \ + ("merge_order_assertions, expected: %s" % \ + (node1, node2)) + ", got: " + str(got)) + elif key in ("unstable_keywords", "needed_p_mask_changes") and expect= ed is not None: expected =3D set(expected) =20 diff --git a/pym/portage/tests/resolver/test_merge_order.py b/pym/portage= /tests/resolver/test_merge_order.py index be41f82..62d16d9 100644 --- a/pym/portage/tests/resolver/test_merge_order.py +++ b/pym/portage/tests/resolver/test_merge_order.py @@ -56,6 +56,26 @@ class MergeOrderTestCase(TestCase): "app-misc/circ-runtime-c-1": { "RDEPEND": "app-misc/circ-runtime-a", }, + "app-misc/circ-satisfied-a-0": { + "RDEPEND": "app-misc/circ-satisfied-b", + }, + "app-misc/circ-satisfied-a-1": { + "RDEPEND": "app-misc/circ-satisfied-b", + }, + "app-misc/circ-satisfied-b-0": { + "RDEPEND": "app-misc/circ-satisfied-c", + }, + "app-misc/circ-satisfied-b-1": { + "RDEPEND": "app-misc/circ-satisfied-c", + }, + "app-misc/circ-satisfied-c-0": { + "DEPEND": "app-misc/circ-satisfied-a", + "RDEPEND": "app-misc/circ-satisfied-a", + }, + "app-misc/circ-satisfied-c-1": { + "DEPEND": "app-misc/circ-satisfied-a", + "RDEPEND": "app-misc/circ-satisfied-a", + }, "app-misc/installed-blocker-a-1" : { "EAPI" : "2", "DEPEND" : "!app-misc/blocker-buildtime-a", @@ -74,6 +94,16 @@ class MergeOrderTestCase(TestCase): =20 installed =3D { "app-misc/circ-buildtime-a-0": {}, + "app-misc/circ-satisfied-a-0": { + "RDEPEND": "app-misc/circ-satisfied-b", + }, + "app-misc/circ-satisfied-b-0": { + "RDEPEND": "app-misc/circ-satisfied-c", + }, + "app-misc/circ-satisfied-c-0": { + "DEPEND": "app-misc/circ-satisfied-a", + "RDEPEND": "app-misc/circ-satisfied-a", + }, "app-misc/installed-blocker-a-1" : { "EAPI" : "2", "DEPEND" : "!app-misc/blocker-buildtime-a", @@ -114,6 +144,19 @@ class MergeOrderTestCase(TestCase): success =3D True, ambigous_merge_order =3D True, mergelist =3D ["app-misc/circ-post-runtime-a-1", ("app-misc/circ-pos= t-runtime-b-1", "app-misc/circ-post-runtime-c-1"), "app-misc/some-app-b-1= "]), + # Test optimal merge order for a circular dep that is + # RDEPEND in one direction and DEPEND in the other, + # with all dependencies initially satisfied. Optimally, + # the DEPEND/buildtime dep should be updated before the + # package that depends on it, even though it's feasible + # to update it later since it is already satisfied. + ResolverPlaygroundTestCase( + ["app-misc/circ-satisfied-a", "app-misc/circ-satisfied-b", "app-misc= /circ-satisfied-c"], + success =3D True, + all_permutations =3D True, + ambigous_merge_order =3D True, + merge_order_assertions =3D (("app-misc/circ-satisfied-a-1", "app-mis= c/circ-satisfied-c-1"),), + mergelist =3D [("app-misc/circ-satisfied-a-1", "app-misc/circ-satisf= ied-b-1", "app-misc/circ-satisfied-c-1")]), # installed package has buildtime-only blocker # that should be ignored ResolverPlaygroundTestCase(