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

Side by Side Diff: tests/run_test_cases_test.py

Issue 12995009: Parse the test executable output on the fly. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/swarm_client
Patch Set: oops Created 7 years, 9 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 | « 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 shutil 8 import shutil
9 import subprocess 9 import subprocess
10 import sys 10 import sys
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 self.assertFalse(verbose) 233 self.assertFalse(verbose)
234 return 89 234 return 89
235 235
236 try: 236 try:
237 run_test_cases.run_test_cases = expect 237 run_test_cases.run_test_cases = expect
238 result = run_test_cases.main([exe, '--gtest_filter=Foo.Bar*-*.Bar2']) 238 result = run_test_cases.main([exe, '--gtest_filter=Foo.Bar*-*.Bar2'])
239 self.assertEquals(89, result) 239 self.assertEquals(89, result)
240 finally: 240 finally:
241 run_test_cases.run_test_cases = old 241 run_test_cases.run_test_cases = old
242 242
243 def test_convert_to_lines(self):
244 data = [
245 (
246 ('blah'),
247 ['blah'],
248 ),
249 (
250 ('blah\n'),
251 ['blah\n'],
252 ),
253 (
254 ('blah', '\n'),
255 ['blah\n'],
256 ),
257 (
258 ('\n'),
259 ['\n'],
260 ),
261 (
262 ('blah blah\nboo'),
263 ['blah blah\n', 'boo'],
264 ),
265 (
266 ('b', 'lah blah\nboo'),
267 ['blah blah\n', 'boo'],
268 ),
269 ]
270 for generator, expected in data:
271 self.assertEqual(
272 expected,
273 list(run_test_cases.convert_to_lines(generator)))
274
243 def testRunSome(self): 275 def testRunSome(self):
244 tests = [ 276 tests = [
245 # Try with named arguments. Accepts 3*1 failures. 277 # Try with named arguments. Accepts 3*1 failures.
246 ( 278 (
247 run_test_cases.RunSome( 279 run_test_cases.RunSome(
248 expected_count=10, 280 expected_count=10,
249 retries=2, 281 retries=2,
250 min_failures=1, 282 min_failures=1,
251 max_failure_ratio=0.001, 283 max_failure_ratio=0.001,
252 max_failures=None), 284 max_failures=None),
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after
608 self.fail() 640 self.fail()
609 except FearsomeException: 641 except FearsomeException:
610 self.assertEquals(True, task_added) 642 self.assertEquals(True, task_added)
611 643
612 644
613 if __name__ == '__main__': 645 if __name__ == '__main__':
614 VERBOSE = '-v' in sys.argv 646 VERBOSE = '-v' in sys.argv
615 logging.basicConfig(level=logging.DEBUG if VERBOSE else logging.ERROR) 647 logging.basicConfig(level=logging.DEBUG if VERBOSE else logging.ERROR)
616 unittest.TestCase.maxDiff = 5000 648 unittest.TestCase.maxDiff = 5000
617 unittest.main() 649 unittest.main()
OLDNEW
« no previous file with comments | « run_test_cases.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698