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 16 matching lines...) Expand all Loading... |
27 | 27 |
28 parser = argparse.ArgumentParser(description='A test runner for gtest ' | 28 parser = argparse.ArgumentParser(description='A test runner for gtest ' |
29 'application tests.') | 29 'application tests.') |
30 | 30 |
31 parser.add_argument('apptest_list_file', type=file, | 31 parser.add_argument('apptest_list_file', type=file, |
32 help='A file listing apptests to run.') | 32 help='A file listing apptests to run.') |
33 parser.add_argument('build_dir', type=str, | 33 parser.add_argument('build_dir', type=str, |
34 help='The build output directory.') | 34 help='The build output directory.') |
35 args = parser.parse_args() | 35 args = parser.parse_args() |
36 | 36 |
37 apptest_list = ast.literal_eval(args.apptest_list_file.read()) | 37 config = ConfigForGNArgs(ParseGNConfig(args.build_dir)) |
| 38 |
| 39 execution_globals = { |
| 40 "config": config, |
| 41 } |
| 42 exec args.apptest_list_file in execution_globals |
| 43 apptest_list = execution_globals["tests"] |
38 _logging.debug("Test list: %s" % apptest_list) | 44 _logging.debug("Test list: %s" % apptest_list) |
39 | 45 |
40 config = ConfigForGNArgs(ParseGNConfig(args.build_dir)) | |
41 is_android = (config.target_os == Config.OS_ANDROID) | 46 is_android = (config.target_os == Config.OS_ANDROID) |
42 android_context = android.PrepareShellRun(config) if is_android else None | 47 android_context = android.PrepareShellRun(config) if is_android else None |
43 | 48 |
44 gtest.set_color() | 49 gtest.set_color() |
45 mojo_paths = Paths(config) | 50 mojo_paths = Paths(config) |
46 | 51 |
47 exit_code = 0 | 52 exit_code = 0 |
48 for apptest_dict in apptest_list: | 53 for apptest_dict in apptest_list: |
49 if apptest_dict.get("disabled"): | |
50 continue | |
51 if not config.match_target_os(apptest_dict.get("target_os", [])): | |
52 continue | |
53 | |
54 apptest = apptest_dict["test"] | 54 apptest = apptest_dict["test"] |
55 apptest_args = apptest_dict.get("test-args", []) | 55 apptest_args = apptest_dict.get("test-args", []) |
56 shell_args = apptest_dict.get("shell-args", []) | 56 shell_args = apptest_dict.get("shell-args", []) |
57 launched_services = apptest_dict.get("launched-services", []) | 57 launched_services = apptest_dict.get("launched-services", []) |
58 | 58 |
59 print "Running " + apptest + "...", | 59 print "Running " + apptest + "...", |
60 sys.stdout.flush() | 60 sys.stdout.flush() |
61 | 61 |
62 # List the apptest fixtures so they can be run independently for isolation. | 62 # List the apptest fixtures so they can be run independently for isolation. |
63 # TODO(msw): Run some apptests without fixture isolation? | 63 # TODO(msw): Run some apptests without fixture isolation? |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 launcher_args = [ | 107 launcher_args = [ |
108 '--shell-path=' + apps.socket_path, | 108 '--shell-path=' + apps.socket_path, |
109 '--app-url=' + application, | 109 '--app-url=' + application, |
110 '--app-path=' + mojo_paths.FileFromUrl(application), | 110 '--app-path=' + mojo_paths.FileFromUrl(application), |
111 '--app-args=' + " ".join(application_args)] | 111 '--app-args=' + " ".join(application_args)] |
112 return gtest.run_test(config, launcher_args, run_launcher=True) | 112 return gtest.run_test(config, launcher_args, run_launcher=True) |
113 | 113 |
114 | 114 |
115 if __name__ == '__main__': | 115 if __name__ == '__main__': |
116 sys.exit(main()) | 116 sys.exit(main()) |
OLD | NEW |