diff options
author | William Lyu <William.Lyu@windriver.com> | 2023-10-10 10:10:07 -0400 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2023-10-19 13:38:56 +0100 |
commit | b509feb17b21c94efe3ce19f8bcfda334e8bd5e4 (patch) | |
tree | 8ef5c3b7c842d14e6f7c3ba130b2478a3c9a28de | |
parent | f784681413981cc1afd1e12e27438e0db6eef192 (diff) | |
download | poky-b509feb17b21c94efe3ce19f8bcfda334e8bd5e4.tar.gz |
perl: fix intermittent test failure
Fixes [YOCTO #15136]
This fix addresses the intermittent failure of the Perl ptest
t/op/sigsystem.t.
(From OE-Core rev: 8c1ee92efa107ed055f1737640a027fa89077494)
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>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | meta/recipes-devtools/perl/files/0001-Fix-intermittent-failure-of-test-t-op-sigsystem.t.patch | 77 | ||||
-rw-r--r-- | meta/recipes-devtools/perl/perl_5.38.0.bb | 1 |
2 files changed, 78 insertions, 0 deletions
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 index 0000000000..86fd42cd3d --- /dev/null +++ b/meta/recipes-devtools/perl/files/0001-Fix-intermittent-failure-of-test-t-op-sigsystem.t.patch | |||
@@ -0,0 +1,77 @@ | |||
1 | From 75d974a58c461b3b5d35280e497810e46abae4ca Mon Sep 17 00:00:00 2001 | ||
2 | From: William Lyu <William.Lyu@windriver.com> | ||
3 | Date: Wed, 4 Oct 2023 08:58:41 -0400 | ||
4 | Subject: [PATCH] Fix intermittent failure of test t/op/sigsystem.t | ||
5 | |||
6 | [Perl issue #21546] -- https://github.com/Perl/perl5/issues/21546 | ||
7 | |||
8 | This fix addresses the intermittent failure of the test | ||
9 | t/op/sigsystem.t by improving its robustness. Before the fix, this | ||
10 | test waits a hard-coded amount of time in the parent process for the | ||
11 | child process to exit, and the child process may not be able to exit | ||
12 | soon enough. With this fix, the parent process in this test polls for | ||
13 | whether the SIGCHLD handler reaped the child process for at most 25 | ||
14 | seconds. | ||
15 | |||
16 | Upstream-Status: Backport [commit ID: 75d974a] | ||
17 | |||
18 | Signed-off-by: William Lyu <William.Lyu@windriver.com> | ||
19 | Signed-off-by: Randy MacLeod <randy.macleod@windriver.com> | ||
20 | Reported-by: Alexandre Belloni <alexandre.belloni@bootlin.com> | ||
21 | |||
22 | Committer: William Lyu is now a Perl author. | ||
23 | --- | ||
24 | AUTHORS | 1 + | ||
25 | t/op/sigsystem.t | 17 ++++++++++++++--- | ||
26 | 2 files changed, 15 insertions(+), 3 deletions(-) | ||
27 | |||
28 | diff --git a/AUTHORS b/AUTHORS | ||
29 | index 21948bfdc7..527dd992fd 100644 | ||
30 | --- a/AUTHORS | ||
31 | +++ b/AUTHORS | ||
32 | @@ -1443,6 +1443,7 @@ Wayne Scott <wscott@ichips.intel.com> | ||
33 | Wayne Thompson <Wayne.Thompson@Ebay.sun.com> | ||
34 | Wilfredo Sánchez <wsanchez@mit.edu> | ||
35 | William J. Middleton <William.Middleton@oslo.mobil.telenor.no> | ||
36 | +William Lyu <William.Lyu@windriver.com> | ||
37 | William Mann <wmann@avici.com> | ||
38 | William Middleton <wmiddlet@adobe.com> | ||
39 | William R Ward <hermit@BayView.COM> | ||
40 | diff --git a/t/op/sigsystem.t b/t/op/sigsystem.t | ||
41 | index 25da854902..831feefb0f 100644 | ||
42 | --- a/t/op/sigsystem.t | ||
43 | +++ b/t/op/sigsystem.t | ||
44 | @@ -37,7 +37,15 @@ SKIP: { | ||
45 | test_system('with reaper'); | ||
46 | |||
47 | note("Waiting briefly for SIGCHLD..."); | ||
48 | - Time::HiRes::sleep(0.500); | ||
49 | + | ||
50 | + # Wait at most 50 * 0.500 = 25.0 seconds for the child process to be | ||
51 | + # reaped. If the child process exits and gets reaped early, this polling | ||
52 | + # loop will exit early. | ||
53 | + | ||
54 | + for (1..50) { | ||
55 | + last if @pids; | ||
56 | + Time::HiRes::sleep(0.500); | ||
57 | + } | ||
58 | |||
59 | ok(@pids == 1, 'Reaped only one process'); | ||
60 | ok($pids[0] == $pid, "Reaped the right process.") or diag(Dumper(\@pids)); | ||
61 | @@ -50,8 +58,11 @@ sub test_system { | ||
62 | my $got_zeroes = 0; | ||
63 | |||
64 | # This test is looking for a race between system()'s waitpid() and a | ||
65 | - # signal handler. Looping a few times increases the chances of | ||
66 | - # catching the error. | ||
67 | + # signal handler. The system() call is expected to not interfere with the | ||
68 | + # SIGCHLD signal handler. In particular, the wait() called within system() | ||
69 | + # is expected to reap the child process forked by system() before the | ||
70 | + # SIGCHLD signal handler is called. | ||
71 | + # Looping a few times increases the chances of catching the error. | ||
72 | |||
73 | for (1..$expected_zeroes) { | ||
74 | $got_zeroes++ unless system(TRUE); | ||
75 | -- | ||
76 | 2.25.1 | ||
77 | |||
diff --git a/meta/recipes-devtools/perl/perl_5.38.0.bb b/meta/recipes-devtools/perl/perl_5.38.0.bb index 956e4d64d7..639664e355 100644 --- a/meta/recipes-devtools/perl/perl_5.38.0.bb +++ b/meta/recipes-devtools/perl/perl_5.38.0.bb | |||
@@ -17,6 +17,7 @@ SRC_URI = "https://www.cpan.org/src/5.0/perl-${PV}.tar.gz;name=perl \ | |||
17 | file://0002-Constant-Fix-up-shebang.patch \ | 17 | file://0002-Constant-Fix-up-shebang.patch \ |
18 | file://determinism.patch \ | 18 | file://determinism.patch \ |
19 | file://0001-cpan-Sys-Syslog-Makefile.PL-Fix-_PATH_LOG-for-determ.patch \ | 19 | file://0001-cpan-Sys-Syslog-Makefile.PL-Fix-_PATH_LOG-for-determ.patch \ |
20 | file://0001-Fix-intermittent-failure-of-test-t-op-sigsystem.t.patch \ | ||
20 | " | 21 | " |
21 | SRC_URI:append:class-native = " \ | 22 | SRC_URI:append:class-native = " \ |
22 | file://perl-configpm-switch.patch \ | 23 | file://perl-configpm-switch.patch \ |