diff -Nru tickcount-0.1/debian/changelog tickcount-0.1/debian/changelog --- tickcount-0.1/debian/changelog 2010-06-28 12:11:55.000000000 +0200 +++ tickcount-0.1/debian/changelog 2010-08-28 14:42:19.000000000 +0200 @@ -1,3 +1,11 @@ +tickcount (0.1-0ubuntu13) maverick; urgency=low + + * Fix wrap-around computation and test suite for it: + Don't use int constants for a long data type. It doesn't work as expected + on 64bit. (lp: #625798) + + -- Michael Bienia Sat, 28 Aug 2010 14:34:37 +0200 + tickcount (0.1-0ubuntu12) maverick; urgency=low * debian/patches/arm-test: Fixed testcase where arch=i686 that caused FTBFS diff -Nru tickcount-0.1/debian/patches/arm-test tickcount-0.1/debian/patches/arm-test --- tickcount-0.1/debian/patches/arm-test 2010-06-28 12:11:21.000000000 +0200 +++ tickcount-0.1/debian/patches/arm-test 1970-01-01 01:00:00.000000000 +0100 @@ -1,28 +0,0 @@ -Description: Fix python test for i686 and armv7l -Author: Chuck Short -Last-Update: 2010-06-26 - ---- a/test_tickcount.py -+++ b/test_tickcount.py -@@ -30,6 +30,7 @@ - - def test_difference_wrap(self): - import struct -+ import os - - # Work out what the maximum sized unsigned C int is. Note that - # this will differ from the maximum sized Python int on 64-bit -@@ -41,7 +42,12 @@ - oldcount = uint_max / 2 - 10 - newcount = oldcount + 20 - uint_max - -- self.assertEqual(tickcount.difference(oldcount, newcount), 20) -+ if os.uname()[4] == 'i686': -+ self.assertEqual(tickcount.difference(oldcount, newcount), 21) -+ elif os.uname()[4] == 'armv7l': -+ self.assertEqual(tickcount.difference(oldcount, newcount), 21) -+ else: -+ self.assertEqual(tickcount.difference(oldcount, newcount), 20) - - def test_suite(): - loader = unittest.TestLoader() diff -Nru tickcount-0.1/debian/patches/fix_wraparound_computation tickcount-0.1/debian/patches/fix_wraparound_computation --- tickcount-0.1/debian/patches/fix_wraparound_computation 1970-01-01 01:00:00.000000000 +0100 +++ tickcount-0.1/debian/patches/fix_wraparound_computation 2010-08-28 13:41:08.000000000 +0200 @@ -0,0 +1,41 @@ +Index: tickcount-0.1/tickcount.c +=================================================================== +--- tickcount-0.1.orig/tickcount.c 2010-08-28 13:38:32.000000000 +0200 ++++ tickcount-0.1/tickcount.c 2010-08-28 13:38:55.000000000 +0200 +@@ -57,7 +57,7 @@ + /* adjust for wrap around */ + diff = new - old; + if (diff < 0) +- diff += UINT_MAX; ++ diff += ULONG_MAX; + return PyInt_FromLong(diff); + } + +Index: tickcount-0.1/test_tickcount.py +=================================================================== +--- tickcount-0.1.orig/test_tickcount.py 2010-08-28 13:39:16.000000000 +0200 ++++ tickcount-0.1/test_tickcount.py 2010-08-28 13:40:21.000000000 +0200 +@@ -31,17 +31,17 @@ + def test_difference_wrap(self): + import struct + +- # Work out what the maximum sized unsigned C int is. Note that ++ # Work out what the maximum sized unsigned C long is. Note that + # this will differ from the maximum sized Python int on 64-bit + # platforms. +- sizeof_int = struct.calcsize('I') +- uint_max = struct.unpack('I', '\xff' * sizeof_int)[0] ++ sizeof_long = struct.calcsize('L') ++ ulong_max = struct.unpack('L', '\xff' * sizeof_long)[0] + + # create two tick counts that straddle the wrap point +- oldcount = uint_max / 2 - 10 +- newcount = oldcount + 20 - uint_max ++ oldcount = ulong_max / 2 - 10 ++ newcount = oldcount + 20 - ulong_max + +- self.assertEqual(tickcount.difference(oldcount, newcount), 20) ++ self.assertEqual(tickcount.difference(oldcount, newcount), 21) + + def test_suite(): + loader = unittest.TestLoader() diff -Nru tickcount-0.1/debian/patches/series tickcount-0.1/debian/patches/series --- tickcount-0.1/debian/patches/series 2010-06-28 11:21:23.000000000 +0200 +++ tickcount-0.1/debian/patches/series 2010-08-28 14:33:58.000000000 +0200 @@ -1 +1 @@ -arm-test +fix_wraparound_computation