[PATCH 11 of 11 STABLE] tests: add "(glob)" to omit incorrect "tm_wday" value on Windows

Mads Kiilerich mads at kiilerich.com
Mon Oct 20 09:11:07 CDT 2014


On 10/20/2014 03:27 PM, FUJIWARA Katsunori wrote:
> # HG changeset patch
> # User FUJIWARA Katsunori <foozy at lares.dti.ne.jp>
> # Date 1413810488 -32400
> #      Mon Oct 20 22:08:08 2014 +0900
> # Branch stable
> # Node ID 2bd139ea7c56ac97e049c1e38edc0635ed90c8d3
> # Parent  65e4e7f34d673b2236058ef9de57ca035a331413
> tests: add "(glob)" to omit incorrect "tm_wday" value on Windows
>
> Before this patch, "test-obsolete.t" fails on Windows environment,
> because strings corresponded to "tm_wday" (day of the week) field are
> incorrect.
>
> On POSIX environment, "gmtime()" returns correct "tm_wday" value even
> for negative "time_t" value. On the other hand, it returns incorrect
> one on Windows environment. At least, "gmtime()" of the Windows
> runtime library bundled with Python 2.7.3 does.
>
> This patch chooses changing "test-obsolete.t" instead of the logic
> below in "util.datestr", because the latter seems to have large
> impact.
>
>      t, tz = date or makedate()
>      if t < 0:
>          t = 0   # time.gmtime(lt) fails on Windows for lt < -43200
>          tz = 0
>
> diff --git a/tests/test-obsolete.t b/tests/test-obsolete.t
> --- a/tests/test-obsolete.t
> +++ b/tests/test-obsolete.t
> @@ -93,7 +93,7 @@ Killing a single changeset with replacem
>         2     1    -1   118   204         59   59   59    0      76       192           0     1        1
>         3     1    -1   204   271        204  204   59    0      66       258           0     2        0
>     $ hg debugobsolete
> -  245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f C (Wed Dec 31 23:58:56 1969 -0002) {'user': 'test'}
> +  245bde4270cd1072a27757984f9cda8ba26f08ca cdbce2fbb16313928851e97e0d85413f3f7eb77f C (* Dec 31 23:58:56 1969 -0002) {'user': 'test'} (glob)

With reference to 4d5b12a5517b and 09305d7745dd, I would say that the 
tests are wrong when they exercise dates before epoch (with or without 
considering the timezone). It would be better to avoid testing undefined 
behaviour.

/Mads


More information about the Mercurial-devel mailing list