From 58c9411b535302166226b8700c21fd740d44befb Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Wed, 5 Sep 2007 15:49:38 +0000 Subject: add a simple test that shows urpmi promotes pkgs when a strict require fails --- .../split-transactions--strict-require-1/a.spec | 2 +- .../split-transactions--strict-require-1/b.spec | 13 +++++++++ .../split-transactions--strict-require-1/bb.spec | 15 ---------- .../split-transactions--strict-require-1/c-1.spec | 13 --------- .../split-transactions--strict-require-2/a.spec | 4 +-- .../split-transactions--strict-require-2/b.spec | 2 -- .../split-transactions--strict-require-2/c-2.spec | 13 --------- .../a.spec | 14 +++++++++ .../bb.spec | 15 ++++++++++ .../c-1.spec | 13 +++++++++ .../a.spec | 14 +++++++++ .../b.spec | 15 ++++++++++ .../c-2.spec | 13 +++++++++ ...lit-transactions--strict-require-and-obsolete.t | 33 ++++++++++++++++++++++ t/superuser--split-transactions--strict-require.t | 25 ++++++++-------- 15 files changed, 145 insertions(+), 59 deletions(-) create mode 100644 t/data/SPECS/split-transactions--strict-require-1/b.spec delete mode 100644 t/data/SPECS/split-transactions--strict-require-1/bb.spec delete mode 100644 t/data/SPECS/split-transactions--strict-require-1/c-1.spec delete mode 100644 t/data/SPECS/split-transactions--strict-require-2/c-2.spec create mode 100644 t/data/SPECS/split-transactions--strict-require-and-obsolete-1/a.spec create mode 100644 t/data/SPECS/split-transactions--strict-require-and-obsolete-1/bb.spec create mode 100644 t/data/SPECS/split-transactions--strict-require-and-obsolete-1/c-1.spec create mode 100644 t/data/SPECS/split-transactions--strict-require-and-obsolete-2/a.spec create mode 100644 t/data/SPECS/split-transactions--strict-require-and-obsolete-2/b.spec create mode 100644 t/data/SPECS/split-transactions--strict-require-and-obsolete-2/c-2.spec create mode 100644 t/superuser--split-transactions--strict-require-and-obsolete.t diff --git a/t/data/SPECS/split-transactions--strict-require-1/a.spec b/t/data/SPECS/split-transactions--strict-require-1/a.spec index b0345d65..b9d1643b 100644 --- a/t/data/SPECS/split-transactions--strict-require-1/a.spec +++ b/t/data/SPECS/split-transactions--strict-require-1/a.spec @@ -5,7 +5,7 @@ Release: 1 License: x Group: x Url: x -Requires: b +Requires: b = 1 BuildRoot: %{_tmppath}/%{name} %description diff --git a/t/data/SPECS/split-transactions--strict-require-1/b.spec b/t/data/SPECS/split-transactions--strict-require-1/b.spec new file mode 100644 index 00000000..337a7807 --- /dev/null +++ b/t/data/SPECS/split-transactions--strict-require-1/b.spec @@ -0,0 +1,13 @@ +Summary: x +Name: b +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-1/bb.spec b/t/data/SPECS/split-transactions--strict-require-1/bb.spec deleted file mode 100644 index 4d3a9673..00000000 --- a/t/data/SPECS/split-transactions--strict-require-1/bb.spec +++ /dev/null @@ -1,15 +0,0 @@ -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 deleted file mode 100644 index 21381cf9..00000000 --- a/t/data/SPECS/split-transactions--strict-require-1/c-1.spec +++ /dev/null @@ -1,13 +0,0 @@ -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 index b0345d65..8c506dea 100644 --- a/t/data/SPECS/split-transactions--strict-require-2/a.spec +++ b/t/data/SPECS/split-transactions--strict-require-2/a.spec @@ -1,11 +1,11 @@ Summary: x Name: a -Version: 1 +Version: 2 Release: 1 License: x Group: x Url: x -Requires: b +Requires: b = 2 BuildRoot: %{_tmppath}/%{name} %description diff --git a/t/data/SPECS/split-transactions--strict-require-2/b.spec b/t/data/SPECS/split-transactions--strict-require-2/b.spec index 9986a114..61c0beca 100644 --- a/t/data/SPECS/split-transactions--strict-require-2/b.spec +++ b/t/data/SPECS/split-transactions--strict-require-2/b.spec @@ -5,8 +5,6 @@ Release: 1 License: x Group: x Url: x -Requires: c = %{version} -Obsoletes: bb BuildRoot: %{_tmppath}/%{name} %description 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 deleted file mode 100644 index 3ede1e1e..00000000 --- a/t/data/SPECS/split-transactions--strict-require-2/c-2.spec +++ /dev/null @@ -1,13 +0,0 @@ -Summary: x -Name: c -Version: 2 -Release: 1 -License: x -Group: x -Url: x -BuildRoot: %{_tmppath}/%{name} - -%description -x - -%files diff --git a/t/data/SPECS/split-transactions--strict-require-and-obsolete-1/a.spec b/t/data/SPECS/split-transactions--strict-require-and-obsolete-1/a.spec new file mode 100644 index 00000000..b0345d65 --- /dev/null +++ b/t/data/SPECS/split-transactions--strict-require-and-obsolete-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-and-obsolete-1/bb.spec b/t/data/SPECS/split-transactions--strict-require-and-obsolete-1/bb.spec new file mode 100644 index 00000000..4d3a9673 --- /dev/null +++ b/t/data/SPECS/split-transactions--strict-require-and-obsolete-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-and-obsolete-1/c-1.spec b/t/data/SPECS/split-transactions--strict-require-and-obsolete-1/c-1.spec new file mode 100644 index 00000000..21381cf9 --- /dev/null +++ b/t/data/SPECS/split-transactions--strict-require-and-obsolete-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-and-obsolete-2/a.spec b/t/data/SPECS/split-transactions--strict-require-and-obsolete-2/a.spec new file mode 100644 index 00000000..b0345d65 --- /dev/null +++ b/t/data/SPECS/split-transactions--strict-require-and-obsolete-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-and-obsolete-2/b.spec b/t/data/SPECS/split-transactions--strict-require-and-obsolete-2/b.spec new file mode 100644 index 00000000..9986a114 --- /dev/null +++ b/t/data/SPECS/split-transactions--strict-require-and-obsolete-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-and-obsolete-2/c-2.spec b/t/data/SPECS/split-transactions--strict-require-and-obsolete-2/c-2.spec new file mode 100644 index 00000000..3ede1e1e --- /dev/null +++ b/t/data/SPECS/split-transactions--strict-require-and-obsolete-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/superuser--split-transactions--strict-require-and-obsolete.t b/t/superuser--split-transactions--strict-require-and-obsolete.t new file mode 100644 index 00000000..6ad4aec9 --- /dev/null +++ b/t/superuser--split-transactions--strict-require-and-obsolete.t @@ -0,0 +1,33 @@ +#!/usr/bin/perl + +# a requires b : bb or b +# 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-and-obsolete'; +urpmi_addmedia("$name-1 $::pwd/media/$name-1"); +urpmi_addmedia("$name-2 $::pwd/media/$name-2"); + +test('--split-length 0'); +test('--split-level 1'); # was 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'); +} diff --git a/t/superuser--split-transactions--strict-require.t b/t/superuser--split-transactions--strict-require.t index f89947d8..f1493857 100644 --- a/t/superuser--split-transactions--strict-require.t +++ b/t/superuser--split-transactions--strict-require.t @@ -1,12 +1,8 @@ #!/usr/bin/perl -# a requires b : bb or b -# bb requires c-1 -# b requires c-2 -# b obsoletes bb +# a-1 requires b-1 +# a-2 requires b-2 # -# 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; @@ -19,15 +15,18 @@ 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'); # was broken (#31969) +test('--split-length 0 b'); +test('--split-level 1 b'); + +test('--split-length 0 --auto-select'); +test('--split-level 1 --auto-select'); sub test { - my ($option) = @_; + my ($para) = @_; - urpmi("--media $name-1 --auto a"); - check_installed_fullnames('a-1-1', 'bb-1-1', 'c-1-1'); + urpmi("--media $name-1 --auto a b"); + check_installed_names('a', 'b'); - urpmi("--media $name-2 $option --auto --auto-select"); - check_installed_fullnames_and_remove('a-1-1', 'b-2-1', 'c-2-1'); + urpmi("--media $name-2 --auto $para"); + check_installed_fullnames_and_remove('a-2-1', 'b-2-1'); } -- cgit v1.2.1