| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2014 The Chromium Authors. All rights reserved. | 2 # Copyright 2014 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 """A test runner for gtest application tests.""" | 6 """A test runner for gtest application tests.""" |
| 7 | 7 |
| 8 import argparse | 8 import argparse |
| 9 import logging | 9 import logging |
| 10 import sys | 10 import sys |
| 11 | 11 |
| 12 from mopy import dart_apptest | 12 from mopy import dart_apptest |
| 13 from mopy import gtest | 13 from mopy import gtest |
| 14 # TODO(msw): Mojo's script pulls in android.py via mojo/devtools/common/pylib. | |
| 15 from mopy.android import AndroidShell | 14 from mopy.android import AndroidShell |
| 16 from mopy.config import Config | 15 from mopy.config import Config |
| 17 from mopy.gn import ConfigForGNArgs, ParseGNConfig | 16 from mopy.gn import ConfigForGNArgs, ParseGNConfig |
| 18 from mopy.log import InitLogging | 17 from mopy.log import InitLogging |
| 19 from mopy.paths import Paths | 18 from mopy.paths import Paths |
| 20 | 19 |
| 21 | 20 |
| 22 _logger = logging.getLogger() | 21 _logger = logging.getLogger() |
| 23 | 22 |
| 24 | 23 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 41 execution_globals = {"config": config} | 40 execution_globals = {"config": config} |
| 42 exec args.test_list_file in execution_globals | 41 exec args.test_list_file in execution_globals |
| 43 test_list = execution_globals["tests"] | 42 test_list = execution_globals["tests"] |
| 44 _logger.debug("Test list: %s" % test_list) | 43 _logger.debug("Test list: %s" % test_list) |
| 45 | 44 |
| 46 extra_args = [] | 45 extra_args = [] |
| 47 if config.target_os == Config.OS_ANDROID: | 46 if config.target_os == Config.OS_ANDROID: |
| 48 paths = Paths(config) | 47 paths = Paths(config) |
| 49 shell = AndroidShell(paths.target_mojo_shell_path, paths.build_dir, | 48 shell = AndroidShell(paths.target_mojo_shell_path, paths.build_dir, |
| 50 paths.adb_path) | 49 paths.adb_path) |
| 51 extra_args.extend(shell.PrepareShellRun(fixed_port=False)) | 50 extra_args.extend(shell.PrepareShellRun('localhost')) |
| 52 else: | 51 else: |
| 53 shell = None | 52 shell = None |
| 54 | 53 |
| 55 gtest.set_color() | 54 gtest.set_color() |
| 56 | 55 |
| 57 exit_code = 0 | 56 exit_code = 0 |
| 58 for test_dict in test_list: | 57 for test_dict in test_list: |
| 59 test = test_dict["test"] | 58 test = test_dict["test"] |
| 60 test_name = test_dict.get("name", test) | 59 test_name = test_dict.get("name", test) |
| 61 test_type = test_dict.get("type", "gtest") | 60 test_type = test_dict.get("type", "gtest") |
| (...skipping 20 matching lines...) Expand all Loading... |
| 82 if apptest_result != "Succeeded": | 81 if apptest_result != "Succeeded": |
| 83 exit_code = 1 | 82 exit_code = 1 |
| 84 print apptest_result | 83 print apptest_result |
| 85 _logger.info("Completed: %s" % test_name) | 84 _logger.info("Completed: %s" % test_name) |
| 86 | 85 |
| 87 return exit_code | 86 return exit_code |
| 88 | 87 |
| 89 | 88 |
| 90 if __name__ == '__main__': | 89 if __name__ == '__main__': |
| 91 sys.exit(main()) | 90 sys.exit(main()) |
| OLD | NEW |