]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core.git/commitdiff
perl: fix intermittent test failure
authorWilliam Lyu <William.Lyu@windriver.com>
Tue, 10 Oct 2023 14:10:07 +0000 (10:10 -0400)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 19 Oct 2023 12:38:54 +0000 (13:38 +0100)
Fixes [YOCTO #15136]

This fix addresses the intermittent failure of the Perl ptest
t/op/sigsystem.t.

Signed-off-by: William Lyu <William.Lyu@windriver.com>
Signed-off-by: Randy MacLeod <randy.macleod@windriver.com>
Reported-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
meta/recipes-devtools/perl/files/0001-Fix-intermittent-failure-of-test-t-op-sigsystem.t.patch [new file with mode: 0644]
meta/recipes-devtools/perl/perl_5.38.0.bb

diff --git a/meta/recipes-devtools/perl/files/0001-Fix-intermittent-failure-of-test-t-op-sigsystem.t.patch b/meta/recipes-devtools/perl/files/0001-Fix-intermittent-failure-of-test-t-op-sigsystem.t.patch
new file mode 100644 (file)
index 0000000..86fd42c
--- /dev/null
@@ -0,0 +1,77 @@
+From 75d974a58c461b3b5d35280e497810e46abae4ca Mon Sep 17 00:00:00 2001
+From: William Lyu <William.Lyu@windriver.com>
+Date: Wed, 4 Oct 2023 08:58:41 -0400
+Subject: [PATCH] Fix intermittent failure of test t/op/sigsystem.t
+
+[Perl issue #21546] -- https://github.com/Perl/perl5/issues/21546
+
+This fix addresses the intermittent failure of the test
+t/op/sigsystem.t by improving its robustness. Before the fix, this
+test waits a hard-coded amount of time in the parent process for the
+child process to exit, and the child process may not be able to exit
+soon enough. With this fix, the parent process in this test polls for
+whether the SIGCHLD handler reaped the child process for at most 25
+seconds.
+
+Upstream-Status: Backport [commit ID: 75d974a]
+
+Signed-off-by: William Lyu <William.Lyu@windriver.com>
+Signed-off-by: Randy MacLeod <randy.macleod@windriver.com>
+Reported-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
+
+Committer: William Lyu is now a Perl author.
+---
+ AUTHORS          |  1 +
+ t/op/sigsystem.t | 17 ++++++++++++++---
+ 2 files changed, 15 insertions(+), 3 deletions(-)
+
+diff --git a/AUTHORS b/AUTHORS
+index 21948bfdc7..527dd992fd 100644
+--- a/AUTHORS
++++ b/AUTHORS
+@@ -1443,6 +1443,7 @@ Wayne Scott                    <wscott@ichips.intel.com>
+ Wayne Thompson                 <Wayne.Thompson@Ebay.sun.com>
+ Wilfredo Sánchez               <wsanchez@mit.edu>
+ William J. Middleton           <William.Middleton@oslo.mobil.telenor.no>
++William Lyu                    <William.Lyu@windriver.com>
+ William Mann                   <wmann@avici.com>
+ William Middleton              <wmiddlet@adobe.com>
+ William R Ward                 <hermit@BayView.COM>
+diff --git a/t/op/sigsystem.t b/t/op/sigsystem.t
+index 25da854902..831feefb0f 100644
+--- a/t/op/sigsystem.t
++++ b/t/op/sigsystem.t
+@@ -37,7 +37,15 @@ SKIP: {
+     test_system('with reaper');
+     note("Waiting briefly for SIGCHLD...");
+-    Time::HiRes::sleep(0.500);
++
++    # Wait at most 50 * 0.500 = 25.0 seconds for the child process to be 
++    # reaped. If the child process exits and gets reaped early, this polling
++    # loop will exit early. 
++
++    for (1..50) {
++      last if @pids;
++      Time::HiRes::sleep(0.500);
++    }
+     ok(@pids == 1, 'Reaped only one process');
+     ok($pids[0] == $pid, "Reaped the right process.") or diag(Dumper(\@pids));
+@@ -50,8 +58,11 @@ sub test_system {
+     my $got_zeroes      = 0;
+     # This test is looking for a race between system()'s waitpid() and a
+-    # signal handler.    Looping a few times increases the chances of
+-    # catching the error.
++    # signal handler. The system() call is expected to not interfere with the 
++    # SIGCHLD signal handler. In particular, the wait() called within system() 
++    # is expected to reap the child process forked by system() before the 
++    # SIGCHLD signal handler is called. 
++    # Looping a few times increases the chances of catching the error.
+     for (1..$expected_zeroes) {
+       $got_zeroes++ unless system(TRUE);
+-- 
+2.25.1
+
index 956e4d64d705966f87aca852f5f0158b66d9cb5f..639664e35537e2f1188ee7718eb18ea5415eca30 100644 (file)
@@ -17,6 +17,7 @@ SRC_URI = "https://www.cpan.org/src/5.0/perl-${PV}.tar.gz;name=perl \
            file://0002-Constant-Fix-up-shebang.patch \
            file://determinism.patch \
            file://0001-cpan-Sys-Syslog-Makefile.PL-Fix-_PATH_LOG-for-determ.patch \
+           file://0001-Fix-intermittent-failure-of-test-t-op-sigsystem.t.patch \
            "
 SRC_URI:append:class-native = " \
            file://perl-configpm-switch.patch \