← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~mbp/launchpad/mbp-trivial into lp:launchpad/devel

 

Martin Pool has proposed merging lp:~mbp/launchpad/mbp-trivial into lp:launchpad/devel.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  #615740 test_on_merge.py doesn't handle eintr
  https://bugs.launchpad.net/bugs/615740


Same as https://code.edge.launchpad.net/~mbp/launchpad/mbp-trivial/+merge/32173 but into devel
-- 
https://code.launchpad.net/~mbp/launchpad/mbp-trivial/+merge/36515
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~mbp/launchpad/mbp-trivial into lp:launchpad/devel.
=== modified file 'test_on_merge.py'
--- test_on_merge.py	2010-08-10 21:27:56 +0000
+++ test_on_merge.py	2010-09-23 23:13:45 +0000
@@ -1,6 +1,6 @@
 #!/usr/bin/python -S
 #
-# Copyright 2009 Canonical Ltd.  This software is licensed under the
+# Copyright 2009, 2010 Canonical Ltd.  This software is licensed under the
 # GNU Affero General Public License version 3 (see the file LICENSE).
 
 """Tests that get run automatically on a merge."""
@@ -13,7 +13,7 @@
 import psycopg2
 from subprocess import Popen, PIPE, STDOUT
 from signal import SIGKILL, SIGTERM, SIGINT, SIGHUP
-from select import select
+import select
 
 
 # The TIMEOUT setting (expressed in seconds) affects how long a test will run
@@ -164,7 +164,22 @@
     # Popen.communicate() with large data sets.
     open_readers = set([xvfb_proc.stdout])
     while open_readers:
-        rlist, wlist, xlist = select(open_readers, [], [], TIMEOUT)
+        # blocks for a long time and can easily fail with EINTR
+        # <https://bugs.launchpad.net/launchpad/+bug/615740> - catching
+        # it just here is not the perfect fix (other syscalls might be
+        # interrupted) but is pragmatic
+        while True:
+            try:
+                rlist, wlist, xlist = select.select(open_readers, [], [], TIMEOUT)
+                break
+            except select.error, e:
+                # nb: select.error doesn't expose a named 'errno' attribute,
+                # at least in python 2.6.5; see
+                # <http://mail.python.org/pipermail/python-dev/2000-October/009671.html>
+                if e[0] == errno.EINTR:
+                    continue
+                else:
+                    raise
 
         if len(rlist) == 0:
             # The select() statement timed out!