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

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

Issue 10834044: Script to archive profiling data collected from (Closed) Base URL: svn://chrome-svn/chrome/trunk/tools/build/
Patch Set: Created 8 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « scripts/slave/archive_profiling_data.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 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 print '@@@STEP_WARNINGS@@@' 296 print '@@@STEP_WARNINGS@@@'
297 get_text_result = builder.WARNING 297 get_text_result = builder.WARNING
298 else: 298 else:
299 print '@@@STEP_FAILURE@@@' 299 print '@@@STEP_FAILURE@@@'
300 get_text_result = builder.FAILURE 300 get_text_result = builder.FAILURE
301 301
302 for desc in getText(get_text_result, results_tracker, test_name): 302 for desc in getText(get_text_result, results_tracker, test_name):
303 print '@@@STEP_TEXT@%s@@@' % desc 303 print '@@@STEP_TEXT@%s@@@' % desc
304 304
305 305
306 def upload_profiling_data(options):
307 """Using the target build configuration, archive the profiling data to Google
308 Storage.
309 """
310 build_dir = os.path.normpath(os.path.abspath(options.build_dir))
311
312 # archive_profiling_data.py is in
313 # /b/build/slave/SLAVE_NAME/build/src/build/scripts/slave
314 profiling_archive_tool = os.path.join(build_dir, 'src', 'build', 'scripts',
315 'slave', 'archive_profiling_data.py')
316
317 if sys.platform == 'win32':
318 python = 'python_slave'
319 else:
320 python = 'python'
321
322 run_id = '%s_%s_%s' % (options.build_properties['got_revision'],
323 options.build_properties['buildername'],
324 options.gtest_filter[0:12])
325 cmd = [python, profiling_archive_tool, '--run-id', run_id,
326 '--build-dir', build_dir]
327
328 return chromium_utils.RunCommand(cmd)
329
330
306 def main_mac(options, args): 331 def main_mac(options, args):
307 if len(args) < 1: 332 if len(args) < 1:
308 raise chromium_utils.MissingArgument('Usage: %s' % USAGE) 333 raise chromium_utils.MissingArgument('Usage: %s' % USAGE)
309 334
310 test_exe = args[0] 335 test_exe = args[0]
311 build_dir = os.path.normpath(os.path.abspath(options.build_dir)) 336 build_dir = os.path.normpath(os.path.abspath(options.build_dir))
312 test_exe_path = os.path.join(build_dir, options.target, test_exe) 337 test_exe_path = os.path.join(build_dir, options.target, test_exe)
313 if not os.path.exists(test_exe_path): 338 if not os.path.exists(test_exe_path):
314 pre = 'Unable to find %s\n' % test_exe_path 339 pre = 'Unable to find %s\n' % test_exe_path
315 340
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after
696 if sys.platform.startswith('darwin'): 721 if sys.platform.startswith('darwin'):
697 result = main_mac(options, args) 722 result = main_mac(options, args)
698 elif sys.platform == 'win32': 723 elif sys.platform == 'win32':
699 result = main_win(options, args) 724 result = main_win(options, args)
700 elif sys.platform == 'linux2': 725 elif sys.platform == 'linux2':
701 result = main_linux(options, args) 726 result = main_linux(options, args)
702 else: 727 else:
703 sys.stderr.write('Unknown sys.platform value %s\n' % repr(sys.platform)) 728 sys.stderr.write('Unknown sys.platform value %s\n' % repr(sys.platform))
704 return 1 729 return 1
705 730
731 if (options.build_properties['buildername'] == 'XP Perf (1)' and
732 options.build_properties.get('mastername') == 'chromium.perf' and
733 options.gtest_filter == 'StartupTest.*:ShutdownTest.*'):
734 upload_profiling_data(options)
735
706 new_temp_files = get_temp_count() 736 new_temp_files = get_temp_count()
707 if temp_files > new_temp_files: 737 if temp_files > new_temp_files:
708 print >> sys.stderr, ( 738 print >> sys.stderr, (
709 'Confused: %d files were deleted from %s during the test run') % ( 739 'Confused: %d files were deleted from %s during the test run') % (
710 (temp_files - new_temp_files), tempfile.gettempdir()) 740 (temp_files - new_temp_files), tempfile.gettempdir())
711 elif temp_files < new_temp_files: 741 elif temp_files < new_temp_files:
712 print >> sys.stderr, ( 742 print >> sys.stderr, (
713 '%d new files were left in %s: Fix the tests to clean up themselves.' 743 '%d new files were left in %s: Fix the tests to clean up themselves.'
714 ) % ((new_temp_files - temp_files), tempfile.gettempdir()) 744 ) % ((new_temp_files - temp_files), tempfile.gettempdir())
715 # TODO(maruel): Make it an error soon. Not yet since I want to iron out all 745 # TODO(maruel): Make it an error soon. Not yet since I want to iron out all
716 # the remaining cases before. 746 # the remaining cases before.
717 #result = 1 747 #result = 1
718 return result 748 return result
719 749
720 750
721 if '__main__' == __name__: 751 if '__main__' == __name__:
722 sys.exit(main()) 752 sys.exit(main())
OLDNEW
« no previous file with comments | « scripts/slave/archive_profiling_data.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698