[PATCH 6 of 6] run-tests.py: inherit PYTHONHASHSEED from environment if set

Matt Mackall mpm at selenic.com
Sun Jan 20 15:24:38 CST 2013


On Sun, 2013-01-20 at 14:18 +0100, Mads Kiilerich wrote:
> # HG changeset patch
> # User Mads Kiilerich <mads at kiilerich.com>
> # Date 1358687872 -3600
> # Branch stable
> # Node ID f62e594f1b67ea617c8d727834ee8c9895efe4ef
> # Parent  a0e2208420d688baa24bb52d9064e139a9dcc885
> run-tests.py: inherit PYTHONHASHSEED from environment if set
> 
> This makes it possible to fix the seed by using for instance
>   PYTHONHASHSEED=7 ./run-tests.py ...
> 
> This can be very convenient when trying to debug problems that are influenced
> by hash values. Try different seed values until you find one that triggers the
> bad behaviour and then keep that while debugging.
> 
> It could also to some extent make sense for buildbots to set (different) fixed
> values to make sure the test execution is stable.

I'm not sure precisely what you mean here. I think there's value in
running the buildbot with random seeds. However, it's also useful to be
able to rerun a test with the same seed a buildbot uses. As there's no
way to access the seed used for PYTHONHASHSEED=random, perhaps the
buildbot or run-test should generate a seed and log it.

> diff --git a/tests/run-tests.py b/tests/run-tests.py
> --- a/tests/run-tests.py
> +++ b/tests/run-tests.py
> @@ -1252,7 +1252,7 @@ def main():
>      os.environ['no_proxy'] = ''
>      os.environ['NO_PROXY'] = ''
>      os.environ['TERM'] = 'xterm'
> -    os.environ['PYTHONHASHSEED'] = 'random'
> +    os.environ['PYTHONHASHSEED'] = os.environ.get('PYTHONHASHSEED', 'random')
>  
>      # unset env related to hooks
>      for k in os.environ.keys():
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel


-- 
Mathematics is the supreme nostalgia of our time.




More information about the Mercurial-devel mailing list