Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(696)

Side by Side Diff: mojo/tools/mopy/gtest_list_tests.py

Issue 741323002: Handle and surface application test failures. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Address comments, add tests. Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 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 re
6
7
5 def gtest_list_tests(gtest_list_tests_output): 8 def gtest_list_tests(gtest_list_tests_output):
6 """Returns a list of strings formatted as TestSuite.TestFixture from the 9 """Returns a list of strings formatted as TestSuite.TestFixture from the
7 output of running --gtest_list_tests on a GTEST application.""" 10 output of running --gtest_list_tests on a GTEST application."""
8 11
12 if not re.match("^(\w*\.\r?\n( \w*\r?\n)+)+", gtest_list_tests_output):
13 raise Exception ("Unrecognized --gtest_list_tests output:\n%s" %
viettrungluu 2014/11/24 20:22:58 nit: No space before '('.
msw 2014/11/24 20:47:31 Done.
14 gtest_list_tests_output)
15
9 output_lines = gtest_list_tests_output.split('\n') 16 output_lines = gtest_list_tests_output.split('\n')
10 17
11 test_list = [] 18 test_list = []
12 for line in output_lines: 19 for line in output_lines:
13 if not line: 20 if not line:
14 continue 21 continue
15 if line[0] != ' ': 22 if line[0] != ' ':
16 suite = line.strip() 23 suite = line.strip()
17 continue 24 continue
18 test_list.append(suite + line.strip()) 25 test_list.append(suite + line.strip())
19 26
20 return test_list 27 return test_list
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698