summaryrefslogtreecommitdiff
path: root/Tools/Scripts/webkitpy/common/system/executive_unittest.py
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@nokia.com>2012-06-01 10:36:58 +0200
committerSimon Hausmann <simon.hausmann@nokia.com>2012-06-01 10:36:58 +0200
commitb1e9e47fa11f608ae16bc07f97a2acf95bf80272 (patch)
treec88c45e80c9c44506e7cdf9a3bb39ebf82a8cd5b /Tools/Scripts/webkitpy/common/system/executive_unittest.py
parentbe01689f43cf6882cf670d33df49ead1f570c53a (diff)
downloadqtwebkit-b1e9e47fa11f608ae16bc07f97a2acf95bf80272.tar.gz
Imported WebKit commit 499c84c99aa98e9870fa7eaa57db476c6d160d46 (http://svn.webkit.org/repository/webkit/trunk@119200)
Weekly update :). Particularly relevant changes for Qt are the use of the WebCore image decoders and direct usage of libpng/libjpeg if available in the system.
Diffstat (limited to 'Tools/Scripts/webkitpy/common/system/executive_unittest.py')
-rw-r--r--Tools/Scripts/webkitpy/common/system/executive_unittest.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/Tools/Scripts/webkitpy/common/system/executive_unittest.py b/Tools/Scripts/webkitpy/common/system/executive_unittest.py
index c63ff3555..466e2ec02 100644
--- a/Tools/Scripts/webkitpy/common/system/executive_unittest.py
+++ b/Tools/Scripts/webkitpy/common/system/executive_unittest.py
@@ -31,6 +31,7 @@ import os
import signal
import subprocess
import sys
+import time
import unittest
# Since we execute this script directly as part of the unit tests, we need to ensure
@@ -216,6 +217,18 @@ class ExecutiveTest(unittest.TestCase):
pids = executive.running_pids()
self.assertTrue(os.getpid() in pids)
+ def test_run_in_parallel(self):
+ NUM_PROCESSES = 4
+ DELAY_SECS = 0.25
+ cmd_line = [sys.executable, '-c', 'import time; time.sleep(%f); print "hello"' % DELAY_SECS]
+ cwd = os.getcwd()
+ commands = [tuple([cmd_line, cwd])] * NUM_PROCESSES
+ start = time.time()
+ command_outputs = Executive().run_in_parallel(commands, processes=NUM_PROCESSES)
+ done = time.time()
+ self.assertTrue(done - start < NUM_PROCESSES * DELAY_SECS)
+ self.assertEquals([output[1] for output in command_outputs], ["hello\n"] * NUM_PROCESSES)
+
def main(platform, stdin, stdout, cmd, args):
if platform == 'win32' and hasattr(stdout, 'fileno'):