From 12fc02682f4a7ba64ae765d925b03946ca46c787 Mon Sep 17 00:00:00 2001 From: Anssi Hannula Date: Sat, 23 Jan 2010 05:51:38 +0000 Subject: testsuite: When trying to install two conflicting packages, consider the tests passed if either of them is installed succesfully after alerting the user. --- t/superuser--handle-conflict-deps.t | 14 ++++++++++++-- t/superuser--handle-conflict-deps2.t | 17 ++++++++++------- 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/t/superuser--handle-conflict-deps.t b/t/superuser--handle-conflict-deps.t index 24197604..e5c45a3e 100644 --- a/t/superuser--handle-conflict-deps.t +++ b/t/superuser--handle-conflict-deps.t @@ -39,10 +39,20 @@ sub test_conflict_on_upgrade { sub test_conflict_on_install { urpmi('--auto a b'); - check_installed_and_remove('b', 'b-sub'); # WARNING: either a or b is chosen, depending on hdlist order + # 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('--auto f g'); # test for bug #52135 - check_installed_and_remove('f'); + # 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 { diff --git a/t/superuser--handle-conflict-deps2.t b/t/superuser--handle-conflict-deps2.t index f192faee..a68ba195 100644 --- a/t/superuser--handle-conflict-deps2.t +++ b/t/superuser--handle-conflict-deps2.t @@ -22,16 +22,14 @@ need_root_and_prepare(); my $name = 'handle-conflict-deps2'; urpmi_addmedia("$name $::pwd/media/$name"); -# 'c-2','d2-2' is also a valid result; both wanted pkgs can't be installed, +# these test have two alternative results; both wanted pkgs can't be installed, # so urpmi can arbitrarily drop one (after confirming with user, of course) -test(['d1-1', 'c-1'], ['c-2', 'd1-2'], ['c-2', 'd2-2']); - -# 'a1-2','b-1' is also a valid result -test(['a1-1', 'b-1'], ['b-2', 'a1-2'], ['b-1', 'a1-2']); +test(['d1-1', 'c-1'], ['c-2', 'd1-2'], ['c-1', 'd1-2'], ['c-2', 'd2-2']); +test(['a1-1', 'b-1'], ['b-2', 'a1-2'], ['a2-2', 'b-2'], ['a1-2', 'b-1']); sub test { - my ($first, $wanted, $result) = @_; + my ($first, $wanted, $result1, $result2) = @_; urpmi("--auto @$first"); check_installed_fullnames(map { "$_-1" } @$first); @@ -41,5 +39,10 @@ sub test { check_installed_fullnames(map { "$_-1" } @$first); urpmi("--auto @$wanted"); - check_installed_fullnames_and_remove(map { "$_-1" } @$result); + + if (system("rpm -q --quiet --root $::pwd/root ".@$result1[0]) == 0) { + check_installed_fullnames_and_remove(map { "$_-1" } @$result1); + } else { + check_installed_fullnames_and_remove(map { "$_-1" } @$result2); + } } -- cgit v1.2.1