[BUG] changeset test suite fails unpredictably
John A Meinel
john at arbash-meinel.com
Thu Jul 21 02:23:27 BST 2005
Aaron Bentley wrote:
> Hi all,
>
> The changeset test suite uses random numbers to test the
> unpack_hires_date function. These numbers are sometimes out of range of
> time_t, and sometimes not. As a result, the test suite sometimes fails,
> and sometimes passes.
>
> Aaron
Unless I missed my guess as to the randomization function, it should be
rather unlikely to overflow a time_t.
However, it has been tested enough times now, that I'm pretty okay with
just removing the random number section.
I suppose we could do a more systematic cycle through all time zones.
John
=:->
>
>
> bzrlib.plugin.bzr-changeset.common.unpack_highres_date FAILURE
> ------------------------------------------------------------
> unpack_highres_date (bzrlib.plugin.bzr-changeset.common)
> (Doctest: bzrlib.plugin.bzr-changeset.common.unpack_highres_date)
> Traceback (most recent call last):
> File "/usr/lib/python2.4/unittest.py", line 260, in run
> testMethod()
> File "/usr/lib/python2.4/doctest.py", line 2152, in runTest
> raise self.failureException(self.format_failure(new.getvalue()))
> AssertionError: Failed doctest test for
> bzrlib.plugin.bzr-changeset.common.unpack_highres_date
> File "/home/abentley/.bzr.conf/plugins/bzr-changeset/common.py", line
> 185, in unpack_highres_date
>
> ----------------------------------------------------------------------
> File "/home/abentley/.bzr.conf/plugins/bzr-changeset/common.py", line
> 209, in bzrlib.plugin.bzr-changeset.common.unpack_highres_date
> Failed example:
> for count in xrange(500):
> t += random.random()*24*3600*365*2 - 24*3600*364 # Random time
> within +/- 1 year
> o = random.randint(-12,12)*3600 # Random timezone
> date = format_highres_date(t, o)
> t2, o2 = unpack_highres_date(date)
> if t != t2 or o != o2:
> print 'Failed on date %r, %s,%s diff:%s' % (date, t, o, t2-t)
> break
> Exception raised:
> Traceback (most recent call last):
> File "/usr/lib/python2.4/doctest.py", line 1243, in __run
> compileflags, 1) in test.globs
> File "<doctest
> bzrlib.plugin.bzr-changeset.common.unpack_highres_date[10]>", line 4, in ?
> File "/home/abentley/.bzr.conf/plugins/bzr-changeset/common.py",
> line 179, in format_highres_date
> tt = time.gmtime(t + offset)
> ValueError: timestamp out of range for platform time_t
>
> ------------------------------------------------------------
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 253 bytes
Desc: OpenPGP digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20050720/8f3c68b7/attachment.pgp
More information about the bazaar
mailing list