svn commit: r106912 - /perl/modperl/trunk/t/response/TestAPI/internal_redirect.pm
Author: stas Date: Mon Nov 29 07:14:25 2004 New Revision: 106912 URL: http://svn.apache.org/viewcvs?view=rev&rev=106912 Log: embed debugging Modified: perl/modperl/trunk/t/response/TestAPI/internal_redirect.pm Modified: perl/modperl/trunk/t/response/TestAPI/internal_redirect.pm Url: http://svn.apache.org/viewcvs/perl/modperl/trunk/t/response/TestAPI/internal_redirect.pm?view=diff&rev=106912&p1=perl/modperl/trunk/t/response/TestAPI/internal_redirect.pm&r1=106911&p2=perl/modperl/trunk/t/response/TestAPI/internal_redirect.pm&r2=106912 == --- perl/modperl/trunk/t/response/TestAPI/internal_redirect.pm (original) +++ perl/modperl/trunk/t/response/TestAPI/internal_redirect.pm Mon Nov 29 07:14:25 2004 @@ -7,6 +7,8 @@ use Apache::RequestIO (); use Apache::SubRequest (); +use Apache::TestTrace; + use Apache::Const -compile => 'OK'; sub modperl { @@ -16,11 +18,13 @@ if ($args{main}) { # sub-req $r->content_type('text/plain'); +debug "modperl: sub-req: response"; $r->print("internal redirect: $args{main} => modperl"); } else { # main-req my $redirect_uri = $args{uri}; +debug "modperl: main-req => $redirect_uri?main=modperl"; $r->internal_redirect("$redirect_uri?main=modperl"); } @@ -34,11 +38,13 @@ if ($args{main}) { # sub-req $r->content_type('text/plain'); +debug "perl-script: sub-req: response"; print "internal redirect: $args{main} => perl-script"; } else { # main-req my $redirect_uri = $args{uri}; +debug "perl-script: main-req => $redirect_uri?main=perl-script"; $r->internal_redirect("$redirect_uri?main=perl-script"); }
svn commit: r106913 - /perl/modperl/trunk/t/response/TestApache/cgihandler.pm
Author: stas Date: Mon Nov 29 07:15:25 2004 New Revision: 106913 URL: http://svn.apache.org/viewcvs?view=rev&rev=106913 Log: correct the config, A-T was placing PerlInterpScope handler on the top level which was affecting other tests Modified: perl/modperl/trunk/t/response/TestApache/cgihandler.pm Modified: perl/modperl/trunk/t/response/TestApache/cgihandler.pm Url: http://svn.apache.org/viewcvs/perl/modperl/trunk/t/response/TestApache/cgihandler.pm?view=diff&rev=106913&p1=perl/modperl/trunk/t/response/TestApache/cgihandler.pm&r1=106912&p2=perl/modperl/trunk/t/response/TestApache/cgihandler.pm&r2=106913 == --- perl/modperl/trunk/t/response/TestApache/cgihandler.pm (original) +++ perl/modperl/trunk/t/response/TestApache/cgihandler.pm Mon Nov 29 07:15:25 2004 @@ -40,7 +40,12 @@ 1; __END__ -SetHandler perl-script - -PerlInterpScope handler - + + + +PerlInterpScope handler + +SetHandler perl-script +PerlResponseHandler TestApache::cgihandler + +
svn commit: r106914 - /perl/modperl/trunk/t/lib/TestAPRlib/pool.pm /perl/modperl/trunk/todo/release
Author: stas Date: Mon Nov 29 07:27:46 2004 New Revision: 106914 URL: http://svn.apache.org/viewcvs?view=rev&rev=106914 Log: on windows $pool->clean, followed by $pool->destroy no longer breaks (apparenly fixed by the recent rewrite of APR::Pool implementation) Modified: perl/modperl/trunk/t/lib/TestAPRlib/pool.pm perl/modperl/trunk/todo/release Modified: perl/modperl/trunk/t/lib/TestAPRlib/pool.pm Url: http://svn.apache.org/viewcvs/perl/modperl/trunk/t/lib/TestAPRlib/pool.pm?view=diff&rev=106914&p1=perl/modperl/trunk/t/lib/TestAPRlib/pool.pm&r1=106913&p2=perl/modperl/trunk/t/lib/TestAPRlib/pool.pm&r2=106914 == --- perl/modperl/trunk/t/lib/TestAPRlib/pool.pm (original) +++ perl/modperl/trunk/t/lib/TestAPRlib/pool.pm Mon Nov 29 07:27:46 2004 @@ -11,15 +11,15 @@ use APR::Table (); sub num_of_tests { -return 65; +return 74; } sub test { my $pool = APR::Pool->new(); my $table = APR::Table::make($pool, 2); -### custom pools ### +### custom pools ### # test: explicit pool object destroy destroys the custom pool { @@ -43,9 +43,6 @@ } - - - # test: lexical scoping DESTROYs the custom pool { { @@ -66,6 +63,8 @@ $table->clear; } + + ### custom pools + sub-pools ### # test: basic pool and sub-pool tests + implicit destroy of pool objects @@ -348,39 +347,32 @@ "non existing function"); } -# XXX: on windows $pool->clean, followed by $pool->destroy breaks -# other tests. Specifically, -#perl t/TEST apr/pool compat/send_fd -# or -#perl t/TEST apr/pool directive/setupenv -# causes a -#response had protocol HTTP/0.9 (headers not sent?) -# error. on unix it works fine. -# -#### $p->clear ### -#{ -#my ($pp, $sp) = both_pools_create_ok($table); -#$pp->clear; -## both pools should have run their cleanups -#both_pools_destroy_ok($table); -# -## sub-pool $sp should be now bogus, as clear() destroys -## subpools -#eval { $sp->parent_get }; -#ok t_cmp($@, -# qr/invalid pool object/, -# "clear destroys sub pools"); -# -## now we should be able to use the parent pool without -## allocating it -#$pp->cleanup_register(\&set_cleanup, [$table, 're-using pool']); -#$pp->destroy; -# -#my @notes = $table->get('cleanup'); -#ok t_cmp('re-using pool', $notes[0]); -# -#$table->clear; -#} + + +### $p->clear ### +{ +my ($pp, $sp) = both_pools_create_ok($table); +$pp->clear; +# both pools should have run their cleanups +both_pools_destroy_ok($table); + +# sub-pool $sp should be now bogus, as clear() destroys +# subpools +eval { $sp->parent_get }; +ok t_cmp($@, + qr/invalid pool object/, + "clear destroys sub pools"); + +# now we should be able to use the parent pool without +# allocating it +$pp->cleanup_register(\&set_cleanup, [$table, 're-using pool']); +$pp->destroy; + +my @notes = $table->get('cleanup'); +ok t_cmp('re-using pool', $notes[0]); + +$table->clear; +} # a pool can be tagged, so when doing low level apr_pool tracing Modified: perl/modperl/trunk/todo/release Url: http://svn.apache.org/viewcvs/perl/modperl/trunk/todo/release?view=diff&rev=106914&p1=perl/modperl/trunk/todo/release&r1=106913&p2=perl/modperl/trunk/todo/release&r2=106914 == --- perl/modperl/trunk/todo/release (original) +++ perl/modperl/trunk/todo/release Mon Nov 29 07:27:46 2004 @@ -55,10 +55,6 @@ http://marc.theaimsgroup.com/?l=apache-modperl-dev&m=108967266419527&w=2 owner: gozer -* on windows $pool->clean, followed by $pool->destroy breaks other tests - See test TestAPR::pool - http://marc.theaimsgroup.com/?l=apache-modperl-dev&m=108547894817083&w=2 - * per-server cleanups core dump or are otherwise ineffective Apache->server->process->pconf->cleanup_register(sub { ... }); Report: geoff
svn commit: r106926 - /perl/modperl/trunk/Changes /perl/modperl/trunk/lib/Apache/compat.pm /perl/modperl/trunk/t/response/TestCompat/request.pm
Author: stas Date: Mon Nov 29 08:15:53 2004 New Revision: 106926 URL: http://svn.apache.org/viewcvs?view=rev&rev=106926 Log: fix $r->filename in Apache::compat to update the finfo struct (which is how it worked in mp1) Modified: perl/modperl/trunk/Changes perl/modperl/trunk/lib/Apache/compat.pm perl/modperl/trunk/t/response/TestCompat/request.pm Modified: perl/modperl/trunk/Changes Url: http://svn.apache.org/viewcvs/perl/modperl/trunk/Changes?view=diff&rev=106926&p1=perl/modperl/trunk/Changes&r1=106925&p2=perl/modperl/trunk/Changes&r2=106926 == --- perl/modperl/trunk/Changes (original) +++ perl/modperl/trunk/Changes Mon Nov 29 08:15:53 2004 @@ -12,6 +12,9 @@ =item 1.99_18-dev +fix $r->filename in Apache::compat to update the finfo struct (which +is how it worked in mp1) [Stas] + enclose all occurences of eval_* with ENTER;SAVETMPS; ... FREETMPS;LEAVE; previously things just happened to work, due to external scopes which was not very reliable and some change could Modified: perl/modperl/trunk/lib/Apache/compat.pm Url: http://svn.apache.org/viewcvs/perl/modperl/trunk/lib/Apache/compat.pm?view=diff&rev=106926&p1=perl/modperl/trunk/lib/Apache/compat.pm&r1=106925&p2=perl/modperl/trunk/lib/Apache/compat.pm&r2=106926 == --- perl/modperl/trunk/lib/Apache/compat.pm (original) +++ perl/modperl/trunk/lib/Apache/compat.pm Mon Nov 29 08:15:53 2004 @@ -60,6 +60,8 @@ use Symbol (); use File::Spec (); +use APR::Const -compile => qw(FINFO_NORM); + BEGIN { $INC{'Apache.pm'} = __FILE__; @@ -74,6 +76,28 @@ # the overriding code, needs to "return" the original CODE reference # when eval'ed , so that it can be restored later my %overridable_mp2_api = ( +'Apache::RequestRec::filename' => <<'EOI', +{ +require Apache::RequestRec; +require APR::Finfo; +my $orig_sub = *Apache::RequestRec::filename{CODE}; +*Apache::RequestRec::filename = sub { +my($r, $newfile) = @_; +my $old_filename; +if (defined $newfile) { +$old_filename = $r->$orig_sub($newfile); +die "'$newfile' doesn't exist" unless -e $newfile; +$r->finfo(APR::Finfo::stat($newfile, APR::FINFO_NORM, $r->pool)); +} +else { +$old_filename = $r->$orig_sub(); +} +return $old_filename; +}; +$orig_sub; +} + +EOI 'Apache::RequestRec::notes' => <<'EOI', { require Apache::RequestRec; Modified: perl/modperl/trunk/t/response/TestCompat/request.pm Url: http://svn.apache.org/viewcvs/perl/modperl/trunk/t/response/TestCompat/request.pm?view=diff&rev=106926&p1=perl/modperl/trunk/t/response/TestCompat/request.pm&r1=106925&p2=perl/modperl/trunk/t/response/TestCompat/request.pm&r2=106926 == --- perl/modperl/trunk/t/response/TestCompat/request.pm (original) +++ perl/modperl/trunk/t/response/TestCompat/request.pm Mon Nov 29 08:15:53 2004 @@ -10,13 +10,17 @@ use Apache::TestUtil; use Apache::Test; +use APR::Finfo (); + +use File::Spec::Functions qw(catfile); + use Apache::compat (); use Apache::Constants qw(OK REMOTE_HOST); sub handler { my $r = shift; -plan $r, tests => 20; +plan $r, tests => 22; $r->send_http_header('text/plain'); @@ -72,6 +76,26 @@ } } +# $r->filename +{ +Apache::compat::override_mp2_api('Apache::RequestRec::filename'); +my $orig = $r->filename; +my $new = catfile Apache::Test::vars("serverroot"), +"conf", "httpd.conf"; + +# in mp1 setting filename, updates $r's finfo (not in mp2) +$r->filename($new); +ok t_cmp $r->finfo->size, -s $new , "new filesize"; + +# restore +$new = __FILE__; +$r->filename($new); +ok t_cmp $r->finfo->size, -s $new , "new filesize"; + +# restore the real 2.0 filename() method, now that we are done +# with the compat one +Apache::compat::restore_mp2_api('Apache::RequestRec::filename'); +} # $r->notes {
svn commit: r106943 - /perl/modperl/trunk/t/response/TestPerl/signals.pm
Author: stas Date: Mon Nov 29 11:22:47 2004 New Revision: 106943 URL: http://svn.apache.org/viewcvs?view=rev&rev=106943 Log: perl signals tests Added: perl/modperl/trunk/t/response/TestPerl/signals.pm Added: perl/modperl/trunk/t/response/TestPerl/signals.pm Url: http://svn.apache.org/viewcvs/perl/modperl/trunk/t/response/TestPerl/signals.pm?view=auto&rev=106943 == --- (empty file) +++ perl/modperl/trunk/t/response/TestPerl/signals.pm Mon Nov 29 11:22:47 2004 @@ -0,0 +1,62 @@ +package TestPerl::signals; + +use strict; +use warnings FATAL => 'all'; + +use Apache::Test; +use Apache::TestUtil; + +use Apache::MPM (); + +use POSIX qw(SIGALRM); + +use Apache::Const -compile => qw(OK); + +my $mpm = lc Apache::MPM->show; + +# XXX: ALRM sighandler works with prefork, but it doesn't work with +# worker (others?) + +sub handler { +my $r = shift; + +plan $r, tests => 2, +need { "works for prefork" => ($mpm eq 'prefork') }; + +{ +local $ENV{PERL_SIGNALS} = "unsafe"; + +eval { +local $SIG{ALRM} = sub { die "alarm" }; +alarm 2; +run_for_5_sec(); +alarm 0; +}; +ok t_cmp $@, qr/alarm/, "SIGALRM / unsafe %SIG"; +} + +{ +eval { +POSIX::sigaction(SIGALRM, + POSIX::SigAction->new(sub { die "alarm" })) + or die "Error setting SIGALRM handler: $!\n"; +alarm 2; +run_for_5_sec(); +alarm 0; +}; +ok t_cmp $@, qr/alarm/, "SIGALRM / POSIX"; +} + +return Apache::OK; +} + +sub run_for_5_sec { +for (1..20) { # ~5 sec +my $x = 3**20; +select undef, undef, undef, 0.25; +} +} + +1; + +__END__
svn commit: r106958 - in perl/modperl/trunk/t: conf filter/TestFilter lib/ModPerl lib/TestCommon response/TestAPI response/TestApache response/TestModperl
Author: stas Date: Mon Nov 29 14:10:03 2004 New Revision: 106958 URL: http://svn.apache.org/viewcvs?view=rev&rev=106958 Log: refactor modperl_extra.pl which was becoming a big mess - move the code snippets into subs - move helper modules into their own files under t/lib Added: perl/modperl/trunk/t/lib/ModPerl/ perl/modperl/trunk/t/lib/ModPerl/TestFilterDebug.pm perl/modperl/trunk/t/lib/ModPerl/TestMemoryLeak.pm perl/modperl/trunk/t/lib/ModPerl/TestTiePerlSection.pm perl/modperl/trunk/t/lib/TestCommon/Handlers.pm Modified: perl/modperl/trunk/t/conf/extra.last.conf.in perl/modperl/trunk/t/conf/modperl_extra.pl perl/modperl/trunk/t/filter/TestFilter/both_str_native_remove.pm perl/modperl/trunk/t/filter/TestFilter/both_str_req_add.pm perl/modperl/trunk/t/filter/TestFilter/both_str_req_mix.pm perl/modperl/trunk/t/filter/TestFilter/both_str_req_proxy.pm perl/modperl/trunk/t/filter/TestFilter/in_autoload.pm perl/modperl/trunk/t/filter/TestFilter/in_bbs_body.pm perl/modperl/trunk/t/filter/TestFilter/in_bbs_consume.pm perl/modperl/trunk/t/filter/TestFilter/in_bbs_inject_header.pm perl/modperl/trunk/t/filter/TestFilter/in_bbs_underrun.pm perl/modperl/trunk/t/filter/TestFilter/in_init_basic.pm perl/modperl/trunk/t/filter/TestFilter/in_str_bin_data.pm perl/modperl/trunk/t/filter/TestFilter/in_str_consume.pm perl/modperl/trunk/t/filter/TestFilter/in_str_declined.pm perl/modperl/trunk/t/filter/TestFilter/in_str_lc.pm perl/modperl/trunk/t/filter/TestFilter/in_str_msg.pm perl/modperl/trunk/t/filter/TestFilter/in_str_sandwich.pm perl/modperl/trunk/t/filter/TestFilter/out_init_basic.pm perl/modperl/trunk/t/filter/TestFilter/out_str_req_eos.pm perl/modperl/trunk/t/filter/TestFilter/out_str_req_mix.pm perl/modperl/trunk/t/filter/TestFilter/out_str_reverse.pm perl/modperl/trunk/t/lib/TestCommon/Utils.pm perl/modperl/trunk/t/response/TestAPI/content_encoding.pm perl/modperl/trunk/t/response/TestApache/discard_rbody.pm perl/modperl/trunk/t/response/TestApache/post.pm perl/modperl/trunk/t/response/TestModperl/post_utf8.pm Modified: perl/modperl/trunk/t/conf/extra.last.conf.in Url: http://svn.apache.org/viewcvs/perl/modperl/trunk/t/conf/extra.last.conf.in?view=diff&rev=106958&p1=perl/modperl/trunk/t/conf/extra.last.conf.in&r1=106957&p2=perl/modperl/trunk/t/conf/extra.last.conf.in&r2=106958 == --- perl/modperl/trunk/t/conf/extra.last.conf.in(original) +++ perl/modperl/trunk/t/conf/extra.last.conf.inMon Nov 29 14:10:03 2004 @@ -14,6 +14,7 @@ #Test tied %Location +use ModPerl::TestTiePerlSection (); tie %Location, 'ModPerl::TestTiePerlSection'; $Location{'/tied'} = 'test_tied'; Modified: perl/modperl/trunk/t/conf/modperl_extra.pl Url: http://svn.apache.org/viewcvs/perl/modperl/trunk/t/conf/modperl_extra.pl?view=diff&rev=106958&p1=perl/modperl/trunk/t/conf/modperl_extra.pl&r1=106957&p2=perl/modperl/trunk/t/conf/modperl_extra.pl&r2=106958 == --- perl/modperl/trunk/t/conf/modperl_extra.pl (original) +++ perl/modperl/trunk/t/conf/modperl_extra.pl Mon Nov 29 14:10:03 2004 @@ -1,7 +1,7 @@ use strict; use warnings FATAL => 'all'; -use Socket (); #test DynaLoader vs. XSLoader workaround for 5.6.x +use Socket (); # test DynaLoader vs. XSLoader workaround for 5.6.x use IO::File (); use File::Spec::Functions qw(canonpath catdir); @@ -10,56 +10,83 @@ use Apache::ServerRec (); use Apache::ServerUtil (); use Apache::Process (); - -# after Apache2 has pushed blib and core dirs including Apache2 on top -# reorg @INC to have first devel libs, then blib libs, and only then -# perl core libs -my $pool = Apache->server->process->pool; -my $project_root = canonpath -Apache::ServerUtil::server_root_relative($pool, ".."); -my (@a, @b, @c); -for (@INC) { -if (m|^\Q$project_root\E|) { -m|blib| ? push @b, $_ : push @a, $_; -} -else { -push @c, $_; -} -} [EMAIL PROTECTED] = (@a, @b, @c); - -use ModPerl::Util (); #for CORE::GLOBAL::exit - use Apache::RequestRec (); use Apache::RequestIO (); use Apache::RequestUtil (); - use Apache::Connection (); use Apache::Log (); +use APR::Table (); + +use ModPerl::Util (); #for CORE::GLOBAL::exit + use Apache::Const -compile => ':common'; use APR::Const-compile => ':common'; -use APR::Table (); +reorg_INC(); -unless ($ENV{MOD_PERL}) { -die '$ENV{MOD_PERL} not set!'; +die '$ENV{MOD_PERL} not set!' unless $ENV{MOD_PERL}; + +END { +warn "END in modperl_extra.pl, pid=$$\n"; } -#see t/modperl/methodobj -use TestModperl::methodobj (); -$TestModperl::MethodObj = TestModperl::methodobj->new; +startup_info(); + +test_add_config(); + +test_hooks_startup(); + +test_method_obj(); + +test_modperl_env(); + +test_loglevel(); + +test_add_version_component(); + +test_apache_status(); + +test
svn commit: r106966 - /perl/modperl/trunk/t/filter/TestFilter/both_str_native_remove.pm /perl/modperl/trunk/t/response/TestAPI/content_encoding.pm /perl/modperl/trunk/t/response/TestAPI/in_out_filters.pm
Author: stas Date: Mon Nov 29 14:43:53 2004 New Revision: 106966 URL: http://svn.apache.org/viewcvs?view=rev&rev=106966 Log: add missing M_POST compilations Modified: perl/modperl/trunk/t/filter/TestFilter/both_str_native_remove.pm perl/modperl/trunk/t/response/TestAPI/content_encoding.pm perl/modperl/trunk/t/response/TestAPI/in_out_filters.pm Modified: perl/modperl/trunk/t/filter/TestFilter/both_str_native_remove.pm Url: http://svn.apache.org/viewcvs/perl/modperl/trunk/t/filter/TestFilter/both_str_native_remove.pm?view=diff&rev=106966&p1=perl/modperl/trunk/t/filter/TestFilter/both_str_native_remove.pm&r1=106965&p2=perl/modperl/trunk/t/filter/TestFilter/both_str_native_remove.pm&r2=106966 == --- perl/modperl/trunk/t/filter/TestFilter/both_str_native_remove.pm (original) +++ perl/modperl/trunk/t/filter/TestFilter/both_str_native_remove.pmMon Nov 29 14:43:53 2004 @@ -14,7 +14,7 @@ use TestCommon::Utils (); -use Apache::Const -compile => qw(OK DECLINED); +use Apache::Const -compile => qw(OK DECLINED M_POST); # this filter removes the next filter in chain and itself sub remove_includes { Modified: perl/modperl/trunk/t/response/TestAPI/content_encoding.pm Url: http://svn.apache.org/viewcvs/perl/modperl/trunk/t/response/TestAPI/content_encoding.pm?view=diff&rev=106966&p1=perl/modperl/trunk/t/response/TestAPI/content_encoding.pm&r1=106965&p2=perl/modperl/trunk/t/response/TestAPI/content_encoding.pm&r2=106966 == --- perl/modperl/trunk/t/response/TestAPI/content_encoding.pm (original) +++ perl/modperl/trunk/t/response/TestAPI/content_encoding.pm Mon Nov 29 14:43:53 2004 @@ -10,7 +10,7 @@ use TestCommon::Utils (); -use Apache::Const -compile => qw(OK DECLINED); +use Apache::Const -compile => qw(OK DECLINED M_POST); sub handler { my $r = shift; Modified: perl/modperl/trunk/t/response/TestAPI/in_out_filters.pm Url: http://svn.apache.org/viewcvs/perl/modperl/trunk/t/response/TestAPI/in_out_filters.pm?view=diff&rev=106966&p1=perl/modperl/trunk/t/response/TestAPI/in_out_filters.pm&r1=106965&p2=perl/modperl/trunk/t/response/TestAPI/in_out_filters.pm&r2=106966 == --- perl/modperl/trunk/t/response/TestAPI/in_out_filters.pm (original) +++ perl/modperl/trunk/t/response/TestAPI/in_out_filters.pm Mon Nov 29 14:43:53 2004 @@ -15,7 +15,7 @@ use APR::Bucket (); use Apache::Filter (); -use Apache::Const -compile => qw(OK DECLINED MODE_READBYTES); +use Apache::Const -compile => qw(OK M_POST DECLINED MODE_READBYTES); use APR::Const-compile => qw(SUCCESS BLOCK_READ); use constant IOBUFSIZE => 8192;
svn commit: r106968 - /perl/modperl/trunk/t/perl
Author: stas Date: Mon Nov 29 14:44:59 2004 New Revision: 106968 URL: http://svn.apache.org/viewcvs?view=rev&rev=106968 Log: ignore signals.t Modified: perl/modperl/trunk/t/perl/ (props changed)