From 6631840bc112151fb8bd588e20aee8742b1c42eb Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Wed, 15 Jan 2020 02:33:20 +0100 Subject: 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) --- NEWS | 1 + t/02create_pkgs.t | 1 + t/data/SPECS/orphans-1/h.spec | 2 ++ t/helper.pm | 6 ++++++ t/superuser--orphans.t | 12 ++++++++++-- t/superuser--suggests.t | 9 ++++++++- 6 files changed, 28 insertions(+), 3 deletions(-) diff --git a/NEWS b/NEWS index a88c040d..3db98fcd 100644 --- a/NEWS +++ b/NEWS @@ -9,6 +9,7 @@ o require a newer enough Test::More & rpmtools o skip mirrorlist tests on !Mageia o skip tests if we have no supported downloader + o skip weak deps test on CentOS 7 (unsupported) o testsuite needs rpmtools Version 8.120 - 21 October 2019 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']); -- cgit v1.2.1