perl-modperl-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ge...@apache.org
Subject svn commit: r417787 - in /perl/Apache-SizeLimit/trunk: MANIFEST Makefile.PL t/TEST.PL t/apache/ t/apache/all.t
Date Wed, 28 Jun 2006 15:21:53 GMT
Author: geoff
Date: Wed Jun 28 08:21:53 2006
New Revision: 417787

URL: http://svn.apache.org/viewvc?rev=417787&view=rev
Log:
tweak Apache-Test settings a bit so that things
are properly configured and skipped if prereqs
are missing.

Added:
    perl/Apache-SizeLimit/trunk/t/apache/
    perl/Apache-SizeLimit/trunk/t/apache/all.t
Removed:
    perl/Apache-SizeLimit/trunk/t/TEST.PL
Modified:
    perl/Apache-SizeLimit/trunk/MANIFEST
    perl/Apache-SizeLimit/trunk/Makefile.PL

Modified: perl/Apache-SizeLimit/trunk/MANIFEST
URL: http://svn.apache.org/viewvc/perl/Apache-SizeLimit/trunk/MANIFEST?rev=417787&r1=417786&r2=417787&view=diff
==============================================================================
--- perl/Apache-SizeLimit/trunk/MANIFEST (original)
+++ perl/Apache-SizeLimit/trunk/MANIFEST Wed Jun 28 08:21:53 2006
@@ -8,6 +8,6 @@
 RELEASE
 SUPPORT
 lib/Apache/SizeLimit.pm
-t/TEST.PL
 t/pod.t
 t/response/TestApache/basic.pm
+t/apache/all.t

Modified: perl/Apache-SizeLimit/trunk/Makefile.PL
URL: http://svn.apache.org/viewvc/perl/Apache-SizeLimit/trunk/Makefile.PL?rev=417787&r1=417786&r2=417787&view=diff
==============================================================================
--- perl/Apache-SizeLimit/trunk/Makefile.PL (original)
+++ perl/Apache-SizeLimit/trunk/Makefile.PL Wed Jun 28 08:21:53 2006
@@ -18,15 +18,28 @@
     elsif ( $Config{'osname'} eq 'MSWin32' ) {
         $prereqs{'Win32::API'} = 0;
     }
+}
+
+use constant HAS_APACHE_TEST => eval {
+    require Apache::Test;
+    require Apache::TestMM;
+    require Apache::TestRunPerl;
+
+    Apache::TestMM->import(qw(test clean));
+    Apache::TestMM::filter_args();
+
+    my %args = @Apache::TestMM::Argv;
+
+    die 'suitable httpd required'
+      unless ($args{apxs} or $args{httpd} or
+              $ENV{APACHE_TEST_HTTPD} or $ENV{APACHE_TEST_APXS});
+
+    Apache::TestRunPerl->generate_script();
+
+    return Apache::TestMM->test;
+};
 
-    if ( -f 't/apache/basic.t'
-         && eval { require Apache::TestMM } ) {
-        $prereqs{'Apache::Test'} = 0;
 
-        Apache::TestMM::filter_args();
-        Apache::TestMM::generate_script('t/TEST');
-    }
-}
 
 WriteMakefile( VERSION_FROM    => "lib/Apache/SizeLimit.pm",
                NAME            => "Apache::SizeLimit",
@@ -47,4 +60,24 @@
 EOF
 
     return $string;
+}
+
+sub MY::test {
+
+    my $test = shift->MM::test(@_);
+
+    return HAS_APACHE_TEST if HAS_APACHE_TEST;
+
+    return $test;
+}
+
+sub MY::clean {
+
+    if (HAS_APACHE_TEST) {
+        require Apache::TestMM;
+
+        return Apache::TestMM::clean(@_);
+    }
+
+    return shift->MM::clean(@_);
 }

Added: perl/Apache-SizeLimit/trunk/t/apache/all.t
URL: http://svn.apache.org/viewvc/perl/Apache-SizeLimit/trunk/t/apache/all.t?rev=417787&view=auto
==============================================================================
--- perl/Apache-SizeLimit/trunk/t/apache/all.t (added)
+++ perl/Apache-SizeLimit/trunk/t/apache/all.t Wed Jun 28 08:21:53 2006
@@ -0,0 +1,34 @@
+use strict;
+use warnings FATAL => 'all';
+
+use Config;
+use Apache::Test;
+
+# skip all tests in this directory unless mod_perl is enabled
+plan tests => 1, \&my_need;
+
+ok 1;
+
+sub my_need {
+
+    my $ok = 1;
+
+    if ( $Config{'osname'} eq 'linux' ) {
+        $ok = need_module('Linux::Pid');
+        if ( -e '/proc/self/smaps' ) {
+            $ok &= need_module('Linux::Smaps');
+        }
+    }
+    elsif ( $Config{'osname'} =~ /(bsd|aix|darwin)/i ) {
+        $ok &= need_module('BSD::Resource');
+    }
+    elsif ( $Config{'osname'} eq 'MSWin32' ) {
+        $ok &= need_module('Win32::API');
+    }
+
+    $ok &= need_module('mod_perl.c');
+
+    $ok &= need_min_apache_version(1);
+
+    return $ok;
+}



Mime
View raw message