Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(83)

Side by Side Diff: tools/testrunner/local/pool_unittest.py

Issue 275093002: Introduce a dynamic process pool for the local test driver (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Review Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tools/testrunner/local/pool.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #!/usr/bin/env python
2 # Copyright 2014 the V8 project authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
5
6 import unittest
7
8 from pool import Pool
9
10 def Run(x):
11 if x == 10:
12 raise Exception("Expected exception triggered by test.")
13 return x
14
15 class PoolTest(unittest.TestCase):
16 def testNormal(self):
17 results = set()
18 pool = Pool(3)
19 for result in pool.imap_unordered(Run, [[x] for x in range(0, 10)]):
20 results.add(result)
21 self.assertEquals(set(range(0, 10)), results)
22
23 def testException(self):
24 results = set()
25 pool = Pool(3)
26 for result in pool.imap_unordered(Run, [[x] for x in range(0, 12)]):
27 # Item 10 will not appear in results due to an internal exception.
28 results.add(result)
29 expect = set(range(0, 12))
30 expect.remove(10)
31 self.assertEquals(expect, results)
32
33 def testAdd(self):
34 results = set()
35 pool = Pool(3)
36 for result in pool.imap_unordered(Run, [[x] for x in range(0, 10)]):
37 results.add(result)
38 if result < 30:
39 pool.add([result + 20])
40 self.assertEquals(set(range(0, 10) + range(20, 30) + range(40, 50)),
41 results)
OLDNEW
« no previous file with comments | « tools/testrunner/local/pool.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698