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: skipping and installing
Date Mon, 23 Feb 2004 18:52:17 GMT
Geoffrey Young wrote:
>>-    $file ||= 'SKIP';
>>+    $file ||= 't/SKIP';
> 
> 
> excellent, thanks for tracking that down.
> 
> we just need to be a bit more platform independent.  if you could verify
> that the attached patch works ok for you, I'll commit it.

> Index: lib/Apache/TestHarness.pm
> ===================================================================
> RCS file: /home/cvspublic/httpd-test/perl-framework/Apache-Test/lib/Apache/TestHarness.pm,v
> retrieving revision 1.13
> diff -u -r1.13 TestHarness.pm
> --- lib/Apache/TestHarness.pm	31 Jan 2004 01:12:17 -0000	1.13
> +++ lib/Apache/TestHarness.pm	23 Feb 2004 17:40:32 -0000
> @@ -23,7 +23,7 @@
>  #skip tests listed in t/SKIP
>  sub skip {
>      my($self, $file) = @_;
> -    $file ||= 'SKIP';
> +    $file ||= catfile Apache::Test::vars('serverroot'), 'SKIP';

Geoff, you are making a good point of removing the hardcoding of t/ towards 
the idea of being able to split the test suite. There are a few other places 
where t/ is hardcoded. But at those places, e.g.:

Apache-Test/lib/Apache/TestRun.pm:                push @tests, "t/$arg";
Apache-Test/lib/Apache/TestRun.pm:                push @tests, "t/$arg.t";

Apache::Test::vars('serverroot') is not available yet. So perhaps we need to 
deduct the serverroot directory from the location of the driving script. I'd 
think in the recently added code in TestRun.pm:

sub run {
     my $self = shift;

     # assuming that test files are always in the same directory as the
     # driving script, make it possible to run the test suite from any place
     # use a full path, which will work after chdir (e.g. ./TEST)
     $0 = File::Spec->rel2abs($0);
     if (-e $0) {
         my $top = dirname dirname $0;
         chdir $top if $top and -d $top;
     }

So may be it should be:

my $server_root;
my $project_root;
sub server_root { $server_root }
sub project_root { $project_root }
sub run {
     my $self = shift;

     # assuming that test files are always in the same directory as the
     # driving script, make it possible to run the test suite from any place
     # use a full path, which will work after chdir (e.g. ./TEST)
     $0 = File::Spec->rel2abs($0);
     if (-e $0) {
         $server_root = dirname $0;
         $project_root = dirname $server_root;
         chdir $project_root if $project_root and -d $project_root;
     }

and now server_root() and project_root() are available across the A-T project.

That's of course if all projects will always put TEST (or its equivalent) in 
t/ or another directory.

__________________________________________________________________
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