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 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 498 Add a new step <stepname> after the last step. Do not end the step at the | 498 Add a new step <stepname> after the last step. Do not end the step at the |
| 499 cursor, don't advance the cursor to the seeded step. | 499 cursor, don't advance the cursor to the seeded step. |
| 500 | 500 |
| 501 @@@STEP_CURSOR <stepname>@@@ | 501 @@@STEP_CURSOR <stepname>@@@ |
| 502 Set the cursor to the named step. All further commands apply to the current | 502 Set the cursor to the named step. All further commands apply to the current |
| 503 cursor. | 503 cursor. |
| 504 | 504 |
| 505 @@@STEP_LINK@<label>@<url>@@@ | 505 @@@STEP_LINK@<label>@<url>@@@ |
| 506 Add a link with label <label> linking to <url> to the current stage. | 506 Add a link with label <label> linking to <url> to the current stage. |
| 507 | 507 |
| 508 If the label value is of the form "text-->base", this is considered an alias | |
| 509 link, and will add an alias named "text" with the value "url" to the log or | |
| 510 link named "base". | |
| 511 | |
| 508 @@@STEP_STARTED@@@ | 512 @@@STEP_STARTED@@@ |
| 509 Start the step at the cursor location. | 513 Start the step at the cursor location. |
| 510 | 514 |
| 511 @@@STEP_WARNINGS@@@ | 515 @@@STEP_WARNINGS@@@ |
| 512 Mark the current step as having warnings (orange). | 516 Mark the current step as having warnings (orange). |
| 513 | 517 |
| 514 @@@STEP_FAILURE@@@ | 518 @@@STEP_FAILURE@@@ |
| 515 Mark the current step as having failed (red). | 519 Mark the current step as having failed (red). |
| 516 | 520 |
| 517 @@@STEP_EXCEPTION@@@ | 521 @@@STEP_EXCEPTION@@@ |
| (...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1017 # then add the new graph list to the main graph list. | 1021 # then add the new graph list to the main graph list. |
| 1018 graph_list.extend(new_graph_list) | 1022 graph_list.extend(new_graph_list) |
| 1019 | 1023 |
| 1020 # Write the resulting graph list. | 1024 # Write the resulting graph list. |
| 1021 graph_file = open(graph_filename, 'w') | 1025 graph_file = open(graph_filename, 'w') |
| 1022 json.dump(graph_list, graph_file) | 1026 json.dump(graph_list, graph_file) |
| 1023 graph_file.close() | 1027 graph_file.close() |
| 1024 os.chmod(graph_filename, EXECUTABLE_FILE_PERMISSIONS) | 1028 os.chmod(graph_filename, EXECUTABLE_FILE_PERMISSIONS) |
| 1025 | 1029 |
| 1026 def addLinkToCursor(self, link_label, link_url): | 1030 def addLinkToCursor(self, link_label, link_url): |
| 1027 self.cursor['links'].append((link_label, link_url)) | 1031 parts = link_label.split('-->', 1) |
|
dnj
2016/03/18 01:52:46
I'm not a huge fan of "-->". If something inspirin
| |
| 1028 self.cursor['step'].addURL(link_label, link_url) | 1032 link_alias = None |
| 1033 if len(parts) == 2: | |
| 1034 link_alias, link_label = parts | |
| 1035 | |
| 1036 self.cursor['links'].append((link_label, link_url, link_alias)) | |
| 1037 if not link_alias: | |
| 1038 self.cursor['step'].addURL(link_label, link_url, alias_text=link_alias) | |
| 1039 else: | |
| 1040 self.cursor['step'].addAlias(link_label, link_url, text=link_alias) | |
| 1029 | 1041 |
| 1030 def handleOutputLine(self, line): | 1042 def handleOutputLine(self, line): |
| 1031 """This is called once with each line of the test log.""" | 1043 """This is called once with each line of the test log.""" |
| 1032 # Handle initial setup here, as step_status might not exist yet at init. | 1044 # Handle initial setup here, as step_status might not exist yet at init. |
| 1033 self.initialSection() | 1045 self.initialSection() |
| 1034 | 1046 |
| 1035 annotator.MatchAnnotation(line.rstrip(), self) | 1047 annotator.MatchAnnotation(line.rstrip(), self) |
| 1036 | 1048 |
| 1037 def addLogLines(self, log_label, log_lines): | 1049 def addLogLines(self, log_label, log_lines): |
| 1038 self.cursor['annotated_logs'].setdefault(log_label, []).extend(log_lines) | 1050 self.cursor['annotated_logs'].setdefault(log_label, []).extend(log_lines) |
| (...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1531 and starts to wait for remaining steps to finish. Returns command_result | 1543 and starts to wait for remaining steps to finish. Returns command_result |
| 1532 as Deferred.""" | 1544 as Deferred.""" |
| 1533 self.scriptComplete(command_result) | 1545 self.scriptComplete(command_result) |
| 1534 steps_d = self.script_observer.waitForSteps() | 1546 steps_d = self.script_observer.waitForSteps() |
| 1535 # Ignore the waitForSteps' result and return the original result, | 1547 # Ignore the waitForSteps' result and return the original result, |
| 1536 # so the caller of runCommand receives command_result. | 1548 # so the caller of runCommand receives command_result. |
| 1537 steps_d.addCallback(lambda *_: command_result) | 1549 steps_d.addCallback(lambda *_: command_result) |
| 1538 return steps_d | 1550 return steps_d |
| 1539 d.addCallback(onCommandFinished) | 1551 d.addCallback(onCommandFinished) |
| 1540 return d | 1552 return d |
| OLD | NEW |