httpd-test-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stas Bekman <s...@stason.org>
Subject Re: Apache-Test and Cwd
Date Wed, 21 Jan 2004 20:39:19 GMT
David Wheeler wrote:
> On Jan 20, 2004, at 11:20 PM, Stas Bekman wrote:
> 
>> Does the patch below solve the problem?
> 
> 
> Maybe, but it's not quite there yet:
> 
>  Can't locate object method "chdir_t" via package "Apache::TestHarness" 
> at lib/Apache/TestRun.pm line 648.

Sorry, David, I guess I was testing with the wrong version. Here is a new 
patch. It breaks quite a few tests in modperl-2.0 but it's because they rely 
on that chdir_t, and can be fixed to be relocatable. It's possible that there 
are other implications, but I believe they all can be fixed. But first let me 
know if that patch does the trick for you.

Index: lib/Apache/TestHarness.pm
===================================================================
RCS file: 
/home/cvs/httpd-test/perl-framework/Apache-Test/lib/Apache/TestHarness.pm,v
retrieving revision 1.12
diff -u -r1.12 TestHarness.pm
--- lib/Apache/TestHarness.pm	12 Sep 2003 02:20:27 -0000	1.12
+++ lib/Apache/TestHarness.pm	21 Jan 2004 20:36:44 -0000
@@ -6,16 +6,10 @@
  use Test::Harness ();
  use Apache::TestSort ();
  use Apache::TestTrace;
-use File::Spec::Functions qw(catfile);
+use File::Spec::Functions qw(catfile catdir);
  use File::Find qw(finddepth);
  use File::Basename qw(dirname);

-sub chdir_t {
-    chdir 't' if -d 't';
-#Apache::TestConfig->new takes care of @INC
-#    inc_fixup();
-}
-
  sub inc_fixup {
      # use blib
      unshift @INC, map "blib/$_", qw(lib arch);
@@ -101,14 +95,14 @@
      my $args = shift;
      my @tests = ();

-    chdir_t();
+    my $base = -d 't' ? catdir('t', '.') : '.';

      my $ts = $args->{tests} || [];

      if (@$ts) {
  	for (@$ts) {
  	    if (-d $_) {
-		push(@tests, sort <$_/*.t>);
+		push(@tests, sort <$base/$_/*.t>);
  	    }
  	    else {
  		$_ .= ".t" unless /\.t$/;
@@ -118,7 +112,7 @@
      }
      else {
          if ($args->{tdirs}) {
-            push @tests, map { sort <$_/*.t> } @{ $args->{tdirs} };
+            push @tests, map { sort <$base/$_/*.t> } @{ $args->{tdirs} };
          }
          else {
              finddepth(sub {
@@ -127,7 +121,7 @@
                            my $dotslash = catfile '.', "";
                            $t =~ s:^\Q$dotslash::;
                            push @tests, $t
-                      }, '.');
+                      }, $base);
              @tests = sort @tests;
          }
      }
Index: lib/Apache/TestRun.pm
===================================================================
RCS file: /home/cvs/httpd-test/perl-framework/Apache-Test/lib/Apache/TestRun.pm,v
retrieving revision 1.143
diff -u -r1.143 TestRun.pm
--- lib/Apache/TestRun.pm	18 Jan 2004 08:34:29 -0000	1.143
+++ lib/Apache/TestRun.pm	21 Jan 2004 20:36:45 -0000
@@ -645,8 +645,6 @@

      my(@argv) = @_;

-    Apache::TestHarness->chdir_t;
-
      $self->getopts(\@argv);

      $self->pre_configure() if $self->can('pre_configure');


__________________________________________________________________
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