summaryrefslogtreecommitdiffstats
path: root/t
diff options
context:
space:
mode:
Diffstat (limited to 't')
-rw-r--r--t/data/SPECS/split-transactions--strict-require-1/a.spec14
-rw-r--r--t/data/SPECS/split-transactions--strict-require-1/bb.spec15
-rw-r--r--t/data/SPECS/split-transactions--strict-require-1/c-1.spec13
-rw-r--r--t/data/SPECS/split-transactions--strict-require-2/a.spec14
-rw-r--r--t/data/SPECS/split-transactions--strict-require-2/b.spec15
-rw-r--r--t/data/SPECS/split-transactions--strict-require-2/c-2.spec13
-rw-r--r--t/helper.pm9
-rw-r--r--t/superuser--split-transactions--strict-require.t33
8 files changed, 125 insertions, 1 deletions
diff --git a/t/data/SPECS/split-transactions--strict-require-1/a.spec b/t/data/SPECS/split-transactions--strict-require-1/a.spec
new file mode 100644
index 00000000..b0345d65
--- /dev/null
+++ b/t/data/SPECS/split-transactions--strict-require-1/a.spec
@@ -0,0 +1,14 @@
+Summary: x
+Name: a
+Version: 1
+Release: 1
+License: x
+Group: x
+Url: x
+Requires: b
+BuildRoot: %{_tmppath}/%{name}
+
+%description
+x
+
+%files
diff --git a/t/data/SPECS/split-transactions--strict-require-1/bb.spec b/t/data/SPECS/split-transactions--strict-require-1/bb.spec
new file mode 100644
index 00000000..4d3a9673
--- /dev/null
+++ b/t/data/SPECS/split-transactions--strict-require-1/bb.spec
@@ -0,0 +1,15 @@
+Summary: x
+Name: bb
+Version: 1
+Release: 1
+License: x
+Group: x
+Url: x
+Provides: b
+Requires: c = %{version}
+BuildRoot: %{_tmppath}/%{name}
+
+%description
+x
+
+%files
diff --git a/t/data/SPECS/split-transactions--strict-require-1/c-1.spec b/t/data/SPECS/split-transactions--strict-require-1/c-1.spec
new file mode 100644
index 00000000..21381cf9
--- /dev/null
+++ b/t/data/SPECS/split-transactions--strict-require-1/c-1.spec
@@ -0,0 +1,13 @@
+Summary: x
+Name: c
+Version: 1
+Release: 1
+License: x
+Group: x
+Url: x
+BuildRoot: %{_tmppath}/%{name}
+
+%description
+x
+
+%files
diff --git a/t/data/SPECS/split-transactions--strict-require-2/a.spec b/t/data/SPECS/split-transactions--strict-require-2/a.spec
new file mode 100644
index 00000000..b0345d65
--- /dev/null
+++ b/t/data/SPECS/split-transactions--strict-require-2/a.spec
@@ -0,0 +1,14 @@
+Summary: x
+Name: a
+Version: 1
+Release: 1
+License: x
+Group: x
+Url: x
+Requires: b
+BuildRoot: %{_tmppath}/%{name}
+
+%description
+x
+
+%files
diff --git a/t/data/SPECS/split-transactions--strict-require-2/b.spec b/t/data/SPECS/split-transactions--strict-require-2/b.spec
new file mode 100644
index 00000000..9986a114
--- /dev/null
+++ b/t/data/SPECS/split-transactions--strict-require-2/b.spec
@@ -0,0 +1,15 @@
+Summary: x
+Name: b
+Version: 2
+Release: 1
+License: x
+Group: x
+Url: x
+Requires: c = %{version}
+Obsoletes: bb
+BuildRoot: %{_tmppath}/%{name}
+
+%description
+x
+
+%files
diff --git a/t/data/SPECS/split-transactions--strict-require-2/c-2.spec b/t/data/SPECS/split-transactions--strict-require-2/c-2.spec
new file mode 100644
index 00000000..3ede1e1e
--- /dev/null
+++ b/t/data/SPECS/split-transactions--strict-require-2/c-2.spec
@@ -0,0 +1,13 @@
+Summary: x
+Name: c
+Version: 2
+Release: 1
+License: x
+Group: x
+Url: x
+BuildRoot: %{_tmppath}/%{name}
+
+%description
+x
+
+%files
diff --git a/t/helper.pm b/t/helper.pm
index eecf5e20..d7880b73 100644
--- a/t/helper.pm
+++ b/t/helper.pm
@@ -9,7 +9,7 @@ our @EXPORT = qw(need_root_and_prepare
urpmi_cfg set_urpmi_cfg_global_options
system_ system_should_fail
check_installed_fullnames check_installed_names check_nothing_installed
- check_installed_and_remove check_installed_and_urpme
+ check_installed_and_remove check_installed_fullnames_and_remove check_installed_and_urpme
);
my $using_root;
@@ -118,6 +118,13 @@ sub check_installed_and_remove {
check_nothing_installed();
}
+sub check_installed_fullnames_and_remove {
+ my (@names) = @_;
+ check_installed_fullnames(@names);
+ system_("rpm --root $::pwd/root -e " . join(' ', @names));
+ check_nothing_installed();
+}
+
sub check_installed_and_urpme {
my (@names) = @_;
check_installed_names(@names);
diff --git a/t/superuser--split-transactions--strict-require.t b/t/superuser--split-transactions--strict-require.t
new file mode 100644
index 00000000..e6d60a3d
--- /dev/null
+++ b/t/superuser--split-transactions--strict-require.t
@@ -0,0 +1,33 @@
+#!/usr/bin/perl
+
+# a requires b : bb-1 or b-2
+# bb requires c-1
+# b requires c-2
+# b obsoletes bb
+#
+# upgrading { bb, c-1 } to { b, c-2 } must be done in the same transaction,
+# otherwise { c-1 } to { c-2 } implies removing { a, bb }
+use strict;
+use lib '.', 't';
+use helper;
+use urpm::util;
+use Test::More 'no_plan';
+
+need_root_and_prepare();
+
+my $name = 'split-transactions--strict-require';
+urpmi_addmedia("$name-1 $::pwd/media/$name-1");
+urpmi_addmedia("$name-2 $::pwd/media/$name-2");
+
+test('--split-length 0');
+#test('--split-level 1'); # broken (#31969)
+
+sub test {
+ my ($option) = @_;
+
+ urpmi("--media $name-1 --auto a");
+ check_installed_fullnames('a-1-1', 'bb-1-1', 'c-1-1');
+
+ urpmi("--media $name-2 $option --auto --auto-select");
+ check_installed_fullnames_and_remove('a-1-1', 'b-2-1', 'c-2-1');
+}