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

Side by Side Diff: tools/run-tests.py

Issue 1374733006: [swarming] Run unittests together with default tests. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 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 | « test/developer_default.isolate ('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 # 2 #
3 # Copyright 2012 the V8 project authors. All rights reserved. 3 # Copyright 2012 the V8 project authors. All rights reserved.
4 # Redistribution and use in source and binary forms, with or without 4 # Redistribution and use in source and binary forms, with or without
5 # modification, are permitted provided that the following conditions are 5 # modification, are permitted provided that the following conditions are
6 # met: 6 # met:
7 # 7 #
8 # * Redistributions of source code must retain the above copyright 8 # * Redistributions of source code must retain the above copyright
9 # notice, this list of conditions and the following disclaimer. 9 # notice, this list of conditions and the following disclaimer.
10 # * Redistributions in binary form must reproduce the above 10 # * Redistributions in binary form must reproduce the above
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 from testrunner.local import progress 45 from testrunner.local import progress
46 from testrunner.local import testsuite 46 from testrunner.local import testsuite
47 from testrunner.local.testsuite import ALL_VARIANTS 47 from testrunner.local.testsuite import ALL_VARIANTS
48 from testrunner.local import utils 48 from testrunner.local import utils
49 from testrunner.local import verbose 49 from testrunner.local import verbose
50 from testrunner.network import network_execution 50 from testrunner.network import network_execution
51 from testrunner.objects import context 51 from testrunner.objects import context
52 52
53 53
54 ARCH_GUESS = utils.DefaultArch() 54 ARCH_GUESS = utils.DefaultArch()
55 DEFAULT_TESTS = [
56 "mjsunit",
57 "unittests",
58 "cctest",
59 "message",
60 "preparser",
61 "intl",
62 ]
63 55
64 # Map of test name synonyms to lists of test suites. Should be ordered by 56 # Map of test name synonyms to lists of test suites. Should be ordered by
65 # expected runtimes (suites with slow test cases first). These groups are 57 # expected runtimes (suites with slow test cases first). These groups are
66 # invoked in seperate steps on the bots. 58 # invoked in seperate steps on the bots.
67 TEST_MAP = { 59 TEST_MAP = {
68 "default": [ 60 "default": [
69 "mjsunit", 61 "mjsunit",
70 "cctest", 62 "cctest",
71 "message", 63 "message",
72 "preparser", 64 "preparser",
73 "intl", 65 "intl",
66 "unittests",
74 ], 67 ],
75 "optimize_for_size": [ 68 "optimize_for_size": [
76 "mjsunit", 69 "mjsunit",
77 "cctest", 70 "cctest",
78 "webkit", 71 "webkit",
79 "intl", 72 "intl",
80 ], 73 ],
81 "unittests": [ 74 "unittests": [
82 "unittests", 75 "unittests",
83 ], 76 ],
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 "mips64el", 163 "mips64el",
171 "nacl_ia32", 164 "nacl_ia32",
172 "nacl_x64", 165 "nacl_x64",
173 "x87", 166 "x87",
174 "arm64"] 167 "arm64"]
175 168
176 169
177 def BuildOptions(): 170 def BuildOptions():
178 result = optparse.OptionParser() 171 result = optparse.OptionParser()
179 result.usage = '%prog [options] [tests]' 172 result.usage = '%prog [options] [tests]'
180 result.description = """TESTS: %s""" % (DEFAULT_TESTS) 173 result.description = """TESTS: %s""" % (TEST_MAP["default"])
181 result.add_option("--arch", 174 result.add_option("--arch",
182 help=("The architecture to run tests for, " 175 help=("The architecture to run tests for, "
183 "'auto' or 'native' for auto-detect: %s" % SUPPORTED_A RCHS), 176 "'auto' or 'native' for auto-detect: %s" % SUPPORTED_A RCHS),
184 default="ia32,x64,arm") 177 default="ia32,x64,arm")
185 result.add_option("--arch-and-mode", 178 result.add_option("--arch-and-mode",
186 help="Architecture and mode in the format 'arch.mode'", 179 help="Architecture and mode in the format 'arch.mode'",
187 default=None) 180 default=None)
188 result.add_option("--asan", 181 result.add_option("--asan",
189 help="Regard test expectations for ASAN", 182 help="Regard test expectations for ASAN",
190 default=False, action="store_true") 183 default=False, action="store_true")
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
454 print "Unknown %s mode %s" % (name, option) 447 print "Unknown %s mode %s" % (name, option)
455 return False 448 return False
456 return True 449 return True
457 if not CheckTestMode("flaky test", options.flaky_tests): 450 if not CheckTestMode("flaky test", options.flaky_tests):
458 return False 451 return False
459 if not CheckTestMode("slow test", options.slow_tests): 452 if not CheckTestMode("slow test", options.slow_tests):
460 return False 453 return False
461 if not CheckTestMode("pass|fail test", options.pass_fail_tests): 454 if not CheckTestMode("pass|fail test", options.pass_fail_tests):
462 return False 455 return False
463 if options.no_i18n: 456 if options.no_i18n:
464 DEFAULT_TESTS.remove("intl")
465 TEST_MAP["default"].remove("intl") 457 TEST_MAP["default"].remove("intl")
466 return True 458 return True
467 459
468 460
469 def ShardTests(tests, shard_count, shard_run): 461 def ShardTests(tests, shard_count, shard_run):
470 if shard_count < 2: 462 if shard_count < 2:
471 return tests 463 return tests
472 if shard_run < 1 or shard_run > shard_count: 464 if shard_run < 1 or shard_run > shard_count:
473 print "shard-run not a valid number, should be in [1:shard-count]" 465 print "shard-run not a valid number, should be in [1:shard-count]"
474 print "defaulting back to running all tests" 466 print "defaulting back to running all tests"
(...skipping 16 matching lines...) Expand all
491 483
492 exit_code = 0 484 exit_code = 0
493 workspace = os.path.abspath(join(os.path.dirname(sys.argv[0]), "..")) 485 workspace = os.path.abspath(join(os.path.dirname(sys.argv[0]), ".."))
494 if not options.no_presubmit: 486 if not options.no_presubmit:
495 print ">>> running presubmit tests" 487 print ">>> running presubmit tests"
496 exit_code = subprocess.call( 488 exit_code = subprocess.call(
497 [sys.executable, join(workspace, "tools", "presubmit.py")]) 489 [sys.executable, join(workspace, "tools", "presubmit.py")])
498 490
499 suite_paths = utils.GetSuitePaths(join(workspace, "test")) 491 suite_paths = utils.GetSuitePaths(join(workspace, "test"))
500 492
493 # Use default tests if no test configuration was provided at the cmd line.
494 if len(args) == 0:
495 args = ["default"]
496
501 # Expand arguments with grouped tests. The args should reflect the list of 497 # Expand arguments with grouped tests. The args should reflect the list of
502 # suites as otherwise filters would break. 498 # suites as otherwise filters would break.
503 def ExpandTestGroups(name): 499 def ExpandTestGroups(name):
504 if name in TEST_MAP: 500 if name in TEST_MAP:
505 return [suite for suite in TEST_MAP[arg]] 501 return [suite for suite in TEST_MAP[arg]]
506 else: 502 else:
507 return [name] 503 return [name]
508 args = reduce(lambda x, y: x + y, 504 args = reduce(lambda x, y: x + y,
509 [ExpandTestGroups(arg) for arg in args], 505 [ExpandTestGroups(arg) for arg in args],
510 []) 506 [])
511 507
512 if len(args) == 0: 508 args_suites = OrderedDict() # Used as set
513 suite_paths = [ s for s in DEFAULT_TESTS if s in suite_paths ] 509 for arg in args:
514 else: 510 args_suites[arg.split('/')[0]] = True
515 args_suites = OrderedDict() # Used as set 511 suite_paths = [ s for s in args_suites if s in suite_paths ]
516 for arg in args:
517 args_suites[arg.split('/')[0]] = True
518 suite_paths = [ s for s in args_suites if s in suite_paths ]
519 512
520 suites = [] 513 suites = []
521 for root in suite_paths: 514 for root in suite_paths:
522 suite = testsuite.TestSuite.LoadTestSuite( 515 suite = testsuite.TestSuite.LoadTestSuite(
523 os.path.join(workspace, "test", root)) 516 os.path.join(workspace, "test", root))
524 if suite: 517 if suite:
525 suites.append(suite) 518 suites.append(suite)
526 519
527 if options.download_data or options.download_data_only: 520 if options.download_data or options.download_data_only:
528 for s in suites: 521 for s in suites:
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
711 verbose.PrintTestDurations(suites, overall_duration) 704 verbose.PrintTestDurations(suites, overall_duration)
712 705
713 if num_tests == 0: 706 if num_tests == 0:
714 print("Warning: no tests were run!") 707 print("Warning: no tests were run!")
715 708
716 return exit_code 709 return exit_code
717 710
718 711
719 if __name__ == "__main__": 712 if __name__ == "__main__":
720 sys.exit(Main()) 713 sys.exit(Main())
OLDNEW
« no previous file with comments | « test/developer_default.isolate ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698