summaryrefslogtreecommitdiffstats
path: root/t
diff options
context:
space:
mode:
authorThierry Vignaud <thierry.vignaud@gmail.com>2020-01-15 02:33:20 +0100
committerThierry Vignaud <thierry.vignaud@gmail.com>2020-04-09 17:50:35 +0200
commit6631840bc112151fb8bd588e20aee8742b1c42eb (patch)
tree00b1f5cd25dfe7dc9c2adc80ddc7c48371b7c43b /t
parentdf855def6d9c9c2a5820d85e06df9071e796a03d (diff)
downloadurpmi-6631840bc112151fb8bd588e20aee8742b1c42eb.tar
urpmi-6631840bc112151fb8bd588e20aee8742b1c42eb.tar.gz
urpmi-6631840bc112151fb8bd588e20aee8742b1c42eb.tar.bz2
urpmi-6631840bc112151fb8bd588e20aee8742b1c42eb.tar.xz
urpmi-6631840bc112151fb8bd588e20aee8742b1c42eb.zip
cpan_testers: skip weak deps test on CentOS 7 (unsupported)
rationale: CentOS 7's rpm doesn't support eg Recommendstag, it only knows their definitions but is unable to parse a spec file using Recommends Ideally we should be able to detect a too old/unpatched rpm... Technically, we could check whether it's Mageia < 6 which did have an non upstream implementation (but was using Suggests tag instead of Recommends and so would need testsuite adaption -- not worth it)
Diffstat (limited to 't')
-rw-r--r--t/02create_pkgs.t1
-rw-r--r--t/data/SPECS/orphans-1/h.spec2
-rw-r--r--t/helper.pm6
-rw-r--r--t/superuser--orphans.t12
-rw-r--r--t/superuser--suggests.t9
5 files changed, 27 insertions, 3 deletions
diff --git a/t/02create_pkgs.t b/t/02create_pkgs.t
index 507af0c4..7b1bcc5e 100644
--- a/t/02create_pkgs.t
+++ b/t/02create_pkgs.t
@@ -17,6 +17,7 @@ my $genhdlist2 = 'genhdlist2 --xml-info';
foreach my $dir (grep { -d $_ } glob("data/SPECS/*")) {
my ($medium_name) = $dir =~ m!([^/]*)$!;
+ next if $medium_name eq 'suggests' && !are_weak_deps_supported();
rpmbuild($_, $medium_name) foreach glob("$dir/*.spec");
genhdlist_std($medium_name);
}
diff --git a/t/data/SPECS/orphans-1/h.spec b/t/data/SPECS/orphans-1/h.spec
index 44c5e2d8..939d4bb2 100644
--- a/t/data/SPECS/orphans-1/h.spec
+++ b/t/data/SPECS/orphans-1/h.spec
@@ -3,7 +3,9 @@ Name: h
Version: 1
Release: 1
License: x
+%if 0%{?fedora} > 21 || 0%{?mageia} > 4 || 0%{?rhel} > 7
Recommends: hh
+%endif
%description
x
diff --git a/t/helper.pm b/t/helper.pm
index fb211359..ad0f152c 100644
--- a/t/helper.pm
+++ b/t/helper.pm
@@ -1,8 +1,11 @@
package helper;
use Test::More;
+use urpm::select;
+use urpm::util;
use base 'Exporter';
our @EXPORT = qw(need_root_and_prepare need_downloader
+ are_weak_deps_supported
start_httpd httpd_port
urpmi_addmedia urpmi_removemedia urpmi_update
urpm_cmd run_urpm_cmd urpmi_cmd urpmi urpmi_partial test_urpmi_fail urpme
@@ -173,6 +176,9 @@ sub check_installed_and_urpme {
check_nothing_installed();
}
+sub are_weak_deps_supported() {
+ return urpm::select::_rpm_version() gt 4.12.0
+}
END {
$using_root and system('rm -rf root');
diff --git a/t/superuser--orphans.t b/t/superuser--orphans.t
index 30c16477..216a54e3 100644
--- a/t/superuser--orphans.t
+++ b/t/superuser--orphans.t
@@ -40,7 +40,11 @@ set_urpmi_cfg_global_options({ 'nb-of-new-unrequested-pkgs-between-auto-select-o
test_urpme_v1(['h'], 'h', '');
-test_urpme_v1(['hh', 'h'], 'h', 'hh');
+if (are_weak_deps_supported()) {
+ test_urpme_v1(['hh', 'h'], 'h', 'hh');
+} else {
+ test_urpme_v1(['h'], 'h');
+}
test_urpme_v1(['u1 u2'], 'u1', 'u2');
test_urpme_v1(['u3 u4'], 'u4', 'u3');
@@ -52,7 +56,11 @@ test_auto_select_both('d', 'dd', 'd-2', 'dd-1');
test_auto_select_both('e', 'ee1', 'e-2 ee2-2', 'ee1-1');
test_auto_select_both('f', 'ff1', 'f-2 ff2-2');
test_auto_select_both('g', 'gg', 'g-2 gg-2');
-test_auto_select_both('h', 'hh', 'h-2', 'hh-1');
+if (are_weak_deps_supported()) {
+ test_auto_select_both('h', 'hh', 'h-2', 'hh-1');
+} else {
+ test_auto_select_both('h', '', 'h-2', '');
+}
test_auto_select_both('l', 'll', 'l-2 ll-1');
test_auto_select_both('m', 'mm', 'm-2 mm-2');
test_auto_select_both('n', 'nn', 'n-2 nn-2');
diff --git a/t/superuser--suggests.t b/t/superuser--suggests.t
index af60f1da..8e1fbf48 100644
--- a/t/superuser--suggests.t
+++ b/t/superuser--suggests.t
@@ -16,7 +16,13 @@ use strict;
use lib '.', 't';
use helper;
use urpm::util;
-use Test::More 'no_plan';
+use Test::More;
+if (are_weak_deps_supported()) {
+ plan 'no_plan';
+} else {
+ plan skip_all => "Weak dependencies support is needed for those tests" ;
+}
+
need_root_and_prepare();
@@ -30,6 +36,7 @@ test_invalid();
test_upgrade();
test_d();
test_force_suggests();
+done_testing();
sub test_b {
test('b', ['bb'], ['suggested_b']);