You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Malcolm J Harwood <mj...@liminalflux.net> on 2005/09/19 01:58:12 UTC

Apache::Test problem

I'm finally learning my way around Apache::Test and I'm having a problem.

Everything seems to be set up correctly (at least as far as I can determine). When 
running the actual code on my installed server, everything is happy. My initial tests 
fail though as follows:

make test results in:

server localhost.localdomain:8529 started
t/00Startup....Can't locate object method "server" via package "Apache2::ServerUtil" at t/00Startup.t line 8.
t/00Startup....dubious
        Test returned status 255 (wstat 65280, 0xff00)
DIED. FAILED test 1
        Failed 1/1 tests, 0.00% okay


where my test script is reduced to:

use Apache::Test; 

plan tests => 1;

use Apache2::ServerUtil ();
ok( Apache2::ServerUtil->server );



If there isn't something I'm obviously doing wrong, any suggestions as to 
where I should start looking? 

The webserver is apache 2.0.54 with statically linked mod_perl 2.0.1.


-- 
"And what are you?" "Alive. Everything else is negotiable."
- Sheridan and Franklin, Babylon 5

Re: Apache::Test problem

Posted by Malcolm J Harwood <mj...@liminalflux.net>.
On Monday 19 September 2005 12:59 pm, Geoffrey Young wrote:

> > t/response/Something/00foo.pm
> >
> > requires the NNfoo.pm to be lower case.
> > 	00foo.pm works
> > 	00Foo.pm does not.

> yeah, IIRC I mention in those slides somewhere that the t/response
> voodoo is case sensitive.  

You don't. :-(
Definitely add that somewhere.

> I know I try to remember to emphasize that  when I talk about it...

You probably did. It's been several months and this is the first time I've 
gotten to actually try it out.

I've gotten my initial tests working, just need to work out the preload voodoo 
as some of my modules register cleanup handlers.


On Monday 19 September 2005 01:01 pm, Geoffrey Young wrote:

>    http://people.apache.org/~geoff/Apache-Test-with-Devel-Cover.tar.gz
> works this way.

I was going to ask about coverage testing, and you've already set something 
up. :) That's one of the things I appreciated about this community, much of 
the time the pieces are already there and all I need to do is work out how to 
use them.



-- 
The meek shall inherit what they damn well please
- 'Under the Gun' Sisters of Mercy

Re: Apache::Test problem

Posted by Geoffrey Young <ge...@modperlcookbook.org>.

Philip M. Gollucci wrote:
> Malcolm J Harwood wrote:
> 
>>>  http://people.apache.org/~geoff/Apache-Test-skeleton-mp2.tar.gz
> 
> THIS PACKAGE IS FOR mod_perl 2.0 (1.99_XX) ONLY!
> a mod_perl 1.0 package is available from
> http://perl.apache.org/~geoff/
> 
> 
> You may want to update that slightly as I think RC5 was the only 1.99_XX 
> (22) release thats works for.
> All the rest are 2.0.x

yeah.

actually, since Apache2.pm is no longer (which was required from 
Makefile.PL) I ought to be able to make one distribution that works for 
both mp1 and mp2 now.

   http://people.apache.org/~geoff/Apache-Test-with-Devel-Cover.tar.gz

works this way.

anyway, I'll try to take care of that soonish...

--Geoff

Re: Apache::Test problem

Posted by "Philip M. Gollucci" <pg...@p6m7g8.com>.
Malcolm J Harwood wrote:
>>  http://people.apache.org/~geoff/Apache-Test-skeleton-mp2.tar.gz
THIS PACKAGE IS FOR mod_perl 2.0 (1.99_XX) ONLY!
a mod_perl 1.0 package is available from
http://perl.apache.org/~geoff/


You may want to update that slightly as I think RC5 was the only 1.99_XX (22) release thats works for.
All the rest are 2.0.x





-- 
END
------------------------------------------------------------
     What doesn't kill us can only make us stronger.
                 Nothing is impossible.
				
Philip M. Gollucci (pgollucci@p6m7g8.com) 301.254.5198
Consultant / http://p6m7g8.net/Resume/
Senior Developer / Liquidity Services, Inc.
   http://www.liquidityservicesinc.com
        http://www.liquidation.com
        http://www.uksurplus.com
        http://www.govliquidation.com
        http://www.gowholesale.com


Re: Apache::Test problem

Posted by Geoffrey Young <ge...@modperlcookbook.org>.
> missing piece:
> 
> t/response/Something/00foo.pm
> 
> requires the NNfoo.pm to be lower case. 
> 	00foo.pm works
> 	00Foo.pm does not.

yeah, IIRC I mention in those slides somewhere that the t/response 
voodoo is case sensitive.  I know I try to remember to emphasize that 
when I talk about it...

--Geoff

Re: Apache::Test problem

Posted by Malcolm J Harwood <mj...@liminalflux.net>.
On Monday 19 September 2005 07:39 am, Geoffrey Young wrote:

> > however "make test" (or "t/TEST") fails because it can't find
> > TestStartup/00startup.pm as it's only got "t/" in the path, not
> > "t/response".
> >
> > What did I miss?
>
> are you using TestRunPerl in your Makefile.PL?

Yes.

> try starting with this skeleton
>
>   http://people.apache.org/~geoff/Apache-Test-skeleton-mp2.tar.gz
>
> and modifying it to suit your needs.  perhaps that will help you isolate
> the missing pieces.

missing piece:

t/response/Something/00foo.pm

requires the NNfoo.pm to be lower case. 
	00foo.pm works
	00Foo.pm does not.







-- 
Some dreams seem impossible, then they seem improbable.  But, then when we
summon the will, they seem inevitable.
- Christopher Reeve

Re: Apache::Test problem

Posted by Geoffrey Young <ge...@modperlcookbook.org>.
> however "make test" (or "t/TEST") fails because it can't find 
> TestStartup/00startup.pm as it's only got "t/" in the path, not "t/response".
> 
> What did I miss?

are you using TestRunPerl in your Makefile.PL?

try starting with this skeleton

  http://people.apache.org/~geoff/Apache-Test-skeleton-mp2.tar.gz

and modifying it to suit your needs.  perhaps that will help you isolate the
missing pieces.

--Geoff

Re: Apache::Test problem

Posted by Malcolm J Harwood <mj...@liminalflux.net>.
On Sunday 18 September 2005 10:11 pm, Geoffrey Young wrote:

> the only thing that jumps out at me is that t/00Startup.t is being executed
> in perl-space outside of the apache server.  that is, 'make test' is doing
> the same thing as if you ran
>
>   $ perl t/00Startup.t
>
> which probably isn't what you want.

Indeed.

> the utility of the test you've setup aside, 

The test is very cut down, I was trying to track the issue by reducing my test 
code to the minimum. The full test file is somewhat larger when I uncomment 
the rest of the tests.

> you probably want to place that code inside
>   t/response/TestStartup/01server.pm
> so that the test runs within the perl running within httpd.

Well, that helped.

> there's stuff about this in the Apache-Test docs I'm sure, 

The docs are not clear, at least to me at this point. Your presentation is 
more helpful, but I'm working from the slides and what I remember, which is 
probably missing some important detail.

I'm getting closer though, I think.

If I have the voodoo right:

test file goes in t/response/TestStartup/00startup.pm
creates t/startup/00startup.t
and a block in httpd.conf so:
	<Location /TestStartup__00startup>
	    SetHandler modperl
	    PerlResponseHandler TestStartup::00startup
	</Location>

however "make test" (or "t/TEST") fails because it can't find 
TestStartup/00startup.pm as it's only got "t/" in the path, not "t/response".

What did I miss?


t/response/TestStartup/00startup.pm:

-----------------------------
package TestStartup::00startup;

use Apache::Test qw(-withtestmore);
use Apache2::Const   -compile => qw(OK);

sub handler
{
    my $r = shift;

    plan $r, tests => 2;

    {
        use_ok( 'Apache2::ServerUtil' );
    }
    {
        can_ok( 'Apache2::ServerUtil', 'server' );
    }
    return Apache2::Const::OK;
}

1;
-----------------------------





-- 
"I thought the apt-get faerie just creates [applications] out of thin air..."
- flacco, slashdot.org 9/2/05

Re: Apache::Test problem

Posted by Geoffrey Young <ge...@modperlcookbook.org>.
> t/00Startup....Can't locate object method "server" via package "Apache2::ServerUtil" at t/00Startup.t line 8.

> where my test script is reduced to:
> 
> use Apache::Test; 
> 
> plan tests => 1;
> 
> use Apache2::ServerUtil ();
> ok( Apache2::ServerUtil->server );
> 
> 
> 
> If there isn't something I'm obviously doing wrong, any suggestions as to 
> where I should start looking? 

the only thing that jumps out at me is that t/00Startup.t is being executed
in perl-space outside of the apache server.  that is, 'make test' is doing
the same thing as if you ran

  $ perl t/00Startup.t

which probably isn't what you want.

the utility of the test you've setup aside, you probably want to place that
code inside

  t/response/TestStartup/01server.pm

so that the test runs within the perl running within httpd.

there's stuff about this in the Apache-Test docs I'm sure, but this
presentation might help as well (which is the one I gave to phl.pm you
attended, but just as a refresher :)

http://www.modperlcookbook.org/~geoff/slides/YAPC/2005/apache-test-part-II-printable.pdf.gz

--Geoff