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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 | 63 |
64 | 64 |
65 def get_fixtures(mojo_shell, apptest): | 65 def get_fixtures(mojo_shell, apptest): |
66 """Returns the "Test.Fixture" list from an apptest using mojo_shell. | 66 """Returns the "Test.Fixture" list from an apptest using mojo_shell. |
67 | 67 |
68 Tests are listed by running the given apptest in mojo_shell and passing | 68 Tests are listed by running the given apptest in mojo_shell and passing |
69 --gtest_list_tests. The output is parsed and reformatted into a list like | 69 --gtest_list_tests. The output is parsed and reformatted into a list like |
70 [TestSuite.TestFixture, ... ] | 70 [TestSuite.TestFixture, ... ] |
71 An empty list is returned on failure, with errors logged. | 71 An empty list is returned on failure, with errors logged. |
72 """ | 72 """ |
73 command = [mojo_shell, | 73 command = [mojo_shell, "--gtest_list_tests", apptest] |
74 "--args-for={0} --gtest_list_tests".format(apptest), | |
75 apptest] | |
76 try: | 74 try: |
77 list_output = subprocess.check_output(command, stderr=subprocess.STDOUT) | 75 list_output = subprocess.check_output(command, stderr=subprocess.STDOUT) |
78 _logging.debug("Tests listed:\n%s" % list_output) | 76 _logging.debug("Tests listed:\n%s" % list_output) |
79 return _gtest_list_tests(list_output) | 77 return _gtest_list_tests(list_output) |
80 except Exception as e: | 78 except Exception as e: |
81 print "Failed to get test fixtures:" | 79 print "Failed to get test fixtures:" |
82 _print_process_error(command, e) | 80 _print_process_error(command, e) |
83 return [] | 81 return [] |
84 | 82 |
85 | 83 |
(...skipping 14 matching lines...) Expand all Loading... |
100 test_list = [] | 98 test_list = [] |
101 for line in output_lines: | 99 for line in output_lines: |
102 if not line: | 100 if not line: |
103 continue | 101 continue |
104 if line[0] != ' ': | 102 if line[0] != ' ': |
105 suite = line.strip() | 103 suite = line.strip() |
106 continue | 104 continue |
107 test_list.append(suite + line.strip()) | 105 test_list.append(suite + line.strip()) |
108 | 106 |
109 return test_list | 107 return test_list |
OLD | NEW |