Skip Menu |

This queue is for tickets about the Time-modules CPAN distribution.

Report information
The Basics
Id: 68234
Status: resolved
Priority: 0/
Queue: Time-modules

People
Owner: Nobody in particular
Requestors: bitcard [...] theblob.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 2011.0505
Fixed in: (no value)



Subject: "make test" skips most tests because of $ENV{TZ}; patch included
When running 'make test', most tests are skipped (doing so in a way that seems to cause the test harness to break, but that's not in the scope of this bug): Show quoted text
> t/datetime....ok > t/metdate.....# No tests run! > t/metdate.....dubious > Test returned status 255 (wstat 65280, 0xff00) > t/order1......# No tests run! > t/order1......dubious > Test returned status 255 (wstat 65280, 0xff00) > t/order2......# No tests run! > t/order2......dubious > Test returned status 255 (wstat 65280, 0xff00) > Failed Test Stat Wstat Total Fail Failed List of Failed >
------------------------------------------------------------------------------- Show quoted text
> t/metdate.t 255 65280 ?? ?? % ?? > t/order1.t 255 65280 ?? ?? % ?? > t/order2.t 255 65280 ?? ?? % ?? > Failed 3/4 test scripts, 25.00% okay. 0/309 subtests failed, 100.00% >
okay. Show quoted text
> make: *** [test_dynamic] Error 255
Running the tests manually with 'perl' shows: Show quoted text
> neo:~/.cpan/build/Time-modules-2011.0505# PERL5LIB="blib/lib" perl
t/metdate.t Show quoted text
> 1..0 # Skipped: It seems localtime() does not honor $ENV{TZ} when set
in the test script. Show quoted text
> # No tests run!
This is actually due to not running the POSIX::tzset() function after each $ENV{TZ} change. The attached patch fixes this, and all tests succeed.
Subject: Time-modules-tzset.patch
diff -u t/metdate.t t.new/metdate.t --- t/metdate.t 2011-05-06 01:58:44.000000000 +0000 +++ t.new/metdate.t 2011-05-16 14:01:53.000000000 +0000 @@ -5,12 +5,14 @@ use Test::More qw(no_plan); use Time::ParseDate; use Time::CTime; +use POSIX qw(tzset); my $finished; END { ok($finished, 'finished') if defined $finished } $ENV{'LANG'} = 'C'; $ENV{'TZ'} = 'PST8PDT'; +tzset; my @x = localtime(785307957); my @y = gmtime(785307957); @@ -23,6 +25,7 @@ } $ENV{'TZ'} = 'MET'; +tzset; @x = localtime(785307957); @y = gmtime(785307957); @@ -37,6 +40,7 @@ $finished = 0; $ENV{TZ} = 'MET'; +tzset; my $t0 = parsedate("2009-10-25 02:55:00"); my $t1 = parsedate("+ 1 hour", NOW => scalar(parsedate("2009-10-25 02:55:00"))); @@ -47,6 +51,7 @@ is($lt1, "Sun Oct 25 03:55:00 2009", "testing TZ=MET +1 h localtime"); $ENV{TZ} = "PST8PDT"; +tzset; my $p0 = parsedate("2009-11-01 01:55:00"); my $p1 = parsedate("+ 1 hour", NOW => scalar(parsedate("2009-11-01 01:55:00"))); diff -u t/order1.t t.new/order1.t --- t/order1.t 2011-05-06 02:01:06.000000000 +0000 +++ t.new/order1.t 2011-05-16 14:01:53.000000000 +0000 @@ -4,12 +4,14 @@ use warnings; use Test::More qw(no_plan); use Time::ParseDate; +use POSIX qw(tzset); my $finished; END { ok($finished, 'finished') if defined $finished } $ENV{'LANG'} = 'C'; $ENV{'TZ'} = 'PST8PDT'; +tzset; my @x = localtime(785307957); my @y = gmtime(785307957); diff -u t/order2.t t.new/order2.t --- t/order2.t 2011-05-06 02:00:36.000000000 +0000 +++ t.new/order2.t 2011-05-16 14:01:53.000000000 +0000 @@ -4,12 +4,14 @@ use warnings; use Time::ParseDate; use Test::More qw(no_plan); +use POSIX qw(tzset); my $finished; END { ok($finished, 'finished') if defined $finished } $ENV{'LANG'} = 'C'; $ENV{'TZ'} = 'PST8PDT'; +tzset; my @x = localtime(785307957); my @y = gmtime(785307957);
Thank you for the patch. Fixed in 2011.0517 along with the other problem you mentioned.