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 Joe Orton <jo...@redhat.com> on 2004/02/27 10:52:13 UTC

[PATCH] fix @INC when running all.t

The all.t tests are all failing for me on HEAD with errors like:

Can't locate Apache/Test.pm in @INC (@INC contains: ../Apache-Test/lib 
/usr/lib/perl5/5.8.1/i386-linux-thread-multi /usr/lib/perl5/5.8.1 
etc etc .) at 
t/ssl/all.t line 4.

from an strace, the cwd of the process is the top-level perl-framework
directory, so INC should be pointed at the Apache-Test subdir directly
rather than ../Apache-Test.

It works if you also have Apache-Test installed in the system site_perl
directory of course, which I have on most boxes so only just noticed
this.  This fixes it for me, OK to checkin?

Index: Apache-Test/lib/Apache/TestHarness.pm
===================================================================
RCS file: /home/cvs/httpd-test/perl-framework/Apache-Test/lib/Apache/TestHarness.pm,v
retrieving revision 1.15
diff -u -r1.15 TestHarness.pm
--- Apache-Test/lib/Apache/TestHarness.pm	23 Feb 2004 20:37:39 -0000	1.15
+++ Apache-Test/lib/Apache/TestHarness.pm	27 Feb 2004 09:43:53 -0000
@@ -49,7 +49,7 @@
 sub run_t {
     my($self, $file) = @_;
     my $ran = 0;
-    my $cmd = "$^X -Mlib=../Apache-Test/lib $file";
+    my $cmd = "$^X -Mlib=Apache-Test/lib $file";
 
     my $h = Symbol::gensym();
     open $h, "$cmd|" or die "open $cmd: $!";

Re: [PATCH] fix @INC when running all.t

Posted by Stas Bekman <st...@stason.org>.
Rodent of Unusual Size wrote:
> Joe Orton wrote:
> 
>>>my $lib = catfile Apache::Test::vars('top_dir'), qw(Apache-Test lib);
>>>my $cmd = "$^X -Mlib=$lib $file";
> 
> 
> i don't think catfile does things like space-escaping, so wouldn't
> 
> my $lib = catfile Apache::Test::vars('top_dir'), qw(Apache-Test lib);
> my $cmd = "$^X -Mlib=\"$lib\" $file";
> 
> be better for things that might be in (for instance) "C:\Program Files\foo" ?

Good thinking, Ken. Please commit that change.

Though backslashism is not nice. Better write:

my $cmd = qq[$^X -Mlib="$lib" $file];

Thanks.

__________________________________________________________________
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: [PATCH] fix @INC when running all.t

Posted by Rodent of Unusual Size <Ke...@Golux.Com>.
Joe Orton wrote:
>> 
>> my $lib = catfile Apache::Test::vars('top_dir'), qw(Apache-Test lib);
>> my $cmd = "$^X -Mlib=$lib $file";

i don't think catfile does things like space-escaping, so wouldn't

my $lib = catfile Apache::Test::vars('top_dir'), qw(Apache-Test lib);
my $cmd = "$^X -Mlib=\"$lib\" $file";

be better for things that might be in (for instance) "C:\Program Files\foo" ?
-- 
#ken	P-)}

Ken Coar, Sanagendamgagwedweinini  http://Ken.Coar.Org/
Author, developer, opinionist      http://Apache-Server.Com/

"Millennium hand and shrimp!"


Re: [PATCH] fix @INC when running all.t

Posted by Joe Orton <jo...@redhat.com>.
On Fri, Feb 27, 2004 at 03:04:20AM -0800, Stas Bekman wrote:
> Joe Orton wrote:
> >It works if you also have Apache-Test installed in the system site_perl
> >directory of course, which I have on most boxes so only just noticed
> >this.  This fixes it for me, OK to checkin?
> 
> Yup. That's one of those remaining places that have relied on the fact that 
> we were running from within t/. It should be fixed in a better way, using a 
> full path, concating the value of $config->vars->{top_dir} and 
> "Apache-Test/lib"
> 
> my $lib = catfile Apache::Test::vars('top_dir'), qw(Apache-Test lib);
> my $cmd = "$^X -Mlib=$lib $file";

Hokay, thanks, committed that.

Re: [PATCH] fix @INC when running all.t

Posted by Stas Bekman <st...@stason.org>.
Joe Orton wrote:
> The all.t tests are all failing for me on HEAD with errors like:
> 
> Can't locate Apache/Test.pm in @INC (@INC contains: ../Apache-Test/lib 
> /usr/lib/perl5/5.8.1/i386-linux-thread-multi /usr/lib/perl5/5.8.1 
> etc etc .) at 
> t/ssl/all.t line 4.
> 
> from an strace, the cwd of the process is the top-level perl-framework
> directory, so INC should be pointed at the Apache-Test subdir directly
> rather than ../Apache-Test.
> 
> It works if you also have Apache-Test installed in the system site_perl
> directory of course, which I have on most boxes so only just noticed
> this.  This fixes it for me, OK to checkin?

Yup. That's one of those remaining places that have relied on the fact that we 
were running from within t/. It should be fixed in a better way, using a full 
path, concating the value of $config->vars->{top_dir} and "Apache-Test/lib"

my $lib = catfile Apache::Test::vars('top_dir'), qw(Apache-Test lib);
my $cmd = "$^X -Mlib=$lib $file";

> Index: Apache-Test/lib/Apache/TestHarness.pm
> ===================================================================
> RCS file: /home/cvs/httpd-test/perl-framework/Apache-Test/lib/Apache/TestHarness.pm,v
> retrieving revision 1.15
> diff -u -r1.15 TestHarness.pm
> --- Apache-Test/lib/Apache/TestHarness.pm	23 Feb 2004 20:37:39 -0000	1.15
> +++ Apache-Test/lib/Apache/TestHarness.pm	27 Feb 2004 09:43:53 -0000
> @@ -49,7 +49,7 @@
>  sub run_t {
>      my($self, $file) = @_;
>      my $ran = 0;
> -    my $cmd = "$^X -Mlib=../Apache-Test/lib $file";
> +    my $cmd = "$^X -Mlib=Apache-Test/lib $file";
>  
>      my $h = Symbol::gensym();
>      open $h, "$cmd|" or die "open $cmd: $!";


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