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

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

Issue 2373043002: [test] Make test runner more rubust on startup. (Closed)
Patch Set: Created 4 years, 2 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
« no previous file with comments | « no previous file | 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 # Copyright 2012 the V8 project authors. All rights reserved. 1 # Copyright 2012 the V8 project authors. All rights reserved.
2 # Redistribution and use in source and binary forms, with or without 2 # Redistribution and use in source and binary forms, with or without
3 # modification, are permitted provided that the following conditions are 3 # modification, are permitted provided that the following conditions are
4 # met: 4 # met:
5 # 5 #
6 # * Redistributions of source code must retain the above copyright 6 # * Redistributions of source code must retain the above copyright
7 # notice, this list of conditions and the following disclaimer. 7 # notice, this list of conditions and the following disclaimer.
8 # * Redistributions in binary form must reproduce the above 8 # * Redistributions in binary form must reproduce the above
9 # copyright notice, this list of conditions and the following 9 # copyright notice, this list of conditions and the following
10 # disclaimer in the documentation and/or other materials provided 10 # disclaimer in the documentation and/or other materials provided
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 318
319 319
320 class GoogleTestSuite(TestSuite): 320 class GoogleTestSuite(TestSuite):
321 def __init__(self, name, root): 321 def __init__(self, name, root):
322 super(GoogleTestSuite, self).__init__(name, root) 322 super(GoogleTestSuite, self).__init__(name, root)
323 323
324 def ListTests(self, context): 324 def ListTests(self, context):
325 shell = os.path.abspath(os.path.join(context.shell_dir, self.shell())) 325 shell = os.path.abspath(os.path.join(context.shell_dir, self.shell()))
326 if utils.IsWindows(): 326 if utils.IsWindows():
327 shell += ".exe" 327 shell += ".exe"
328 output = commands.Execute(context.command_prefix + 328
329 [shell, "--gtest_list_tests"] + 329 output = None
330 context.extra_flags) 330 for i in xrange(3): # Try 3 times in case of errors.
331 if output.exit_code != 0: 331 output = commands.Execute(context.command_prefix +
332 [shell, "--gtest_list_tests"] +
333 context.extra_flags)
334 if output.exit_code == 0:
335 break
336 print "Test executable failed to list the tests (try %d).\n\nStdout:" % i
332 print output.stdout 337 print output.stdout
338 print "\nStderr:"
333 print output.stderr 339 print output.stderr
340 print "\nExit code: %d" % output.exit_code
341 else:
334 raise Exception("Test executable failed to list the tests.") 342 raise Exception("Test executable failed to list the tests.")
343
335 tests = [] 344 tests = []
336 test_case = '' 345 test_case = ''
337 for line in output.stdout.splitlines(): 346 for line in output.stdout.splitlines():
338 test_desc = line.strip().split()[0] 347 test_desc = line.strip().split()[0]
339 if test_desc.endswith('.'): 348 if test_desc.endswith('.'):
340 test_case = test_desc 349 test_case = test_desc
341 elif test_case and test_desc: 350 elif test_case and test_desc:
342 test = testcase.TestCase(self, test_case + test_desc) 351 test = testcase.TestCase(self, test_case + test_desc)
343 tests.append(test) 352 tests.append(test)
344 tests.sort(key=lambda t: t.path) 353 tests.sort(key=lambda t: t.path)
345 return tests 354 return tests
346 355
347 def GetFlagsForTestCase(self, testcase, context): 356 def GetFlagsForTestCase(self, testcase, context):
348 return (testcase.flags + ["--gtest_filter=" + testcase.path] + 357 return (testcase.flags + ["--gtest_filter=" + testcase.path] +
349 ["--gtest_random_seed=%s" % context.random_seed] + 358 ["--gtest_random_seed=%s" % context.random_seed] +
350 ["--gtest_print_time=0"] + 359 ["--gtest_print_time=0"] +
351 context.mode_flags) 360 context.mode_flags)
352 361
353 def _VariantGeneratorFactory(self): 362 def _VariantGeneratorFactory(self):
354 return StandardVariantGenerator 363 return StandardVariantGenerator
355 364
356 def shell(self): 365 def shell(self):
357 return self.name 366 return self.name
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698