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