Patchwork [STABLE] test: display used python hash seed

login
register
mail settings
Submitter Pierre-Yves David
Date Jan. 30, 2013, 12:32 a.m.
Message ID <7918b4ffff358db8c271.1359505948@yamac.lan>
Download mbox | patch
Permalink /patch/759/
State Superseded
Commit 35b4affe6fdd7198f524f3393cd1b967ab85caee
Headers show

Comments

Pierre-Yves David - Jan. 30, 2013, 12:32 a.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@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.
Augie Fackler - Jan. 30, 2013, 3:25 p.m.
On Wed, Jan 30, 2013 at 01:32:28AM +0100, Pierre-Yves David wrote:
> # HG changeset patch
> # User Pierre-Yves David <pierre-yves.david@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@selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel
Pierre-Yves David - Jan. 30, 2013, 3:34 p.m.
On Wed, Jan 30, 2013 at 10:25:39AM -0500, Augie Fackler wrote:
> On Wed, Jan 30, 2013 at 01:32:28AM +0100, Pierre-Yves David wrote:
> > # HG changeset patch
> > # User Pierre-Yves David <pierre-yves.david@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?

This may helps to understand some of the buildbot error. I recommend using it ASAP.
Brendan Cully - Jan. 30, 2013, 5:37 p.m.
On Wednesday, 30 January 2013 at 16:34, Pierre-Yves David wrote:
> On Wed, Jan 30, 2013 at 10:25:39AM -0500, Augie Fackler wrote:
> > On Wed, Jan 30, 2013 at 01:32:28AM +0100, Pierre-Yves David wrote:
> > > # HG changeset patch
> > > # User Pierre-Yves David <pierre-yves.david@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?
> 
> This may helps to understand some of the buildbot error. I recommend using it ASAP.

I will implement the same logic in buildbot today, so there's no real rush.
Bryan O'Sullivan - Jan. 30, 2013, 6:22 p.m.
On Wed, Jan 30, 2013 at 7:34 AM, Pierre-Yves David <
pierre-yves.david@logilab.fr> wrote:

> This may helps to understand some of the buildbot error. I recommend using
> it ASAP.
>

There is only one significant buildbot error, which is the cvs convert
issue that flaps between passing and failing depending on cvs timestamp.
This patch won't help that.
Brendan Cully - Jan. 30, 2013, 7:54 p.m.
On Wednesday, 30 January 2013 at 09:37, Brendan Cully wrote:
> On Wednesday, 30 January 2013 at 16:34, Pierre-Yves David wrote:
> > On Wed, Jan 30, 2013 at 10:25:39AM -0500, Augie Fackler wrote:
> > > On Wed, Jan 30, 2013 at 01:32:28AM +0100, Pierre-Yves David wrote:
> > > > # HG changeset patch
> > > > # User Pierre-Yves David <pierre-yves.david@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?
> > 
> > This may helps to understand some of the buildbot error. I recommend using it ASAP.
> 
> I will implement the same logic in buildbot today, so there's no real rush.

Done now. buildbot will generate a random number, store it in the
'pythonhashseed' build property, and export it as the PYTHONHASHSEED
environment variable during run-tests.

Patch

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