OLD | NEW |
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 """Subclasses of various slave command classes.""" | 5 """Subclasses of various slave command classes.""" |
6 | 6 |
7 import copy | 7 import copy |
8 import errno | 8 import errno |
9 import json | 9 import json |
10 import logging | 10 import logging |
(...skipping 667 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
678 if not old_env: | 678 if not old_env: |
679 old_env = {} | 679 old_env = {} |
680 env.update(old_env) | 680 env.update(old_env) |
681 # Change passed in args (ok as a copy is made internally). | 681 # Change passed in args (ok as a copy is made internally). |
682 kwargs['env'] = env | 682 kwargs['env'] = env |
683 | 683 |
684 ProcessLogShellStep.__init__(self, *args, **kwargs) | 684 ProcessLogShellStep.__init__(self, *args, **kwargs) |
685 self.script_observer = AnnotationObserver(self) | 685 self.script_observer = AnnotationObserver(self) |
686 self.addLogObserver('stdio', self.script_observer) | 686 self.addLogObserver('stdio', self.script_observer) |
687 | 687 |
| 688 def _removePreamble(self): |
| 689 """Remove preamble if there is only section. |
| 690 |
| 691 'stdio' will be identical to 'preamble' if there is only one annotator |
| 692 section, so it's redundant to show both on the waterfall. |
| 693 """ |
| 694 if len(self.script_observer.sections) == 1: |
| 695 self.step_status.logs = [x for x in self.step_status.logs if |
| 696 x.name != 'preamble'] |
| 697 |
688 def interrupt(self, reason): | 698 def interrupt(self, reason): |
689 self.script_observer.fixupLast(builder.EXCEPTION) | 699 self.script_observer.fixupLast(builder.EXCEPTION) |
| 700 self._removePreamble() |
690 return ProcessLogShellStep.interrupt(self, reason) | 701 return ProcessLogShellStep.interrupt(self, reason) |
691 | 702 |
692 def evaluateCommand(self, cmd): | 703 def evaluateCommand(self, cmd): |
693 observer_result = self.script_observer.annotate_status | 704 observer_result = self.script_observer.annotate_status |
694 # Check if ProcessLogShellStep detected a failure or warning also. | 705 # Check if ProcessLogShellStep detected a failure or warning also. |
695 log_processor_result = ProcessLogShellStep.evaluateCommand(self, cmd) | 706 log_processor_result = ProcessLogShellStep.evaluateCommand(self, cmd) |
696 return BuilderStatus.combine(observer_result, log_processor_result) | 707 return BuilderStatus.combine(observer_result, log_processor_result) |
697 | 708 |
698 def commandComplete(self, cmd): | 709 def commandComplete(self, cmd): |
699 self.script_observer.handleReturnCode(cmd.rc) | 710 self.script_observer.handleReturnCode(cmd.rc) |
| 711 self._removePreamble() |
700 return ProcessLogShellStep.commandComplete(self, cmd) | 712 return ProcessLogShellStep.commandComplete(self, cmd) |
701 | 713 |
702 | 714 |
703 class PerfStepAnnotatedCommand(AnnotatedCommand): | 715 class PerfStepAnnotatedCommand(AnnotatedCommand): |
704 """Annotator command that prepends perf logs when finished.""" | 716 """Annotator command that prepends perf logs when finished.""" |
705 | 717 |
706 def __init__(self, report_link=None, output_dir=None, *args, **kwargs): | 718 def __init__(self, report_link=None, output_dir=None, *args, **kwargs): |
707 # perf_expectations.json holds performance expectations. See | 719 # perf_expectations.json holds performance expectations. See |
708 # http://dev.chromium.org/developers/testing/chromium-build-infrastructure/ | 720 # http://dev.chromium.org/developers/testing/chromium-build-infrastructure/ |
709 # performance-test-plots for more info. | 721 # performance-test-plots for more info. |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
801 def commandComplete(self, cmd): | 813 def commandComplete(self, cmd): |
802 if self._report_link and self._output_dir: | 814 if self._report_link and self._output_dir: |
803 self._MakeOutputDirectory() | 815 self._MakeOutputDirectory() |
804 for received_log in self.step_status.getLogs(): | 816 for received_log in self.step_status.getLogs(): |
805 # TODO(xusydoc): do we need to skip 'stdio' and 'preamble' here? | 817 # TODO(xusydoc): do we need to skip 'stdio' and 'preamble' here? |
806 if log == self._GRAPH_LIST: | 818 if log == self._GRAPH_LIST: |
807 self._SaveGraphInfo(self.getLog(received_log)) | 819 self._SaveGraphInfo(self.getLog(received_log)) |
808 else: | 820 else: |
809 self._Prepend(received_log, self.getLog(received_log)) | 821 self._Prepend(received_log, self.getLog(received_log)) |
810 return AnnotatedCommand.commandComplete(self, cmd) | 822 return AnnotatedCommand.commandComplete(self, cmd) |
OLD | NEW |