Chromium Code Reviews| 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 72 shell, common_shell_args = shell_arguments.get_shell(config, shell_args) | 73 shell, common_shell_args = shell_arguments.get_shell(config, shell_args) |
| 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 |
| 83 shell_dir = os.path.dirname(config.shell_path) | |
|
viettrungluu
2016/02/17 22:18:04
I think you should just plumb through shell_path,
kulakowski
2016/02/17 22:41:52
Done.
| |
| 82 target_os = "android" if script_args.android else "linux" | 84 target_os = "android" if script_args.android else "linux" |
| 83 test_list_globals = {"target_os": target_os} | 85 test_list_globals = { |
| 86 "shell_dir": shell_dir, | |
| 87 "target_os": target_os, | |
| 88 } | |
| 84 exec script_args.test_list_file in test_list_globals | 89 exec script_args.test_list_file in test_list_globals |
| 85 test_list = test_list_globals["tests"] | 90 test_list = test_list_globals["tests"] |
| 86 | 91 |
| 87 succeeded = True | 92 succeeded = True |
| 88 for test_dict in test_list: | 93 for test_dict in test_list: |
| 89 test = test_dict["test"] | 94 test = test_dict["test"] |
| 90 test_name = test_dict.get("name", test) | 95 test_name = test_dict.get("name", test) |
| 91 test_type = test_dict.get("type", "gtest") | 96 test_type = test_dict.get("type", "gtest") |
| 92 test_args = test_dict.get("test-args", []) | 97 test_args = test_dict.get("test-args", []) |
| 93 shell_args = test_dict.get("shell-args", []) + common_shell_args | 98 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 | 121 print "Unrecognized test type in %r" % test_dict |
| 117 | 122 |
| 118 print "Succeeded" if apptest_result else "Failed" | 123 print "Succeeded" if apptest_result else "Failed" |
| 119 _logger.info("Completed: %s" % test_name) | 124 _logger.info("Completed: %s" % test_name) |
| 120 if not apptest_result: | 125 if not apptest_result: |
| 121 succeeded = False | 126 succeeded = False |
| 122 return 0 if succeeded else 1 | 127 return 0 if succeeded else 1 |
| 123 | 128 |
| 124 if __name__ == '__main__': | 129 if __name__ == '__main__': |
| 125 sys.exit(main()) | 130 sys.exit(main()) |
| OLD | NEW |