summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--t/data/SPECS/obsolete-and-provide/a-1.spec14
-rw-r--r--t/data/SPECS/obsolete-and-provide/a-2.spec14
-rw-r--r--t/data/SPECS/obsolete-and-provide/b-3.spec14
-rw-r--r--t/helper.pm8
-rw-r--r--t/superuser--obsolete-and-provide.t27
5 files changed, 76 insertions, 1 deletions
diff --git a/t/data/SPECS/obsolete-and-provide/a-1.spec b/t/data/SPECS/obsolete-and-provide/a-1.spec
new file mode 100644
index 00000000..acddee43
--- /dev/null
+++ b/t/data/SPECS/obsolete-and-provide/a-1.spec
@@ -0,0 +1,14 @@
+Summary: a
+Name: a
+Version: 1
+Release: 1
+License: x
+Group: x
+Url: x
+Provides: c = %{version}
+BuildRoot: %{_tmppath}/%{name}
+
+%description
+x
+
+%files
diff --git a/t/data/SPECS/obsolete-and-provide/a-2.spec b/t/data/SPECS/obsolete-and-provide/a-2.spec
new file mode 100644
index 00000000..68193e92
--- /dev/null
+++ b/t/data/SPECS/obsolete-and-provide/a-2.spec
@@ -0,0 +1,14 @@
+Summary: a
+Name: a
+Version: 2
+Release: 1
+License: x
+Group: x
+Url: x
+Provides: c = %{version}
+BuildRoot: %{_tmppath}/%{name}
+
+%description
+x
+
+%files
diff --git a/t/data/SPECS/obsolete-and-provide/b-3.spec b/t/data/SPECS/obsolete-and-provide/b-3.spec
new file mode 100644
index 00000000..1936a709
--- /dev/null
+++ b/t/data/SPECS/obsolete-and-provide/b-3.spec
@@ -0,0 +1,14 @@
+Summary: b
+Name: b
+Version: 3
+Release: 1
+License: x
+Group: x
+Url: x
+Provides: c = %{version}
+BuildRoot: %{_tmppath}/%{name}
+
+%description
+x
+
+%files
diff --git a/t/helper.pm b/t/helper.pm
index 11614842..d7e6d802 100644
--- a/t/helper.pm
+++ b/t/helper.pm
@@ -8,7 +8,8 @@ our @EXPORT = qw(need_root_and_prepare
urpm_cmd urpmi_cmd urpmi urpme
urpmi_cfg set_urpmi_cfg_global_options
system_
- check_installed_names check_installed_and_remove check_installed_and_urpme
+ check_installed_fullnames check_installed_names check_nothing_installed
+ check_installed_and_remove check_installed_and_urpme
);
my $using_root;
@@ -91,6 +92,11 @@ sub system_ {
}
+sub check_installed_fullnames {
+ my (@names) = @_;
+ is(`rpm -qa --root $::pwd/root | sort`, join('', map { "$_\n" } sort(@names)));
+}
+
sub check_installed_names {
my (@names) = @_;
is(`rpm -qa --qf '%{name}\\n' --root $::pwd/root | sort`, join('', map { "$_\n" } sort(@names)));
diff --git a/t/superuser--obsolete-and-provide.t b/t/superuser--obsolete-and-provide.t
new file mode 100644
index 00000000..dc45e45e
--- /dev/null
+++ b/t/superuser--obsolete-and-provide.t
@@ -0,0 +1,27 @@
+#!/usr/bin/perl
+
+use strict;
+use lib '.', 't';
+use helper;
+use Test::More 'no_plan';
+
+my $medium_name = 'obsolete-and-provide';
+
+need_root_and_prepare();
+
+urpmi_addmedia("$medium_name $::pwd/media/$medium_name");
+
+test(sub { urpmi('a'); check_installed_fullnames("a-2-1"); urpme('a') });
+test(sub { urpmi('b'); check_installed_fullnames("a-1-1", "b-3-1"); urpme('a b') });
+
+#- the following test fail. "urpmi --auto-select" should do the same as "urpmi a"
+#test(sub { urpmi('--auto-select'); check_installed_fullnames("a-2-1"); urpme('a') });
+
+sub test {
+ my ($f) = @_;
+ system_("rpm --root $::pwd/root -i media/$medium_name/a-1-*.rpm");
+ is(`rpm -qa --root $::pwd/root`, "a-1-1\n");
+
+ $f->();
+ check_nothing_installed();
+}