-
Notifications
You must be signed in to change notification settings - Fork 540
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
t/io/openpid.t makes test harness sluggish; reduce sleep time #16420
Comments
From @jkeenanWhen you run 'make test_harness' often enough, you quickly become aware The amount of 'sleep' requested has been unchanged since commit c8fc8fb Thank you very much. |
From @jkeenanSummary of my perl5 (revision 5 version 27 subversion 9) configuration: Characteristics of this binary (from libperl): |
From @jkeenan0001-Reduce-sleep-time-so-that-test-does-not-delay-make-t.patchFrom 6246167de9698ceb531052746ab8c87e1f2a7d02 Mon Sep 17 00:00:00 2001
From: James E Keenan <jkeenan@cpan.org>
Date: Wed, 14 Feb 2018 10:35:03 -0500
Subject: [PATCH] Reduce 'sleep' time so that test does not delay 'make
test_harness'.
---
t/io/openpid.t | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/t/io/openpid.t b/t/io/openpid.t
index d3fcf78..2516ddd 100644
--- a/t/io/openpid.t
+++ b/t/io/openpid.t
@@ -35,8 +35,8 @@ $perl .= qq[ "-I../lib"];
# the other reader reads one line, waits a few seconds and then
# exits to test the waitpid function.
#
-$cmd1 = qq/$perl -e "\$|=1; print qq[first process\\n]; sleep 30;"/;
-$cmd2 = qq/$perl -e "\$|=1; print qq[second process\\n]; sleep 30;"/;
+$cmd1 = qq/$perl -e "\$|=1; print qq[first process\\n]; sleep 5;"/;
+$cmd2 = qq/$perl -e "\$|=1; print qq[second process\\n]; sleep 5;"/;
$cmd3 = qq/$perl -e "print <>;"/; # hangs waiting for end of STDIN
$cmd4 = qq/$perl -e "print scalar <>;"/;
--
2.7.4
|
From @TuxOn Wed, 14 Feb 2018 07:46:04 -0800, James E Keenan (via RT)
Hum, my oldest box still takes 4½ hours per configuration adding op to Are their any tests that "measure" allowed delays and set them
-- |
The RT System itself - Status changed from 'new' to 'open' |
From @tonycozOn Wed, 14 Feb 2018 07:46:03 -0800, jkeenan@pobox.com wrote:
There's some sort of interaction between harness and this test causing the delay. If you run the test directly: tony@mars:.../perl/t$ time ./perl io/openpid.t real 0m0.033s or under TEST: tony@mars:.../perl/t$ time ./perl TEST io/openpid.t real 0m0.041s the test completes immediately. Only under harness does it take a long time: tony@mars:.../perl/t$ time ./perl harness io/openpid.t real 0m30.123s Tony |
From @tonycozOn Wed, 14 Feb 2018 14:38:26 -0800, tonyc wrote:
I thought this was familiar, please try the attached patch. List form pipe has been implemented since the discussion in #121028. Tony |
From @tonycoz0001-perl-121028-avoid-creating-a-shell-process.patchFrom 38350e53702d28f072f80311bc943afead03ef89 Mon Sep 17 00:00:00 2001
From: Tony Cook <tony@develop-help.com>
Date: Tue, 28 Jan 2014 15:52:22 +1100
Subject: [perl #121028] avoid creating a shell process
---
t/io/openpid.t | 20 +++++++++++++++-----
1 file changed, 15 insertions(+), 5 deletions(-)
diff --git a/t/io/openpid.t b/t/io/openpid.t
index d3fcf7869a..634330ded7 100644
--- a/t/io/openpid.t
+++ b/t/io/openpid.t
@@ -23,11 +23,15 @@ watchdog(15, $^O eq 'MSWin32' ? "alarm" : '');
use Config;
$| = 1;
$SIG{PIPE} = 'IGNORE';
+# reset the handler in case the shell has set a broken default
+$SIG{HUP} = 'DEFAULT';
$SIG{HUP} = 'IGNORE' if $^O eq 'interix';
my $perl = which_perl();
$perl .= qq[ "-I../lib"];
+my @perl = ( which_perl(), "-I../lib" );
+
#
# commands run 4 perl programs. Two of these programs write a
# short message to STDOUT and exit. Two of these programs
@@ -35,16 +39,22 @@ $perl .= qq[ "-I../lib"];
# the other reader reads one line, waits a few seconds and then
# exits to test the waitpid function.
#
-$cmd1 = qq/$perl -e "\$|=1; print qq[first process\\n]; sleep 30;"/;
-$cmd2 = qq/$perl -e "\$|=1; print qq[second process\\n]; sleep 30;"/;
+# Using 4+ arg open for the children that sleep so that that we're
+# killing the perl process instead of an intermediate shell, this
+# allows harness to see the file handles closed sooner. I didn't
+# convert them all since I wanted 3-arg open to continue to be
+# exercised here.
+#
+@cmd1 = ( @perl, "-e", "\$|=1; print qq[first process\\n]; sleep 30;" );
+@cmd2 = ( @perl, "-e", "\$|=1; print qq[second process\\n]; sleep 30;" );
$cmd3 = qq/$perl -e "print <>;"/; # hangs waiting for end of STDIN
$cmd4 = qq/$perl -e "print scalar <>;"/;
-#warn "#$cmd1\n#$cmd2\n#$cmd3\n#$cmd4\n";
+#warn "#@cmd1\n#@cmd2\n#$cmd3\n#$cmd4\n";
# start the processes
-ok( $pid1 = open(FH1, "$cmd1 |"), 'first process started');
-ok( $pid2 = open(FH2, "$cmd2 |"), ' second' );
+ok( $pid1 = open(FH1, "-|", @cmd1), 'first process started');
+ok( $pid2 = open(FH2, "-|", @cmd2), ' second' );
{
no warnings 'once';
ok( $pid3 = open(FH3, "| $cmd3"), ' third' );
--
2.11.0
|
From @LeontOn Thu, Feb 15, 2018 at 12:31 AM, Tony Cook via RT
Fix looks sensible to me, and I can indeed reproduce this issue once I Leon |
From @jkeenanOn Wed, 14 Feb 2018 23:31:43 GMT, tonyc wrote:
Looks good to me. After applying your patch: ##### real 0m0.036s $ cd t;time ./perl harness -v io/openpid.t; cd - real 0m0.067s Please apply unless someone raises an objection. Thank you very much. -- |
@tonycoz - Status changed from 'open' to 'pending release' |
From @TuxOn Wed, 14 Feb 2018 15:31:43 -0800, "Tony Cook via RT"
+1
-- |
From @craigberryOn Wed, Feb 14, 2018 at 9:44 PM, Tony Cook via RT
The test now fails like so on VMS: $ perl io/openpid.t |
From @craigberryOn Thu, Feb 15, 2018 at 9:35 PM, Craig A. Berry <craig.a.berry@gmail.com> wrote:
As of 0970cf2 I have hacked up the test to run the old way |
From @khwilliamsonThank you for filing this report. You have helped make Perl better. With the release yesterday of Perl 5.28.0, this and 185 other issues have been Perl 5.28.0 may be downloaded via: If you find that the problem persists, feel free to reopen this ticket. |
@khwilliamson - Status changed from 'pending release' to 'resolved' |
Migrated from rt.perl.org#132867 (status was 'resolved')
Searchable as RT132867$
The text was updated successfully, but these errors were encountered: