| 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 section['step'].setText(['<br>'.join(section['step_text'])]) |
| 51 section['step'].setText2(result + section['step_summary_text']) | 51 section['step'].setText2(result + section['step_summary_text']) |
| 52 | 52 |
| 53 | 53 |
| 54 # derived from addCompleteLog in process/buildstep.py | 54 # derived from addCompleteLog in process/buildstep.py |
| 55 def addLogToStep(step, name, text): | 55 def addLogToStep(step, name, text): |
| 56 """Add a complete log to a step.""" | 56 """Add a complete log to a step.""" |
| 57 loog = step.addLog(name) | 57 loog = step.addLog(name) |
| 58 size = loog.chunkSize | 58 size = loog.chunkSize |
| 59 for start in range(0, len(text), size): | 59 for start in range(0, len(text), size): |
| 60 loog.addStdout(text[start:start+size]) | 60 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>@@@ | 535 @@@STEP_LOG_END_PERF@<label>@@@ |
| 536 Same as STEP_LOG_END, but signifies that this is a perf log and should be | 536 Same as STEP_LOG_END, but signifies that this is a perf log and should be |
| 537 saved to the master. | 537 saved to the master. |
| 538 | 538 |
| 539 @@@STEP_CLEAR@@@ | 539 @@@STEP_CLEAR@@@ |
| 540 Reset the text description of the current step. | 540 Reset the text description of the current step. |
| 541 | 541 |
| 542 @@@STEP_SUMMARY_CLEAR@@@ | 542 @@@STEP_SUMMARY_CLEAR@@@ |
| 543 Reset the text summary of the current step. | 543 Reset the text summary of the current step. |
| 544 | 544 |
| 545 @@@STEP_TEXT@<msg>@@@ | 545 @@@STEP_TEXT@<msg line>@@@ |
| 546 Append <msg> to the current step text. | 546 Append <msg line> to the current step text. |
| 547 | 547 |
| 548 @@@SEED_STEP_TEXT@step@<msg>@@@ | 548 @@@SEED_STEP_TEXT@step@<msg line>@@@ |
| 549 Append <msg> to the specified seeded step. | 549 Append <msg line> to the specified seeded step. |
| 550 | 550 |
| 551 @@@STEP_SUMMARY_TEXT@<msg>@@@ | 551 @@@STEP_SUMMARY_TEXT@<msg>@@@ |
| 552 Append <msg> to the step summary (appears on top of the waterfall). | 552 Append <msg> to the step summary (appears on top of the waterfall). |
| 553 | 553 |
| 554 @@@STEP_NEST_LEVEL@<level>@@@ | 554 @@@STEP_NEST_LEVEL@<level>@@@ |
| 555 Set the nesting level of the current step. Steps at level n are assumed to | 555 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. | 556 be nested under the most recent step of level n-1. |
| 557 | 557 |
| 558 @@@HALT_ON_FAILURE@@@ | 558 @@@HALT_ON_FAILURE@@@ |
| 559 Halt if exception or failure steps are encountered (default is not). | 559 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() | 938 section['started'] = util.now() |
| 939 # parent step already has its logging set up by buildbot | 939 # parent step already has its logging set up by buildbot |
| 940 if section != self.sections[0]: | 940 if section != self.sections[0]: |
| 941 stdio = step.addLog('stdio') | 941 stdio = step.addLog('stdio') |
| 942 section['log'] = stdio | 942 section['log'] = stdio |
| 943 | 943 |
| 944 def addSection(self, step_name, step=None, legacy=False): | 944 def addSection(self, step_name, step=None, legacy=False): |
| 945 """Adds a new section to annotator sections, does not change cursor.""" | 945 """Adds a new section to annotator sections, does not change cursor.""" |
| 946 if not step: | 946 if not step: |
| 947 step = self.command.step_status.getBuild().addStepWithName(step_name) | 947 step = self.command.step_status.getBuild().addStepWithName(step_name) |
| 948 step.setText([step_name]) | 948 step.setText([]) |
| 949 self.sections.append({ | 949 self.sections.append({ |
| 950 'name': step_name, | 950 'name': step_name, |
| 951 'step': step, | 951 'step': step, |
| 952 'closed': False, | 952 'closed': False, |
| 953 'log': None, | 953 'log': None, |
| 954 'annotated_logs': {}, | 954 'annotated_logs': {}, |
| 955 'finished_logs': [], | 955 'finished_logs': [], |
| 956 'status': builder.SUCCESS, | 956 'status': builder.SUCCESS, |
| 957 'links': [], | 957 'links': [], |
| 958 'step_summary_text': [], | 958 'step_summary_text': [], |
| 959 # step_text is a list of lines that will printed after step name. |
| 959 'step_text': [], | 960 'step_text': [], |
| 960 'started': None, | 961 'started': None, |
| 961 'async_ops': [], | 962 'async_ops': [], |
| 962 'legacy': legacy, | 963 'legacy': legacy, |
| 963 }) | 964 }) |
| 964 | 965 |
| 965 return self.sections[-1] | 966 return self.sections[-1] |
| 966 | 967 |
| 967 def _PerfStepMappings(self, show_results, perf_id, test_name, suffix=None): | 968 def _PerfStepMappings(self, show_results, perf_id, test_name, suffix=None): |
| 968 """Looks up test IDs in PERF_TEST_MAPPINGS and returns test info.""" | 969 """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 | 1583 and starts to wait for remaining steps to finish. Returns command_result |
| 1583 as Deferred.""" | 1584 as Deferred.""" |
| 1584 self.scriptComplete(command_result) | 1585 self.scriptComplete(command_result) |
| 1585 steps_d = self.script_observer.waitForSteps() | 1586 steps_d = self.script_observer.waitForSteps() |
| 1586 # Ignore the waitForSteps' result and return the original result, | 1587 # Ignore the waitForSteps' result and return the original result, |
| 1587 # so the caller of runCommand receives command_result. | 1588 # so the caller of runCommand receives command_result. |
| 1588 steps_d.addCallback(lambda *_: command_result) | 1589 steps_d.addCallback(lambda *_: command_result) |
| 1589 return steps_d | 1590 return steps_d |
| 1590 d.addCallback(onCommandFinished) | 1591 d.addCallback(onCommandFinished) |
| 1591 return d | 1592 return d |
| OLD | NEW |