| 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 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 } | 42 } |
| 43 | 43 |
| 44 |test_list_file| may reference the |target_os| global that will be any of | 44 |test_list_file| may reference the |target_os| global that will be any of |
| 45 ['android', 'linux'], indicating the system on which the tests are to be run. | 45 ['android', 'linux'], indicating the system on which the tests are to be run. |
| 46 | 46 |
| 47 Any arguments not recognized by the script will be passed on as shell arguments. | 47 Any arguments not recognized by the script will be passed on as shell arguments. |
| 48 """ | 48 """ |
| 49 | 49 |
| 50 _logger = logging.getLogger() | 50 _logger = logging.getLogger() |
| 51 | 51 |
| 52 _CACHE_SERVICE_URL = 'mojo:url_response_disk_cache' |
| 53 |
| 52 | 54 |
| 53 def main(): | 55 def main(): |
| 54 parser = argparse.ArgumentParser( | 56 parser = argparse.ArgumentParser( |
| 55 formatter_class=argparse.RawDescriptionHelpFormatter, | 57 formatter_class=argparse.RawDescriptionHelpFormatter, |
| 56 description=_DESCRIPTION) | 58 description=_DESCRIPTION) |
| 57 parser.add_argument("test_list_file", type=file, | 59 parser.add_argument("test_list_file", type=file, |
| 58 help="a file listing apptests to run") | 60 help="a file listing apptests to run") |
| 59 shell_config.add_shell_arguments(parser) | 61 shell_config.add_shell_arguments(parser) |
| 60 | 62 |
| 61 script_args, shell_args = parser.parse_known_args() | 63 script_args, shell_args = parser.parse_known_args() |
| 62 | 64 |
| 63 try: | 65 try: |
| 64 config = shell_config.get_shell_config(script_args) | 66 config = shell_config.get_shell_config(script_args) |
| 65 if script_args.android: | 67 if script_args.android: |
| 66 # We need root to have the stdout of the shell available on the host. | 68 # We need root to have the stdout of the shell available on the host. |
| 67 config.require_root = True | 69 config.require_root = True |
| 68 shell, common_shell_args = shell_arguments.get_shell(config, shell_args) | 70 shell, common_shell_args = shell_arguments.get_shell(config, shell_args) |
| 71 # Tests must be reproducible. Start with an empty cache. |
| 72 common_shell_args.append( |
| 73 "--args-for=%s %s" % (_CACHE_SERVICE_URL, "--clear")) |
| 69 except shell_config.ShellConfigurationException as e: | 74 except shell_config.ShellConfigurationException as e: |
| 70 print e | 75 print e |
| 71 return 1 | 76 return 1 |
| 72 | 77 |
| 73 target_os = "android" if script_args.android else "linux" | 78 target_os = "android" if script_args.android else "linux" |
| 74 test_list_globals = {"target_os": target_os} | 79 test_list_globals = {"target_os": target_os} |
| 75 exec script_args.test_list_file in test_list_globals | 80 exec script_args.test_list_file in test_list_globals |
| 76 test_list = test_list_globals["tests"] | 81 test_list = test_list_globals["tests"] |
| 77 | 82 |
| 78 succeeded = True | 83 succeeded = True |
| (...skipping 25 matching lines...) Expand all Loading... |
| 104 print "Unrecognized test type in %r" % test_dict | 109 print "Unrecognized test type in %r" % test_dict |
| 105 | 110 |
| 106 print "Succeeded" if apptest_result else "Failed" | 111 print "Succeeded" if apptest_result else "Failed" |
| 107 _logger.info("Completed: %s" % test_name) | 112 _logger.info("Completed: %s" % test_name) |
| 108 if not apptest_result: | 113 if not apptest_result: |
| 109 succeeded = False | 114 succeeded = False |
| 110 return 0 if succeeded else 1 | 115 return 0 if succeeded else 1 |
| 111 | 116 |
| 112 if __name__ == '__main__': | 117 if __name__ == '__main__': |
| 113 sys.exit(main()) | 118 sys.exit(main()) |
| OLD | NEW |