You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Stas Bekman <st...@stason.org> on 2003/04/28 05:09:51 UTC

[ANNOUNCE] Apache::Test 1.0

The uploaded file

     Apache-Test-1.0.tar.gz

has entered CPAN as

   file: $CPAN/authors/id/S/ST/STAS/Apache-Test-1.0.tar.gz
   size: 74795 bytes
    md5: 79c80c26083ea27c75006d47ef9061a4

Recent changes:

when inheriting httpd.conf on some platforms SERVER_CONFIG_FILE is an
absolute path, so try to use that if found. [Haroon Rafique
<ha...@utoronto.ca>]

new Apache::Test functions:
have_min_apache_version - to require a minimal Apache version.
have_apache_version     - to require a specific Apache version.
[Stas]

Apache::TestUtil API change:
write_perl_script  => t_write_perl_script
write_shell_script => t_write_shell_script
chown              => t_chown
All 3 functions are now optionally exported [Geoffrey Young].

Provide a new request macro _BODY_ASSERT to replace _BODY in cases
where the client part of the test directly prints to the output, in
order to avoid skipped tests instead of reporting the failure of the
server side. Use it in automatically generated tests. [Stas]

httpd (1.3 && 2) / winFU have problems when the first path's segment
includes ':' (security precaution which breaks the rfc) so we can't
use /TestFoo::bar as path_info in Apache::Tests. Adjusting all tests
to use /TestFoo__bar. [Stas]

change Apache::TestConfig::filter_args to accept arguments which
aren't only key/value pairs, but also tokens like 'FOO=1' [Stas]

In autogenerated t/TEST, make sure not to include 'use Apache2' for
the mod_perl 2.0 build itself [Stas]

avoid starting httpd with 'Group root' when running the test suite
under root [Stas]

add support for 'make test TEST_VERBOSE=1 "TEST_FILES=foo bar"' [Stas]

Apache::Test now can run 'make test' under 'root', without permission
problems (e.g. when files need to be written), it'll chown all the
files under t/ to the user chosen to run the server with, before
running the tests and will restore the permissions at the end. [Stas]

don't inherit loading of the mod_perl object from the system-wide
config, since Apache::TestRunPerl already configures it [Stas]

Support two new shortcuts for skip functionality:
  - have_threads: checks whether both Apache and Perl support threads
  - under_construction: to print a consistent/clear skip reason
[Stas]

Support <NoAutoConfig> </NoAutoConfig> blocks in .pm files, so we can
have a full manual control over generated config sections. These
sections are fully parsed and variables are substituted, including
vhosts. [Stas]

Implement a more robust autogenerated client .t test in
Apache::TestConfigPerl. Before this fix if the server side returned
500, the test would get skipped, not good. Now it will die a horrible
death. [Stas]

Before v1.0 most changes were logged in modperl-2.0/Changes (see
mod_perl <= v1.99_08).



__________________________________________________________________
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: [ANNOUNCE] Apache::Test 1.0

Posted by Stas Bekman <st...@stason.org>.
Randal L. Schwartz wrote:
>>>>>>"Randal" == Randal L Schwartz <me...@stonehenge.com> writes:
>>>>>
> 
> Randal>                              'proxy' => 'off',
> Randal>                              'serveradmin' => 'merlyn@localhost',
> Randal>                              'authname' => 'gold club',
> Randal>                              'remote_addr' => '127.0.0.1',
> Randal>                              'perlpod' => '',
> Randal>                              'sslcaorg' => 'asf',
> Randal>                              'ssl_module' => 'mod_ssl.c',
> Randal>                              'auth_module' => 'mod_auth.c',
> Randal>                              'access_module' => 'mod_access.c',
> 
> Randal> Dunno if it's significant that this particular line has an empty value.
> 
> Randal> It says it's autogenerated, but since I don't know anything about
> Randal> Apache::Test, I really don't know where to look to look upstream.
> 
> Ahh.  Autogenerated in Apache::TestConfig.pm, using something like this:
> 
> perl -le 'print for grep -d "$_/pod", @INC'
> 
> Well, that prints nothing on my 5.8 installation in /opt, although for
> Perl 5.6.1 it prints the system installed Perl library for /Pod/
> (because of the lack of case sensitivity).
> 
> What exactly were you looking for there?  It's a non-portable
> presumption, apparently.  OSX Perl calls the core pod directory
> "$PREFIX/lib/5.8.0/pods", not "$SOMETHING_IN_INC/pod".  I think you
> need to get it from some Config variable, not go hunting for it.

Thanks for the analysis, Randal.

The following patch does two things:

- it won't configure Aliases which has no real value (avoid startup errors)
- if it can't find the pod dir it'll search for dirs with .pod files

Please confirm that it works for you.

Index: lib/Apache/TestConfig.pm
===================================================================
RCS file: 
/home/cvs/httpd-test/perl-framework/Apache-Test/lib/Apache/TestConfig.pm,v
retrieving revision 1.154
diff -u -r1.154 TestConfig.pm
--- lib/Apache/TestConfig.pm	23 Apr 2003 02:24:16 -0000	1.154
+++ lib/Apache/TestConfig.pm	29 Apr 2003 01:22:31 -0000
@@ -214,7 +214,7 @@
      $vars->{t_dir}        ||= catfile $vars->{top_dir}, 't';
      $vars->{serverroot}   ||= $vars->{t_dir};
      $vars->{documentroot} ||= catfile $vars->{serverroot}, 'htdocs';
-    $vars->{perlpod}      ||= $self->find_in_inc('pod');
+    $vars->{perlpod}      ||= $self->find_perlpod();
      $vars->{perl}         ||= $^X;
      $vars->{t_conf}       ||= catfile $vars->{serverroot}, 'conf';
      $vars->{sslca}        ||= catfile $vars->{t_conf}, 'ssl', 'ca';
@@ -1181,11 +1181,35 @@
      return "";
  }

+
+sub find_perlpod {
+    my($self) = @_;
+
+    my $perlpod = $self->find_in_inc('pod');
+    return $perlpod if $perlpod;
+
+    # if the /pod sub-dir wasn't found, try the slow search for .pod files
+    my %pod_dir = ();
+    for my $path (@INC) {
+        next unless -d $path;
+        finddepth(sub { $pod_dir{$File::Find::dir}++ if /\.pod$/i; }, $path);
+        my @most = sort {$pod_dir{$b} <=> $pod_dir{$a} } keys %pod_dir;
+        return $most[0] if @most;
+    }
+
+    return '';
+}
+
  sub prepare_t_conf {
      my $self = shift;
      $self->gendir($self->{vars}->{t_conf});
  }

+my %aliases = (
+    "perl-pod"     => "perlpod",
+    "binary-httpd" => "httpd",
+    "binary-perl"  => "perl",
+);
  sub generate_httpd_conf {
      my $self = shift;
      my $vars = $self->{vars};
@@ -1250,6 +1274,11 @@

      $self->replace_vars($in, $out);

+    for (keys %aliases) {
+        next unless $vars->{$aliases{$_}};
+        print $out "Alias /getfiles-$_ $vars->{$aliases{$_}}\n";
+    }
+
      print $out "\n";

      $self->postamble_run($out);
@@ -1632,9 +1661,3 @@
      SetHandler server-status
  </Location>

-#so we can test downloading some files of various size
-Alias /getfiles-perl-pod          @PerlPod@
-
-#and some big ones
-Alias /getfiles-binary-httpd      @httpd@
-Alias /getfiles-binary-perl       @perl@


__________________________________________________________________
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: [ANNOUNCE] Apache::Test 1.0

Posted by "Randal L. Schwartz" <me...@stonehenge.com>.
>>>>> "Randal" == Randal L Schwartz <me...@stonehenge.com> writes:

Randal>                              'proxy' => 'off',
Randal>                              'serveradmin' => 'merlyn@localhost',
Randal>                              'authname' => 'gold club',
Randal>                              'remote_addr' => '127.0.0.1',
Randal>                              'perlpod' => '',
Randal>                              'sslcaorg' => 'asf',
Randal>                              'ssl_module' => 'mod_ssl.c',
Randal>                              'auth_module' => 'mod_auth.c',
Randal>                              'access_module' => 'mod_access.c',

Randal> Dunno if it's significant that this particular line has an empty value.

Randal> It says it's autogenerated, but since I don't know anything about
Randal> Apache::Test, I really don't know where to look to look upstream.

Ahh.  Autogenerated in Apache::TestConfig.pm, using something like this:

perl -le 'print for grep -d "$_/pod", @INC'

Well, that prints nothing on my 5.8 installation in /opt, although for
Perl 5.6.1 it prints the system installed Perl library for /Pod/
(because of the lack of case sensitivity).

What exactly were you looking for there?  It's a non-portable
presumption, apparently.  OSX Perl calls the core pod directory
"$PREFIX/lib/5.8.0/pods", not "$SOMETHING_IN_INC/pod".  I think you
need to get it from some Config variable, not go hunting for it.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<me...@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

Re: [ANNOUNCE] Apache::Test 1.0

Posted by "Randal L. Schwartz" <me...@stonehenge.com>.
>>>>> "Randal" == Randal L Schwartz <me...@stonehenge.com> writes:

Randal> And here's the stuff around that line of the file (line 98 is the one
Randal> with perl-pod):

Randal>     <Location /server-status>
Randal>         SetHandler server-status
Randal>     </Location>

Randal>     #so we can test downloading some files of various size
Randal>     Alias /getfiles-perl-pod          

Randal>     #and some big ones
Randal>     Alias /getfiles-binary-httpd      /usr/sbin/httpd
Randal>     Alias /getfiles-binary-perl       /opt/perl/snap/bin/perl

Randal> Yeah, "that trick never works", in the words of Rocket J. Squirrel.

Oh yeah, and poking around just a tiny bit, I see this in the
apache_test_config.pm file nearby:

                             'proxy' => 'off',
                             'serveradmin' => 'merlyn@localhost',
                             'authname' => 'gold club',
                             'remote_addr' => '127.0.0.1',
                             'perlpod' => '',
                             'sslcaorg' => 'asf',
                             'ssl_module' => 'mod_ssl.c',
                             'auth_module' => 'mod_auth.c',
                             'access_module' => 'mod_access.c',

Dunno if it's significant that this particular line has an empty value.

It says it's autogenerated, but since I don't know anything about
Apache::Test, I really don't know where to look to look upstream.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<me...@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

Re: [ANNOUNCE] Apache::Test 1.0

Posted by "Randal L. Schwartz" <me...@stonehenge.com>.
>>>>> "Stas" == Stas Bekman <st...@stason.org> writes:

Stas> Remember that Apache::Test works with Apache 1.3 and Apache 2.0 w/ and
Stas> w/o mod_perl. So if you have codebases that work with both generation
Stas> it's possible to have one test suite for both.

For some meaning of "work" that doesn't include OSX, or Perl 5.8, or
something.  Here's what I get when I tried to install this:

    /usr/sbin/httpd -X -d /Volumes/UFS/opt/perl/cpan/build/Apache-Test-1.0/t -f /Volumes/UFS/opt/perl/cpan/build/Apache-Test-1.0/t/conf/httpd.conf -DAPACHE1 
    using Apache/1.3.27 

    waiting for server to start: ..Syntax error on line 98 of /Volumes/UFS/opt/perl/cpan/build/Apache-Test-1.0/t/conf/httpd.conf:
    Alias takes two arguments, a fakename and a realname
    ............................................................
    waiting for server to start: giving up after 61 secs
    !!! server failed to start! (t/logs/error_log wasn't created, start the server in the debug mode)
    make: *** [run_tests] Error 1
      /usr/bin/make test -- NOT OK
    Running make install
      make test had returned bad status, won't install without force

And here's the stuff around that line of the file (line 98 is the one
with perl-pod):

    <Location /server-status>
        SetHandler server-status
    </Location>

    #so we can test downloading some files of various size
    Alias /getfiles-perl-pod          

    #and some big ones
    Alias /getfiles-binary-httpd      /usr/sbin/httpd
    Alias /getfiles-binary-perl       /opt/perl/snap/bin/perl

Yeah, "that trick never works", in the words of Rocket J. Squirrel.

Did you miss testing some particular configuration of things?  Do you
need more info?  Or is this enough to go "Aha!" and patch Apache::Test
to 1.01 right away?

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<me...@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

Re: [ANNOUNCE] Apache::Test 1.0

Posted by Stas Bekman <st...@stason.org>.
Stas Bekman wrote:
> The uploaded file
> 
>     Apache-Test-1.0.tar.gz
> 
> has entered CPAN as
> 
>   file: $CPAN/authors/id/S/ST/STAS/Apache-Test-1.0.tar.gz
>   size: 74795 bytes
>    md5: 79c80c26083ea27c75006d47ef9061a4
> 
> Recent changes:

The release of this module indicates a green light for usage of Apache::Test 
in your modules. Since now you can put Apache::Test in the prerequisites list 
in Makefile.PL.

Remember that Apache::Test works with Apache 1.3 and Apache 2.0 w/ and w/o 
mod_perl. So if you have codebases that work with both generation it's 
possible to have one test suite for both.

The Apache::Test tutorial is available from here:
http://perl.apache.org/docs/general/testing/testing.html


__________________________________________________________________
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