httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject svn commit: r1494956 - /httpd/test/framework/trunk/t/modules/include.t
Date Thu, 20 Jun 2013 12:36:53 GMT
Author: jim
Date: Thu Jun 20 12:36:53 2013
New Revision: 1494956

URL: http://svn.apache.org/r1494956
Log:
If TZ isn't set, then assume UTC. This test can still
fail if the test environ and the httpd run environ
are different (eg: TZ set for httpd but not for
t/TEST)... 

Modified:
    httpd/test/framework/trunk/t/modules/include.t

Modified: httpd/test/framework/trunk/t/modules/include.t
URL: http://svn.apache.org/viewvc/httpd/test/framework/trunk/t/modules/include.t?rev=1494956&r1=1494955&r2=1494956&view=diff
==============================================================================
--- httpd/test/framework/trunk/t/modules/include.t (original)
+++ httpd/test/framework/trunk/t/modules/include.t Thu Jun 20 12:36:53 2013
@@ -313,6 +313,15 @@ unless(eval{require POSIX}) {
     skip "POSIX module not found", 1;
 }
 else {
+    # XXX: not sure about the locale thing, but it seems to work at least on my
+    # machine :)
+    use POSIX qw(tzset);
+    POSIX->import('locale_h');
+    my $oldloc = setlocale(&LC_TIME);
+    POSIX::setlocale(&LC_TIME, "C");
+    my $oldtimezone = $ENV{'TZ'};
+    ($ENV{'TZ'} = 'UTC' && tzset) unless $oldtimezone;
+
     my $file = catfile($htdocs, splitpath($dir), "file.shtml");
     my $mtime = (stat $file)[9];
 
@@ -324,12 +333,6 @@ else {
         POSIX::strftime($fmt, @time);
     };
 
-    # XXX: not sure about the locale thing, but it seems to work at least on my
-    # machine :)
-    POSIX->import('locale_h');
-    my $oldloc = setlocale(&LC_TIME);
-    POSIX::setlocale(&LC_TIME, "C");
-
     my $expected = join ' ' =>
         $strftime->("%A, %d-%b-%Y %H:%M:%S %Z"),
         $strftime->("%A, %d-%b-%Y %H:%M:%S %Z"),
@@ -339,6 +342,7 @@ else {
         $strftime->("%T");
 
     POSIX::setlocale(&LC_TIME, $oldloc);
+    ($ENV{'TZ'} = $oldtimezone && tzset) if $oldtimezone;
 
     my $result = super_chomp(GET_BODY "${dir}file.shtml");
 



Mime
View raw message