summaryrefslogtreecommitdiffstats
path: root/t/superuser--file-conflicts.t
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2007-08-13 11:26:05 +0000
committerPascal Rigaux <pixel@mandriva.com>2007-08-13 11:26:05 +0000
commit3036fe3904d6e8e7bcfe384457bbb7399f57bf7f (patch)
treed5d82e40889f643e2a982df8daa0dd740c924fd5 /t/superuser--file-conflicts.t
parenta665e757a125d84d2164e4a14cd9a644b7f84202 (diff)
downloadurpmi-3036fe3904d6e8e7bcfe384457bbb7399f57bf7f.tar
urpmi-3036fe3904d6e8e7bcfe384457bbb7399f57bf7f.tar.gz
urpmi-3036fe3904d6e8e7bcfe384457bbb7399f57bf7f.tar.bz2
urpmi-3036fe3904d6e8e7bcfe384457bbb7399f57bf7f.tar.xz
urpmi-3036fe3904d6e8e7bcfe384457bbb7399f57bf7f.zip
new test for file conflicts
Diffstat (limited to 't/superuser--file-conflicts.t')
-rw-r--r--t/superuser--file-conflicts.t75
1 files changed, 75 insertions, 0 deletions
diff --git a/t/superuser--file-conflicts.t b/t/superuser--file-conflicts.t
new file mode 100644
index 00000000..8580b6f5
--- /dev/null
+++ b/t/superuser--file-conflicts.t
@@ -0,0 +1,75 @@
+#!/usr/bin/perl
+
+use strict;
+use lib '.', 't';
+use helper;
+use Expect;
+use urpm::util;
+use Test::More 'no_plan';
+
+need_root_and_prepare();
+
+my $medium_name = 'file-conflicts';
+
+urpmi_addmedia("$medium_name $::pwd/media/$medium_name");
+
+
+test_rpm_same_transaction();
+test_rpm_different_transactions();
+
+test_urpmi_same_transaction();
+test_urpmi_different_transactions();
+
+sub test_rpm_same_transaction {
+ # disabled, fail
+ #test_rpm_i_fail('a', 'b');
+ #check_nothing_installed();
+
+ test_rpm_i_succeeds('a', 'c');
+ check_installed_and_remove('a', 'c');
+}
+
+sub test_rpm_different_transactions {
+ test_rpm_i_succeeds('a');
+
+ test_rpm_i_fail('b');
+ check_installed_names('a');
+
+ test_rpm_i_succeeds('c');
+ check_installed_and_remove('a', 'c');
+}
+
+sub test_urpmi_same_transaction {
+ # disabled, fail
+ #test_urpmi_fail('a', 'b');
+ #check_nothing_installed();
+
+ urpmi('a c');
+ check_installed_and_remove('a', 'c');
+}
+
+sub test_urpmi_different_transactions {
+ urpmi('a');
+
+ test_urpmi_fail('b');
+ check_installed_names('a');
+
+ # disabled, fail when dropping RPMTAG_FILEDIGESTS
+ #urpmi('c');
+ #check_installed_and_remove('a', 'c');
+}
+
+sub test_rpm_i_succeeds {
+ my (@rpms) = @_;
+ my $rpms = join(' ', map { "media/$medium_name/$_-*.rpm" } @rpms);
+ system_("rpm --root $::pwd/root -i $rpms");
+}
+sub test_rpm_i_fail {
+ my (@rpms) = @_;
+ my $rpms = join(' ', map { "media/$medium_name/$_-*.rpm" } @rpms);
+ system_should_fail("rpm --root $::pwd/root -i $rpms");
+}
+sub test_urpmi_fail {
+ my ($rpms) = @_;
+ system_should_fail(urpmi_cmd() . " $rpms");
+}