You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@perl.apache.org by Stas Bekman <st...@stason.org> on 2002/04/06 16:48:15 UTC

testing in sub-projects problems summary

There are at least two problems with sub-projects which want to have their
own test suite. These problems are relevant to the Apache-Test sub-project
as well:

1. Apache::TestMM's export of MY::test and MY::clean works only once,
   which is the top level. Any other attempts to repeat the import
   elsewhere results in default t/*.t as generated by normal
   ExtUtils::MakeMaker (i.e. MY::test is not seen by 
   ModPerl::MM::WriteMakefile)

  As a temp workaround I've used an explicit aliasing in Makefile.PL's, 
  which allowed me to use t/TEST when 'make test' is called:

use Apache::TestMM;

*MY::test  = \&Apache::TestMM::test;
*MY::clean = \&Apache::TestMM::clean;

but that's not what we want. I'm not sure why MY package can be seen
only in the first caller of Apache::TestMM::import.

2. Apache::Test finds an already installed libmodperl.so and uses it
   in the LoadModule directive in the sub-project's httpd.conf,
   instead of using the one just built under the parent
   directory. I've tried the following workaround, but something else
   is missing since the server doesn't start and doesn't print any
   error or segfaults... it just silently quits.

   This is the workaround I've used.

--- ModPerl-Registry/t/TEST.PL	13 Nov 2001 04:35:26 -0000	1.3
+++ ModPerl-Registry/t/TEST.PL	6 Apr 2002 14:26:51 -0000
@@ -9,7 +9,7 @@
 use Apache::TestRunPerl ();
 
 package MyTest;
-
+use Cwd ();
 our @ISA = qw(Apache::TestRunPerl);
 
 # subclass new_test_config to add some config vars which will be
@@ -17,7 +17,10 @@
 sub new_test_config {
     my $self = shift;
 
+    my $cwd = Cwd::cwd();
+
     $self->{conf_opts}->{maxclients} = 2;
+    $self->{conf_opts}->{libmodperl} = "$cwd/../../src/modules/perl/libmodperl.so";
 
     return $self->SUPER::new_test_config;
 }



__________________________________________________________________
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


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Re: testing in sub-projects problems summary

Posted by Stas Bekman <st...@stason.org>.
>>>you could just do:
>>>       $self->{conf_opts}->{src_dir} = "$cwd/../..";
>>
>                                             ^^^^^^^^^^
> 
>>     $self->{conf_opts}->{src_dir} = "$cwd/../../src";
>>
>>doesn't seem to do the trick, still finds the one installed on the system.
> 
> 
> try without '/src'

I've tried both, with the same effect.

-- 


__________________________________________________________________
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



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Re: testing in sub-projects problems summary

Posted by Stas Bekman <st...@stason.org>.
>>While debugging the problem, I've noticed that if the Makefile.PL in 
>>sub-dirs fails, it's silently swallowed. I think it should croak. Is it 
>>a problem with MakeMaker in general or something specific to 
>>modperl-2.0/Makefile.PL? Most likely the former.
> 
> 
> this would be a MakeMaker issue.  it should at least warn, from 
> MakeMaker.pm:
> sub eval_in_x {
> ...
>     if ($@) {
> ...
>         warn "WARNING from evaluation of $dir/Makefile.PL: $@";

thanks, I've tested it outside of modperl and reported to the makemaker 
list.

__________________________________________________________________
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


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Re: testing in sub-projects problems summary

Posted by Doug MacEachern <do...@covalent.net>.
On Mon, 8 Apr 2002, Stas Bekman wrote:

> ok, the patch at the end solves the problem. Now any sub-dir can enjoy 
> from imported My::test, etc.

looks right to me, +1
 
> While debugging the problem, I've noticed that if the Makefile.PL in 
> sub-dirs fails, it's silently swallowed. I think it should croak. Is it 
> a problem with MakeMaker in general or something specific to 
> modperl-2.0/Makefile.PL? Most likely the former.

this would be a MakeMaker issue.  it should at least warn, from 
MakeMaker.pm:
sub eval_in_x {
...
    if ($@) {
...
        warn "WARNING from evaluation of $dir/Makefile.PL: $@";


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Re: testing in sub-projects problems summary

Posted by Stas Bekman <st...@stason.org>.
Doug MacEachern wrote:
> On Sun, 7 Apr 2002, Stas Bekman wrote:
>  
> 
>>Yes, but how does it help with Apache::TestMM?
> 
> 
> well, there's a comment explains what's going on.
> and code to work around the problem.
> 
> 
>>Its import() already does a similar thing.
> 
> 
> no, that is not the same.
> 
> 
>>Should it unconditionaly force the aliasing? In fact 
>>I've tried that, didn't seem to work.
> 
> 
> not sure what you tried exactly.  but notice ModPerl::MM::WriteMakefile 
> calls my_import(), to make it happen for each subdir Makefile.PL
> and ModPerl::MM::my_import only takes care of itself, not the functions in 
> Apache::TestMM.

ok, the patch at the end solves the problem. Now any sub-dir can enjoy 
from imported My::test, etc.

While debugging the problem, I've noticed that if the Makefile.PL in 
sub-dirs fails, it's silently swallowed. I think it should croak. Is it 
a problem with MakeMaker in general or something specific to 
modperl-2.0/Makefile.PL? Most likely the former.


Index: Apache-Test/lib/Apache/TestMM.pm
===================================================================
RCS file: 
/home/cvs/httpd-test/perl-framework/Apache-Test/lib/Apache/TestMM.pm,vretrieving 
revision 1.15
diff -u -r1.15 TestMM.pm
--- Apache-Test/lib/Apache/TestMM.pm    23 Dec 2001 16:16:24 -0000      1.15
+++ Apache-Test/lib/Apache/TestMM.pm    7 Apr 2002 17:27:41 -0000
@@ -16,8 +16,9 @@
          }
          no strict 'refs';
          my $sub = "MY::$section";
-        #e.g. modperl-2.0/Makefile.PL pulls in Apache-Test/Makefile.PL
-        next if defined &$sub;
+        # Force aliasing, since previous WriteMakefile might have
+        # moved it
+        undef &$sub if defined &$sub;
          *$sub = \&{$section};
      }
  }



__________________________________________________________________
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


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Re: testing in sub-projects problems summary

Posted by Doug MacEachern <do...@covalent.net>.
On Sun, 7 Apr 2002, Stas Bekman wrote:
 
> Yes, but how does it help with Apache::TestMM?

well, there's a comment explains what's going on.
and code to work around the problem.

> Its import() already does a similar thing.

no, that is not the same.

> Should it unconditionaly force the aliasing? In fact 
> I've tried that, didn't seem to work.

not sure what you tried exactly.  but notice ModPerl::MM::WriteMakefile 
calls my_import(), to make it happen for each subdir Makefile.PL
and ModPerl::MM::my_import only takes care of itself, not the functions in 
Apache::TestMM.
 
> > you could just do:
> >        $self->{conf_opts}->{src_dir} = "$cwd/../..";
                                            ^^^^^^^^^^
>      $self->{conf_opts}->{src_dir} = "$cwd/../../src";
> 
> doesn't seem to do the trick, still finds the one installed on the system.

try without '/src'


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Re: testing in sub-projects problems summary

Posted by Stas Bekman <st...@stason.org>.
Doug MacEachern wrote:
> On Sat, 6 Apr 2002, Stas Bekman wrote:
>  
> 
>>but that's not what we want. I'm not sure why MY package can be seen
>>only in the first caller of Apache::TestMM::import.
> 
> 
> see ModPerl::MM::my_import

Yes, but how does it help with Apache::TestMM? Its import() already does 
a similar thing. Should it unconditionaly force the aliasing? In fact 
I've tried that, didn't seem to work.

>>     $self->{conf_opts}->{maxclients} = 2;
>>+    $self->{conf_opts}->{libmodperl} = "$cwd/../../src/modules/perl/libmodperl.so";
> 
> 
> don't want to hardcode the 'libmodperl' name.
> you could just do:
>        $self->{conf_opts}->{src_dir} = "$cwd/../..";
> 
> then it can find the .so relative to that under src/modules/perl/

     $self->{conf_opts}->{src_dir} = "$cwd/../../src";

doesn't seem to do the trick, still finds the one installed on the system.

__________________________________________________________________
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


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Re: testing in sub-projects problems summary

Posted by Doug MacEachern <do...@covalent.net>.
On Sat, 6 Apr 2002, Stas Bekman wrote:
 
> but that's not what we want. I'm not sure why MY package can be seen
> only in the first caller of Apache::TestMM::import.

see ModPerl::MM::my_import
 
>      $self->{conf_opts}->{maxclients} = 2;
> +    $self->{conf_opts}->{libmodperl} = "$cwd/../../src/modules/perl/libmodperl.so";

don't want to hardcode the 'libmodperl' name.
you could just do:
       $self->{conf_opts}->{src_dir} = "$cwd/../..";

then it can find the .so relative to that under src/modules/perl/


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org