* [PATCH 1/2] t/httpd-corner.t: fix uninitialized warning
@ 2020-05-01 18:04 6% ` Eric Wong
0 siblings, 0 replies; 3+ results
From: Eric Wong @ 2020-05-01 18:04 UTC (permalink / raw)
To: meta
Current versions of Perl don't warn when vec() is given `undef'
as its first arg, but Perl 5.10.1 does, at least.
Fixes: c7b4cbdadf3116a0 ("t/httpd-corner: improve reliability and diagnostics")
---
t/httpd-corner.t | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/t/httpd-corner.t b/t/httpd-corner.t
index 7a6bcc66..68148655 100644
--- a/t/httpd-corner.t
+++ b/t/httpd-corner.t
@@ -296,7 +296,7 @@ my $len = length $str;
is($len, 26, 'got the alphabet');
my $check_self = sub {
my ($conn) = @_;
- vec(my $rbits, fileno($conn), 1) = 1;
+ vec(my $rbits = '', fileno($conn), 1) = 1;
select($rbits, undef, undef, 30) or Carp::confess('timed out');
$conn->read(my $buf, 4096);
my ($head, $body) = split(/\r\n\r\n/, $buf, 2);
^ permalink raw reply related [relevance 6%]
* [PATCH 0/2] more test fixes
@ 2020-04-16 1:48 7% Eric Wong
2020-04-16 1:48 6% ` [PATCH 1/2] t/httpd-corner: improve reliability and diagnostics Eric Wong
0 siblings, 1 reply; 3+ results
From: Eric Wong @ 2020-04-16 1:48 UTC (permalink / raw)
To: meta
Still testing these, but I think these will be the last two
patches before 1.4.0.
Eric Wong (2):
t/httpd-corner: improve reliability and diagnostics
t/httpd-unix: reliability for non-signalfd/EVFILT_SIGNAL
t/httpd-corner.t | 20 +++++++++++++-------
t/httpd-unix.t | 24 +++++++++++++++++++++---
2 files changed, 34 insertions(+), 10 deletions(-)
^ permalink raw reply [relevance 7%]
* [PATCH 1/2] t/httpd-corner: improve reliability and diagnostics
2020-04-16 1:48 7% [PATCH 0/2] more test fixes Eric Wong
@ 2020-04-16 1:48 6% ` Eric Wong
0 siblings, 0 replies; 3+ results
From: Eric Wong @ 2020-04-16 1:48 UTC (permalink / raw)
To: meta
The graceful-shutdown-on-PUT test is unreliable because we can't
rely on a FIFO as we do with the GET tests. So increase the
delay to 100ms since that seems enough on my system even with
CONFIG_HZ=100.
Add a timeout and backtrace to the $check_self sub to help with
further diagnostics while we're at it, too.
It would be nice if there were a portable syscall tracing
mechanism we could attach to the -httpd process to make the test
more determistic...
---
t/httpd-corner.t | 20 +++++++++++++-------
1 file changed, 13 insertions(+), 7 deletions(-)
diff --git a/t/httpd-corner.t b/t/httpd-corner.t
index 21b5c560..f25a9a9c 100644
--- a/t/httpd-corner.t
+++ b/t/httpd-corner.t
@@ -16,6 +16,7 @@ use IO::Socket::UNIX;
use Fcntl qw(:seek);
use Socket qw(IPPROTO_TCP TCP_NODELAY SOL_SOCKET);
use POSIX qw(mkfifo);
+use Carp ();
my ($tmpdir, $for_destroy) = tmpdir();
my $fifo = "$tmpdir/fifo";
ok(defined mkfifo($fifo, 0777), 'created FIFO');
@@ -298,6 +299,8 @@ my $len = length $str;
is($len, 26, 'got the alphabet');
my $check_self = sub {
my ($conn) = @_;
+ vec(my $rbits, fileno($conn), 1) = 1;
+ select($rbits, undef, undef, 30) or Carp::confess('timed out');
$conn->read(my $buf, 4096);
my ($head, $body) = split(/\r\n\r\n/, $buf, 2);
like($head, qr/\r\nContent-Length: 40\r\n/s, 'got expected length');
@@ -391,17 +394,20 @@ SKIP: {
{
my $conn = conn_for($sock, 'graceful termination during slow request');
- $conn->write("PUT /sha1 HTTP/1.0\r\n");
- delay();
- $conn->write("Content-Length: $len\r\n");
- delay();
- $conn->write("\r\n");
- is($td->kill, 1, 'started graceful shutdown');
- delay();
+ $conn->write("PUT /sha1 HTTP/1.0\r\nContent-Length: $len\r\n\r\n");
+
+ # XXX ugh, want a reliable and non-intrusive way to detect
+ # that the server has started buffering our partial request so we
+ # can reliably test graceful termination. Maybe making this and
+ # similar tests dependent on Linux strace is a possibility?
+ delay(0.1);
+
+ is($td->kill, 1, 'start graceful shutdown');
my $n = 0;
foreach my $c ('a'..'z') {
$n += $conn->write($c);
}
+ ok(kill(0, $td->{pid}), 'graceful shutdown did not kill httpd');
is($n, $len, 'wrote alphabet');
$check_self->($conn);
$td->join;
^ permalink raw reply related [relevance 6%]
Results 1-3 of 3 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2020-04-16 1:48 7% [PATCH 0/2] more test fixes Eric Wong
2020-04-16 1:48 6% ` [PATCH 1/2] t/httpd-corner: improve reliability and diagnostics Eric Wong
2020-05-01 18:04 [PATCH 0/2] tests: Perl 5.10.1 fixes Eric Wong
2020-05-01 18:04 6% ` [PATCH 1/2] t/httpd-corner.t: fix uninitialized warning Eric Wong
Code repositories for project(s) associated with this public inbox
https://80x24.org/public-inbox.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).