You are viewing a plain text version of this content. The canonical link for it is here.
Posted to test-dev@httpd.apache.org by William McKee <wi...@knowmad.com> on 2003/12/23 00:16:50 UTC

APACHE_TEST_LIVE_DEV

Hi again,

More problems with configuring my Apache::Test setup. I have
successfully added the Apache::Test framework into a current project. As
I'm adding new tests, I need to update the code in my modules. To this
end, I followed the advice in the docs to set APACHE_TEST_LIVE_DEV.

Running t/TEST -config correctly created the modperl_inc.pl with the
path to my project/lib directory. However, it also adds paths to the
blib directory above this one which means that I have to run make each
time my modules change in order to get my test server to see the
updates (currently I'm using t/TEST -run-tests to prevent restarting the
server everytime). Deleting the blib paths (there are 2 that get added)
does not make any difference (even if I restart the test server).

Questions:
	1) Why is t/TEST -config adding the blib paths?
	2) Why aren't my changes to modperl_inc.pl affecting the @INC hash?

I can't seem to find much documentation about the modperl_inc.pl or
modperl_startup.pl files. Any pointers would be most appreciated!

Thanks,
William

-- 
Knowmad Services Inc.
http://www.knowmad.com

Re: APACHE_TEST_LIVE_DEV

Posted by William McKee <wi...@knowmad.com>.
On Tue, Dec 23, 2003 at 11:17:22AM -0800, Stas Bekman wrote:
> >	t/TEST -start
> >	t/TEST -run-tests
> 
> That's the right paradigm.

It's a great paradigm!

> As you can see after modperl_inc.pl the @INC is correct ('lib' is first).

Yep. I should have mentioned that this version looks correct. It's when
the tests get loaded that things go haywire with @INC.


> So you must have messed things up and added blib somewhere by yourself. I 
> think the easiest way to fix it if you can't find it yourself is to upload 
> your tar.gz with all files somewhere, post the URL here and we will look at 
> it.

I've grepped for blib and have found that TEST requires the blib package
in the BEGIN block. However, commenting that out makes no difference. I
can't find anywhere in my code that I'm loading these modules. I'll put
together a package soon.


> p.s. I'm leaving in about 8 hours and will be back next week, but may be 
> Geoff will be able to look at it.

Happy holidays & safe travels!

William

-- 
Knowmad Services Inc.
http://www.knowmad.com

Re: APACHE_TEST_LIVE_DEV

Posted by Stas Bekman <st...@stason.org>.
William McKee wrote:
> Stas,
> 
> A bit more testing has revealed more about modperl_inc.pl to me. I had
> neglected to realize that modperl_inc.pl only gets loaded on server
> startup. I had been running my tests using the following commands:
> 	t/TEST -start
> 	t/TEST -run-tests

That's the right paradigm.

> When I made the changes to modperl_inc.pl, I had not restarted the
> server and therefore did not see the @INC output. Once I restarted the
> server, I began to see the output. The weird thing is that the output of
> @INC in modperl_inc.pl is very different from the output of @INC in my
> test script (see example at end of email).
> 
> Also, I found the blib paths in t/conf/apache_test_config.pm and decided
> to comment those out to see what would happen. As you can see from the
> output of @INC below, those changes did not appear to have any effect.
> Is the apache_test_config.pm file documented anywhere? What is this file
> doing?
> 
> Thanks,
> William
> 
> ---------------------------------------------------------------------
> setting ulimit to allow core files
> ulimit -c unlimited; t/TEST 't/02WebBase.t'
> /usr/local/apache/bin/httpd -d /home/quicktel/QT-Web/t -f
> /home/quicktel/QT-Web/t/conf/httpd.conf -DAPACHE1 
> using Apache/1.3.29 
> waiting 60 seconds for server to start: 00:00$VAR1 = [
>           '/home/quicktel/QT-Web/lib',
>           '/home/quicktel/QT-Web/blib/lib',
>           '/home/quicktel/QT-Web/blib/arch',
>           '/home/quicktel/QT-Web/t',
>           '/usr/local/lib/perl5/5.8.2/i686-linux',
>           '/usr/local/lib/perl5/5.8.2',
>           '/usr/local/lib/perl5/site_perl/5.8.2/i686-linux',
>           '/usr/local/lib/perl5/site_perl/5.8.2',
>           '/usr/local/lib/perl5/site_perl',
>           '/usr/share/perl5/',
>           '.',
>           '/home/quicktel/QT-Web/t/',
>           '/home/quicktel/QT-Web/t/lib/perl'
>         ];

As you can see after modperl_inc.pl the @INC is correct ('lib' is first).

> waiting 60 seconds for server to start: ok (waited 1 secs)
> server localhost:8529 started
> server localhost:8530 listening (*)
> 02WebBase....ok 2/11[Tue Dec 23 10:22:45 2003] 02WebBase.t: $VAR1 = [        
> [Tue Dec 23 10:22:45 2003] 02WebBase.t: '/home/quicktel/QT-Web/blib/lib',
> [Tue Dec 23 10:22:45 2003] 02WebBase.t: '/home/quicktel/QT-Web/blib/arch',
> [Tue Dec 23 10:22:45 2003] 02WebBase.t: '/home/quicktel/QT-Web/lib',
> [Tue Dec 23 10:22:45 2003] 02WebBase.t:           'lib',
> [Tue Dec 23 10:22:45 2003] 02WebBase.t: '/usr/local/lib/perl5/5.8.2/i686-linux',
> [Tue Dec 23 10:22:45 2003] 02WebBase.t: '/usr/local/lib/perl5/5.8.2',
> [Tue Dec 23 10:22:45 2003] 02WebBase.t: '/usr/local/lib/perl5/site_perl/5.8.2/i686-linux',
> [Tue Dec 23 10:22:45 2003] 02WebBase.t: '/usr/local/lib/perl5/site_perl/5.8.2',
> [Tue Dec 23 10:22:45 2003] 02WebBase.t: '/usr/local/lib/perl5/site_perl',
> [Tue Dec 23 10:22:45 2003] 02WebBase.t:           '/usr/share/perl5/',
> [Tue Dec 23 10:22:45 2003] 02WebBase.t:           '.'
> [Tue Dec 23 10:22:45 2003] 02WebBase.t:         ];

So you must have messed things up and added blib somewhere by yourself. I 
think the easiest way to fix it if you can't find it yourself is to upload 
your tar.gz with all files somewhere, post the URL here and we will look at it.

p.s. I'm leaving in about 8 hours and will be back next week, but may be Geoff 
will be able to look at it.



__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


Re: APACHE_TEST_LIVE_DEV

Posted by William McKee <wi...@knowmad.com>.
Stas,

A bit more testing has revealed more about modperl_inc.pl to me. I had
neglected to realize that modperl_inc.pl only gets loaded on server
startup. I had been running my tests using the following commands:
	t/TEST -start
	t/TEST -run-tests

When I made the changes to modperl_inc.pl, I had not restarted the
server and therefore did not see the @INC output. Once I restarted the
server, I began to see the output. The weird thing is that the output of
@INC in modperl_inc.pl is very different from the output of @INC in my
test script (see example at end of email).

Also, I found the blib paths in t/conf/apache_test_config.pm and decided
to comment those out to see what would happen. As you can see from the
output of @INC below, those changes did not appear to have any effect.
Is the apache_test_config.pm file documented anywhere? What is this file
doing?

Thanks,
William

---------------------------------------------------------------------
setting ulimit to allow core files
ulimit -c unlimited; t/TEST 't/02WebBase.t'
/usr/local/apache/bin/httpd -d /home/quicktel/QT-Web/t -f
/home/quicktel/QT-Web/t/conf/httpd.conf -DAPACHE1 
using Apache/1.3.29 
waiting 60 seconds for server to start: 00:00$VAR1 = [
          '/home/quicktel/QT-Web/lib',
          '/home/quicktel/QT-Web/blib/lib',
          '/home/quicktel/QT-Web/blib/arch',
          '/home/quicktel/QT-Web/t',
          '/usr/local/lib/perl5/5.8.2/i686-linux',
          '/usr/local/lib/perl5/5.8.2',
          '/usr/local/lib/perl5/site_perl/5.8.2/i686-linux',
          '/usr/local/lib/perl5/site_perl/5.8.2',
          '/usr/local/lib/perl5/site_perl',
          '/usr/share/perl5/',
          '.',
          '/home/quicktel/QT-Web/t/',
          '/home/quicktel/QT-Web/t/lib/perl'
        ];
waiting 60 seconds for server to start: ok (waited 1 secs)
server localhost:8529 started
server localhost:8530 listening (*)
02WebBase....ok 2/11[Tue Dec 23 10:22:45 2003] 02WebBase.t: $VAR1 = [        
[Tue Dec 23 10:22:45 2003] 02WebBase.t: '/home/quicktel/QT-Web/blib/lib',
[Tue Dec 23 10:22:45 2003] 02WebBase.t: '/home/quicktel/QT-Web/blib/arch',
[Tue Dec 23 10:22:45 2003] 02WebBase.t: '/home/quicktel/QT-Web/lib',
[Tue Dec 23 10:22:45 2003] 02WebBase.t:           'lib',
[Tue Dec 23 10:22:45 2003] 02WebBase.t: '/usr/local/lib/perl5/5.8.2/i686-linux',
[Tue Dec 23 10:22:45 2003] 02WebBase.t: '/usr/local/lib/perl5/5.8.2',
[Tue Dec 23 10:22:45 2003] 02WebBase.t: '/usr/local/lib/perl5/site_perl/5.8.2/i686-linux',
[Tue Dec 23 10:22:45 2003] 02WebBase.t: '/usr/local/lib/perl5/site_perl/5.8.2',
[Tue Dec 23 10:22:45 2003] 02WebBase.t: '/usr/local/lib/perl5/site_perl',
[Tue Dec 23 10:22:45 2003] 02WebBase.t:           '/usr/share/perl5/',
[Tue Dec 23 10:22:45 2003] 02WebBase.t:           '.'
[Tue Dec 23 10:22:45 2003] 02WebBase.t:         ];
02WebBase....ok                                                              
All tests successful.
Files=1, Tests=11,  2 wallclock secs ( 1.66 cusr +  0.13 csys =  1.79
CPU)
server localhost:8529 shutdown
---------------------------------------------------------------------


-- 
Knowmad Services Inc.
http://www.knowmad.com

Re: APACHE_TEST_LIVE_DEV

Posted by William McKee <wi...@knowmad.com>.
On Mon, Dec 22, 2003 at 04:02:20PM -0800, Stas Bekman wrote:
> By putting it last (after blib):
>  <snip>
> it ensures that it'll be first in @INC. So it does it right.

Yes, of course, that makes sense. However, when I dump my @INC the blib
directories show up above the project/lib directory:

$VAR1 = [
	'/home/quicktel/QT-Web/blib/lib',
	'/home/quicktel/QT-Web/blib/arch',
	'/home/quicktel/QT-Web/lib',
	'lib',
	'/usr/local/lib/perl5/5.8.2/i686-linux',
	'/usr/local/lib/perl5/5.8.2',
	'/usr/local/lib/perl5/site_perl/5.8.2/i686-linux',
	'/usr/local/lib/perl5/site_perl/5.8.2',
	'/usr/local/lib/perl5/site_perl',
	'/usr/share/perl5/',
	'.'
];



> Show us an example of a module that you put in project/lib/ and it finds 
> the blib/ one instead. Are you sure you fully qualify the package name in 
> lib/?

I'm not sure what you want to see. I know that if I run make before
running the test, my changes are seen. Otherwise, they are skipped.


> >Questions:
> >	1) Why is t/TEST -config adding the blib paths?
> 
> it has to, because not all packages contain only .pm files, but .xs too and 
> they end up in blib/.

OK.


> >	2) Why aren't my changes to modperl_inc.pl affecting the @INC hash?
> 
> they do. Have you dumped your @INC? Are you sure you aren't calling 'use 
> blib' somewhere in your code?

Yes, see above for dump. I know that I didn't manually add the blib
paths to my modules and grepping the lib directory for blib turns up
nothing. Could the blib paths be getting added by the make operation?


> e.g. change modperl_inc.pl to dump @INC at the end of the file. I'm pretty 
> sure that lib is the first dir.

OK, I was dumping it from within my test. Well, adding the following
line:

  warn Dumper(\@INC);

Didn't output anything. It seems like A-T is not accessing this file at
all. So, that begs the question of how are the blib paths getting set at
all?


> >I can't seem to find much documentation about the modperl_inc.pl or
> >modperl_startup.pl files. Any pointers would be most appreciated!
> 
> Right, there is no documentation. Patches are welcome.

If I can shed some more light on these files, I'd be glad to contribute
a patch. First, I need to figure out how they are working/not working.

Thanks,
William

-- 
Knowmad Services Inc.
http://www.knowmad.com

Re: APACHE_TEST_LIVE_DEV

Posted by Stas Bekman <st...@stason.org>.
William McKee wrote:
> Hi again,
> 
> More problems with configuring my Apache::Test setup. I have
> successfully added the Apache::Test framework into a current project. As
> I'm adding new tests, I need to update the code in my modules. To this
> end, I followed the advice in the docs to set APACHE_TEST_LIVE_DEV.
> 
> Running t/TEST -config correctly created the modperl_inc.pl with the
> path to my project/lib directory. However, it also adds paths to the
> blib directory above this one which means that I have to run make each
> time my modules change in order to get my test server to see the
> updates (currently I'm using t/TEST -run-tests to prevent restarting the
> server everytime). Deleting the blib paths (there are 2 that get added)
> does not make any difference (even if I restart the test server).

By putting it last (after blib):

use lib '/home/stas/work/modules/Apache-Filter-HTTPHeadersFixup/t/response';
use lib '/home/stas/work/modules/Apache-Filter-HTTPHeadersFixup/blib/arch';
use lib '/home/stas/work/modules/Apache-Filter-HTTPHeadersFixup/blib/lib';
use Apache2;
use lib '/home/stas/work/modules/Apache-Filter-HTTPHeadersFixup/lib';

it ensures that it'll be first in @INC. So it does it right.

Show us an example of a module that you put in project/lib/ and it finds the 
blib/ one instead. Are you sure you fully qualify the package name in lib/?

> Questions:
> 	1) Why is t/TEST -config adding the blib paths?

it has to, because not all packages contain only .pm files, but .xs too and 
they end up in blib/.

> 	2) Why aren't my changes to modperl_inc.pl affecting the @INC hash?

they do. Have you dumped your @INC? Are you sure you aren't calling 'use blib' 
somewhere in your code?

e.g. change modperl_inc.pl to dump @INC at the end of the file. I'm pretty 
sure that lib is the first dir.

> I can't seem to find much documentation about the modperl_inc.pl or
> modperl_startup.pl files. Any pointers would be most appreciated!

Right, there is no documentation. Patches are welcome.

__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com