File: conflicts.t

package info (click to toggle)
libbssolv-perl 0.17%2Bgit20250403%2Bfc787703f7f6-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 396 kB
  • sloc: perl: 785; makefile: 12
file content (97 lines) | stat: -rw-r--r-- 2,614 bytes parent folder | download
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
#!/usr/bin/perl -w

use strict;
use Test::More tests => 17;

require 't/testlib.pm';

my $repo = <<'EOR';
P: a = 1-1
R: p
P: b = 1-1 p
P: c = 1-1 p
P: d = 1-1
C: b
P: e = 1-1
C: c
P: f = 1-1
C: p
P: g = 1-1
C: b c
P: h = 1-1
R: f
P: i = 1-1
P: j = 1-1
P: k = 1-1
R: j
P: l = 1-1
R: b d
P: m = 1-1
C: m
P: x = 1-1
P: y = 1-1
R: x
P: z = 1-1 z1
P: z2 = 1-1 z
P: z3 = 1-1
P: z4 = 1-1 z3
EOR

my $config = setuptest($repo, "Conflict: i:j\nConflict: x\nConflict: z3");
my @r;

# test that conflicts can fix choices
@r = expand($config, 'a');
is_deeply(\@r, [undef, 'have choice for p needed by a: b c'], 'install a');

@r = expand($config, 'a', 'd');
is_deeply(\@r, [1, 'a', 'c', 'd'], 'install a d');

@r = expand($config, 'a', 'e');
is_deeply(\@r, [1, 'a', 'b', 'e'], 'install a e');

# test test conflicting all providers works
@r = expand($config, 'a', 'd', 'e');
is_deeply(\@r, [undef, '(provider b is in conflict with d)', '(provider c is in conflict with e)', 'conflict for providers of p needed by a'], 'install a d e');

@r = expand($config, 'a', 'f');
is_deeply(\@r, [undef, '(provider b is in conflict with f)', '(provider c is in conflict with f)', 'conflict for providers of p needed by a'], 'install a f');

# test that conflicting jobs work
@r = expand($config, 'b', 'f');
is_deeply(\@r, [undef, 'f conflicts with b'], 'install b f');

@r = expand($config, 'b', 'h');
is_deeply(\@r, [undef, '(provider f conflicts with b)', 'conflict for providers of f needed by h'], 'install b h');

# test conflicts specified in the job
@r = expand($config, 'i', '!i');
is_deeply(\@r, [undef, 'i is in conflict'], 'install i !i');

@r = expand($config, 'k', '!j');
is_deeply(\@r, [undef, '(provider j is in conflict)', 'conflict for providers of j needed by k'], 'install k !j');

# test conflicts from project config
@r = expand($config, 'i', 'j');
is_deeply(\@r, [undef, 'i conflicts with j', 'j conflicts with i'], 'install i j');

@r = expand($config, 'i', 'k');
is_deeply(\@r, [undef, '(provider j is in conflict with i)', 'conflict for providers of j needed by k'], 'install i k');

@r = expand($config, 'l');
is_deeply(\@r, [undef, 'd conflicts with b'], 'install l');

@r = expand($config, 'm');
is_deeply(\@r, [1, 'm'], 'install m');

@r = expand($config, 'x');
is_deeply(\@r, [undef, 'x is in conflict'], 'install x');

@r = expand($config, 'y');
is_deeply(\@r, [undef, '(provider x is in conflict)', 'conflict for providers of x needed by y'], 'install y');

@r = expand($config, 'z', '!z1');
is_deeply(\@r, [1, 'z2'], 'install z !z1');

@r = expand($config, 'z3');
is_deeply(\@r, [1, 'z4'], 'install z3');