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

Side by Side Diff: scripts/slave/runtest.py

Issue 26184003: Move memory waterfall build directory computation to the slave. (Closed) Base URL: http://src.chromium.org/chrome/trunk/tools/build/
Patch Set: Created 7 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 | « scripts/master/factory/chromium_commands.py ('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 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """A tool to run a chrome test executable, used by the buildbot slaves. 6 """A tool to run a chrome test executable, used by the buildbot slaves.
7 7
8 When this is run, the current directory (cwd) should be the outer build 8 When this is run, the current directory (cwd) should be the outer build
9 directory (e.g., chrome-release/build/). 9 directory (e.g., chrome-release/build/).
10 10
(...skipping 630 matching lines...) Expand 10 before | Expand all | Expand 10 after
641 641
642 if options.parallel: 642 if options.parallel:
643 command = _BuildParallelCommand(build_dir, test_exe_path, options) 643 command = _BuildParallelCommand(build_dir, test_exe_path, options)
644 elif options.run_shell_script: 644 elif options.run_shell_script:
645 command = ['bash', test_exe_path] 645 command = ['bash', test_exe_path]
646 elif options.run_python_script: 646 elif options.run_python_script:
647 command = [sys.executable, test_exe] 647 command = [sys.executable, test_exe]
648 else: 648 else:
649 command = [test_exe_path] 649 command = [test_exe_path]
650 command.extend(args[1:]) 650 command.extend(args[1:])
651 if options.pass_build_dir:
652 command.append('--build-dir=' + build_dir)
M-A Ruel 2013/10/06 20:32:26 In general I prefer using 2 separate arguments, e.
651 653
652 if list_parsers(options.annotate): 654 if list_parsers(options.annotate):
653 return 0 655 return 0
654 tracker_class = select_results_tracker(options.annotate, 656 tracker_class = select_results_tracker(options.annotate,
655 options.generate_json_file) 657 options.generate_json_file)
656 results_tracker = create_results_tracker(tracker_class, options) 658 results_tracker = create_results_tracker(tracker_class, options)
657 659
658 if options.generate_json_file: 660 if options.generate_json_file:
659 if os.path.exists(options.test_output_xml): 661 if os.path.exists(options.test_output_xml):
660 # remove the old XML output file. 662 # remove the old XML output file.
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
732 # If first argument is not in the correct format, log a warning but 734 # If first argument is not in the correct format, log a warning but
733 # fall back to assuming the first arg is the test_name and just run 735 # fall back to assuming the first arg is the test_name and just run
734 # on the iphone simulator. 736 # on the iphone simulator.
735 test_name = args[0] 737 test_name = args[0]
736 print ('Can\'t parse test name, device, and iOS version. ' 738 print ('Can\'t parse test name, device, and iOS version. '
737 'Running %s on %s %s' % (test_name, device, ios_version)) 739 'Running %s on %s %s' % (test_name, device, ios_version))
738 740
739 # Build the args for invoking iossim, which will install the app on the 741 # Build the args for invoking iossim, which will install the app on the
740 # simulator and launch it, then dump the test results to stdout. 742 # simulator and launch it, then dump the test results to stdout.
741 743
742 # Note that the first object (build_dir) returned from the following 744 build_dir, app_exe_path = get_build_dir_and_exe_path_mac(
743 # method invocations is ignored because only the app executable is needed.
744 _, app_exe_path = get_build_dir_and_exe_path_mac(
745 options, 745 options,
746 options.target + '-iphonesimulator', 746 options.target + '-iphonesimulator',
747 test_name + '.app') 747 test_name + '.app')
748 748
749 # Note that the first object (build_dir) returned from the following
750 # method invocations is ignored because only the app executable is needed.
749 _, test_exe_path = get_build_dir_and_exe_path_mac(options, 751 _, test_exe_path = get_build_dir_and_exe_path_mac(options,
750 os.path.join('ninja-iossim', options.target), 752 os.path.join('ninja-iossim', options.target),
751 'iossim') 753 'iossim')
752 command = [test_exe_path, 754 command = [test_exe_path,
753 '-d', device, 755 '-d', device,
754 '-s', ios_version, 756 '-s', ios_version,
755 app_exe_path, '--' 757 app_exe_path, '--'
756 ] 758 ]
757 command.extend(args[1:]) 759 command.extend(args[1:])
760 if options.pass_build_dir:
761 command.append('--build-dir=' + build_dir)
758 762
759 if list_parsers(options.annotate): 763 if list_parsers(options.annotate):
760 return 0 764 return 0
761 results_tracker = create_results_tracker(get_parsers()['gtest'], options) 765 results_tracker = create_results_tracker(get_parsers()['gtest'], options)
762 766
763 # Make sure the simulator isn't running. 767 # Make sure the simulator isn't running.
764 kill_simulator() 768 kill_simulator()
765 769
766 # Nuke anything that appears to be stale chrome items in the temporary 770 # Nuke anything that appears to be stale chrome items in the temporary
767 # directory from previous test runs (i.e.- from crashes or unittest leaks). 771 # directory from previous test runs (i.e.- from crashes or unittest leaks).
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
888 892
889 if options.parallel: 893 if options.parallel:
890 command = _BuildParallelCommand(build_dir, test_exe_path, options) 894 command = _BuildParallelCommand(build_dir, test_exe_path, options)
891 elif options.run_shell_script: 895 elif options.run_shell_script:
892 command = ['bash', test_exe_path] 896 command = ['bash', test_exe_path]
893 elif options.run_python_script: 897 elif options.run_python_script:
894 command = [sys.executable, test_exe] 898 command = [sys.executable, test_exe]
895 else: 899 else:
896 command = [test_exe_path] 900 command = [test_exe_path]
897 command.extend(args[1:]) 901 command.extend(args[1:])
902 if options.pass_build_dir:
903 command.append('--build-dir=' + build_dir)
898 904
899 if list_parsers(options.annotate): 905 if list_parsers(options.annotate):
900 return 0 906 return 0
901 tracker_class = select_results_tracker(options.annotate, 907 tracker_class = select_results_tracker(options.annotate,
902 options.generate_json_file) 908 options.generate_json_file)
903 results_tracker = create_results_tracker(tracker_class, options) 909 results_tracker = create_results_tracker(tracker_class, options)
904 910
905 if options.generate_json_file: 911 if options.generate_json_file:
906 if os.path.exists(options.test_output_xml): 912 if os.path.exists(options.test_output_xml):
907 # remove the old XML output file. 913 # remove the old XML output file.
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
1006 # build_dir/target/ directory. 1012 # build_dir/target/ directory.
1007 if options.factory_properties.get('asan'): 1013 if options.factory_properties.get('asan'):
1008 logfile = test_exe_path + '.asan_log' 1014 logfile = test_exe_path + '.asan_log'
1009 command = ['%s' % os.path.join(build_dir, 1015 command = ['%s' % os.path.join(build_dir,
1010 options.target, 1016 options.target,
1011 'agent_logger.exe'), 1017 'agent_logger.exe'),
1012 'start', 1018 'start',
1013 '--output-file=%s' % logfile, 1019 '--output-file=%s' % logfile,
1014 '--'] + command 1020 '--'] + command
1015 command.extend(args[1:]) 1021 command.extend(args[1:])
1022 if options.pass_build_dir:
1023 command.append('--build-dir=' + build_dir)
1016 1024
1017 # Nuke anything that appears to be stale chrome items in the temporary 1025 # Nuke anything that appears to be stale chrome items in the temporary
1018 # directory from previous test runs (i.e.- from crashes or unittest leaks). 1026 # directory from previous test runs (i.e.- from crashes or unittest leaks).
1019 slave_utils.RemoveChromeTemporaryFiles() 1027 slave_utils.RemoveChromeTemporaryFiles()
1020 1028
1021 if list_parsers(options.annotate): 1029 if list_parsers(options.annotate):
1022 return 0 1030 return 0
1023 tracker_class = select_results_tracker(options.annotate, 1031 tracker_class = select_results_tracker(options.annotate,
1024 options.generate_json_file) 1032 options.generate_json_file)
1025 results_tracker = create_results_tracker(tracker_class, options) 1033 results_tracker = create_results_tracker(tracker_class, options)
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
1132 datefmt='%y%m%d %H:%M:%S') 1140 datefmt='%y%m%d %H:%M:%S')
1133 1141
1134 option_parser = optparse.OptionParser(usage=USAGE) 1142 option_parser = optparse.OptionParser(usage=USAGE)
1135 1143
1136 # Since the trailing program to run may have has command-line args of its 1144 # Since the trailing program to run may have has command-line args of its
1137 # own, we need to stop parsing when we reach the first positional argument. 1145 # own, we need to stop parsing when we reach the first positional argument.
1138 option_parser.disable_interspersed_args() 1146 option_parser.disable_interspersed_args()
1139 1147
1140 option_parser.add_option('', '--target', default='Release', 1148 option_parser.add_option('', '--target', default='Release',
1141 help='build target (Debug or Release)') 1149 help='build target (Debug or Release)')
1150 option_parser.add_option('--pass-target', action='store_true', default=False,
1151 help='pass --target to the spawned test script')
1142 option_parser.add_option('', '--build-dir', 1152 option_parser.add_option('', '--build-dir',
1143 help='path to main build directory (the parent of ' 1153 help='path to main build directory (the parent of '
1144 'the Release or Debug directory)') 1154 'the Release or Debug directory)')
1155 option_parser.add_option('--pass-build-dir', action='store_true',
1156 default=False,
1157 help='pass --build-dir to the spawned test script')
1145 option_parser.add_option('', '--enable-pageheap', action='store_true', 1158 option_parser.add_option('', '--enable-pageheap', action='store_true',
1146 default=False, 1159 default=False,
1147 help='enable pageheap checking for chrome.exe') 1160 help='enable pageheap checking for chrome.exe')
1148 # --with-httpd assumes a chromium checkout with src/tools/python. 1161 # --with-httpd assumes a chromium checkout with src/tools/python.
1149 option_parser.add_option('', '--with-httpd', dest='document_root', 1162 option_parser.add_option('', '--with-httpd', dest='document_root',
1150 default=None, metavar='DOC_ROOT', 1163 default=None, metavar='DOC_ROOT',
1151 help='Start a local httpd server using the given ' 1164 help='Start a local httpd server using the given '
1152 'document root, relative to the current dir') 1165 'document root, relative to the current dir')
1153 option_parser.add_option('', '--total-shards', dest='total_shards', 1166 option_parser.add_option('', '--total-shards', dest='total_shards',
1154 default=None, type='int', 1167 default=None, type='int',
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
1253 'step_name', '') 1266 'step_name', '')
1254 1267
1255 if options.run_shell_script and options.run_python_script: 1268 if options.run_shell_script and options.run_python_script:
1256 sys.stderr.write('Use either --run-shell-script OR --run-python-script, ' 1269 sys.stderr.write('Use either --run-shell-script OR --run-python-script, '
1257 'not both.') 1270 'not both.')
1258 return 1 1271 return 1
1259 1272
1260 # Print out builder name for log_parser 1273 # Print out builder name for log_parser
1261 print '[Running on builder: "%s"]' % options.builder_name 1274 print '[Running on builder: "%s"]' % options.builder_name
1262 1275
1276 if options.pass_target and options.target:
1277 args.append('--target=' + options.target)
1278 # TODO(thakis): Unify build_dir logic and handle pass_build_dir here too.
1279
1263 # Some test suites are not yet green under LSan, so do not enable LSan for 1280 # Some test suites are not yet green under LSan, so do not enable LSan for
1264 # them by default. Bots can override this behavior with lsan_run_all_tests. 1281 # them by default. Bots can override this behavior with lsan_run_all_tests.
1265 lsan_blacklist = [ 1282 lsan_blacklist = [
1266 'browser_tests', 1283 'browser_tests',
1267 'content_browsertests', 1284 'content_browsertests',
1268 'interactive_ui_tests', 1285 'interactive_ui_tests',
1269 ] 1286 ]
1270 options.enable_lsan = (options.enable_lsan or 1287 options.enable_lsan = (options.enable_lsan or
1271 (options.factory_properties.get('lsan', False) and 1288 (options.factory_properties.get('lsan', False) and
1272 (options.factory_properties.get('lsan_run_all_tests', False) or 1289 (options.factory_properties.get('lsan_run_all_tests', False) or
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
1388 '%d new files were left in %s: Fix the tests to clean up themselves.' 1405 '%d new files were left in %s: Fix the tests to clean up themselves.'
1389 ) % ((new_temp_files - temp_files), tempfile.gettempdir()) 1406 ) % ((new_temp_files - temp_files), tempfile.gettempdir())
1390 # TODO(maruel): Make it an error soon. Not yet since I want to iron out all 1407 # TODO(maruel): Make it an error soon. Not yet since I want to iron out all
1391 # the remaining cases before. 1408 # the remaining cases before.
1392 #result = 1 1409 #result = 1
1393 return result 1410 return result
1394 1411
1395 1412
1396 if '__main__' == __name__: 1413 if '__main__' == __name__:
1397 sys.exit(main()) 1414 sys.exit(main())
OLDNEW
« no previous file with comments | « scripts/master/factory/chromium_commands.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698