aboutsummaryrefslogtreecommitdiff
path: root/meta-linaro-integration/recipes-overlayed/firefox/firefox/debian-hacks/Add-a-2-minutes-timeout-on-xpcshell-tests.patch
blob: 84a45dff974adf5c364ef65bb8a1b0d007c34840 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
From: Mike Hommey <mh@glandium.org>
Date: Mon, 27 Dec 2010 10:44:28 +0100
Subject: Add a 2 minutes timeout on xpcshell tests

---
 testing/xpcshell/runxpcshelltests.py |   18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/testing/xpcshell/runxpcshelltests.py b/testing/xpcshell/runxpcshelltests.py
index ea15466..e1babbb 100644
--- a/testing/xpcshell/runxpcshelltests.py
+++ b/testing/xpcshell/runxpcshelltests.py
@@ -38,7 +38,7 @@
 #
 # ***** END LICENSE BLOCK ***** */
 
-import re, sys, os, os.path, logging, shutil, signal, math, time
+import re, sys, os, os.path, logging, shutil, signal, math, time, select
 from glob import glob
 from optparse import OptionParser
 from subprocess import Popen, PIPE, STDOUT
@@ -510,7 +510,21 @@ class XPCShellTests(object):
         # - don't move this line above launchProcess, or child will inherit the SIG_IGN
         signal.signal(signal.SIGINT, markGotSIGINT)
         # |stderr == None| as |pStderr| was either |None| or redirected to |stdout|.
-        stdout, stderr = self.communicate(proc)
+        if pStdout == PIPE:
+          stdout = ""
+          while True:
+            (r, w, e) = select.select([proc.stdout], [], [], 120)
+            if len(r) == 0:
+              stdout += "TEST-UNEXPECTED-FAIL | %s | application timed out after 120 seconds with no output" % (test)
+              proc.kill()
+              break
+            line = proc.stdout.read(1)
+            if line == "":
+              break
+            stdout += line
+          proc.wait()
+        else:
+          stdout, stderr = self.communicate(proc)
         signal.signal(signal.SIGINT, signal.SIG_DFL)
 
         if interactive: