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

Side by Side Diff: tests/run_test_cases_smoke_test.py

Issue 12976005: Get rid of the single test_case code path. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/swarm_client
Patch Set: Rebase take two 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 | « tests/gtest_fake/gtest_fake_base.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 json 6 import json
7 import logging 7 import logging
8 import os 8 import os
9 import re 9 import re
10 import shutil 10 import shutil
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 expected_out_re = [] 238 expected_out_re = []
239 test_cases = ( 239 test_cases = (
240 'Foo.Bar2', 240 'Foo.Bar2',
241 'Foo.Bar1', 241 'Foo.Bar1',
242 'Foo.Bar/3', 242 'Foo.Bar/3',
243 ) 243 )
244 244
245 for index, name in enumerate(test_cases): 245 for index, name in enumerate(test_cases):
246 expected_out_re.append( 246 expected_out_re.append(
247 r'\[%d/\d\] \d\.\d\ds ' % (index + 1) + re.escape(name) + ' .+') 247 r'\[%d/\d\] \d\.\d\ds ' % (index + 1) + re.escape(name) + ' .+')
248 expected_out_re.append(re.escape('Note: Google Test filter = ' + name))
249 expected_out_re.append('')
250 expected_out_re.extend( 248 expected_out_re.extend(
251 re.escape(l) for l in 249 re.escape(l) for l in
252 gtest_fake_base.get_test_output(name, False).splitlines()) 250 gtest_fake_base.get_test_output_inner(name, False).splitlines())
253 expected_out_re.append('')
254 expected_out_re.extend(
255 re.escape(l) for l in gtest_fake_base.get_footer(1, 1).splitlines())
256 expected_out_re.append('')
257 expected_out_re.append('') 251 expected_out_re.append('')
258 252
259 expected_out_re.extend([ 253 expected_out_re.extend([
260 re.escape('Summary:'), 254 re.escape('Summary:'),
261 re.escape(' Success: 3 100.00%') + r' +\d+\.\d\ds', 255 re.escape(' Success: 3 100.00%') + r' +\d+\.\d\ds',
262 re.escape(' Flaky: 0 0.00%') + r' +\d+\.\d\ds', 256 re.escape(' Flaky: 0 0.00%') + r' +\d+\.\d\ds',
263 re.escape(' Fail: 0 0.00%') + r' +\d+\.\d\ds', 257 re.escape(' Fail: 0 0.00%') + r' +\d+\.\d\ds',
264 r' \d+\.\d\ds Done running 3 tests with 3 executions. \d+\.\d\d test/s', 258 r' \d+\.\d\ds Done running 3 tests with 3 executions. \d+\.\d\d test/s',
265 ]) 259 ])
266 self._check_results(expected_out_re, out, '') 260 self._check_results(expected_out_re, out, '')
(...skipping 29 matching lines...) Expand all
296 # Linearize execution. 290 # Linearize execution.
297 '--clusters', '1', 291 '--clusters', '1',
298 '--jobs', '1', 292 '--jobs', '1',
299 '--result', self.filename, 293 '--result', self.filename,
300 os.path.join(ROOT_DIR, 'tests', 'gtest_fake', 'gtest_fake_fail.py'), 294 os.path.join(ROOT_DIR, 'tests', 'gtest_fake', 'gtest_fake_fail.py'),
301 ]) 295 ])
302 296
303 self.assertEqual(1, return_code) 297 self.assertEqual(1, return_code)
304 298
305 test_failure_output = [ 299 test_failure_output = [
306 re.escape('Note: Google Test filter = Baz.Fail'), 300 re.escape(l) for l in
307 r'', 301 gtest_fake_base.get_test_output_inner('Baz.Fail', True).splitlines()
308 ] + [ 302 ] + [
309 re.escape(l) for l in
310 gtest_fake_base.get_test_output('Baz.Fail', True).splitlines()
311 ] + [
312 '',
313 ] + [
314 re.escape(l) for l in gtest_fake_base.get_footer(1, 1).splitlines()
315 ] + [
316 '',
317 '', 303 '',
318 ] 304 ]
319 305
320 expected_out_re = [ 306 expected_out_re = [
321 r'\[1/\d\] \d\.\d\ds .+', 307 r'\[1/\d\] \d\.\d\ds .+',
322 r'\[2/\d\] \d\.\d\ds .+', 308 r'\[2/\d\] \d\.\d\ds .+',
323 r'\[3/\d\] \d\.\d\ds .+', 309 r'\[3/\d\] \d\.\d\ds .+',
324 r'\[4/\d\] \d\.\d\ds .+', 310 r'\[4/\d\] \d\.\d\ds .+',
325 ] + test_failure_output + [ 311 ] + test_failure_output + [
326 # Retries 312 # Retries
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 ) 363 )
378 364
379 for index, name in enumerate(test_cases): 365 for index, name in enumerate(test_cases):
380 if index + 1 == len(test_cases): 366 if index + 1 == len(test_cases):
381 # We are about to retry the test serially, so check for the warning. 367 # We are about to retry the test serially, so check for the warning.
382 expected_out_re.extend( 368 expected_out_re.extend(
383 re.escape(l) for l in run_test_cases.running_serial_warning()) 369 re.escape(l) for l in run_test_cases.running_serial_warning())
384 370
385 expected_out_re.append( 371 expected_out_re.append(
386 r'\[%d/\d\] \d\.\d\ds ' % (index + 1) + re.escape(name) + ' .+') 372 r'\[%d/\d\] \d\.\d\ds ' % (index + 1) + re.escape(name) + ' .+')
387 expected_out_re.append(re.escape('Note: Google Test filter = ' + name))
388 expected_out_re.append('')
389 expected_out_re.extend( 373 expected_out_re.extend(
390 re.escape(l) for l in 374 re.escape(l)
391 gtest_fake_base.get_test_output(name, 'Fail' in name).splitlines()) 375 for l in gtest_fake_base.get_test_output_inner(
392 expected_out_re.append('') 376 name, 'Fail' in name).splitlines())
393 expected_out_re.extend(
394 re.escape(l) for l in gtest_fake_base.get_footer(1, 1).splitlines())
395 expected_out_re.append('')
396 expected_out_re.append('') 377 expected_out_re.append('')
397 378
398 expected_out_re.extend([ 379 expected_out_re.extend([
399 re.escape('Failed tests:'), 380 re.escape('Failed tests:'),
400 re.escape(' Baz.Fail'), 381 re.escape(' Baz.Fail'),
401 re.escape('Summary:'), 382 re.escape('Summary:'),
402 re.escape(' Success: 3 75.00%') + r' +\d+\.\d\ds', 383 re.escape(' Success: 3 75.00%') + r' +\d+\.\d\ds',
403 re.escape(' Flaky: 0 0.00%') + r' +\d+\.\d\ds', 384 re.escape(' Flaky: 0 0.00%') + r' +\d+\.\d\ds',
404 re.escape(' Fail: 1 25.00%') + r' +\d+\.\d\ds', 385 re.escape(' Fail: 1 25.00%') + r' +\d+\.\d\ds',
405 r' \d+\.\d\ds Done running 4 tests with 6 executions. \d+\.\d\d test/s', 386 r' \d+\.\d\ds Done running 4 tests with 6 executions. \d+\.\d\d test/s',
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
524 self.fail() 505 self.fail()
525 expected_xml = load_xml_as_string_and_filter( 506 expected_xml = load_xml_as_string_and_filter(
526 os.path.join(ROOT_DIR, 'tests', 'gtest_fake', 'expected.xml')) 507 os.path.join(ROOT_DIR, 'tests', 'gtest_fake', 'expected.xml'))
527 self.assertEqual(expected_xml, actual_xml) 508 self.assertEqual(expected_xml, actual_xml)
528 509
529 510
530 if __name__ == '__main__': 511 if __name__ == '__main__':
531 VERBOSE = '-v' in sys.argv 512 VERBOSE = '-v' in sys.argv
532 logging.basicConfig(level=logging.DEBUG if VERBOSE else logging.ERROR) 513 logging.basicConfig(level=logging.DEBUG if VERBOSE else logging.ERROR)
533 unittest.main() 514 unittest.main()
OLDNEW
« no previous file with comments | « tests/gtest_fake/gtest_fake_base.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698