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

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/chromium/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 # Profiling data is in /b/build/slave/SLAVE_NAME/build/src/chrome/test/data
313 profiling_data_dir = os.path.join(build_dir, 'src', 'chrome', 'test', 'data')
314 if not os.path.exists(profiling_data_dir):
315 return True
316
317 profiling_file = os.path.join(profiling_data_dir, 'task_profile.json')
318 if not os.path.exists(profiling_file):
319 return True
320
321 # Profiling tool is in
322 # /b/build/slave/SLAVE_NAME/build/src/build/scripts/slave/chromium
323 profiling_archive_tool = os.path.join(build_dir, 'src', 'build', 'scripts',
324 'slave', 'chromium',
325 'archive_profiling_data.py')
cmp 2012/08/07 18:15:08 is it possible to collapse this logic into archive
ramant (doing other things) 2012/08/07 22:23:55 Done. Should we move the archive_profiling_data.py
cmp 2012/08/07 23:34:39 Sure!
ramant (doing other things) 2012/08/07 23:44:44 Done.
326
327 if sys.platform == 'win32':
328 python = 'python_slave'
329 else:
330 python = 'python'
331
332 # TODO(rtenneti): get test name.
333 run_id = '%s_%s_%s' % (options.build_properties['got_revision'],
334 options.build_properties['buildername'],
335 options.gtest_filter[0:12])
336 cmd = [python,
337 profiling_archive_tool,
338 '--run-id', run_id,
339 '--profiling-data-dir', profiling_data_dir]
340
341 return chromium_utils.RunCommand(cmd)
342
343
306 def main_mac(options, args): 344 def main_mac(options, args):
307 if len(args) < 1: 345 if len(args) < 1:
308 raise chromium_utils.MissingArgument('Usage: %s' % USAGE) 346 raise chromium_utils.MissingArgument('Usage: %s' % USAGE)
309 347
310 test_exe = args[0] 348 test_exe = args[0]
311 build_dir = os.path.normpath(os.path.abspath(options.build_dir)) 349 build_dir = os.path.normpath(os.path.abspath(options.build_dir))
312 test_exe_path = os.path.join(build_dir, options.target, test_exe) 350 test_exe_path = os.path.join(build_dir, options.target, test_exe)
313 if not os.path.exists(test_exe_path): 351 if not os.path.exists(test_exe_path):
314 pre = 'Unable to find %s\n' % test_exe_path 352 pre = 'Unable to find %s\n' % test_exe_path
315 353
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after
696 if sys.platform.startswith('darwin'): 734 if sys.platform.startswith('darwin'):
697 result = main_mac(options, args) 735 result = main_mac(options, args)
698 elif sys.platform == 'win32': 736 elif sys.platform == 'win32':
699 result = main_win(options, args) 737 result = main_win(options, args)
700 elif sys.platform == 'linux2': 738 elif sys.platform == 'linux2':
701 result = main_linux(options, args) 739 result = main_linux(options, args)
702 else: 740 else:
703 sys.stderr.write('Unknown sys.platform value %s\n' % repr(sys.platform)) 741 sys.stderr.write('Unknown sys.platform value %s\n' % repr(sys.platform))
704 return 1 742 return 1
705 743
744 if ('buildername' in options.build_properties and
745 options.build_properties['buildername'] == 'XP Perf (1)' and
cmp 2012/08/07 18:15:08 let's collapse lines 744 and 745 into: if (option
ramant (doing other things) 2012/08/07 22:23:55 Done.
746 options.build_properties.get('mastername') == 'chromium.perf' and
747 options.gtest_filter == 'StartupTest.*:ShutdownTest.*'):
748 upload_profiling_data(options)
749
706 new_temp_files = get_temp_count() 750 new_temp_files = get_temp_count()
707 if temp_files > new_temp_files: 751 if temp_files > new_temp_files:
708 print >> sys.stderr, ( 752 print >> sys.stderr, (
709 'Confused: %d files were deleted from %s during the test run') % ( 753 'Confused: %d files were deleted from %s during the test run') % (
710 (temp_files - new_temp_files), tempfile.gettempdir()) 754 (temp_files - new_temp_files), tempfile.gettempdir())
711 elif temp_files < new_temp_files: 755 elif temp_files < new_temp_files:
712 print >> sys.stderr, ( 756 print >> sys.stderr, (
713 '%d new files were left in %s: Fix the tests to clean up themselves.' 757 '%d new files were left in %s: Fix the tests to clean up themselves.'
714 ) % ((new_temp_files - temp_files), tempfile.gettempdir()) 758 ) % ((new_temp_files - temp_files), tempfile.gettempdir())
715 # TODO(maruel): Make it an error soon. Not yet since I want to iron out all 759 # TODO(maruel): Make it an error soon. Not yet since I want to iron out all
716 # the remaining cases before. 760 # the remaining cases before.
717 #result = 1 761 #result = 1
718 return result 762 return result
719 763
720 764
721 if '__main__' == __name__: 765 if '__main__' == __name__:
722 sys.exit(main()) 766 sys.exit(main())
OLDNEW
« no previous file with comments | « scripts/slave/chromium/archive_profiling_data.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698