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

Side by Side Diff: tools/isolate/run_test_cases_test.py

Issue 10829014: Add --gtest_filter support to run_test_cases.py. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 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/isolate/run_test_cases.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
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 import logging 6 import logging
7 import os 7 import os
8 import sys 8 import sys
9 import unittest 9 import unittest
10 10
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 self.assertEquals(to_native_eol('Sleeping.\nSlept.\n'), output) 89 self.assertEquals(to_native_eol('Sleeping.\nSlept.\n'), output)
90 self.assertEquals(0, code) 90 self.assertEquals(0, code)
91 91
92 def test_call_timeout_no_kill_eol(self): 92 def test_call_timeout_no_kill_eol(self):
93 cmd = [sys.executable, SLEEP, '0.001'] 93 cmd = [sys.executable, SLEEP, '0.001']
94 output, code = run_test_cases.call_with_timeout( 94 output, code = run_test_cases.call_with_timeout(
95 cmd, timeout=100, universal_newlines=True) 95 cmd, timeout=100, universal_newlines=True)
96 self.assertEquals('Sleeping.\nSlept.\n', output) 96 self.assertEquals('Sleeping.\nSlept.\n', output)
97 self.assertEquals(0, code) 97 self.assertEquals(0, code)
98 98
99 def test_gtest_filter(self):
100 old = run_test_cases.run_test_cases
101 exe = os.path.join(ROOT_DIR, 'data', 'gtest_fake', 'gtest_fake_pass.py')
102 def expect(executable, test_cases, jobs, timeout, no_dump):
103 self.assertEquals(exe, executable)
104 self.assertEquals(['Foo.Bar1', 'Foo.Bar3'], test_cases)
105 self.assertEquals(run_test_cases.num_processors(), jobs)
106 self.assertEquals(120, timeout)
107 self.assertEquals(None, no_dump)
108 return 89
109 try:
110 run_test_cases.run_test_cases = expect
111 result = run_test_cases.main([exe, '--gtest_filter=Foo.Bar*-*.Bar2'])
112 self.assertEquals(89, result)
113 finally:
114 run_test_cases.run_test_cases = old
115
99 116
100 class WorkerPoolTest(unittest.TestCase): 117 class WorkerPoolTest(unittest.TestCase):
101 def test_normal(self): 118 def test_normal(self):
102 mapper = lambda value: -value 119 mapper = lambda value: -value
103 with run_test_cases.ThreadPool(8) as pool: 120 with run_test_cases.ThreadPool(8) as pool:
104 for i in range(32): 121 for i in range(32):
105 pool.add_task(mapper, i) 122 pool.add_task(mapper, i)
106 results = pool.join() 123 results = pool.join()
107 self.assertEquals(range(-31, 1), sorted(results)) 124 self.assertEquals(range(-31, 1), sorted(results))
108 125
(...skipping 10 matching lines...) Expand all
119 pool.join() 136 pool.join()
120 self.fail() 137 self.fail()
121 except FearsomeException: 138 except FearsomeException:
122 self.assertEquals(True, task_added) 139 self.assertEquals(True, task_added)
123 140
124 141
125 if __name__ == '__main__': 142 if __name__ == '__main__':
126 VERBOSE = '-v' in sys.argv 143 VERBOSE = '-v' in sys.argv
127 logging.basicConfig(level=logging.DEBUG if VERBOSE else logging.ERROR) 144 logging.basicConfig(level=logging.DEBUG if VERBOSE else logging.ERROR)
128 unittest.main() 145 unittest.main()
OLDNEW
« no previous file with comments | « tools/isolate/run_test_cases.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698