summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorMichael Schroeder <mls@suse.de>2017-04-13 13:53:19 +0200
committerMichael Schroeder <mls@suse.de>2017-04-13 13:55:28 +0200
commit85f79f6feadbd0def4c0887deadcb3c79201fd15 (patch)
tree0303656a30ba77a5c0efe92421928e91f8ff9cb5 /t
parent2e25189b54e63ea9f4a1a5d7cba2a0c77151fed6 (diff)
Update testcases
new tests for determinism and debian or dependencies
Diffstat (limited to 't')
-rw-r--r--t/conflicts.t23
-rw-r--r--t/determinism.t42
-rw-r--r--t/obsoletes.t20
-rw-r--r--t/ordep.t55
-rw-r--r--t/recommends.t2
-rw-r--r--t/requires.t45
-rw-r--r--t/richdeps.t66
7 files changed, 223 insertions, 30 deletions
diff --git a/t/conflicts.t b/t/conflicts.t
index 7853870..1941655 100644
--- a/t/conflicts.t
+++ b/t/conflicts.t
@@ -2,7 +2,7 @@
################################################################
#
-# Copyright (c) 1995-2014 SUSE Linux Products GmbH
+# Copyright (c) 2017 SUSE Linux Products GmbH
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 or 3 as
@@ -21,7 +21,7 @@
################################################################
use strict;
-use Test::More tests => 11;
+use Test::More tests => 12;
require 't/testlib.pm';
@@ -44,6 +44,8 @@ P: i = 1-1
P: j = 1-1
P: k = 1-1
R: j
+P: l = 1-1
+R: b d
EOR
my $config = setuptest($repo, "Conflict: i:j");
@@ -61,28 +63,31 @@ is_deeply(\@r, [1, 'a', 'b', 'e'], 'install a e');
# test test conflicting all providers works
@r = expand($config, 'a', 'd', 'e');
-is_deeply(\@r, [undef, '(provider b is conflicted by installed d)', '(provider c is conflicted by installed e)', 'conflict for providers of p needed by a'], 'install a d e');
+is_deeply(\@r, [undef, '(provider b is in conflict with d)', '(provider c is in conflict with e)', 'conflict for providers of p needed by a'], 'install a d e');
@r = expand($config, 'a', 'f');
-is_deeply(\@r, [undef, '(provider b is conflicted by installed f)', '(provider c is conflicted by installed f)', 'conflict for providers of p needed by a'], 'install a f');
+is_deeply(\@r, [undef, '(provider b is in conflict with f)', '(provider c is in conflict with f)', 'conflict for providers of p needed by a'], 'install a f');
# test that conflicting jobs work
@r = expand($config, 'b', 'f');
is_deeply(\@r, [undef, 'f conflicts with b'], 'install b f');
@r = expand($config, 'b', 'h');
-is_deeply(\@r, [undef, '(provider f conflicts with installed b)', 'conflict for providers of f needed by h'], 'install b h');
+is_deeply(\@r, [undef, '(provider f conflicts with b)', 'conflict for providers of f needed by h'], 'install b h');
# test conflicts specified in the job
@r = expand($config, 'i', '!i');
-is_deeply(\@r, [undef, 'i is conflicted'], 'install i !i');
+is_deeply(\@r, [undef, 'i is in conflict'], 'install i !i');
@r = expand($config, 'k', '!j');
-is_deeply(\@r, [undef, '(provider j is conflicted)', 'conflict for providers of j needed by k'], 'install k !j');
+is_deeply(\@r, [undef, '(provider j is in conflict)', 'conflict for providers of j needed by k'], 'install k !j');
# test conflicts from project config
@r = expand($config, 'i', 'j');
-is_deeply(\@r, [undef, 'j is conflicted by installed i'], 'install i j');
+is_deeply(\@r, [undef, 'i conflicts with j', 'j conflicts with i'], 'install i j');
@r = expand($config, 'i', 'k');
-is_deeply(\@r, [undef, '(provider j is conflicted by installed i)', 'conflict for providers of j needed by k'], 'install i k');
+is_deeply(\@r, [undef, '(provider j is in conflict with i)', 'conflict for providers of j needed by k'], 'install i k');
+
+@r = expand($config, 'l');
+is_deeply(\@r, [undef, 'd conflicts with b'], 'install l');
diff --git a/t/determinism.t b/t/determinism.t
new file mode 100644
index 0000000..64b6924
--- /dev/null
+++ b/t/determinism.t
@@ -0,0 +1,42 @@
+#!/usr/bin/perl -w
+
+################################################################
+#
+# Copyright (c) 2017 SUSE Linux Products GmbH
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 2 or 3 as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program (see the file COPYING); if not, write to the
+# Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+#
+################################################################
+
+use strict;
+use Test::More tests => 1;
+
+require 't/testlib.pm';
+
+my $repo = <<'EOR';
+P: a = 1-1
+R: b c
+P: b1 = 1-1 b
+C: c1
+P: b2 = 1-1 b
+P: c1 = 1-1 c
+P: c2 = 1-1 c
+EOR
+
+my $config = setuptest($repo, 'Prefer: b1 c1');
+my @r;
+
+@r = expand($config, 'a');
+is_deeply(\@r, [undef, 'b1 conflicts with c1'], 'install a');
diff --git a/t/obsoletes.t b/t/obsoletes.t
index a72f0b1..9c71e04 100644
--- a/t/obsoletes.t
+++ b/t/obsoletes.t
@@ -2,7 +2,7 @@
################################################################
#
-# Copyright (c) 1995-2014 SUSE Linux Products GmbH
+# Copyright (c) 2017 SUSE Linux Products GmbH
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 or 3 as
@@ -21,7 +21,7 @@
################################################################
use strict;
-use Test::More tests => 5;
+use Test::More tests => 9;
require 't/testlib.pm';
@@ -38,6 +38,8 @@ P: f = 1-1
O: p
P: g = 1-1
O: b c
+P: h = 1-1
+R: b d
EOR
my $config = setuptest($repo);
@@ -53,7 +55,19 @@ is_deeply(\@r, [1, 'a', 'c', 'd'], 'install a d');
is_deeply(\@r, [1, 'a', 'b', 'e'], 'install a e');
@r = expand($config, 'a', 'd', 'e');
-is_deeply(\@r, [undef, '(provider b is obsoleted by installed d)', '(provider c is obsoleted by installed e)', 'conflict for providers of p needed by a'], 'install a d e');
+is_deeply(\@r, [undef, '(provider b is obsoleted by d)', '(provider c is obsoleted by e)', 'conflict for providers of p needed by a'], 'install a d e');
@r = expand($config, 'a', 'f');
is_deeply(\@r, [undef, 'have choice for p needed by a: b c'], 'install a f');
+
+@r = expand($config, 'b', 'd');
+is_deeply(\@r, [undef, 'd obsoletes b'], 'install b d');
+
+@r = expand($config, 'h');
+is_deeply(\@r, [undef, 'd obsoletes b'], 'install h');
+
+@r = expand($config, 'h', 'd');
+is_deeply(\@r, [undef, '(provider b is obsoleted by d)', 'conflict for providers of b needed by h'], 'install h d');
+
+@r = expand($config, 'h', 'b');
+is_deeply(\@r, [undef, '(provider d obsoletes b)', 'conflict for providers of d needed by h'], 'install h b');
diff --git a/t/ordep.t b/t/ordep.t
new file mode 100644
index 0000000..06f88e6
--- /dev/null
+++ b/t/ordep.t
@@ -0,0 +1,55 @@
+#!/usr/bin/perl -w
+
+################################################################
+#
+# Copyright (c) 2017 SUSE Linux Products GmbH
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 2 or 3 as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program (see the file COPYING); if not, write to the
+# Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+#
+################################################################
+
+use strict;
+use Test::More tests => 4;
+
+require 't/testlib.pm';
+
+my $repo = <<'EOR';
+P: a = 1-1
+R: x | y
+P: b = 1-1
+R: d | e
+P: c = 1-1
+R: d | f
+P: d = 1-1
+P: e = 1-1
+P: f = 1-1
+P: g = 1-1
+R: x | e | d
+EOR
+
+my $config = setuptest($repo, "Binarytype: deb\nPrefer: f\n");
+my @r;
+
+@r = expand($config, 'a');
+is_deeply(\@r, [undef, 'nothing provides x | y needed by a'], 'install a');
+
+@r = expand($config, 'b');
+is_deeply(\@r, [1, 'b', 'd'], 'install b');
+
+@r = expand($config, 'c');
+is_deeply(\@r, [1, 'c', 'f'], 'install c');
+
+@r = expand($config, 'g');
+is_deeply(\@r, [1, 'e', 'g'], 'install g');
diff --git a/t/recommends.t b/t/recommends.t
index fab8362..6472aaf 100644
--- a/t/recommends.t
+++ b/t/recommends.t
@@ -2,7 +2,7 @@
################################################################
#
-# Copyright (c) 1995-2014 SUSE Linux Products GmbH
+# Copyright (c) 2017 SUSE Linux Products GmbH
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 or 3 as
diff --git a/t/requires.t b/t/requires.t
index 4a25475..329aa0a 100644
--- a/t/requires.t
+++ b/t/requires.t
@@ -2,7 +2,7 @@
################################################################
#
-# Copyright (c) 1995-2014 SUSE Linux Products GmbH
+# Copyright (c) 2017 SUSE Linux Products GmbH
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 or 3 as
@@ -21,7 +21,7 @@
################################################################
use strict;
-use Test::More tests => 7;
+use Test::More tests => 16;
require 't/testlib.pm';
@@ -35,9 +35,20 @@ P: d = 1-1 p
P: e = 1-1 p
P: f = 1-1
R: n
+P: ign2 = 1-1
+R: ign1
+P: ign3 = 1-1
+R: ign4
+P: ign5 = 1-1 ign4
+P: ign6 = 1-1
+R: ign7
+P: ign8 = 1-1
+R: ign7
+P: g = 1-1 h
+P: h = 1-1
EOR
-my $config = setuptest($repo);
+my $config = setuptest($repo, 'Ignore: ign1 ign5 ign6:ign7');
my $config2 = setuptest($repo, 'Prefer: d');
my $config3 = setuptest($repo, 'Prefer: -d');
my @r;
@@ -62,3 +73,31 @@ is_deeply(\@r, [1, 'c', 'd'], 'install c with prefer');
@r = expand($config3, "c");
is_deeply(\@r, [1, 'c', 'e'], 'install c with neg prefer');
+
+@r = expand($config, "ign1");
+is_deeply(\@r, [undef, 'nothing provides ign1'], 'install ign1');
+
+@r = expand($config, "ign2");
+is_deeply(\@r, [1, 'ign2'], 'install ign2');
+
+@r = expand($config, "ign3");
+is_deeply(\@r, [1, 'ign3'], 'install ign3');
+
+@r = expand($config, "ign6");
+is_deeply(\@r, [1, 'ign6'], 'install ign6');
+
+@r = expand($config, "ign8");
+is_deeply(\@r, [undef, 'nothing provides ign7 needed by ign8'], 'install ign8');
+
+@r = expand($config, "ign2", "-ign2");
+is_deeply(\@r, [1, 'ign2'], 'install ign2 -ign2');
+
+@r = expand($config, "ign8", "-ign7");
+is_deeply(\@r, [1, 'ign8'], 'install ign8 -ign7');
+
+@r = expand($config, "h");
+is_deeply(\@r, [1, 'h'], 'install h');
+
+@r = expand($config, "--directdepsend--", "h");
+is_deeply(\@r, [undef, 'have choice for h: g h'], 'install --directdepsend-- h');
+
diff --git a/t/richdeps.t b/t/richdeps.t
index 7c551a2..e3227d6 100644
--- a/t/richdeps.t
+++ b/t/richdeps.t
@@ -2,7 +2,7 @@
################################################################
#
-# Copyright (c) 1995-2014 SUSE Linux Products GmbH
+# Copyright (c) 2017 SUSE Linux Products GmbH
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 or 3 as
@@ -21,7 +21,7 @@
################################################################
use strict;
-use Test::More tests => 19;
+use Test::More tests => 27;
require 't/testlib.pm';
@@ -49,26 +49,37 @@ P: lc2 = 1-1
C: (n if n)
P: m = 1-1
C: (b and (n if b))
+P: cx = 1-1
+C: (b and cx and d)
+P: ign1 = 1-1
+R: (ign and b)
+P: ign2 = 1-1
+R: (ign or b)
+P: ign3 = 1-1
+R: (b if ign)
+P: ign4 = 1-1
+R: (ign if b)
+P: bad1 = 1-1
+R: (n foo m)
+P: bad2 = 1-1
+C: (n foo m)
EOR
-my $config = setuptest($repo);
+my $config = setuptest($repo, 'Ignore: ign');
my @r;
@r = expand($config, "()");
-is_deeply(\@r, [undef, 'cannot parse rich dependency ()'], 'install ()');
+is_deeply(\@r, [undef, 'cannot parse dependency ()'], 'install ()');
@r = expand($config, "(n and )");
-is_deeply(\@r, [undef, 'cannot parse rich dependency (n and )'], 'install (n and )');
+is_deeply(\@r, [undef, 'cannot parse dependency (n and )'], 'install (n and )');
@r = expand($config, "(n foo m)");
-is_deeply(\@r, [undef, 'cannot parse rich dependency (n foo m)'], 'install (n foo m)');
+is_deeply(\@r, [undef, 'cannot parse dependency (n foo m)'], 'install (n foo m)');
@r = expand($config, "n");
is_deeply(\@r, [undef, 'nothing provides n'], 'install n');
-@r = expand($config, "(n)");
-is_deeply(\@r, [undef, 'nothing provides n'], 'install (n)');
-
@r = expand($config, "(n or o)");
is_deeply(\@r, [undef, 'nothing provides (n or o)'], 'install (n or o)');
@@ -79,7 +90,7 @@ is_deeply(\@r, [undef, 'nothing provides (n and o)'], 'install (n and o)');
is_deeply(\@r, [undef, "nothing provides n needed by n1"], "install n1");
@r = expand($config, "(n2 and d)");
-is_deeply(\@r, [undef, '(provider d is conflicted by installed n2)', "conflict for providers of (n2 and d)"], "install (n2 and d)");
+is_deeply(\@r, [undef, 'n2 conflicts with d'], "install (n2 and d)");
@r = expand($config, "(n2 or d)");
is_deeply(\@r, [undef, "have choice for (n2 or d): d n2"], "install (n2 or d)");
@@ -88,7 +99,7 @@ is_deeply(\@r, [undef, "have choice for (n2 or d): d n2"], "install (n2 or d)");
is_deeply(\@r, [1, qw{a b c d}], "install a");
@r = expand($config, 'i', 'j');
-is_deeply(\@r, [undef, '(provider k conflicts with installed i)', '(provider k conflicts with installed j)', "conflict for providers of k needed by j"], "install i j");
+is_deeply(\@r, [undef, '(provider k conflicts with i)', '(provider k conflicts with j)', "conflict for providers of k needed by j"], "install i j");
# test corner cases
@r = expand($config, "(b if b)");
@@ -101,14 +112,41 @@ is_deeply(\@r, [1], 'install (n if n)');
is_deeply(\@r, [1, 'lr'], 'install lr');
@r = expand($config, "lc1");
-is_deeply(\@r, [undef, '(provider b is conflicted by installed lc1)', 'conflict for providers of (b if b) needed by lc1'], 'install lc1');
+is_deeply(\@r, [undef, '(provider b is in conflict with lc1)', 'conflict for providers of (b if b) needed by lc1'], 'install lc1');
@r = expand($config, "lc2");
-is_deeply(\@r, [undef, 'lc2 conflicts with everything'], 'install lc2');
+is_deeply(\@r, [undef, 'lc2 conflicts with always true (n if n)'], 'install lc2');
@r = expand($config, "m");
is_deeply(\@r, [1, 'm'], 'install m');
# complex config from the job
@r = expand($config, 'b', 'c', 'd', '!(b and c and d)');
-is_deeply(\@r, [undef, 'd is conflicted'], 'install b c d !(b and c and d)');
+is_deeply(\@r, [undef, 'conflicts with b', 'conflicts with c', 'conflicts with d'], 'install b c d !(b and c and d)');
+
+@r = expand($config, '!(n if n)');
+is_deeply(\@r, [undef, 'conflict with always true (n if n)'], 'install !(n if n)');
+
+@r = expand($config, 'b', 'cx', 'd');
+is_deeply(\@r, [undef, 'cx conflicts with b', 'cx conflicts with d'], 'install b cx d');
+
+@r = expand($config, 'ign');
+is_deeply(\@r, [undef, 'nothing provides ign'], 'install ign');
+
+@r = expand($config, 'ign1');
+is_deeply(\@r, [1, 'b', 'ign1'], 'install ign1');
+
+@r = expand($config, 'ign2');
+is_deeply(\@r, [1, 'ign2'], 'install ign2');
+
+@r = expand($config, 'ign3');
+is_deeply(\@r, [1, 'ign3'], 'install ign3');
+
+@r = expand($config, 'b', 'ign4');
+is_deeply(\@r, [1, 'b', 'ign4'], 'install b ign4');
+
+@r = expand($config, 'bad1');
+is_deeply(\@r, [undef, 'cannot parse dependency (n foo m) from bad1'], 'install bad1');
+
+@r = expand($config, 'bad2');
+is_deeply(\@r, [undef, 'cannot parse dependency (n foo m) from bad2'], 'install bad2');