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

Side by Side Diff: Tools/Scripts/webkitpy/tool/commands/rebaseline.py

Issue 329873005: Fix rebaseline-o-matic logging (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: fix git cl Created 6 years, 6 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 | « no previous file | 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 # Copyright (c) 2010 Google Inc. All rights reserved. 1 # Copyright (c) 2010 Google Inc. All rights reserved.
2 # 2 #
3 # Redistribution and use in source and binary forms, with or without 3 # Redistribution and use in source and binary forms, with or without
4 # modification, are permitted provided that the following conditions are 4 # modification, are permitted provided that the following conditions are
5 # met: 5 # met:
6 # 6 #
7 # * Redistributions of source code must retain the above copyright 7 # * Redistributions of source code must retain the above copyright
8 # notice, this list of conditions and the following disclaimer. 8 # notice, this list of conditions and the following disclaimer.
9 # * Redistributions in binary form must reproduce the above 9 # * Redistributions in binary form must reproduce the above
10 # copyright notice, this list of conditions and the following disclaimer 10 # copyright notice, this list of conditions and the following disclaimer
(...skipping 744 matching lines...) Expand 10 before | Expand all | Expand 10 after
755 lines_to_remove[test].append(builder_name) 755 lines_to_remove[test].append(builder_name)
756 test_prefix_list[test][builder_name] = BASELINE_SUFFIX_LIST 756 test_prefix_list[test][builder_name] = BASELINE_SUFFIX_LIST
757 757
758 return test_prefix_list, lines_to_remove 758 return test_prefix_list, lines_to_remove
759 759
760 def _run_git_cl_command(self, options, command): 760 def _run_git_cl_command(self, options, command):
761 subprocess_command = ['git', 'cl'] + command 761 subprocess_command = ['git', 'cl'] + command
762 if options.verbose: 762 if options.verbose:
763 subprocess_command.append('--verbose') 763 subprocess_command.append('--verbose')
764 764
765 process = self._tool.executive.popen(subprocess_command, stdout=self._to ol.executive.PIPE, stderr=self._tool.executive.PIPE) 765 process = self._tool.executive.popen(subprocess_command, stdout=self._to ol.executive.PIPE, stderr=self._tool.executive.STDOUT)
766 last_output_time = time.time() 766 last_output_time = time.time()
767 767
768 # git cl sometimes completely hangs. Bail if we haven't gotten any outpu t to stdout/stderr in a while. 768 # git cl sometimes completely hangs. Bail if we haven't gotten any outpu t to stdout/stderr in a while.
769 while process.poll() == None and time.time() < last_output_time + self.S ECONDS_BEFORE_GIVING_UP: 769 while process.poll() == None and time.time() < last_output_time + self.S ECONDS_BEFORE_GIVING_UP:
770 # FIXME: This isn't awesome. It may improperly interleave stdout and stderr? 770 # FIXME: This doesn't make any sense. readline blocks, so all this c ode to
771 # try and bail is useless. Instead, we should do the readline calls on a
772 # subthread. Then the rest of this code would make sense.
771 out = process.stdout.readline().rstrip('\n') 773 out = process.stdout.readline().rstrip('\n')
772 if out: 774 if out:
773 last_output_time = time.time() 775 last_output_time = time.time()
774 _log.info(out) 776 _log.info(out)
775 777
776 err = process.stdout.readline().rstrip('\n')
777 if err:
778 last_output_time = time.time()
779 _log.error(err)
780
781 if process.poll() == None: 778 if process.poll() == None:
782 _log.error('Command hung: %s' % subprocess_command) 779 _log.error('Command hung: %s' % subprocess_command)
783 return False 780 return False
784 return True 781 return True
785 782
786 # FIXME: Move this somewhere more general. 783 # FIXME: Move this somewhere more general.
787 def tree_status(self): 784 def tree_status(self):
788 blink_tree_status_url = "http://blink-status.appspot.com/status" 785 blink_tree_status_url = "http://blink-status.appspot.com/status"
789 status = urllib2.urlopen(blink_tree_status_url).read().lower() 786 status = urllib2.urlopen(blink_tree_status_url).read().lower()
790 if status.find('closed') != -1 or status == "0": 787 if status.find('closed') != -1 or status == "0":
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
878 urllib2.urlopen("http://" + self.LOG_SERVER + "/updatelog", data=urllib. urlencode(query)) 875 urllib2.urlopen("http://" + self.LOG_SERVER + "/updatelog", data=urllib. urlencode(query))
879 876
880 def _log_line(self, handle): 877 def _log_line(self, handle):
881 out = handle.readline().rstrip('\n') 878 out = handle.readline().rstrip('\n')
882 if out: 879 if out:
883 if self._verbose: 880 if self._verbose:
884 print out 881 print out
885 self._log_to_server(out) 882 self._log_to_server(out)
886 return out 883 return out
887 884
888 def _log_remaining_lines(self, handle): 885 def _run_logged_command(self, command):
889 out = self._log_line(handle) 886 process = self._tool.executive.popen(command, stdout=self._tool.executiv e.PIPE, stderr=self._tool.executive.STDOUT)
887
888 out = self._log_line(process.stdout)
890 while out: 889 while out:
891 out = self._log_line(handle)
892
893 def _run_logged_command(self, command):
894 process = self._tool.executive.popen(command, stdout=self._tool.executiv e.PIPE, stderr=self._tool.executive.PIPE)
895 while process.poll() == None:
896 # FIXME: This should probably batch up lines if they're available an d log to the server once. 890 # FIXME: This should probably batch up lines if they're available an d log to the server once.
897 self._log_line(process.stdout) 891 out = self._log_line(process.stdout)
898 self._log_line(process.stderr)
899
900 self._log_remaining_lines(process.stdout)
901 self._log_remaining_lines(process.stderr)
902 892
903 def _do_one_rebaseline(self): 893 def _do_one_rebaseline(self):
904 try: 894 try:
905 old_branch_name = self._tool.scm().current_branch() 895 old_branch_name = self._tool.scm().current_branch()
906 self._log_to_server(is_new_entry=True) 896 self._log_to_server(is_new_entry=True)
907 self._run_logged_command(['git', 'pull']) 897 self._run_logged_command(['git', 'pull'])
908 rebaseline_command = [self._tool.filesystem.join(self._tool.scm().ch eckout_root, 'Tools', 'Scripts', 'webkit-patch'), 'auto-rebaseline'] 898 rebaseline_command = [self._tool.filesystem.join(self._tool.scm().ch eckout_root, 'Tools', 'Scripts', 'webkit-patch'), 'auto-rebaseline']
909 if self._verbose: 899 if self._verbose:
910 rebaseline_command.append('--verbose') 900 rebaseline_command.append('--verbose')
911 self._run_logged_command(rebaseline_command) 901 self._run_logged_command(rebaseline_command)
912 except: 902 except:
913 traceback.print_exc(file=sys.stderr) 903 traceback.print_exc(file=sys.stderr)
914 # Sometimes git crashes and leaves us on a detached head. 904 # Sometimes git crashes and leaves us on a detached head.
915 self._tool.scm().checkout_branch(old_branch_name) 905 self._tool.scm().checkout_branch(old_branch_name)
916 906
917 def execute(self, options, args, tool): 907 def execute(self, options, args, tool):
918 self._verbose = options.verbose 908 self._verbose = options.verbose
919 while True: 909 while True:
920 self._do_one_rebaseline() 910 self._do_one_rebaseline()
921 time.sleep(self.SLEEP_TIME_IN_SECONDS) 911 time.sleep(self.SLEEP_TIME_IN_SECONDS)
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698