Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(19)

Side by Side Diff: mojo/devtools/common/mojo_test

Issue 1384773003: Clear the network service disk cache for each apptest run. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
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' 52 _CACHE_SERVICE_URL = 'mojo:url_response_disk_cache'
53 _NETWORK_SERVICE_URL = 'mojo:network_service'
53 54
54 55
55 def main(): 56 def main():
56 parser = argparse.ArgumentParser( 57 parser = argparse.ArgumentParser(
57 formatter_class=argparse.RawDescriptionHelpFormatter, 58 formatter_class=argparse.RawDescriptionHelpFormatter,
58 description=_DESCRIPTION) 59 description=_DESCRIPTION)
59 parser.add_argument("test_list_file", type=file, 60 parser.add_argument("test_list_file", type=file,
60 help="a file listing apptests to run") 61 help="a file listing apptests to run")
61 shell_config.add_shell_arguments(parser) 62 shell_config.add_shell_arguments(parser)
62 63
63 script_args, shell_args = parser.parse_known_args() 64 script_args, shell_args = parser.parse_known_args()
64 65
65 try: 66 try:
66 config = shell_config.get_shell_config(script_args) 67 config = shell_config.get_shell_config(script_args)
67 if script_args.android: 68 if script_args.android:
68 # We need root to have the stdout of the shell available on the host. 69 # We need root to have the stdout of the shell available on the host.
69 config.require_root = True 70 config.require_root = True
70 shell, common_shell_args = shell_arguments.get_shell(config, shell_args) 71 shell, common_shell_args = shell_arguments.get_shell(config, shell_args)
71 # Tests must be reproducible. Start with an empty cache. 72 # Tests must be reproducible, start with empty caches.
72 common_shell_args.append( 73 common_shell_args.append(
73 "--args-for=%s %s" % (_CACHE_SERVICE_URL, "--clear")) 74 "--args-for=%s %s" % (_CACHE_SERVICE_URL, "--clear"))
75 common_shell_args.append(
76 "--args-for=%s %s" % (_NETWORK_SERVICE_URL, "--clear"))
74 except shell_config.ShellConfigurationException as e: 77 except shell_config.ShellConfigurationException as e:
75 print e 78 print e
76 return 1 79 return 1
77 80
78 target_os = "android" if script_args.android else "linux" 81 target_os = "android" if script_args.android else "linux"
79 test_list_globals = {"target_os": target_os} 82 test_list_globals = {"target_os": target_os}
80 exec script_args.test_list_file in test_list_globals 83 exec script_args.test_list_file in test_list_globals
81 test_list = test_list_globals["tests"] 84 test_list = test_list_globals["tests"]
82 85
83 succeeded = True 86 succeeded = True
(...skipping 25 matching lines...) Expand all
109 print "Unrecognized test type in %r" % test_dict 112 print "Unrecognized test type in %r" % test_dict
110 113
111 print "Succeeded" if apptest_result else "Failed" 114 print "Succeeded" if apptest_result else "Failed"
112 _logger.info("Completed: %s" % test_name) 115 _logger.info("Completed: %s" % test_name)
113 if not apptest_result: 116 if not apptest_result:
114 succeeded = False 117 succeeded = False
115 return 0 if succeeded else 1 118 return 0 if succeeded else 1
116 119
117 if __name__ == '__main__': 120 if __name__ == '__main__':
118 sys.exit(main()) 121 sys.exit(main())
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698