| OLD | NEW |
| 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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 "'auto' or 'native' for auto-detect"), | 87 "'auto' or 'native' for auto-detect"), |
| 88 default="ia32,x64,arm") | 88 default="ia32,x64,arm") |
| 89 result.add_option("--arch-and-mode", | 89 result.add_option("--arch-and-mode", |
| 90 help="Architecture and mode in the format 'arch.mode'", | 90 help="Architecture and mode in the format 'arch.mode'", |
| 91 default=None) | 91 default=None) |
| 92 result.add_option("--buildbot", | 92 result.add_option("--buildbot", |
| 93 help="Adapt to path structure used on buildbots", | 93 help="Adapt to path structure used on buildbots", |
| 94 default=False, action="store_true") | 94 default=False, action="store_true") |
| 95 result.add_option("--cat", help="Print the source of the tests", | 95 result.add_option("--cat", help="Print the source of the tests", |
| 96 default=False, action="store_true") | 96 default=False, action="store_true") |
| 97 result.add_option("--flaky-tests", | |
| 98 help="Regard tests marked as flaky (run|skip|dontcare)", | |
| 99 default="dontcare") | |
| 100 result.add_option("--command-prefix", | 97 result.add_option("--command-prefix", |
| 101 help="Prepended to each shell command used to run a test", | 98 help="Prepended to each shell command used to run a test", |
| 102 default="") | 99 default="") |
| 103 result.add_option("--download-data", help="Download missing test suite data", | 100 result.add_option("--download-data", help="Download missing test suite data", |
| 104 default=False, action="store_true") | 101 default=False, action="store_true") |
| 105 result.add_option("--extra-flags", | 102 result.add_option("--extra-flags", |
| 106 help="Additional flags to pass to each test command", | 103 help="Additional flags to pass to each test command", |
| 107 default="") | 104 default="") |
| 108 result.add_option("--isolates", help="Whether to test isolates", | 105 result.add_option("--isolates", help="Whether to test isolates", |
| 109 default=False, action="store_true") | 106 default=False, action="store_true") |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 if options.shell: | 197 if options.shell: |
| 201 print "Warning: --shell is deprecated, use --shell-dir instead." | 198 print "Warning: --shell is deprecated, use --shell-dir instead." |
| 202 options.shell_dir = os.path.dirname(options.shell) | 199 options.shell_dir = os.path.dirname(options.shell) |
| 203 if options.stress_only: | 200 if options.stress_only: |
| 204 VARIANT_FLAGS = [["--stress-opt", "--always-opt"]] | 201 VARIANT_FLAGS = [["--stress-opt", "--always-opt"]] |
| 205 if options.valgrind: | 202 if options.valgrind: |
| 206 run_valgrind = os.path.join("tools", "run-valgrind.py") | 203 run_valgrind = os.path.join("tools", "run-valgrind.py") |
| 207 # This is OK for distributed running, so we don't need to set no_network. | 204 # This is OK for distributed running, so we don't need to set no_network. |
| 208 options.command_prefix = (["python", "-u", run_valgrind] + | 205 options.command_prefix = (["python", "-u", run_valgrind] + |
| 209 options.command_prefix) | 206 options.command_prefix) |
| 210 if not options.flaky_tests in ["run", "skip", "dontcare"]: | |
| 211 print "Unknown flaky test mode %s" % options.flaky_tests | |
| 212 return False | |
| 213 return True | 207 return True |
| 214 | 208 |
| 215 | 209 |
| 216 def ShardTests(tests, shard_count, shard_run): | 210 def ShardTests(tests, shard_count, shard_run): |
| 217 if shard_count < 2: | 211 if shard_count < 2: |
| 218 return tests | 212 return tests |
| 219 if shard_run < 1 or shard_run > shard_count: | 213 if shard_run < 1 or shard_run > shard_count: |
| 220 print "shard-run not a valid number, should be in [1:shard-count]" | 214 print "shard-run not a valid number, should be in [1:shard-count]" |
| 221 print "defaulting back to running all tests" | 215 print "defaulting back to running all tests" |
| 222 return tests | 216 return tests |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 314 } | 308 } |
| 315 all_tests = [] | 309 all_tests = [] |
| 316 num_tests = 0 | 310 num_tests = 0 |
| 317 test_id = 0 | 311 test_id = 0 |
| 318 for s in suites: | 312 for s in suites: |
| 319 s.ReadStatusFile(variables) | 313 s.ReadStatusFile(variables) |
| 320 s.ReadTestCases(ctx) | 314 s.ReadTestCases(ctx) |
| 321 if len(args) > 0: | 315 if len(args) > 0: |
| 322 s.FilterTestCasesByArgs(args) | 316 s.FilterTestCasesByArgs(args) |
| 323 all_tests += s.tests | 317 all_tests += s.tests |
| 324 s.FilterTestCasesByStatus(options.warn_unused, options.flaky_tests) | 318 s.FilterTestCasesByStatus(options.warn_unused) |
| 325 if options.cat: | 319 if options.cat: |
| 326 verbose.PrintTestSource(s.tests) | 320 verbose.PrintTestSource(s.tests) |
| 327 continue | 321 continue |
| 328 variant_flags = s.VariantFlags() or VARIANT_FLAGS | 322 variant_flags = s.VariantFlags() or VARIANT_FLAGS |
| 329 s.tests = [ t.CopyAddingFlags(v) for t in s.tests for v in variant_flags ] | 323 s.tests = [ t.CopyAddingFlags(v) for t in s.tests for v in variant_flags ] |
| 330 s.tests = ShardTests(s.tests, options.shard_count, options.shard_run) | 324 s.tests = ShardTests(s.tests, options.shard_count, options.shard_run) |
| 331 num_tests += len(s.tests) | 325 num_tests += len(s.tests) |
| 332 for t in s.tests: | 326 for t in s.tests: |
| 333 t.id = test_id | 327 t.id = test_id |
| 334 test_id += 1 | 328 test_id += 1 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 383 except KeyboardInterrupt: | 377 except KeyboardInterrupt: |
| 384 return 1 | 378 return 1 |
| 385 | 379 |
| 386 if options.time: | 380 if options.time: |
| 387 verbose.PrintTestDurations(suites, overall_duration) | 381 verbose.PrintTestDurations(suites, overall_duration) |
| 388 return exit_code | 382 return exit_code |
| 389 | 383 |
| 390 | 384 |
| 391 if __name__ == "__main__": | 385 if __name__ == "__main__": |
| 392 sys.exit(Main()) | 386 sys.exit(Main()) |
| OLD | NEW |