Merge lp:~mbp/launchpad/mbp-trivial into lp:launchpad

Proposed by Martin Pool
Status: Merged
Approved by: Michael Hudson-Doyle
Approved revision: no longer in the source branch.
Merged at revision: 11635
Proposed branch: lp:~mbp/launchpad/mbp-trivial
Merge into: lp:launchpad
Diff against target: 46 lines (+20/-3)
1 file modified
test_on_merge.py (+20/-3)
To merge this branch: bzr merge lp:~mbp/launchpad/mbp-trivial
Reviewer Review Type Date Requested Status
Michael Hudson-Doyle Approve
Review via email: mp+36515@code.launchpad.net

Commit message

handle EINTR in test_on_merge so resizing the window doesn't crash your test run

Description of the change

To post a comment you must log in.
Revision history for this message
Michael Hudson-Doyle (mwhudson) wrote :

Looks fine, thanks for making the comment clearer.

review: Approve
Revision history for this message
Martin Pool (mbp) wrote :

It fails like so:

Tests with errors
-----------------
 lp.code.windmill.tests.test_branch_subscriptions.TestBranchSubscriptions.test_branch_subscription_ajax_load
 lp.codehosting.puller.tests.test_worker.TestWorkerProgressReporting.test_network

======================================================================
ERROR: lp.code.windmill.tests.test_branch_subscriptions.TestBranchSubscriptions.test_branch_subscription_ajax_load (subunit.RemotedTestCase)
----------------------------------------------------------------------
_StringException: Text attachment: garbage
------------
[<Thread(Thread-631, started daemon 47931595147024)>]
------------

======================================================================
ERROR: lp.codehosting.puller.tests.test_worker.TestWorkerProgressReporting.test_network (subunit.RemotedTestCase)
----------------------------------------------------------------------
_StringException: Text attachment: garbage
------------
[<Thread(Thread-18, started daemon 47106544203536)>]
------------

**NOT** submitted to PQM:
[r=mwhudson][ui=none][bug=615740] handle EINTR in test_on_merge so resizing the window doesn't crash your test run

I guess this is not my fault, but I don't know.

Revision history for this message
Michael Hudson-Doyle (mwhudson) wrote :

The branch passed on EC2 a second time, but then failed to land due to testfix mode. Can you land this yourself?

Revision history for this message
Martin Pool (mbp) wrote :

On 25 September 2010 07:26, Michael Hudson-Doyle
<email address hidden> wrote:
> The branch passed on EC2 a second time, but then failed to land due to testfix mode.  Can you land this yourself?

All my previous attempts have been rejected, but I can see about
having pqm access.

--
Martin

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'test_on_merge.py'
2--- test_on_merge.py 2010-08-10 21:27:56 +0000
3+++ test_on_merge.py 2010-09-23 23:57:49 +0000
4@@ -1,6 +1,6 @@
5 #!/usr/bin/python -S
6 #
7-# Copyright 2009 Canonical Ltd. This software is licensed under the
8+# Copyright 2009, 2010 Canonical Ltd. This software is licensed under the
9 # GNU Affero General Public License version 3 (see the file LICENSE).
10
11 """Tests that get run automatically on a merge."""
12@@ -13,7 +13,7 @@
13 import psycopg2
14 from subprocess import Popen, PIPE, STDOUT
15 from signal import SIGKILL, SIGTERM, SIGINT, SIGHUP
16-from select import select
17+import select
18
19
20 # The TIMEOUT setting (expressed in seconds) affects how long a test will run
21@@ -164,7 +164,24 @@
22 # Popen.communicate() with large data sets.
23 open_readers = set([xvfb_proc.stdout])
24 while open_readers:
25- rlist, wlist, xlist = select(open_readers, [], [], TIMEOUT)
26+ # select() blocks for a long time and can easily fail with EINTR
27+ # <https://bugs.launchpad.net/launchpad/+bug/615740>. Really we
28+ # should have EINTR protection across the whole script (other syscalls
29+ # might be interrupted) but this is the longest and most likely to
30+ # hit, and doing it perfectly in python has proved to be quite hard in
31+ # bzr. -- mbp 20100924
32+ while True:
33+ try:
34+ rlist, wlist, xlist = select.select(open_readers, [], [], TIMEOUT)
35+ break
36+ except select.error, e:
37+ # nb: select.error doesn't expose a named 'errno' attribute,
38+ # at least in python 2.6.5; see
39+ # <http://mail.python.org/pipermail/python-dev/2000-October/009671.html>
40+ if e[0] == errno.EINTR:
41+ continue
42+ else:
43+ raise
44
45 if len(rlist) == 0:
46 # The select() statement timed out!