Adjust tests to gdbm-1.15 using an upstream fix

This commit is contained in:
Petr Písař 2019-01-14 15:51:34 +01:00
parent fb37340d0b
commit 539a03b8cf
5 changed files with 157 additions and 100 deletions

View File

@ -0,0 +1,80 @@
From 72cc38bc65d4a675d9134acb085d2e0c3dcd5383 Mon Sep 17 00:00:00 2001
From: David Mitchell <davem@iabyn.com>
Date: Fri, 14 Dec 2018 16:54:42 +0000
Subject: [PATCH] ext/GDBM_File/t/fatal.t: handle non-fatality
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This script is supposed to exercise the error handling callback
mechanism in gdbm, by triggering an error by surreptitiously closing
the file handle which gdbm has opened.
However, this doesn't trigger an error in newer releases of the gdbm
library, which uses mmap() rather than write() etc. In fact I can't see
any way of triggering an error: so just skip the relevant tests if we
can't trigger a failure.
Petr Písař: Ported to 5.28.1 from
upstream's d33f9fbdb3bb27a3b32a2ffa9aa035617c07f7a1.
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
ext/GDBM_File/t/fatal.t | 35 ++++++++++++++++++++++++++---------
1 file changed, 26 insertions(+), 9 deletions(-)
diff --git a/ext/GDBM_File/t/fatal.t b/ext/GDBM_File/t/fatal.t
index 0e426d4..6945653 100644
--- a/ext/GDBM_File/t/fatal.t
+++ b/ext/GDBM_File/t/fatal.t
@@ -1,4 +1,12 @@
#!./perl -w
+#
+# Exercise the error handling callback mechanism in gdbm.
+#
+# Try to trigger an error by surreptitiously closing the file handle which
+# gdbm has opened. Note that this won't trigger an error in newer
+# releases of the gdbm library, which uses mmap() rather than write() etc:
+# so skip in that case.
+
use strict;
use Test::More;
@@ -34,16 +42,25 @@ isnt((open $fh, "<&=$fileno"), undef, "dup fileno $fileno")
or diag("\$! = $!");
isnt(close $fh, undef,
"close fileno $fileno, out from underneath the GDBM_File");
-is(eval {
+
+# store some data to a closed file handle
+
+my $res = eval {
$h{Perl} = 'Rules';
untie %h;
- 1;
-}, undef, 'Trapped error when attempting to write to knobbled GDBM_File');
-
-# Observed "File write error" and "lseek error" from two different systems.
-# So there might be more variants. Important part was that we trapped the error
-# via croak.
-like($@, qr/ at .*\bfatal\.t line \d+\.\n\z/,
- 'expected error message from GDBM_File');
+ 99;
+};
+
+SKIP: {
+ skip "Can't tigger failure", 2 if $res == 99;
+
+ is $res, undef, "eval should return undef";
+
+ # Observed "File write error" and "lseek error" from two different
+ # systems. So there might be more variants. Important part was that
+ # we trapped the error # via croak.
+ like($@, qr/ at .*\bfatal\.t line \d+\.\n\z/,
+ 'expected error message from GDBM_File');
+}
unlink <Op_dbmx*>;
--
2.17.2

View File

@ -1,94 +0,0 @@
From 892e8b006aa99ac2c880cdc2a81fd16f06c1a0f3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
Date: Mon, 9 Jul 2018 16:18:36 +0200
Subject: [PATCH] Remove ext/GDBM_File/t/fatal.t
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
gdbm-1.15 defaults to a memory-mapped I/O and does not report any I/O
errors on store and close operations. Thus ext/GDBM_File/t/fatal.t
test that expects these fatal error reports fails. Because there is
no other way to provoke a fatal error in gdbm-1.15 this patch
removes the test. Future gdbm version promisses reporting a regular
error on closing a database.
RT#133295
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
MANIFEST | 1 -
ext/GDBM_File/t/fatal.t | 49 -------------------------------------------------
2 files changed, 50 deletions(-)
delete mode 100644 ext/GDBM_File/t/fatal.t
diff --git a/MANIFEST b/MANIFEST
index 95fa539095..b07fed1f54 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -4100,7 +4100,6 @@ ext/GDBM_File/GDBM_File.pm GDBM extension Perl module
ext/GDBM_File/GDBM_File.xs GDBM extension external subroutines
ext/GDBM_File/hints/sco.pl Hint for GDBM_File for named architecture
ext/GDBM_File/Makefile.PL GDBM extension makefile writer
-ext/GDBM_File/t/fatal.t Test the fatal_func argument to gdbm_open
ext/GDBM_File/t/gdbm.t See if GDBM_File works
ext/GDBM_File/typemap GDBM extension interface types
ext/Hash-Util/Changes Change history of Hash::Util
diff --git a/ext/GDBM_File/t/fatal.t b/ext/GDBM_File/t/fatal.t
deleted file mode 100644
index 0e426d4dbc..0000000000
--- a/ext/GDBM_File/t/fatal.t
+++ /dev/null
@@ -1,49 +0,0 @@
-#!./perl -w
-use strict;
-
-use Test::More;
-use Config;
-
-BEGIN {
- plan(skip_all => "GDBM_File was not built")
- unless $Config{extensions} =~ /\bGDBM_File\b/;
-
- # https://rt.perl.org/Public/Bug/Display.html?id=117967
- plan(skip_all => "GDBM_File is flaky in $^O")
- if $^O =~ /darwin/;
-
- plan(tests => 8);
- use_ok('GDBM_File');
-}
-
-unlink <Op_dbmx*>;
-
-open my $fh, '<', $^X or die "Can't open $^X: $!";
-my $fileno = fileno $fh;
-isnt($fileno, undef, "Can find next available file descriptor");
-close $fh or die $!;
-
-is((open $fh, "<&=$fileno"), undef,
- "Check that we cannot open fileno $fileno. \$! is $!");
-
-umask(0);
-my %h;
-isa_ok(tie(%h, 'GDBM_File', 'Op_dbmx', GDBM_WRCREAT, 0640), 'GDBM_File');
-
-isnt((open $fh, "<&=$fileno"), undef, "dup fileno $fileno")
- or diag("\$! = $!");
-isnt(close $fh, undef,
- "close fileno $fileno, out from underneath the GDBM_File");
-is(eval {
- $h{Perl} = 'Rules';
- untie %h;
- 1;
-}, undef, 'Trapped error when attempting to write to knobbled GDBM_File');
-
-# Observed "File write error" and "lseek error" from two different systems.
-# So there might be more variants. Important part was that we trapped the error
-# via croak.
-like($@, qr/ at .*\bfatal\.t line \d+\.\n\z/,
- 'expected error message from GDBM_File');
-
-unlink <Op_dbmx*>;
--
2.14.4

View File

@ -0,0 +1,35 @@
From c950d6fa306a1a0a1e28ece3646aec9490a7ea0e Mon Sep 17 00:00:00 2001
From: James E Keenan <jkeenan@cpan.org>
Date: Sat, 15 Dec 2018 10:29:12 -0500
Subject: [PATCH] Avoid "Use of uninitialized value $res in numeric eq (==)"
warning
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The test within the SKIP block expects $res to be undef, but the 'skip'
condition itself expects it to be defined and numeric. So we were
getting an uninitialized value warning. In 'skip' condition, test for
definedness before numeric comparison.
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
ext/GDBM_File/t/fatal.t | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/ext/GDBM_File/t/fatal.t b/ext/GDBM_File/t/fatal.t
index 01068f3cf4..1cbfdc6018 100644
--- a/ext/GDBM_File/t/fatal.t
+++ b/ext/GDBM_File/t/fatal.t
@@ -52,7 +52,7 @@ my $res = eval {
};
SKIP: {
- skip "Can't trigger failure", 2 if $res == 99;
+ skip "Can't trigger failure", 2 if (defined $res and $res == 99);
is $res, undef, "eval should return undef";
--
2.17.2

View File

@ -0,0 +1,29 @@
From c4df8c74c98b6ecac7f95d0184638f24f0a13bcc Mon Sep 17 00:00:00 2001
From: James E Keenan <jkeenan@cpan.org>
Date: Sat, 15 Dec 2018 09:01:55 -0500
Subject: [PATCH] Correct spelling error in 'skip' message
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
ext/GDBM_File/t/fatal.t | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/ext/GDBM_File/t/fatal.t b/ext/GDBM_File/t/fatal.t
index 159916901a..01068f3cf4 100644
--- a/ext/GDBM_File/t/fatal.t
+++ b/ext/GDBM_File/t/fatal.t
@@ -52,7 +52,7 @@ my $res = eval {
};
SKIP: {
- skip "Can't tigger failure", 2 if $res == 99;
+ skip "Can't trigger failure", 2 if $res == 99;
is $res, undef, "eval should return undef";
--
2.17.2

View File

@ -83,7 +83,7 @@ License: GPL+ or Artistic
Epoch: %{perl_epoch} Epoch: %{perl_epoch}
Version: %{perl_version} Version: %{perl_version}
# release number must be even higher, because dual-lived modules will be broken otherwise # release number must be even higher, because dual-lived modules will be broken otherwise
Release: 429%{?dist} Release: 430%{?dist}
Summary: Practical Extraction and Report Language Summary: Practical Extraction and Report Language
Url: https://www.perl.org/ Url: https://www.perl.org/
Source0: https://www.cpan.org/src/5.0/perl-%{perl_version}.tar.xz Source0: https://www.cpan.org/src/5.0/perl-%{perl_version}.tar.xz
@ -152,9 +152,6 @@ Patch13: perl-5.26.0-perl-131588-be-a-little-more-careful-in-arybase-_tie
# <https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/message/3RHZEHLRUHJFF2XGHI5RB6YPDNLDR4HG/> # <https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/message/3RHZEHLRUHJFF2XGHI5RB6YPDNLDR4HG/>
Patch14: perl-5.27.8-hints-linux-Add-lphtread-to-lddlflags.patch Patch14: perl-5.27.8-hints-linux-Add-lphtread-to-lddlflags.patch
# Adjust tests to gdbm-1.15, RT#133295
Patch15: perl-5.29.0-Remove-ext-GDBM_File-t-fatal.t.patch
# Fix printing a warning about a wide character when matching a regular # Fix printing a warning about a wide character when matching a regular
# expression while ISO-8859-1 locale is in effect, in upstream after 5.29.0 # expression while ISO-8859-1 locale is in effect, in upstream after 5.29.0
Patch17: perl-5.29.0-regexec.c-Call-macro-with-correct-args.patch Patch17: perl-5.29.0-regexec.c-Call-macro-with-correct-args.patch
@ -217,6 +214,11 @@ Patch37: perl-5.29.5-perl-133659-make-an-in-place-edit-successful-if-the-
# compiled code blocks, RT#133687, in upstream after 5.29.5 # compiled code blocks, RT#133687, in upstream after 5.29.5
Patch38: perl-5.29.5-handle-code-mixed-compile-and-runtime.patch Patch38: perl-5.29.5-handle-code-mixed-compile-and-runtime.patch
# Adjust tests to gdbm-1.15, RT#133295, in upstream after 5.29.5
Patch39: perl-5.28.1-ext-GDBM_File-t-fatal.t-handle-non-fatality.patch
Patch40: perl-5.29.5-Correct-spelling-error-in-skip-message.patch
Patch41: perl-5.29.5-Avoid-Use-of-uninitialized-value-res-in-numeric-eq-w.patch
# Link XS modules to libperl.so with EU::CBuilder on Linux, bug #960048 # Link XS modules to libperl.so with EU::CBuilder on Linux, bug #960048
Patch200: perl-5.16.3-Link-XS-modules-to-libperl.so-with-EU-CBuilder-on-Li.patch Patch200: perl-5.16.3-Link-XS-modules-to-libperl.so-with-EU-CBuilder-on-Li.patch
@ -2790,7 +2792,6 @@ Perl extension for Version Objects
%patch12 -p1 %patch12 -p1
%patch13 -p1 %patch13 -p1
%patch14 -p1 %patch14 -p1
%patch15 -p1
%patch17 -p1 %patch17 -p1
%patch18 -p1 %patch18 -p1
%patch20 -p1 %patch20 -p1
@ -2810,6 +2811,9 @@ Perl extension for Version Objects
%patch36 -p1 %patch36 -p1
%patch37 -p1 %patch37 -p1
%patch38 -p1 %patch38 -p1
%patch39 -p1
%patch40 -p1
%patch41 -p1
%patch200 -p1 %patch200 -p1
%patch201 -p1 %patch201 -p1
@ -2831,7 +2835,6 @@ perl -x patchlevel.h \
'Fedora Patch12: Replace EU::MakeMaker dependency with EU::MM::Utils in IPC::Cmd (bug #1129443)' \ 'Fedora Patch12: Replace EU::MakeMaker dependency with EU::MM::Utils in IPC::Cmd (bug #1129443)' \
'Fedora Patch13: Fix executing arybase::_tie_it() in Safe compartement (RT#131588)' \ 'Fedora Patch13: Fix executing arybase::_tie_it() in Safe compartement (RT#131588)' \
'Fedora Patch14: Link XS modules to pthread library to fix linking with -z defs' \ 'Fedora Patch14: Link XS modules to pthread library to fix linking with -z defs' \
'Fedora Patch15: Adjust tests to gdbm-1.15 (RT#133295)' \
'Fedora Patch17: Fix printing a warning about a wide character when matching a regular expression while ISO-8859-1 locale is in effect' \ 'Fedora Patch17: Fix printing a warning about a wide character when matching a regular expression while ISO-8859-1 locale is in effect' \
'Fedora Patch18: Fix invoking a check for wide characters while ISO-8859-1 locale is in effect' \ 'Fedora Patch18: Fix invoking a check for wide characters while ISO-8859-1 locale is in effect' \
'Fedora Patch20: Fix build conditions in locale.c' \ 'Fedora Patch20: Fix build conditions in locale.c' \
@ -2847,6 +2850,7 @@ perl -x patchlevel.h \
'Fedora Patch34: Fix an undefined behaviour in S_hv_delete_common()' \ 'Fedora Patch34: Fix an undefined behaviour in S_hv_delete_common()' \
'Fedora Patch35: Fix in-place edit to replace files on a successful perl exit status (bug #1650041)' \ 'Fedora Patch35: Fix in-place edit to replace files on a successful perl exit status (bug #1650041)' \
'Fedora Patch38: Fix compiling regular expressions that contain both compile- and run-time compiled code blocks (RT#133687)' \ 'Fedora Patch38: Fix compiling regular expressions that contain both compile- and run-time compiled code blocks (RT#133687)' \
'Fedora Patch39: Adjust tests to gdbm-1.15 (RT#133295)' \
'Fedora Patch200: Link XS modules to libperl.so with EU::CBuilder on Linux' \ 'Fedora Patch200: Link XS modules to libperl.so with EU::CBuilder on Linux' \
'Fedora Patch201: Link XS modules to libperl.so with EU::MM on Linux' \ 'Fedora Patch201: Link XS modules to libperl.so with EU::MM on Linux' \
%{nil} %{nil}
@ -5135,6 +5139,9 @@ popd
# Old changelog entries are preserved in CVS. # Old changelog entries are preserved in CVS.
%changelog %changelog
* Mon Jan 14 2019 Petr Pisar <ppisar@redhat.com> - 4:5.28.1-430
- Adjust tests to gdbm-1.15 using an upstream fix (RT#133295)
* Mon Jan 14 2019 Björn Esser <besser82@fedoraproject.org> - 4:5.28.1-429 * Mon Jan 14 2019 Björn Esser <besser82@fedoraproject.org> - 4:5.28.1-429
- Rebuilt for libcrypt.so.2 (#1666033) - Rebuilt for libcrypt.so.2 (#1666033)