aboutsummaryrefslogtreecommitdiff
blob: 438d9cbfceeb47ccb666d5659477a514d7208df8 (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
# Copyright 2016 Gentoo Foundation
# 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 RuntimeCycleMergeOrderTestCase(TestCase):

	def testRuntimeCycleMergeOrder(self):
		ebuilds = {
			'app-misc/plugins-consumer-1' : {
				'EAPI': '6',
				'DEPEND' : 'app-misc/plugin-b:=',
				'RDEPEND' : 'app-misc/plugin-b:=',
			},
			'app-misc/plugin-b-1' : {
				'EAPI': '6',
				'RDEPEND' : 'app-misc/runtime-cycle-b',
				'PDEPEND': 'app-misc/plugins-consumer',
			},
			'app-misc/runtime-cycle-b-1' : {
				'RDEPEND' : 'app-misc/plugin-b app-misc/branch-b',
			},
			'app-misc/branch-b-1' : {
				'RDEPEND' : 'app-misc/leaf-b app-misc/branch-c',
			},
			'app-misc/leaf-b-1' : {},
			'app-misc/branch-c-1' : {
				'RDEPEND' : 'app-misc/runtime-cycle-c app-misc/runtime-c',
			},
			'app-misc/runtime-cycle-c-1' : {
				'RDEPEND' : 'app-misc/branch-c',
			},
			'app-misc/runtime-c-1' : {
				'RDEPEND' : 'app-misc/branch-d',
			},
			'app-misc/branch-d-1' : {
				'RDEPEND' : 'app-misc/leaf-d app-misc/branch-e',
			},
			'app-misc/branch-e-1' : {
				'RDEPEND' : 'app-misc/leaf-e',
			},
			'app-misc/leaf-d-1' : {},
			'app-misc/leaf-e-1' : {},
		}

		test_cases = (
			ResolverPlaygroundTestCase(
				['app-misc/plugin-b'],
				success = True,
				ambiguous_merge_order = True,
				mergelist = [
					('app-misc/leaf-b-1', 'app-misc/leaf-d-1', 'app-misc/leaf-e-1'),
					('app-misc/branch-d-1', 'app-misc/branch-e-1'),
					'app-misc/runtime-c-1',
					('app-misc/runtime-cycle-c-1', 'app-misc/branch-c-1'),
					'app-misc/branch-b-1',
					('app-misc/runtime-cycle-b-1', 'app-misc/plugin-b-1'),
					'app-misc/plugins-consumer-1',
				],
			),
		)

		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()