aboutsummaryrefslogtreecommitdiff
blob: a45ebccc949ac38f3965fea4d5c46335f317b2a7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# Copyright 2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

from portage.tests import TestCase
from portage.tests.resolver.ResolverPlayground import (
    ResolverPlayground,
    ResolverPlaygroundTestCase,
)


class BacktrackMissedUpdateTestCase(TestCase):
    def testBacktrackMissedUpdateTestCase(self):
        ebuilds = {
            "dev-lang/python-2.7.18-r2": {
                "EAPI": "7",
                "SLOT": "2.7",
            },
            "dev-python/pypy3-7.3.2_rc2_p37-r1": {
                "EAPI": "7",
                "SLOT": "0/pypy37-pp73",
            },
            "dev-python/pypy3-7.3.1-r3": {
                "EAPI": "7",
                "SLOT": "0/pypy36-pp73",
            },
            "dev-python/setuptools-50.3.0": {
                "EAPI": "7",
                "IUSE": "python_targets_pypy3",
                "RDEPEND": "python_targets_pypy3? ( dev-python/pypy3:= )",
            },
            "dev-python/setuptools-50.2.0": {
                "EAPI": "7",
                "IUSE": "python_targets_pypy3",
                "RDEPEND": "python_targets_pypy3? ( dev-python/pypy3:= )",
            },
            "dev-python/setuptools-50.1.0": {
                "EAPI": "7",
                "IUSE": "python_targets_pypy3",
                "RDEPEND": "python_targets_pypy3? ( dev-python/pypy3:= )",
            },
            "dev-python/setuptools-49.6.0": {
                "EAPI": "7",
                "IUSE": "python_targets_pypy3",
                "RDEPEND": "python_targets_pypy3? ( dev-python/pypy3:= )",
            },
            "dev-python/setuptools-46.4.0-r2": {
                "EAPI": "7",
                "IUSE": "+python_targets_pypy3 +python_targets_python2_7",
                "RDEPEND": "python_targets_pypy3? ( dev-python/pypy3:= )",
            },
            "dev-lang/python-2.7.18-r2": {
                "EAPI": "7",
                "IUSE": "+python_targets_pypy3 +python_targets_python2_7",
                "RDEPEND": "python_targets_pypy3? ( dev-python/pypy3:= )",
            },
            "dev-vcs/mercurial-5.5.1": {
                "EAPI": "7",
                "IUSE": "+python_targets_pypy3 +python_targets_python2_7",
                "RDEPEND": "dev-python/setuptools[python_targets_pypy3?,python_targets_python2_7?] python_targets_python2_7? ( dev-lang/python:2.7 ) python_targets_pypy3? ( dev-python/pypy3:= )",
            },
        }

        installed = {
            "dev-lang/python-2.7.18-r2": {
                "EAPI": "7",
                "SLOT": "2.7",
            },
            "dev-python/pypy3-7.3.1-r3": {
                "EAPI": "7",
                "SLOT": "0/pypy36-pp73",
            },
            "dev-python/setuptools-46.4.0-r2": {
                "EAPI": "7",
                "IUSE": "+python_targets_pypy3 +python_targets_python2_7",
                "USE": "python_targets_pypy3 python_targets_python2_7",
                "RDEPEND": "dev-python/pypy3:0/pypy36-pp73=",
            },
            "dev-vcs/mercurial-5.5.1": {
                "EAPI": "7",
                "IUSE": "+python_targets_pypy3 +python_targets_python2_7",
                "USE": "python_targets_pypy3 python_targets_python2_7",
                "RDEPEND": "dev-python/setuptools[python_targets_pypy3,python_targets_python2_7] dev-python/pypy3:0/pypy36-pp73=",
            },
        }

        world = ["dev-vcs/mercurial"]

        test_cases = (
            # Bug 743115: missed updates trigger excessive backtracking
            ResolverPlaygroundTestCase(
                [">=dev-python/pypy3-7.3.2_rc", "@world"],
                options={"--update": True, "--deep": True, "--backtrack": 4},
                success=True,
                mergelist=[
                    "dev-python/pypy3-7.3.2_rc2_p37-r1",
                    "dev-python/setuptools-46.4.0-r2",
                    "dev-vcs/mercurial-5.5.1",
                ],
            ),
        )

        playground = ResolverPlayground(
            ebuilds=ebuilds, installed=installed, world=world, debug=False
        )
        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.debug = False
            playground.cleanup()