OLD | NEW |
---|---|
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 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
390 msg = pre + 'Unable to find %s' % exe_path | 390 msg = pre + 'Unable to find %s' % exe_path |
391 if options.factory_properties.get('succeed_on_missing_exe', False): | 391 if options.factory_properties.get('succeed_on_missing_exe', False): |
392 print '%s missing but succeed_on_missing_exe used, exiting' % ( | 392 print '%s missing but succeed_on_missing_exe used, exiting' % ( |
393 exe_path) | 393 exe_path) |
394 return 0 | 394 return 0 |
395 raise chromium_utils.PathNotFound(msg) | 395 raise chromium_utils.PathNotFound(msg) |
396 | 396 |
397 return build_dir, exe_path | 397 return build_dir, exe_path |
398 | 398 |
399 | 399 |
400 def upload_profiling_data(options): | |
401 """Using the target build configuration, archive the profiling data to Google | |
402 Storage. | |
403 """ | |
404 build_dir = os.path.normpath(os.path.abspath(options.build_dir)) | |
405 | |
406 # archive_profiling_data.py is in | |
407 # /b/build/slave/SLAVE_NAME/build/src/build/scripts/slave | |
408 profiling_archive_tool = os.path.join(build_dir, 'src', 'build', 'scripts', | |
409 'slave', 'archive_profiling_data.py') | |
410 | |
411 if sys.platform == 'win32': | |
412 python = 'python_slave' | |
413 else: | |
414 python = 'python' | |
415 | |
416 run_id = '%s_%s_%s' % (options.build_properties['got_revision'], | |
417 options.build_properties['buildername'], | |
cmp
2012/08/09 02:13:04
and these should be .get(), too :)
| |
418 options.gtest_filter[0:12]) | |
419 cmd = [python, profiling_archive_tool, '--run-id', run_id, | |
420 '--build-dir', build_dir] | |
421 | |
422 return chromium_utils.RunCommand(cmd) | |
423 | |
424 | |
400 def main_mac(options, args): | 425 def main_mac(options, args): |
401 if len(args) < 1: | 426 if len(args) < 1: |
402 raise chromium_utils.MissingArgument('Usage: %s' % USAGE) | 427 raise chromium_utils.MissingArgument('Usage: %s' % USAGE) |
403 | 428 |
404 test_exe = args[0] | 429 test_exe = args[0] |
405 build_dir, test_exe_path = get_build_dir_and_exe_path_mac(options, | 430 build_dir, test_exe_path = get_build_dir_and_exe_path_mac(options, |
406 options.target, | 431 options.target, |
407 test_exe) | 432 test_exe) |
408 | 433 |
409 # Nuke anything that appears to be stale chrome items in the temporary | 434 # Nuke anything that appears to be stale chrome items in the temporary |
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
892 else: | 917 else: |
893 result = main_mac(options, args) | 918 result = main_mac(options, args) |
894 elif sys.platform == 'win32': | 919 elif sys.platform == 'win32': |
895 result = main_win(options, args) | 920 result = main_win(options, args) |
896 elif sys.platform == 'linux2': | 921 elif sys.platform == 'linux2': |
897 result = main_linux(options, args) | 922 result = main_linux(options, args) |
898 else: | 923 else: |
899 sys.stderr.write('Unknown sys.platform value %s\n' % repr(sys.platform)) | 924 sys.stderr.write('Unknown sys.platform value %s\n' % repr(sys.platform)) |
900 return 1 | 925 return 1 |
901 | 926 |
927 if (options.build_properties['buildername'] == 'XP Perf (1)' and | |
cmp
2012/08/09 02:13:04
right! this should be .get('buildername')
| |
928 options.build_properties.get('mastername') == 'chromium.perf' and | |
929 options.gtest_filter == 'StartupTest.*:ShutdownTest.*'): | |
930 upload_profiling_data(options) | |
931 | |
902 new_temp_files = get_temp_count() | 932 new_temp_files = get_temp_count() |
903 if temp_files > new_temp_files: | 933 if temp_files > new_temp_files: |
904 print >> sys.stderr, ( | 934 print >> sys.stderr, ( |
905 'Confused: %d files were deleted from %s during the test run') % ( | 935 'Confused: %d files were deleted from %s during the test run') % ( |
906 (temp_files - new_temp_files), tempfile.gettempdir()) | 936 (temp_files - new_temp_files), tempfile.gettempdir()) |
907 elif temp_files < new_temp_files: | 937 elif temp_files < new_temp_files: |
908 print >> sys.stderr, ( | 938 print >> sys.stderr, ( |
909 '%d new files were left in %s: Fix the tests to clean up themselves.' | 939 '%d new files were left in %s: Fix the tests to clean up themselves.' |
910 ) % ((new_temp_files - temp_files), tempfile.gettempdir()) | 940 ) % ((new_temp_files - temp_files), tempfile.gettempdir()) |
911 # TODO(maruel): Make it an error soon. Not yet since I want to iron out all | 941 # TODO(maruel): Make it an error soon. Not yet since I want to iron out all |
912 # the remaining cases before. | 942 # the remaining cases before. |
913 #result = 1 | 943 #result = 1 |
914 return result | 944 return result |
915 | 945 |
916 | 946 |
917 if '__main__' == __name__: | 947 if '__main__' == __name__: |
918 sys.exit(main()) | 948 sys.exit(main()) |
OLD | NEW |