Mailing List Archive

svn commit: r1867454 - in /perl/modperl/trunk/t: filter/TestFilter/in_str_declined.pm filter/TestFilter/in_str_declined_read.pm filter/TestFilter/in_str_msg.pm response/TestModperl/post_utf8.pm
Author: stevehay
Date: Tue Sep 24 12:54:06 2019
New Revision: 1867454

URL: http://svn.apache.org/viewvc?rev=1867454&view=rev
Log:
Fix potential test suite hangs due to pipelined response deadlocks

Patch by Zefram <zefram@fysh.org> from https://rt.cpan.org/Ticket/Display.html?id=82409

Modified:
perl/modperl/trunk/t/filter/TestFilter/in_str_declined.pm
perl/modperl/trunk/t/filter/TestFilter/in_str_declined_read.pm
perl/modperl/trunk/t/filter/TestFilter/in_str_msg.pm
perl/modperl/trunk/t/response/TestModperl/post_utf8.pm

Modified: perl/modperl/trunk/t/filter/TestFilter/in_str_declined.pm
URL: http://svn.apache.org/viewvc/perl/modperl/trunk/t/filter/TestFilter/in_str_declined.pm?rev=1867454&r1=1867453&r2=1867454&view=diff
==============================================================================
--- perl/modperl/trunk/t/filter/TestFilter/in_str_declined.pm (original)
+++ perl/modperl/trunk/t/filter/TestFilter/in_str_declined.pm Tue Sep 24 12:54:06 2019
@@ -36,13 +36,17 @@ sub handler {
sub response {
my $r = shift;

+ my $data;
+ if ($r->method_number == Apache2::Const::M_POST) {
+ # consume the data so the input filter is invoked
+ $data = TestCommon::Utils::read_post($r);
+ }
+
plan $r, tests => 2;

$r->content_type('text/plain');

if ($r->method_number == Apache2::Const::M_POST) {
- # consume the data so the input filter is invoked
- my $data = TestCommon::Utils::read_post($r);
ok t_cmp(length $data, 20000, "the request body received ok");
}


Modified: perl/modperl/trunk/t/filter/TestFilter/in_str_declined_read.pm
URL: http://svn.apache.org/viewvc/perl/modperl/trunk/t/filter/TestFilter/in_str_declined_read.pm?rev=1867454&r1=1867453&r2=1867454&view=diff
==============================================================================
--- perl/modperl/trunk/t/filter/TestFilter/in_str_declined_read.pm (original)
+++ perl/modperl/trunk/t/filter/TestFilter/in_str_declined_read.pm Tue Sep 24 12:54:06 2019
@@ -32,14 +32,19 @@ sub handler {
sub response {
my $r = shift;

+ my $err;
+ if ($r->method_number == Apache2::Const::M_POST) {
+ # this should fail, because of the failing filter
+ eval { TestCommon::Utils::read_post($r) };
+ $err = $@;
+ }
+
plan $r, tests => 1;

$r->content_type('text/plain');

if ($r->method_number == Apache2::Const::M_POST) {
- # this should fail, because of the failing filter
- eval { TestCommon::Utils::read_post($r) };
- ok $@;
+ ok $err;
}

Apache2::Const::OK;

Modified: perl/modperl/trunk/t/filter/TestFilter/in_str_msg.pm
URL: http://svn.apache.org/viewvc/perl/modperl/trunk/t/filter/TestFilter/in_str_msg.pm?rev=1867454&r1=1867453&r2=1867454&view=diff
==============================================================================
--- perl/modperl/trunk/t/filter/TestFilter/in_str_msg.pm (original)
+++ perl/modperl/trunk/t/filter/TestFilter/in_str_msg.pm Tue Sep 24 12:54:06 2019
@@ -77,10 +77,10 @@ my $expected = "UPCASED";
sub response {
my $r = shift;

- plan $r, tests => 1;
-
my $received = TestCommon::Utils::read_post($r);

+ plan $r, tests => 1;
+
ok t_cmp($received, $expected,
"request filter must have upcased the data");


Modified: perl/modperl/trunk/t/response/TestModperl/post_utf8.pm
URL: http://svn.apache.org/viewvc/perl/modperl/trunk/t/response/TestModperl/post_utf8.pm?rev=1867454&r1=1867453&r2=1867454&view=diff
==============================================================================
--- perl/modperl/trunk/t/response/TestModperl/post_utf8.pm (original)
+++ perl/modperl/trunk/t/response/TestModperl/post_utf8.pm Tue Sep 24 12:54:06 2019
@@ -30,14 +30,14 @@ sub handler {
# $r->content_type("text/plain; charset=utf-8");
# $r->print("expected: $expected_utf8\n");

+ my $received = TestCommon::Utils::read_post($r) || "";
+
# utf encode/decode was added only in 5.8.0
# XXX: currently binmode is only available with perlio (used on the
# server side on the tied/perlio STDOUT)
plan $r, tests => 2,
need need_min_perl_version(5.008), need_perl('perlio');

- my $received = TestCommon::Utils::read_post($r) || "";
-
# workaround for perl-5.8.0, which doesn't decode correctly a
# tainted variable
require ModPerl::Util;