OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 from common import chromium_utils | 6 from common import chromium_utils |
7 import json | 7 import json |
8 import os | 8 import os |
9 import re | 9 import re |
10 import tempfile | 10 import tempfile |
11 | 11 |
12 | 12 |
13 # These labels should match the ones output by gtest's JSON. | 13 # These labels should match the ones output by gtest's JSON. |
14 TEST_UNKNOWN_LABEL = 'UNKNOWN' | 14 TEST_UNKNOWN_LABEL = 'UNKNOWN' |
15 TEST_SUCCESS_LABEL = 'SUCCESS' | 15 TEST_SUCCESS_LABEL = 'SUCCESS' |
16 TEST_FAILURE_LABEL = 'FAILURE' | 16 TEST_FAILURE_LABEL = 'FAILURE' |
17 TEST_FAILURE_ON_EXIT_LABEL = 'FAILURE_ON_EXIT' | 17 TEST_FAILURE_ON_EXIT_LABEL = 'FAILURE_ON_EXIT' |
| 18 TEST_EXCESSIVE_OUTPUT_LABEL = 'EXCESSIVE_OUTPUT' |
18 TEST_CRASH_LABEL = 'CRASH' | 19 TEST_CRASH_LABEL = 'CRASH' |
19 TEST_TIMEOUT_LABEL = 'TIMEOUT' | 20 TEST_TIMEOUT_LABEL = 'TIMEOUT' |
20 TEST_SKIPPED_LABEL = 'SKIPPED' | 21 TEST_SKIPPED_LABEL = 'SKIPPED' |
21 TEST_WARNING_LABEL = 'WARNING' | 22 TEST_WARNING_LABEL = 'WARNING' |
22 | 23 |
23 FULL_RESULTS_FILENAME = 'full_results.json' | 24 FULL_RESULTS_FILENAME = 'full_results.json' |
24 TIMES_MS_FILENAME = 'times_ms.json' | 25 TIMES_MS_FILENAME = 'times_ms.json' |
25 | 26 |
26 def CompressList(lines, max_length, middle_replacement): | 27 def CompressList(lines, max_length, middle_replacement): |
27 """Ensures that |lines| is no longer than |max_length|. If |lines| need to | 28 """Ensures that |lines| is no longer than |max_length|. If |lines| need to |
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
460 | 461 |
461 self.parsing_errors = [] | 462 self.parsing_errors = [] |
462 | 463 |
463 self.master_name = mastername | 464 self.master_name = mastername |
464 | 465 |
465 # List our labels that match the ones output by gtest JSON. | 466 # List our labels that match the ones output by gtest JSON. |
466 self.SUPPORTED_LABELS = (TEST_UNKNOWN_LABEL, | 467 self.SUPPORTED_LABELS = (TEST_UNKNOWN_LABEL, |
467 TEST_SUCCESS_LABEL, | 468 TEST_SUCCESS_LABEL, |
468 TEST_FAILURE_LABEL, | 469 TEST_FAILURE_LABEL, |
469 TEST_FAILURE_ON_EXIT_LABEL, | 470 TEST_FAILURE_ON_EXIT_LABEL, |
| 471 TEST_EXCESSIVE_OUTPUT_LABEL, |
470 TEST_CRASH_LABEL, | 472 TEST_CRASH_LABEL, |
471 TEST_TIMEOUT_LABEL, | 473 TEST_TIMEOUT_LABEL, |
472 TEST_SKIPPED_LABEL) | 474 TEST_SKIPPED_LABEL) |
473 | 475 |
474 def ProcessLine(self, line): | 476 def ProcessLine(self, line): |
475 # Deliberately do nothing - we parse out-of-band JSON summary | 477 # Deliberately do nothing - we parse out-of-band JSON summary |
476 # instead of in-band stdout. | 478 # instead of in-band stdout. |
477 pass | 479 pass |
478 | 480 |
479 def PassedTests(self): | 481 def PassedTests(self): |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
652 # info can be obtained from the original JSON output. | 654 # info can be obtained from the original JSON output. |
653 ascii_lines = run_data['output_snippet'].encode('ascii', | 655 ascii_lines = run_data['output_snippet'].encode('ascii', |
654 errors='replace') | 656 errors='replace') |
655 decoded_lines = CompressList( | 657 decoded_lines = CompressList( |
656 ascii_lines.decode('string_escape', errors='replace').split('\n'), | 658 ascii_lines.decode('string_escape', errors='replace').split('\n'), |
657 self.OUTPUT_SNIPPET_LINES_LIMIT, | 659 self.OUTPUT_SNIPPET_LINES_LIMIT, |
658 '<truncated, full output is in gzipped JSON ' | 660 '<truncated, full output is in gzipped JSON ' |
659 'output at end of step>') | 661 'output at end of step>') |
660 run_lines.extend(decoded_lines) | 662 run_lines.extend(decoded_lines) |
661 self.test_logs[test_name].extend(run_lines) | 663 self.test_logs[test_name].extend(run_lines) |
OLD | NEW |