OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright 2015 The Chromium Authors. All rights reserved. | 2 # Copyright 2015 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 """Test runner for Mojo application tests. | 6 """Test runner for Mojo application tests. |
7 | 7 |
8 TODO(vtl|msw): Add a way of specifying data dependencies. | 8 TODO(vtl|msw): Add a way of specifying data dependencies. |
9 """ | 9 """ |
10 | 10 |
11 import argparse | 11 import argparse |
12 import logging | 12 import logging |
13 import sys | 13 import sys |
| 14 import os.path |
14 | 15 |
15 from devtoolslib import apptest_dart | 16 from devtoolslib import apptest_dart |
16 from devtoolslib import apptest_gtest | 17 from devtoolslib import apptest_gtest |
17 from devtoolslib import shell_arguments | 18 from devtoolslib import shell_arguments |
18 from devtoolslib import shell_config | 19 from devtoolslib import shell_config |
19 | 20 |
20 _DESCRIPTION = """Runner for Mojo application tests. | 21 _DESCRIPTION = """Runner for Mojo application tests. |
21 | 22 |
22 |test_list_file| has to be a valid Python program that sets a |tests| global | 23 |test_list_file| has to be a valid Python program that sets a |tests| global |
23 variable, containing entries of the following form: | 24 variable, containing entries of the following form: |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 # Tests must be reproducible, start with empty caches. | 74 # Tests must be reproducible, start with empty caches. |
74 common_shell_args.append( | 75 common_shell_args.append( |
75 "--args-for=%s %s" % (_CACHE_SERVICE_URL, "--clear")) | 76 "--args-for=%s %s" % (_CACHE_SERVICE_URL, "--clear")) |
76 common_shell_args.append( | 77 common_shell_args.append( |
77 "--args-for=%s %s" % (_NETWORK_SERVICE_URL, "--clear")) | 78 "--args-for=%s %s" % (_NETWORK_SERVICE_URL, "--clear")) |
78 except shell_config.ShellConfigurationException as e: | 79 except shell_config.ShellConfigurationException as e: |
79 print e | 80 print e |
80 return 1 | 81 return 1 |
81 | 82 |
82 target_os = "android" if script_args.android else "linux" | 83 target_os = "android" if script_args.android else "linux" |
83 test_list_globals = {"target_os": target_os} | 84 test_list_globals = { |
| 85 "shell_path": config.shell_path, |
| 86 "target_os": target_os, |
| 87 } |
84 exec script_args.test_list_file in test_list_globals | 88 exec script_args.test_list_file in test_list_globals |
85 test_list = test_list_globals["tests"] | 89 test_list = test_list_globals["tests"] |
86 | 90 |
87 succeeded = True | 91 succeeded = True |
88 for test_dict in test_list: | 92 for test_dict in test_list: |
89 test = test_dict["test"] | 93 test = test_dict["test"] |
90 test_name = test_dict.get("name", test) | 94 test_name = test_dict.get("name", test) |
91 test_type = test_dict.get("type", "gtest") | 95 test_type = test_dict.get("type", "gtest") |
92 test_args = test_dict.get("test-args", []) | 96 test_args = test_dict.get("test-args", []) |
93 shell_args = test_dict.get("shell-args", []) + common_shell_args | 97 shell_args = test_dict.get("shell-args", []) + common_shell_args |
(...skipping 22 matching lines...) Expand all Loading... |
116 print "Unrecognized test type in %r" % test_dict | 120 print "Unrecognized test type in %r" % test_dict |
117 | 121 |
118 print "Succeeded" if apptest_result else "Failed" | 122 print "Succeeded" if apptest_result else "Failed" |
119 _logger.info("Completed: %s" % test_name) | 123 _logger.info("Completed: %s" % test_name) |
120 if not apptest_result: | 124 if not apptest_result: |
121 succeeded = False | 125 succeeded = False |
122 return 0 if succeeded else 1 | 126 return 0 if succeeded else 1 |
123 | 127 |
124 if __name__ == '__main__': | 128 if __name__ == '__main__': |
125 sys.exit(main()) | 129 sys.exit(main()) |
OLD | NEW |