perl-modperl-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jkal...@apache.org
Subject svn commit: r1497262 - /perl/modperl/branches/httpd24/t/response/TestAPI/aplog.pm
Date Thu, 27 Jun 2013 09:30:44 GMT
Author: jkaluza
Date: Thu Jun 27 09:30:44 2013
New Revision: 1497262

URL: http://svn.apache.org/r1497262
Log:
Fix aplog test with httpd-2.2

Modified:
    perl/modperl/branches/httpd24/t/response/TestAPI/aplog.pm

Modified: perl/modperl/branches/httpd24/t/response/TestAPI/aplog.pm
URL: http://svn.apache.org/viewvc/perl/modperl/branches/httpd24/t/response/TestAPI/aplog.pm?rev=1497262&r1=1497261&r2=1497262&view=diff
==============================================================================
--- perl/modperl/branches/httpd24/t/response/TestAPI/aplog.pm (original)
+++ perl/modperl/branches/httpd24/t/response/TestAPI/aplog.pm Thu Jun 27 09:30:44 2013
@@ -17,6 +17,7 @@ use TestCommon::LogDiff;
 
 use Apache2::Const -compile => qw(OK :log);
 use APR::Const    -compile => qw(:error SUCCESS);
+use constant APACHE24   => have_min_apache_version('2.4.0');
 
 my @LogLevels = qw(emerg alert crit error warn notice info debug);
 my $package = __PACKAGE__;
@@ -59,9 +60,11 @@ sub handler {
 
     # log_serror
     {
-        my $orig_log_level = $s->loglevel;
-
-        $s->loglevel(Apache2::Const::LOG_DEBUG);
+        my $orig_log_level = 0;
+        if (APACHE24) {
+            $orig_log_level = $s->loglevel;
+            $s->loglevel(Apache2::Const::LOG_DEBUG);
+        }
         t_server_log_warn_is_expected();
         $s->log_serror(Apache2::Log::LOG_MARK,
                        Apache2::Const::LOG_INFO|Apache2::Const::LOG_STARTUP,
@@ -88,7 +91,9 @@ sub handler {
         ok t_cmp $logdiff->diff,
             qr/$egeneral: log_serror test 2/,
             '$s->log_serror(LOG_MARK, LOG_DEBUG, APR::Const::EGENERAL...)';
-        $s->loglevel($orig_log_level);
+        if (APACHE24) {
+            $s->loglevel($orig_log_level);
+        }
     }
 
     # log_rerror
@@ -96,38 +101,73 @@ sub handler {
     $r->log_rerror(Apache2::Log::LOG_MARK, Apache2::Const::LOG_CRIT,
                    APR::Const::ENOTIME, "log_rerror test");
     # can't match against the error string, since a locale may kick in
-    ok t_cmp $logdiff->diff,
-        qr/\[\w*:crit\] \[pid[^]]+\] .*?: \[[^]]+\] log_rerror test/,
-        '$r->log_rerror(LOG_MARK, LOG_CRIT, APR::Const::ENOTIME...)';
+    if (APACHE24) {
+        ok t_cmp $logdiff->diff,
+            qr/\[\w*:crit\] \[pid[^]]+\] .*?: \[[^]]+\] log_rerror test/,
+            '$r->log_rerror(LOG_MARK, LOG_CRIT, APR::Const::ENOTIME...)';
+    }
+    else {
+        ok t_cmp $logdiff->diff,
+            qr/\[crit\] .*?: log_rerror test/,
+            '$r->log_rerror(LOG_MARK, LOG_CRIT, APR::Const::ENOTIME...)';
+    }
 
     # log_error
     {
         t_server_log_error_is_expected();
         $r->log_error('$r->log_error test');
-        ok t_cmp $logdiff->diff,
-            qr/\[\w*:error\] \[pid[^]]+\] \$r->log_error test/,
-            '$r->log_error(...)';
+        if (APACHE24) {
+            ok t_cmp $logdiff->diff,
+                qr/\[\w*:error\] \[pid[^]]+\] \$r->log_error test/,
+                '$r->log_error(...)';
+        }
+        else {
+            ok t_cmp $logdiff->diff,
+                qr/\[error\] \$r->log_error test/,
+                '$r->log_error(...)';
+        }
 
         t_server_log_error_is_expected();
         $s->log_error('$s->log_error test');
-        ok t_cmp $logdiff->diff,
-            qr/\[\w*:error\] \[pid[^]]+\] \$s->log_error test/,
-            '$s->log_error(...)';
+        if (APACHE24) {
+            ok t_cmp $logdiff->diff,
+                qr/\[\w*:error\] \[pid[^]]+\] \$s->log_error test/,
+                '$s->log_error(...)';
+        }
+        else {
+            ok t_cmp $logdiff->diff,
+                qr/\[error\] \$s->log_error test/,
+                '$s->log_error(...)';
+        }
     }
 
     # log_reason
     {
         t_server_log_error_is_expected();
         $r->log_reason('$r->log_reason test');
-        ok t_cmp $logdiff->diff,
-            qr/\[\w*:error\] \[pid[^]]+\] access to.*failed.*reason: \$r->log_reason test/,
-            '$r->log_reason(msg)';
+        if (APACHE24) {
+            ok t_cmp $logdiff->diff,
+                qr/\[\w*:error\] \[pid[^]]+\] access to.*failed.*reason: \$r->log_reason
test/,
+                '$r->log_reason(msg)';
+        }
+        else {
+            ok t_cmp $logdiff->diff,
+                qr/\[error\] access to.*failed.*reason: \$r->log_reason test/,
+                '$r->log_reason(msg)';
+        }
 
         t_server_log_error_is_expected();
         $r->log_reason('$r->log_reason filename test','filename');
-        ok t_cmp $logdiff->diff,
-            qr/\[\w*:error\] \[pid[^]]+\] access to filename failed.*\$r->log_reason filename
test/,
-            '$r->log_reason(msg, filename)';
+        if (APACHE24) {
+            ok t_cmp $logdiff->diff,
+                qr/\[\w*:error\] \[pid[^]]+\] access to filename failed.*\$r->log_reason
filename test/,
+                '$r->log_reason(msg, filename)';
+        }
+        else {
+            ok t_cmp $logdiff->diff,
+                qr/\[error\] access to filename failed.*\$r->log_reason filename test/,
+                '$r->log_reason(msg, filename)';
+        }
     }
 
     # XXX: at the moment we can't change loglevel after server startup
@@ -180,32 +220,60 @@ sub handler {
 
     t_server_log_warn_is_expected();
     $s->warn('$s->warn test');
-    ok t_cmp $logdiff->diff,
-        qr/\[\w*:warn\] \[pid[^]]+\] \$s->warn test/,
-        '$s->warn()';
+    if (APACHE24) {
+        ok t_cmp $logdiff->diff,
+            qr/\[\w*:warn\] \[pid[^]]+\] \$s->warn test/,
+            '$s->warn()';
+    }
+    else {
+        ok t_cmp $logdiff->diff,
+            qr/\[warn\] \$s->warn test/,
+            '$s->warn()';
+    }
 
     {
         t_server_log_warn_is_expected();
         # this uses global server to get $s internally
         Apache2::ServerRec::warn("Apache2::ServerRec::warn test");
-        ok t_cmp $logdiff->diff,
-            qr/\[\w*:warn\] \[pid[^]]+\] Apache2::ServerRec::warn test/,
-            'Apache2::ServerRec::warn() w/o Apache2::RequestUtil->request ';
+        if (APACHE24) {
+            ok t_cmp $logdiff->diff,
+                qr/\[\w*:warn\] \[pid[^]]+\] Apache2::ServerRec::warn test/,
+                'Apache2::ServerRec::warn() w/o Apache2::RequestUtil->request ';
+        }
+        else {
+            ok t_cmp $logdiff->diff,
+                qr/\[warn\] Apache2::ServerRec::warn test/,
+                'Apache2::ServerRec::warn() w/o Apache2::RequestUtil->request ';
+        }
 
         Apache2::RequestUtil->request($r);
         t_server_log_warn_is_expected();
         # this uses the global $r to get $s internally
         Apache2::ServerRec::warn("Apache2::ServerRec::warn test");
-        ok t_cmp $logdiff->diff,
-            qr/\[\w*:warn\] \[pid[^]]+\] Apache2::ServerRec::warn test/,
-            'Apache2::ServerRec::warn() w/ Apache2::RequestUtil->request ';
+        if (APACHE24) {
+            ok t_cmp $logdiff->diff,
+                qr/\[\w*:warn\] \[pid[^]]+\] Apache2::ServerRec::warn test/,
+                'Apache2::ServerRec::warn() w/ Apache2::RequestUtil->request ';
+        }
+        else {
+            ok t_cmp $logdiff->diff,
+                qr/\[warn\] Apache2::ServerRec::warn test/,
+                'Apache2::ServerRec::warn() w/ Apache2::RequestUtil->request ';
+        }
     }
 
     t_server_log_warn_is_expected();
     warn "warn test";
-    ok t_cmp $logdiff->diff,
-        qr/\[\w*:warn\] \[pid[^]]+\] warn test/,
-        'overriden via export warn()';
+    if (APACHE24) {
+        ok t_cmp $logdiff->diff,
+            qr/\[\w*:warn\] \[pid[^]]+\] warn test/,
+            'overriden via export warn()';
+    }
+    else {
+        ok t_cmp $logdiff->diff,
+            qr/\[warn\] warn test/,
+            'overriden via export warn()';
+    }
 
     Apache2::Const::OK;
 }



Mime
View raw message