summaryrefslogtreecommitdiffstats
path: root/t/superuser--handle-conflict-deps.t
blob: 5a372cbacfbee80820c9e391dfdd53b24f7575d6 (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
#!/usr/bin/perl

# b requires b-sub
# a-sup requires a
# a conflicts with b, b conflicts with a
#
# c conflicts with d
#
# e conflicts with ff
# f provides ff
# g conflicts with ff
#
use strict;
use lib '.', 't';
use helper;
use urpm::util;
use Test::More 'no_plan';

need_root_and_prepare();

my $name = 'handle-conflict-deps';
urpmi_addmedia("$name $::pwd/media/$name");    

test_simple('c', 'd');
test_simple('d', 'c');
test_simple('e', 'f'); # test for mdvbz #17106
test_simple('f', 'e');

test_conflict_on_install();
test_conflict_on_upgrade(); #test from bugs #12696, #11885

sub test_conflict_on_upgrade {
    urpmi('--auto a-sup');
    check_installed_names('a', 'a-sup');

    urpmi('--auto b');
    check_installed_and_remove('b', 'b-sub');
}

sub test_conflict_on_install {
    urpmi_partial('--auto a b');
    # either a or b is chosen, depending on hdlist order; both are valid
    if (system("rpm -q --quiet --root $::pwd/root a") == 0) {
	check_installed_and_remove('a');
    } else {
	check_installed_and_remove('b', 'b-sub');
    }

    urpmi_partial('--auto f g'); # test for bug #52135
    # either f or g is chosen, depending on hdlist order; both are valid
    if (system("rpm -q --quiet --root $::pwd/root f") == 0) {
	check_installed_and_remove('f');
    } else {
	check_installed_and_remove('g');
    }
}

sub test_simple {
    my ($pkg1, $pkg2) = @_;
    urpmi($pkg1);
    check_installed_names($pkg1);

    urpmi("--auto $pkg2");
    check_installed_and_remove($pkg2);
}