[PATCH STABLE] test: display used python hash seed

Augie Fackler raf at durin42.com
Wed Jan 30 09:25:39 CST 2013


On Wed, Jan 30, 2013 at 01:32:28AM +0100, Pierre-Yves David wrote:
> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david at ens-lyon.org>
> # Date 1359505444 -3600
> # Branch stable
> # Node ID 7918b4ffff358db8c27131a55696dbdb4a2c0296
> # Parent  68eecbaf1bd32a616748331cc9f22d55b1316ce3
> test: display used python hash seed
>
> We keep using a random seed for each run, but we "compute" it ourself to be able
> to reproduce a failed test run.

LGTM, though I'm not sure I'd throw this on stable. Hold onto it and
resend after the first?

>
> diff --git a/tests/run-tests.py b/tests/run-tests.py
> --- a/tests/run-tests.py
> +++ b/tests/run-tests.py
> @@ -50,10 +50,11 @@ import shutil
>  import subprocess
>  import signal
>  import sys
>  import tempfile
>  import time
> +import random
>  import re
>  import threading
>  import killdaemons as killmod
>  import cPickle as pickle
>  import Queue as queue
> @@ -1250,11 +1251,15 @@ def main():
>      os.environ['GREP_OPTIONS'] = ''
>      os.environ['http_proxy'] = ''
>      os.environ['no_proxy'] = ''
>      os.environ['NO_PROXY'] = ''
>      os.environ['TERM'] = 'xterm'
> -    os.environ['PYTHONHASHSEED'] = os.environ.get('PYTHONHASHSEED', 'random')
> +    if 'PYTHONHASHSEED' not in os.environ:
> +        # use a random python hash seed all the time
> +        # we do the randomness ourself to know what seed is used
> +        os.environ['PYTHONHASHSEED'] = str(random.getrandbits(32))
> +        print 'python hash seed:', os.environ['PYTHONHASHSEED']
>
>      # unset env related to hooks
>      for k in os.environ.keys():
>          if k.startswith('HG_'):
>              # can't remove on solaris
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel


More information about the Mercurial-devel mailing list