testing/perl-test-unit: adopt aport

also, re-enable tests with the help of patches from Debian
This commit is contained in:
Celeste 2023-12-14 05:20:52 +00:00 committed by Patrycja Rosa
parent 7c0fbab7db
commit c321a0e8c3
5 changed files with 94 additions and 32 deletions

View File

@ -0,0 +1,20 @@
Patch-Source: https://sources.debian.org/data/main/libt/libtest-unit-perl/0.25-7/debian/patches/20_fix-defined-array-warnings.patch
Description: Fix defined(@array) deprecation warning
Also fixes test suite failures where STDERR was checked
Author: Axel Beckert <abe@debian.org>
Bug: https://rt.cpan.org/Public/Bug/Display.html?id=102732
Index: libtest-unit-perl/lib/Test/Unit/TestCase.pm
===================================================================
--- libtest-unit-perl.orig/lib/Test/Unit/TestCase.pm 2013-12-25 21:59:45.182407866 +0100
+++ libtest-unit-perl/lib/Test/Unit/TestCase.pm 2013-12-25 22:08:27.777044278 +0100
@@ -103,7 +103,7 @@
my $class = ref($_[0]) || $_[0];
my @tests = ();
no strict 'refs';
- if (defined(@{"$class\::TESTS"})) {
+ if (@{"$class\::TESTS"}) {
push @tests, @{"$class\::TESTS"};
}
else {

View File

@ -0,0 +1,29 @@
Patch-Source: https://sources.debian.org/data/main/libt/libtest-unit-perl/0.25-7/debian/patches/30_fix-xism-test-suite-failures.patch
Description: Fix test-suite failures due to ?-xism vs ?^
?^ was introduced with Perl 5.14 as abbreviation for ?d-imsx
Author: Axel Beckert <abe@debian.org>
Bug: https://rt.cpan.org/Public/Bug/Display.html?id=62771
Index: libtest-unit-perl/t/tlib/AssertTest.pm
===================================================================
--- libtest-unit-perl.orig/t/tlib/AssertTest.pm 2013-12-26 01:17:02.338121179 +0100
+++ libtest-unit-perl/t/tlib/AssertTest.pm 2013-12-26 01:17:50.658363830 +0100
@@ -70,7 +70,7 @@
'bang' => [ __LINE__, sub { shift->assert(0, 'bang') } ],
'bang' => [ __LINE__, sub { shift->assert('', 'bang') } ],
- "'qux' did not match /(?-xism:foo)/"
+ "'qux' did not match /(?^:foo)/"
=> [ __LINE__, sub { shift->assert(qr/foo/, 'qux') } ],
'bang' => [ __LINE__, sub { shift->assert(qr/foo/, 'qux', 'bang') } ],
'a ne b'=> [ __LINE__, sub { shift->assert($coderef, 'a', 'b') } ],
@@ -253,7 +253,7 @@
q{expected '', got 'foo'} => [ 'foo', '' ],
q{expected 'foo', got ''} => [ '', 'foo' ],
q{expected 5, got 4} => [ $adder, 5 ],
- q{'foo' did not match /(?-xism:x)/} => [ 'foo', qr/x/ ],
+ q{'foo' did not match /(?^:x)/} => [ 'foo', qr/x/ ],
);
my @tests = ();
while (@checks) {

View File

@ -0,0 +1,23 @@
Patch-Source: https://sources.debian.org/data/main/libt/libtest-unit-perl/0.25-7/debian/patches/40_make-deep-test-less-fragile.patch
Description: Add more variants to fragile test
This test was already marked by upstream as "may be fragile due to
recursion ordering" and it indeed is fragile. Fixes occasional test
suite failures due to hash randomization.
Author: Axel Beckert <abe@debian.org>
Bug: https://rt.cpan.org/Public/Bug/Display.html?id=87017
Index: libtest-unit-perl/t/tlib/AssertTest.pm
===================================================================
--- libtest-unit-perl.orig/t/tlib/AssertTest.pm 2013-12-26 02:08:38.782689704 +0100
+++ libtest-unit-perl/t/tlib/AssertTest.pm 2013-12-26 02:13:11.136010021 +0100
@@ -479,7 +479,8 @@
},
}
],
- $differ->( 'HASH', 'not exist') => [$families{orig}, $families{bad_copy}], # test may be fragile due to recursion ordering?
+ # test is fragile due to hash randomization
+ $differ->( 'HASH|John\sDoe', 'not\sexist|Baby\sDoll') => [$families{orig}, $families{bad_copy}],
$differ->("'3'", "'5'") => [ [ \$H, 3 ], [ \$H2, 5 ] ],
$differ->("'hello'", "'goodbye'") => [ { world => \$H }, { world => \$G } ],
$differ->("'hello'", "'goodbye'") => [ [ \$H, "world" ], [ \$G, "world" ] ],

View File

@ -1,42 +1,43 @@
# Automatically generated by apkbuild-cpan, template 2
# Automatically generated by apkbuild-cpan, template 3
# Contributor: Valery Kartel <valery.kartel@gmail.com>
# Maintainer: Valery Kartel <valery.kartel@gmail.com>
# Maintainer: Celeste <cielesti@protonmail.com>
pkgname=perl-test-unit
#_pkgreal is used by apkbuild-cpan to find modules at MetaCpan
_pkgreal=Test-Unit
pkgver=0.25
pkgrel=3
pkgrel=4
pkgdesc="A unit testing framework"
url="https://metacpan.org/release/Test-Unit"
url="https://metacpan.org/release/Test-Unit/"
arch="noarch"
license="GPL-1.0-or-later OR Artistic-1.0-Perl"
options="!check"
depends="perl perl-class-inner perl-error perl-devel-symdump"
depends="perl perl-class-inner perl-devel-symdump perl-error"
subpackages="$pkgname-doc"
source="https://cpan.metacpan.org/authors/id/M/MC/MCAST/Test-Unit-$pkgver.tar.gz
testcase.patch"
20_fix-defined-array-warnings.patch
30_fix-xism-test-suite-failures.patch
40_make-deep-test-less-fragile.patch
"
builddir="$srcdir/$_pkgreal-$pkgver"
prepare() {
default_prepare
export CFLAGS=$(perl -MConfig -E 'say $Config{ccflags}')
PERL_MM_USE_DEFAULT=1 perl Makefile.PL INSTALLDIRS=vendor
}
build() {
export CFLAGS=$(perl -MConfig -E 'say $Config{ccflags}')
PERL_MM_USE_DEFAULT=1 perl -I. Makefile.PL INSTALLDIRS=vendor
make
}
package() {
make DESTDIR="$pkgdir" install
find "$pkgdir" \( -name perllocal.pod -o -name .packlist \) -delete
}
check() {
export CFLAGS=$(perl -MConfig -E 'say $Config{ccflags}')
make test
}
sha512sums="8f76583c7480eec825080eb6cd94d1b1a1c7c3bc7f297607414c95777e9a9f880b5a0d927a41521389ae50c2ba1b9ec3d76149da47d5997add739970df6b154d Test-Unit-0.25.tar.gz
d7e874a687f93347cb03b403b55a9a765caa38aed1f24c437c6e4a43d287084366aff5a97b4990487f00979288146a29d36989059c8e83b702824348c0f86bc5 testcase.patch"
package() {
make DESTDIR="$pkgdir" install
find "$pkgdir" \( -name perllocal.pod -o -name .packlist \) -delete
}
sha512sums="
8f76583c7480eec825080eb6cd94d1b1a1c7c3bc7f297607414c95777e9a9f880b5a0d927a41521389ae50c2ba1b9ec3d76149da47d5997add739970df6b154d Test-Unit-0.25.tar.gz
47415704a1cd0f18cd95be4f231adb69093af08735f0af81cc78a8178ebd25283311f38c41e1d155e3806ed3b545de0d3c0feedbb8fd4192c04a0b6c516d4e73 20_fix-defined-array-warnings.patch
417b738b22cf0f31d7393528610cb3362dab93341623dd7526a3cb8abebdc26f766efa162a4960e81ecce7ad77f139f7cf212a5e97ea7d07c17c768d1530ae35 30_fix-xism-test-suite-failures.patch
40789912e9ff8ed3abbd0bd2d59cd1c0b090277d123aea720a247d0f86debd68756b1be06ae23e22526b80730239520509fc0274f129b19ae220ea84d511d2db 40_make-deep-test-less-fragile.patch
"

View File

@ -1,11 +0,0 @@
--- a/lib/Test/Unit/TestCase.pm
+++ b/lib/Test/Unit/TestCase.pm
@@ -103,7 +103,7 @@
my $class = ref($_[0]) || $_[0];
my @tests = ();
no strict 'refs';
- if (defined(@{"$class\::TESTS"})) {
+ if (@{"$class\::TESTS"}) {
push @tests, @{"$class\::TESTS"};
}
else {