Chromium Code Reviews| 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 from datetime import datetime | 7 from datetime import datetime |
| 8 import copy | 8 import copy |
| 9 import errno | 9 import errno |
| 10 import json | 10 import json |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 40 | 40 |
| 41 def updateText(section): | 41 def updateText(section): |
| 42 # Reflect step status in text2. | 42 # Reflect step status in text2. |
| 43 if section['status'] == builder.EXCEPTION: | 43 if section['status'] == builder.EXCEPTION: |
| 44 result = ['exception', section['name']] | 44 result = ['exception', section['name']] |
| 45 elif section['status'] == builder.FAILURE: | 45 elif section['status'] == builder.FAILURE: |
| 46 result = ['failed', section['name']] | 46 result = ['failed', section['name']] |
| 47 else: | 47 else: |
| 48 result = [] | 48 result = [] |
| 49 | 49 |
| 50 section['step'].setText([section['name']] + section['step_text']) | 50 step_text = ['<br>%s' % line for line in section['step_text']] |
|
Ryan Tseng
2016/06/22 22:44:24
I think we the first line of step_text to be on th
nodir
2016/06/22 22:47:21
Dunno. Note that it will get mixed with step name.
Ryan Tseng
2016/06/22 22:50:08
yeah removing step name sounds good to me, i'm sav
nodir
2016/06/22 22:56:19
Done. http://imgur.com/BWUWRbH
| |
| 51 section['step'].setText([section['name']] + step_text) | |
| 51 section['step'].setText2(result + section['step_summary_text']) | 52 section['step'].setText2(result + section['step_summary_text']) |
| 52 | 53 |
| 53 | 54 |
| 54 # derived from addCompleteLog in process/buildstep.py | 55 # derived from addCompleteLog in process/buildstep.py |
| 55 def addLogToStep(step, name, text): | 56 def addLogToStep(step, name, text): |
| 56 """Add a complete log to a step.""" | 57 """Add a complete log to a step.""" |
| 57 loog = step.addLog(name) | 58 loog = step.addLog(name) |
| 58 size = loog.chunkSize | 59 size = loog.chunkSize |
| 59 for start in range(0, len(text), size): | 60 for start in range(0, len(text), size): |
| 60 loog.addStdout(text[start:start+size]) | 61 loog.addStdout(text[start:start+size]) |
| (...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 535 @@@STEP_LOG_END_PERF@<label>@@@ | 536 @@@STEP_LOG_END_PERF@<label>@@@ |
| 536 Same as STEP_LOG_END, but signifies that this is a perf log and should be | 537 Same as STEP_LOG_END, but signifies that this is a perf log and should be |
| 537 saved to the master. | 538 saved to the master. |
| 538 | 539 |
| 539 @@@STEP_CLEAR@@@ | 540 @@@STEP_CLEAR@@@ |
| 540 Reset the text description of the current step. | 541 Reset the text description of the current step. |
| 541 | 542 |
| 542 @@@STEP_SUMMARY_CLEAR@@@ | 543 @@@STEP_SUMMARY_CLEAR@@@ |
| 543 Reset the text summary of the current step. | 544 Reset the text summary of the current step. |
| 544 | 545 |
| 545 @@@STEP_TEXT@<msg>@@@ | 546 @@@STEP_TEXT@<msg line>@@@ |
| 546 Append <msg> to the current step text. | 547 Append <msg line> to the current step text. |
| 547 | 548 |
| 548 @@@SEED_STEP_TEXT@step@<msg>@@@ | 549 @@@SEED_STEP_TEXT@step@<msg line>@@@ |
| 549 Append <msg> to the specified seeded step. | 550 Append <msg line> to the specified seeded step. |
| 550 | 551 |
| 551 @@@STEP_SUMMARY_TEXT@<msg>@@@ | 552 @@@STEP_SUMMARY_TEXT@<msg>@@@ |
| 552 Append <msg> to the step summary (appears on top of the waterfall). | 553 Append <msg> to the step summary (appears on top of the waterfall). |
| 553 | 554 |
| 554 @@@STEP_NEST_LEVEL@<level>@@@ | 555 @@@STEP_NEST_LEVEL@<level>@@@ |
| 555 Set the nesting level of the current step. Steps at level n are assumed to | 556 Set the nesting level of the current step. Steps at level n are assumed to |
| 556 be nested under the most recent step of level n-1. | 557 be nested under the most recent step of level n-1. |
| 557 | 558 |
| 558 @@@HALT_ON_FAILURE@@@ | 559 @@@HALT_ON_FAILURE@@@ |
| 559 Halt if exception or failure steps are encountered (default is not). | 560 Halt if exception or failure steps are encountered (default is not). |
| (...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 938 section['started'] = util.now() | 939 section['started'] = util.now() |
| 939 # parent step already has its logging set up by buildbot | 940 # parent step already has its logging set up by buildbot |
| 940 if section != self.sections[0]: | 941 if section != self.sections[0]: |
| 941 stdio = step.addLog('stdio') | 942 stdio = step.addLog('stdio') |
| 942 section['log'] = stdio | 943 section['log'] = stdio |
| 943 | 944 |
| 944 def addSection(self, step_name, step=None, legacy=False): | 945 def addSection(self, step_name, step=None, legacy=False): |
| 945 """Adds a new section to annotator sections, does not change cursor.""" | 946 """Adds a new section to annotator sections, does not change cursor.""" |
| 946 if not step: | 947 if not step: |
| 947 step = self.command.step_status.getBuild().addStepWithName(step_name) | 948 step = self.command.step_status.getBuild().addStepWithName(step_name) |
| 948 step.setText([step_name]) | 949 step.setText([]) |
| 949 self.sections.append({ | 950 self.sections.append({ |
| 950 'name': step_name, | 951 'name': step_name, |
| 951 'step': step, | 952 'step': step, |
| 952 'closed': False, | 953 'closed': False, |
| 953 'log': None, | 954 'log': None, |
| 954 'annotated_logs': {}, | 955 'annotated_logs': {}, |
| 955 'finished_logs': [], | 956 'finished_logs': [], |
| 956 'status': builder.SUCCESS, | 957 'status': builder.SUCCESS, |
| 957 'links': [], | 958 'links': [], |
| 958 'step_summary_text': [], | 959 'step_summary_text': [], |
| 960 # step_text is a list of lines that will printed after step name. | |
| 959 'step_text': [], | 961 'step_text': [], |
| 960 'started': None, | 962 'started': None, |
| 961 'async_ops': [], | 963 'async_ops': [], |
| 962 'legacy': legacy, | 964 'legacy': legacy, |
| 963 }) | 965 }) |
| 964 | 966 |
| 965 return self.sections[-1] | 967 return self.sections[-1] |
| 966 | 968 |
| 967 def _PerfStepMappings(self, show_results, perf_id, test_name, suffix=None): | 969 def _PerfStepMappings(self, show_results, perf_id, test_name, suffix=None): |
| 968 """Looks up test IDs in PERF_TEST_MAPPINGS and returns test info.""" | 970 """Looks up test IDs in PERF_TEST_MAPPINGS and returns test info.""" |
| (...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1582 and starts to wait for remaining steps to finish. Returns command_result | 1584 and starts to wait for remaining steps to finish. Returns command_result |
| 1583 as Deferred.""" | 1585 as Deferred.""" |
| 1584 self.scriptComplete(command_result) | 1586 self.scriptComplete(command_result) |
| 1585 steps_d = self.script_observer.waitForSteps() | 1587 steps_d = self.script_observer.waitForSteps() |
| 1586 # Ignore the waitForSteps' result and return the original result, | 1588 # Ignore the waitForSteps' result and return the original result, |
| 1587 # so the caller of runCommand receives command_result. | 1589 # so the caller of runCommand receives command_result. |
| 1588 steps_d.addCallback(lambda *_: command_result) | 1590 steps_d.addCallback(lambda *_: command_result) |
| 1589 return steps_d | 1591 return steps_d |
| 1590 d.addCallback(onCommandFinished) | 1592 d.addCallback(onCommandFinished) |
| 1591 return d | 1593 return d |
| OLD | NEW |