httpd-test-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stas Bekman <s...@stason.org>
Subject [A-T patch] changing should_skip_module to support regex skip patterns
Date Thu, 06 Jan 2005 17:57:47 GMT
As you can see from the email below, some modules embed a version number 
in the module 'mod_fastcgi-2.4.2-AP20.dll'. Our should_skip_module only 
matches an exact name. The patch at the end of this email extends the 
functionality to support regex skip arguments. Let me know if you have any 
objections to this change.

The only bad things about this change is that it slows things a bit (now 
needs to iterate over all entries in skip list on each module, previously 
it was a single hash lookup).

Nick, also please confirm that the patch below *does* work for you :) Thanks.

Nick *** wrote:
>  >Nick *** wrote:
>  >
>  >>> Are you running the latest dev svn?
>  >> 
>  >> The latest svn is fine. I just removed the patch in order to test more
>  >> this issue, and that's the coredump...
>  >
>  >Understood. I certainly don't have the time to look at fastcgi problems at 
>  >the moment. If someone can that would be great.
>  >
>  >so we are all well on this setup. Great!
> 
> Not quite well with RC3.

> When executing this code in TestRun.pm
> 
> # - don't inherit LoadModule perl_module from the apache httpd.conf
> # - loaded fastcgi crashes some mp2 tests
> my %skip = map { ("mod_$_.c" => 1) } qw(perl fastcgi);
> sub should_skip_module {
>     my($self, $name) = @_;
> 	print "\n\n$name\n\n";
>     exists $skip{$name} ? 1 : $self->SUPER::should_skip_module($name);
> }
> 
> and checking for fastcgi, the value of $name is 'mod_fastcgi-2.4.2-AP20.dll' and not
'mod_fastcgi.c', so the module is loaded and the tests fail again.

Please try this patch:

Index: lib/ModPerl/TestRun.pm
===================================================================
--- lib/ModPerl/TestRun.pm	(revision 124346)
+++ lib/ModPerl/TestRun.pm	(working copy)
@@ -64,12 +64,9 @@

  # - don't inherit LoadModule perl_module from the apache httpd.conf
  # - loaded fastcgi crashes some mp2 tests
-my %skip = map { ("mod_$_.c" => 1) } qw(perl fastcgi);
-sub should_skip_module {
-    my($self, $name) = @_;
+my @skip = ('mod_perl.c', qr/mod_fastcgi.*?\.c$/);

-    exists $skip{$name} ? 1 : $self->SUPER::should_skip_module($name);
-}
+Apache::TestConfig::autoconfig_skip_module_add(@skip);

  1;

Index: Apache-Test/lib/Apache/TestConfigParse.pm
===================================================================
--- Apache-Test/lib/Apache/TestConfigParse.pm	(revision 124346)
+++ Apache-Test/lib/Apache/TestConfigParse.pm	(working copy)
@@ -162,20 +162,28 @@
  #XXX mod_jk requires JkWorkerFile or JkWorker to be configured
  #skip it for now, tomcat has its own test suite anyhow.
  #XXX: mod_casp2.so requires other settings in addition to LoadModule
-my %autoconfig_skip_module = map { $_, 1 } qw(mod_jk.c mod_casp2.c);
+my @autoconfig_skip_module = qw(mod_jk.c mod_casp2.c);

  # add modules to be not inherited from the existing config.
  # e.g. prevent from LoadModule perl_module to be included twice, when
  # mod_perl already configures LoadModule and it's certainly found in
  # the existing httpd.conf installed system-wide.
  sub autoconfig_skip_module_add {
-    my($name) = @_;
-    $autoconfig_skip_module{$name} = 1;
+    push @autoconfig_skip_module, @_;
  }

  sub should_skip_module {
      my($self, $name) = @_;
-    return $autoconfig_skip_module{$name} ? 1 : 0;
+
+    for (@autoconfig_skip_module) {
+        if (UNIVERSAL::isa($_, 'Regexp')) {
+            return 1 if $name =~ /$_/;
+        }
+        else {
+            return 1 if $name eq $_;
+        }
+    }
+    return 0;
  }

  #inherit LoadModule
@@ -192,7 +200,8 @@
          }

          my $name = basename $args->[1];
-        $name =~ s/\.s[ol]$/.c/;  #mod_info.so => mod_info.c
+        $name =~ s/\.(s[ol]|dll)$/.c/;  #mod_info.so => mod_info.c
+        $name =~ s/\.dll$/.c/;  #mod_info.so => mod_info.c
          $name =~ s/^lib/mod_/; #libphp4.so => mod_php4.c

          $name = $modname_alias{$name} if $modname_alias{$name};

-- 
__________________________________________________________________
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

Mime
View raw message