| 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 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 import devtools | 12 import devtools |
| 13 devtools.add_lib_to_path() | 13 devtools.add_lib_to_path() |
| 14 from devtoolslib.android_shell import AndroidShell | 14 from devtoolslib.android_shell import AndroidShell |
| 15 from devtoolslib.linux_shell import LinuxShell | 15 from devtoolslib.linux_shell import LinuxShell |
| 16 from devtoolslib.apptest_runner import run_apptests | 16 from devtoolslib.apptest_runner import run_apptests |
| 17 from devtoolslib import shell_arguments |
| 17 | 18 |
| 18 from mopy import gtest | 19 from mopy import gtest |
| 19 from mopy.config import Config | 20 from mopy.config import Config |
| 20 from mopy.gn import ConfigForGNArgs, ParseGNConfig | 21 from mopy.gn import ConfigForGNArgs, ParseGNConfig |
| 21 from mopy.log import InitLogging | 22 from mopy.log import InitLogging |
| 22 from mopy.paths import Paths | 23 from mopy.paths import Paths |
| 23 | 24 |
| 24 | 25 |
| 25 _logger = logging.getLogger() | 26 _logger = logging.getLogger() |
| 26 | 27 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 37 help="the build output directory") | 38 help="the build output directory") |
| 38 args = parser.parse_args() | 39 args = parser.parse_args() |
| 39 | 40 |
| 40 InitLogging(args.verbose_count) | 41 InitLogging(args.verbose_count) |
| 41 config = ConfigForGNArgs(ParseGNConfig(args.build_dir)) | 42 config = ConfigForGNArgs(ParseGNConfig(args.build_dir)) |
| 42 paths = Paths(config) | 43 paths = Paths(config) |
| 43 extra_args = [] | 44 extra_args = [] |
| 44 if config.target_os == Config.OS_ANDROID: | 45 if config.target_os == Config.OS_ANDROID: |
| 45 shell = AndroidShell(paths.adb_path) | 46 shell = AndroidShell(paths.adb_path) |
| 46 shell.InstallApk(paths.target_mojo_shell_path) | 47 shell.InstallApk(paths.target_mojo_shell_path) |
| 47 extra_args.append(shell.SetUpLocalOrigin(paths.build_dir, fixed_port=False)) | 48 extra_args.extend(shell_arguments.ConfigureLocalOrigin( |
| 49 shell, paths.build_dir, fixed_port=False)) |
| 48 else: | 50 else: |
| 49 shell = LinuxShell(paths.mojo_shell_path) | 51 shell = LinuxShell(paths.mojo_shell_path) |
| 50 | 52 |
| 51 gtest.set_color() | 53 gtest.set_color() |
| 52 | 54 |
| 53 test_list_globals = {"config": config} | 55 test_list_globals = {"config": config} |
| 54 exec args.test_list_file in test_list_globals | 56 exec args.test_list_file in test_list_globals |
| 55 apptests_result = run_apptests(shell, extra_args, test_list_globals["tests"]) | 57 apptests_result = run_apptests(shell, extra_args, test_list_globals["tests"]) |
| 56 return 0 if apptests_result else 1 | 58 return 0 if apptests_result else 1 |
| 57 | 59 |
| 58 | 60 |
| 59 if __name__ == '__main__': | 61 if __name__ == '__main__': |
| 60 sys.exit(main()) | 62 sys.exit(main()) |
| OLD | NEW |