Fix a test failure on non-x86 platforms

This commit is contained in:
Petr Písař 2021-09-24 13:58:32 +02:00
parent f0498c18f4
commit 1802750cf8
2 changed files with 56 additions and 0 deletions

View File

@ -0,0 +1,52 @@
From 2dfc35ab974d068d1e27e1ad146c114562a54a3c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
Date: Fri, 24 Sep 2021 13:53:26 +0200
Subject: [PATCH] Fix t/infix.xs failure on non-x86 platforms
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Previously, an invocation of t::infix::addpairsfunc() warned and returned bad data:
$ perl -Iblib/{lib,arch} t/71infix-wrapper.t
ok 1 - add wrapper func
ok 2 - intersperse wrapper func
Use of uninitialized value in custom infix operator at t/71infix-wrapper.t line 15.
Use of uninitialized value in custom infix operator at t/71infix-wrapper.t line 15.
not ok 3 - addpairs wrapper func
# Failed test 'addpairs wrapper func'
# at t/71infix-wrapper.t line 26.
# Structures begin differing at:
# $got->[0] = '3'
# $expected->[0] = '4'
ok 4 - callchecker generated an OP_CUSTOM call
This error exhibited e.g. on aarch64 platform. This patch fixes it without
understanding what's going on.
CPAN RT#139445
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
t/infix.xs | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/t/infix.xs b/t/infix.xs
index 5f1472e..c848470 100644
--- a/t/infix.xs
+++ b/t/infix.xs
@@ -108,7 +108,10 @@ OP *pp_addpairs(pTHX)
PUSHMARK(SP);
while(lhs_count || rhs_count) {
- mPUSHi(SvIV(*lhs) + SvIV(*rhs));
+ /* Without an intermediate storage, mPUSHi() reports an undefined value.
+ * CPAN RT#139445 */
+ IV o = SvIV(*lhs) + SvIV(*rhs);
+ mPUSHi(o);
lhs++; lhs_count--;
rhs++; rhs_count--;
--
2.31.1

View File

@ -9,6 +9,9 @@ License: GPL+ or Artistic
URL: https://metacpan.org/release/XS-Parse-Keyword URL: https://metacpan.org/release/XS-Parse-Keyword
Source0: https://cpan.metacpan.org/authors/id/P/PE/PEVANS/XS-Parse-Keyword-%{version}.tar.gz Source0: https://cpan.metacpan.org/authors/id/P/PE/PEVANS/XS-Parse-Keyword-%{version}.tar.gz
Source1: macros.perl-XS-Parse-Keyword Source1: macros.perl-XS-Parse-Keyword
# Fix a test failure on non-x86 platforms, bug #2007391, CPAN RT#139445,
# proposed to the upstream.
Patch0: XS-Parse-Keyword-0.17-Fix-t-infix.xs-failure-on-non-x86-platforms.patch
BuildRequires: coreutils BuildRequires: coreutils
BuildRequires: perl-devel BuildRequires: perl-devel
BuildRequires: perl-generators BuildRequires: perl-generators
@ -143,6 +146,7 @@ export HARNESS_OPTIONS=j$(perl -e 'if ($ARGV[0] =~ /.*-j([0-9][0-9]*).*/) {print
%changelog %changelog
* Fri Sep 24 2021 Petr Pisar <ppisar@redhat.com> - 0.17-1 * Fri Sep 24 2021 Petr Pisar <ppisar@redhat.com> - 0.17-1
- 0.17 bump - 0.17 bump
- Fix a test failure on non-x86 platforms (bug #2007391)
* Wed Sep 22 2021 Petr Pisar <ppisar@redhat.com> - 0.16-1 * Wed Sep 22 2021 Petr Pisar <ppisar@redhat.com> - 0.16-1
- 0.16 bump - 0.16 bump