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

Side by Side Diff: tests/run_test_cases_smoke_test.py

Issue 11550013: Have run_test_cases.py always print test output for failures. (Closed) Base URL: https://git.chromium.org/git/chromium/tools/swarm_client.git@master
Patch Set: Created 8 years 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
« 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 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 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 def test_simple_fail(self): 217 def test_simple_fail(self):
218 out, err, return_code = RunTest( 218 out, err, return_code = RunTest(
219 [ 219 [
220 '--jobs', '1', 220 '--jobs', '1',
221 '--result', self.filename, 221 '--result', self.filename,
222 os.path.join(ROOT_DIR, 'tests', 'gtest_fake', 'gtest_fake_fail.py'), 222 os.path.join(ROOT_DIR, 'tests', 'gtest_fake', 'gtest_fake_fail.py'),
223 ]) 223 ])
224 224
225 self.assertEqual(1, return_code) 225 self.assertEqual(1, return_code)
226 226
227 expected_out_re = [ 227 test_failure_output = [
228 r'\[1/\d\] \d\.\d\ds .+',
229 r'\[2/\d\] \d\.\d\ds .+',
230 r'\[3/\d\] \d\.\d\ds .+',
231 r'\[4/\d\] \d\.\d\ds .+',
232 # Retries
233 r'\[5/\d\] \d\.\d\ds .+ retry \#1',
234 r'\[6/\d\] \d\.\d\ds .+ retry \#2',
235 re.escape('Note: Google Test filter = Baz.Fail'), 228 re.escape('Note: Google Test filter = Baz.Fail'),
236 r'', 229 r'',
237 ] + [ 230 ] + [
238 re.escape(l) for l in 231 re.escape(l) for l in
239 gtest_fake_base.get_test_output('Baz.Fail').splitlines() 232 gtest_fake_base.get_test_output('Baz.Fail').splitlines()
240 ] + [ 233 ] + [
241 '', 234 '',
242 ] + [ 235 ] + [
243 re.escape(l) for l in gtest_fake_base.get_footer(1, 1).splitlines() 236 re.escape(l) for l in gtest_fake_base.get_footer(1, 1).splitlines()
244 ] + [ 237 ] + [
245 '', 238 '',
246 '', 239 '',
240 ]
241
242 expected_out_re = [
243 r'\[1/\d\] \d\.\d\ds .+',
244 r'\[2/\d\] \d\.\d\ds .+',
245 r'\[3/\d\] \d\.\d\ds .+',
246 r'\[4/\d\] \d\.\d\ds .+',
247 ] + test_failure_output + [
248 # Retries
249 r'\[5/\d\] \d\.\d\ds .+ retry \#1',
250 ] + test_failure_output + [
251 r'\[6/\d\] \d\.\d\ds .+ retry \#2',
252 ] + test_failure_output + [
247 re.escape('Failed tests:'), 253 re.escape('Failed tests:'),
248 re.escape(' Baz.Fail'), 254 re.escape(' Baz.Fail'),
249 re.escape('Summary:'), 255 re.escape('Summary:'),
250 re.escape(' Success: 3 75.00%') + r' +\d+\.\d\ds', 256 re.escape(' Success: 3 75.00%') + r' +\d+\.\d\ds',
251 re.escape(' Flaky: 0 0.00%') + r' +\d+\.\d\ds', 257 re.escape(' Flaky: 0 0.00%') + r' +\d+\.\d\ds',
252 re.escape(' Fail: 1 25.00%') + r' +\d+\.\d\ds', 258 re.escape(' Fail: 1 25.00%') + r' +\d+\.\d\ds',
253 r' \d+\.\d\ds Done running 4 tests with 6 executions. \d+\.\d\d test/s', 259 r' \d+\.\d\ds Done running 4 tests with 6 executions. \d+\.\d\d test/s',
254 ] 260 ]
255 self._check_results(expected_out_re, out, err) 261 self._check_results(expected_out_re, out, err)
256 262
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 '--result', self.filename, 386 '--result', self.filename,
381 # Make it determinist. 387 # Make it determinist.
382 '--jobs', '1', 388 '--jobs', '1',
383 '--retries', '1', 389 '--retries', '1',
384 '--max-failures', '2', 390 '--max-failures', '2',
385 os.path.join( 391 os.path.join(
386 ROOT_DIR, 'tests', 'gtest_fake', 'gtest_fake_flaky.py'), 392 ROOT_DIR, 'tests', 'gtest_fake', 'gtest_fake_flaky.py'),
387 tempdir, 393 tempdir,
388 ]) 394 ])
389 self.assertEqual(1, return_code) 395 self.assertEqual(1, return_code)
390 # Give up on checking the stdout. 396 # Give up on checking the stdout.
M-A Ruel 2012/12/12 14:30:30 Ah! I was wondering about test_flaky_something. I
391 self.assertTrue('STOPPED EARLY' in out, out) 397 self.assertTrue('STOPPED EARLY' in out, out)
392 self.assertEqual('', err) 398 self.assertEqual('', err)
393 # The order is determined by the test shuffling. 399 # The order is determined by the test shuffling.
394 test_cases = [ 400 test_cases = [
395 ('Foo.Bar1', 1), 401 ('Foo.Bar1', 1),
396 ('Foo.Bar4', 1), 402 ('Foo.Bar4', 1),
397 ('Foo.Bar5', 1), 403 ('Foo.Bar5', 1),
398 ] 404 ]
399 self._check_results_file( 405 self._check_results_file(
400 fail=[u'Foo.Bar1', u'Foo.Bar4', u'Foo.Bar5'], 406 fail=[u'Foo.Bar1', u'Foo.Bar4', u'Foo.Bar5'],
(...skipping 16 matching lines...) Expand all
417 actual_xml = load_xml_as_string_and_filter(self.filename) 423 actual_xml = load_xml_as_string_and_filter(self.filename)
418 expected_xml = load_xml_as_string_and_filter( 424 expected_xml = load_xml_as_string_and_filter(
419 os.path.join(ROOT_DIR, 'tests', 'gtest_fake', 'expected.xml')) 425 os.path.join(ROOT_DIR, 'tests', 'gtest_fake', 'expected.xml'))
420 self.assertEqual(expected_xml, actual_xml) 426 self.assertEqual(expected_xml, actual_xml)
421 427
422 428
423 if __name__ == '__main__': 429 if __name__ == '__main__':
424 VERBOSE = '-v' in sys.argv 430 VERBOSE = '-v' in sys.argv
425 logging.basicConfig(level=logging.DEBUG if VERBOSE else logging.ERROR) 431 logging.basicConfig(level=logging.DEBUG if VERBOSE else logging.ERROR)
426 unittest.main() 432 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