| 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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 result.add_option("--no-network", "--nonetwork", | 120 result.add_option("--no-network", "--nonetwork", |
| 121 help="Don't distribute tests on the network", | 121 help="Don't distribute tests on the network", |
| 122 default=(utils.GuessOS() != "linux"), | 122 default=(utils.GuessOS() != "linux"), |
| 123 dest="no_network", action="store_true") | 123 dest="no_network", action="store_true") |
| 124 result.add_option("--no-presubmit", "--nopresubmit", | 124 result.add_option("--no-presubmit", "--nopresubmit", |
| 125 help='Skip presubmit checks', | 125 help='Skip presubmit checks', |
| 126 default=False, dest="no_presubmit", action="store_true") | 126 default=False, dest="no_presubmit", action="store_true") |
| 127 result.add_option("--no-stress", "--nostress", | 127 result.add_option("--no-stress", "--nostress", |
| 128 help="Don't run crankshaft --always-opt --stress-op test", | 128 help="Don't run crankshaft --always-opt --stress-op test", |
| 129 default=False, dest="no_stress", action="store_true") | 129 default=False, dest="no_stress", action="store_true") |
| 130 result.add_option("--no-variants", "--novariants", |
| 131 help="Don't run any testing variants", |
| 132 default=False, dest="no_variants", action="store_true") |
| 130 result.add_option("--outdir", help="Base directory with compile output", | 133 result.add_option("--outdir", help="Base directory with compile output", |
| 131 default="out") | 134 default="out") |
| 132 result.add_option("-p", "--progress", | 135 result.add_option("-p", "--progress", |
| 133 help=("The style of progress indicator" | 136 help=("The style of progress indicator" |
| 134 " (verbose, dots, color, mono)"), | 137 " (verbose, dots, color, mono)"), |
| 135 choices=progress.PROGRESS_INDICATORS.keys(), default="mono") | 138 choices=progress.PROGRESS_INDICATORS.keys(), default="mono") |
| 136 result.add_option("--report", help="Print a summary of the tests to be run", | 139 result.add_option("--report", help="Print a summary of the tests to be run", |
| 137 default=False, action="store_true") | 140 default=False, action="store_true") |
| 138 result.add_option("--shard-count", | 141 result.add_option("--shard-count", |
| 139 help="Split testsuites into this number of shards", | 142 help="Split testsuites into this number of shards", |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 options.no_presubmit = True | 199 options.no_presubmit = True |
| 197 options.no_network = True | 200 options.no_network = True |
| 198 if options.command_prefix: | 201 if options.command_prefix: |
| 199 print("Specifying --command-prefix disables network distribution, " | 202 print("Specifying --command-prefix disables network distribution, " |
| 200 "running tests locally.") | 203 "running tests locally.") |
| 201 options.no_network = True | 204 options.no_network = True |
| 202 options.command_prefix = shlex.split(options.command_prefix) | 205 options.command_prefix = shlex.split(options.command_prefix) |
| 203 options.extra_flags = shlex.split(options.extra_flags) | 206 options.extra_flags = shlex.split(options.extra_flags) |
| 204 if options.j == 0: | 207 if options.j == 0: |
| 205 options.j = multiprocessing.cpu_count() | 208 options.j = multiprocessing.cpu_count() |
| 209 |
| 210 def excl(*args): |
| 211 """Returns true if zero or one of multiple arguments are true.""" |
| 212 return reduce(lambda x, y: x + y, args) <= 1 |
| 213 |
| 214 if not excl(options.no_stress, options.stress_only, options.no_variants): |
| 215 print "Use only one of --no-stress, --stress-only or --no-variants." |
| 216 return False |
| 206 if options.no_stress: | 217 if options.no_stress: |
| 207 VARIANT_FLAGS = [[], ["--nocrankshaft"]] | 218 VARIANT_FLAGS = [[], ["--nocrankshaft"]] |
| 219 if options.no_variants: |
| 220 VARIANT_FLAGS = [[]] |
| 208 if not options.shell_dir: | 221 if not options.shell_dir: |
| 209 if options.shell: | 222 if options.shell: |
| 210 print "Warning: --shell is deprecated, use --shell-dir instead." | 223 print "Warning: --shell is deprecated, use --shell-dir instead." |
| 211 options.shell_dir = os.path.dirname(options.shell) | 224 options.shell_dir = os.path.dirname(options.shell) |
| 212 if options.stress_only: | 225 if options.stress_only: |
| 213 VARIANT_FLAGS = [["--stress-opt", "--always-opt"]] | 226 VARIANT_FLAGS = [["--stress-opt", "--always-opt"]] |
| 214 if options.valgrind: | 227 if options.valgrind: |
| 215 run_valgrind = os.path.join("tools", "run-valgrind.py") | 228 run_valgrind = os.path.join("tools", "run-valgrind.py") |
| 216 # This is OK for distributed running, so we don't need to set no_network. | 229 # This is OK for distributed running, so we don't need to set no_network. |
| 217 options.command_prefix = (["python", "-u", run_valgrind] + | 230 options.command_prefix = (["python", "-u", run_valgrind] + |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 334 for s in suites: | 347 for s in suites: |
| 335 s.ReadStatusFile(variables) | 348 s.ReadStatusFile(variables) |
| 336 s.ReadTestCases(ctx) | 349 s.ReadTestCases(ctx) |
| 337 if len(args) > 0: | 350 if len(args) > 0: |
| 338 s.FilterTestCasesByArgs(args) | 351 s.FilterTestCasesByArgs(args) |
| 339 all_tests += s.tests | 352 all_tests += s.tests |
| 340 s.FilterTestCasesByStatus(options.warn_unused, options.flaky_tests) | 353 s.FilterTestCasesByStatus(options.warn_unused, options.flaky_tests) |
| 341 if options.cat: | 354 if options.cat: |
| 342 verbose.PrintTestSource(s.tests) | 355 verbose.PrintTestSource(s.tests) |
| 343 continue | 356 continue |
| 344 variant_flags = s.VariantFlags() or VARIANT_FLAGS | 357 s.tests = [ t.CopyAddingFlags(v) |
| 345 s.tests = [ t.CopyAddingFlags(v) for t in s.tests for v in variant_flags ] | 358 for t in s.tests |
| 359 for v in s.VariantFlags(t, VARIANT_FLAGS) ] |
| 346 s.tests = ShardTests(s.tests, options.shard_count, options.shard_run) | 360 s.tests = ShardTests(s.tests, options.shard_count, options.shard_run) |
| 347 num_tests += len(s.tests) | 361 num_tests += len(s.tests) |
| 348 for t in s.tests: | 362 for t in s.tests: |
| 349 t.id = test_id | 363 t.id = test_id |
| 350 test_id += 1 | 364 test_id += 1 |
| 351 | 365 |
| 352 if options.cat: | 366 if options.cat: |
| 353 return 0 # We're done here. | 367 return 0 # We're done here. |
| 354 | 368 |
| 355 if options.report: | 369 if options.report: |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 399 except KeyboardInterrupt: | 413 except KeyboardInterrupt: |
| 400 return 1 | 414 return 1 |
| 401 | 415 |
| 402 if options.time: | 416 if options.time: |
| 403 verbose.PrintTestDurations(suites, overall_duration) | 417 verbose.PrintTestDurations(suites, overall_duration) |
| 404 return exit_code | 418 return exit_code |
| 405 | 419 |
| 406 | 420 |
| 407 if __name__ == "__main__": | 421 if __name__ == "__main__": |
| 408 sys.exit(Main()) | 422 sys.exit(Main()) |
| OLD | NEW |