| 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 ast | 9 import ast |
| 10 import logging | 10 import logging |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 | 36 |
| 37 config = ConfigForGNArgs(ParseGNConfig(args.build_dir)) | 37 config = ConfigForGNArgs(ParseGNConfig(args.build_dir)) |
| 38 | 38 |
| 39 execution_globals = { | 39 execution_globals = { |
| 40 "config": config, | 40 "config": config, |
| 41 } | 41 } |
| 42 exec args.apptest_list_file in execution_globals | 42 exec args.apptest_list_file in execution_globals |
| 43 apptest_list = execution_globals["tests"] | 43 apptest_list = execution_globals["tests"] |
| 44 _logging.debug("Test list: %s" % apptest_list) | 44 _logging.debug("Test list: %s" % apptest_list) |
| 45 | 45 |
| 46 android_origin_argument = None | 46 extra_args = [] |
| 47 if config.target_os == Config.OS_ANDROID: | 47 if config.target_os == Config.OS_ANDROID: |
| 48 android_origin_argument = android.PrepareShellRun(config) | 48 extra_args.extend(android.PrepareShellRun(config)) |
| 49 | 49 |
| 50 gtest.set_color() | 50 gtest.set_color() |
| 51 mojo_paths = Paths(config) | 51 mojo_paths = Paths(config) |
| 52 | 52 |
| 53 exit_code = 0 | 53 exit_code = 0 |
| 54 for apptest_dict in apptest_list: | 54 for apptest_dict in apptest_list: |
| 55 apptest = apptest_dict["test"] | 55 apptest = apptest_dict["test"] |
| 56 test_args = apptest_dict.get("test-args", []) | 56 test_args = apptest_dict.get("test-args", []) |
| 57 shell_args = apptest_dict.get("shell-args", []) | 57 shell_args = apptest_dict.get("shell-args", []) + extra_args |
| 58 if android_origin_argument: | |
| 59 shell_args.append(android_origin_argument) | |
| 60 launched_services = apptest_dict.get("launched-services", []) | 58 launched_services = apptest_dict.get("launched-services", []) |
| 61 | 59 |
| 62 print "Running " + apptest + "...", | 60 print "Running " + apptest + "...", |
| 63 sys.stdout.flush() | 61 sys.stdout.flush() |
| 64 | 62 |
| 65 # List the apptest fixtures so they can be run independently for isolation. | 63 # List the apptest fixtures so they can be run independently for isolation. |
| 66 # TODO(msw): Run some apptests without fixture isolation? | 64 # TODO(msw): Run some apptests without fixture isolation? |
| 67 fixtures = gtest.get_fixtures(config, shell_args, apptest) | 65 fixtures = gtest.get_fixtures(config, shell_args, apptest) |
| 68 | 66 |
| 69 if not fixtures: | 67 if not fixtures: |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 launcher_args = [ | 105 launcher_args = [ |
| 108 '--shell-path=' + apps.socket_path, | 106 '--shell-path=' + apps.socket_path, |
| 109 '--app-url=' + application, | 107 '--app-url=' + application, |
| 110 '--app-path=' + mojo_paths.FileFromUrl(application), | 108 '--app-path=' + mojo_paths.FileFromUrl(application), |
| 111 '--app-args=' + " ".join(application_args)] | 109 '--app-args=' + " ".join(application_args)] |
| 112 return gtest.run_test(config, launcher_args, run_launcher=True) | 110 return gtest.run_test(config, launcher_args, run_launcher=True) |
| 113 | 111 |
| 114 | 112 |
| 115 if __name__ == '__main__': | 113 if __name__ == '__main__': |
| 116 sys.exit(main()) | 114 sys.exit(main()) |
| OLD | NEW |