Chromium Code Reviews

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

Issue 1245623005: [test] Key variant flags by variant name everywhere. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
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 26 matching lines...)
37 import platform 37 import platform
38 import random 38 import random
39 import shlex 39 import shlex
40 import subprocess 40 import subprocess
41 import sys 41 import sys
42 import time 42 import time
43 43
44 from testrunner.local import execution 44 from testrunner.local import execution
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 VARIANT_FLAGS 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 = [ 55 DEFAULT_TESTS = [
56 "mjsunit", 56 "mjsunit",
57 "unittests", 57 "unittests",
(...skipping 267 matching lines...)
325 def BuildbotToV8Mode(config): 325 def BuildbotToV8Mode(config):
326 """Convert buildbot build configs to configs understood by the v8 runner. 326 """Convert buildbot build configs to configs understood by the v8 runner.
327 327
328 V8 configs are always lower case and without the additional _x64 suffix for 328 V8 configs are always lower case and without the additional _x64 suffix for
329 64 bit builds on windows with ninja. 329 64 bit builds on windows with ninja.
330 """ 330 """
331 mode = config[:-4] if config.endswith('_x64') else config 331 mode = config[:-4] if config.endswith('_x64') else config
332 return mode.lower() 332 return mode.lower()
333 333
334 def ProcessOptions(options): 334 def ProcessOptions(options):
335 global VARIANT_FLAGS 335 global ALL_VARIANTS
336 global VARIANTS 336 global VARIANTS
337 337
338 # Architecture and mode related stuff. 338 # Architecture and mode related stuff.
339 if options.arch_and_mode: 339 if options.arch_and_mode:
340 options.arch_and_mode = [arch_and_mode.split(".") 340 options.arch_and_mode = [arch_and_mode.split(".")
341 for arch_and_mode in options.arch_and_mode.split(",")] 341 for arch_and_mode in options.arch_and_mode.split(",")]
342 options.arch = ",".join([tokens[0] for tokens in options.arch_and_mode]) 342 options.arch = ",".join([tokens[0] for tokens in options.arch_and_mode])
343 options.mode = ",".join([tokens[1] for tokens in options.arch_and_mode]) 343 options.mode = ",".join([tokens[1] for tokens in options.arch_and_mode])
344 options.mode = options.mode.split(",") 344 options.mode = options.mode.split(",")
345 for mode in options.mode: 345 for mode in options.mode:
(...skipping 70 matching lines...)
416 options.slow_tests = "skip" 416 options.slow_tests = "skip"
417 options.pass_fail_tests = "skip" 417 options.pass_fail_tests = "skip"
418 if options.no_stress: 418 if options.no_stress:
419 VARIANTS = ["default", "nocrankshaft"] 419 VARIANTS = ["default", "nocrankshaft"]
420 if options.no_variants: 420 if options.no_variants:
421 VARIANTS = ["default"] 421 VARIANTS = ["default"]
422 if options.stress_only: 422 if options.stress_only:
423 VARIANTS = ["stress"] 423 VARIANTS = ["stress"]
424 if options.variants: 424 if options.variants:
425 VARIANTS = options.variants.split(",") 425 VARIANTS = options.variants.split(",")
426 if not set(VARIANTS).issubset(VARIANT_FLAGS.keys()): 426 if not set(VARIANTS).issubset(ALL_VARIANTS.keys()):
427 print "All variants must be in %s" % str(VARIANT_FLAGS.keys()) 427 print "All variants must be in %s" % str(ALL_VARIANTS.keys())
428 return False 428 return False
429 if options.predictable: 429 if options.predictable:
430 VARIANTS = ["default"] 430 VARIANTS = ["default"]
431 options.extra_flags.append("--predictable") 431 options.extra_flags.append("--predictable")
432 options.extra_flags.append("--verify_predictable") 432 options.extra_flags.append("--verify_predictable")
433 options.extra_flags.append("--no-inline-new") 433 options.extra_flags.append("--no-inline-new")
434 434
435 if not options.shell_dir: 435 if not options.shell_dir:
436 if options.shell: 436 if options.shell:
437 print "Warning: --shell is deprecated, use --shell-dir instead." 437 print "Warning: --shell is deprecated, use --shell-dir instead."
(...skipping 176 matching lines...)
614 s.ReadStatusFile(variables) 614 s.ReadStatusFile(variables)
615 s.ReadTestCases(ctx) 615 s.ReadTestCases(ctx)
616 if len(args) > 0: 616 if len(args) > 0:
617 s.FilterTestCasesByArgs(args) 617 s.FilterTestCasesByArgs(args)
618 all_tests += s.tests 618 all_tests += s.tests
619 s.FilterTestCasesByStatus(options.warn_unused, options.flaky_tests, 619 s.FilterTestCasesByStatus(options.warn_unused, options.flaky_tests,
620 options.slow_tests, options.pass_fail_tests) 620 options.slow_tests, options.pass_fail_tests)
621 if options.cat: 621 if options.cat:
622 verbose.PrintTestSource(s.tests) 622 verbose.PrintTestSource(s.tests)
623 continue 623 continue
624 variant_flags = [VARIANT_FLAGS[var] for var in VARIANTS] 624 variant_flags = s.VariantFlags(VARIANTS)
625 variant_tests = [ t.CopyAddingFlags(v) 625 variant_tests = [ t.CopyAddingFlags(flags)
626 for t in s.tests 626 for t in s.tests
627 for v in s.VariantFlags(t, variant_flags) ] 627 for _, flags in variant_flags(t) ]
628 628
629 if options.random_seed_stress_count > 1: 629 if options.random_seed_stress_count > 1:
630 # Duplicate test for random seed stress mode. 630 # Duplicate test for random seed stress mode.
631 def iter_seed_flags(): 631 def iter_seed_flags():
632 for i in range(0, options.random_seed_stress_count): 632 for i in range(0, options.random_seed_stress_count):
633 # Use given random seed for all runs (set by default in execution.py) 633 # Use given random seed for all runs (set by default in execution.py)
634 # or a new random seed if none is specified. 634 # or a new random seed if none is specified.
635 if options.random_seed: 635 if options.random_seed:
636 yield [] 636 yield []
637 else: 637 else:
638 yield ["--random-seed=%d" % RandomSeed()] 638 yield ["--random-seed=%d" % RandomSeed()]
639 s.tests = [ 639 s.tests = [
640 t.CopyAddingFlags(v) 640 t.CopyAddingFlags(flags)
641 for t in variant_tests 641 for t in variant_tests
642 for v in iter_seed_flags() 642 for flags in iter_seed_flags()
643 ] 643 ]
644 else: 644 else:
645 s.tests = variant_tests 645 s.tests = variant_tests
646 646
647 s.tests = ShardTests(s.tests, options.shard_count, options.shard_run) 647 s.tests = ShardTests(s.tests, options.shard_count, options.shard_run)
648 num_tests += len(s.tests) 648 num_tests += len(s.tests)
649 649
650 if options.cat: 650 if options.cat:
651 return 0 # We're done here. 651 return 0 # We're done here.
652 652
(...skipping 39 matching lines...)
692 exit_code = runner.Run(options.j) 692 exit_code = runner.Run(options.j)
693 overall_duration = time.time() - start_time 693 overall_duration = time.time() - start_time
694 694
695 if options.time: 695 if options.time:
696 verbose.PrintTestDurations(suites, overall_duration) 696 verbose.PrintTestDurations(suites, overall_duration)
697 return exit_code 697 return exit_code
698 698
699 699
700 if __name__ == "__main__": 700 if __name__ == "__main__":
701 sys.exit(Main()) 701 sys.exit(Main())
OLDNEW

Powered by Google App Engine