OLD | NEW |
1 # Copyright 2015 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 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 import logging | 5 import logging |
6 import os | 6 import os |
7 import re | 7 import re |
8 import subprocess | 8 import subprocess |
9 import sys | 9 import sys |
10 | 10 |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 except Exception as e: | 80 except Exception as e: |
81 print "Failed to get test fixtures:" | 81 print "Failed to get test fixtures:" |
82 _print_process_error(command, e) | 82 _print_process_error(command, e) |
83 return [] | 83 return [] |
84 | 84 |
85 | 85 |
86 def _gtest_list_tests(gtest_list_tests_output): | 86 def _gtest_list_tests(gtest_list_tests_output): |
87 """Returns a list of strings formatted as TestSuite.TestFixture from the | 87 """Returns a list of strings formatted as TestSuite.TestFixture from the |
88 output of running --gtest_list_tests on a GTEST application.""" | 88 output of running --gtest_list_tests on a GTEST application.""" |
89 | 89 |
| 90 # Remove log lines. |
| 91 gtest_list_tests_output = ( |
| 92 re.sub("^\[.*\n", "", gtest_list_tests_output, flags=re.MULTILINE)) |
| 93 |
90 if not re.match("^(\w*\.\r?\n( \w*\r?\n)+)+", gtest_list_tests_output): | 94 if not re.match("^(\w*\.\r?\n( \w*\r?\n)+)+", gtest_list_tests_output): |
91 raise Exception("Unrecognized --gtest_list_tests output:\n%s" % | 95 raise Exception("Unrecognized --gtest_list_tests output:\n%s" % |
92 gtest_list_tests_output) | 96 gtest_list_tests_output) |
93 | 97 |
94 output_lines = gtest_list_tests_output.split('\n') | 98 output_lines = gtest_list_tests_output.split('\n') |
95 | 99 |
96 test_list = [] | 100 test_list = [] |
97 for line in output_lines: | 101 for line in output_lines: |
98 if not line: | 102 if not line: |
99 continue | 103 continue |
100 if line[0] != ' ': | 104 if line[0] != ' ': |
101 suite = line.strip() | 105 suite = line.strip() |
102 continue | 106 continue |
103 test_list.append(suite + line.strip()) | 107 test_list.append(suite + line.strip()) |
104 | 108 |
105 return test_list | 109 return test_list |
OLD | NEW |