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

Side by Side Diff: mojo/tools/apptest_runner.py

Issue 1143223005: Report apptest_runner device not found infra failures. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Simplify changes. Created 5 years, 6 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 | « mojo/tools/android_mojo_shell.py ('k') | mojo/tools/mopy/android.py » ('j') | 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 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 json 9 import json
10 import logging 10 import logging
11 import os
11 import sys 12 import sys
12 import time 13 import time
13 14
14 from mopy import gtest 15 from mopy import gtest
15 from mopy.config import Config 16 from mopy.config import Config
16 17
17 18
18 def main(): 19 def main():
19 parser = argparse.ArgumentParser(description="An application test runner.") 20 parser = argparse.ArgumentParser(description="An application test runner.")
20 parser.add_argument("test_list_file", type=file, 21 parser.add_argument("test_list_file", type=file,
(...skipping 11 matching lines...) Expand all
32 logger.debug("Initialized logging: level=%s" % logger.level) 33 logger.debug("Initialized logging: level=%s" % logger.level)
33 34
34 logger.debug("Test list file: %s", args.test_list_file) 35 logger.debug("Test list file: %s", args.test_list_file)
35 config = Config(args.build_dir) 36 config = Config(args.build_dir)
36 execution_globals = {"config": config} 37 execution_globals = {"config": config}
37 exec args.test_list_file in execution_globals 38 exec args.test_list_file in execution_globals
38 test_list = execution_globals["tests"] 39 test_list = execution_globals["tests"]
39 logger.debug("Test list: %s" % test_list) 40 logger.debug("Test list: %s" % test_list)
40 41
41 shell = None 42 shell = None
42 extra_args = []
43 if config.target_os == Config.OS_ANDROID: 43 if config.target_os == Config.OS_ANDROID:
44 from mopy.android import AndroidShell 44 from mopy.android import AndroidShell
45 shell = AndroidShell(config) 45 shell = AndroidShell(config)
46 extra_args.extend(shell.PrepareShellRun('localhost')) 46 result = shell.InitShell()
47 if result != 0:
48 return result
47 49
48 tests = [] 50 tests = []
49 passed = [] 51 passed = []
50 failed = [] 52 failed = []
51 for test_dict in test_list: 53 for test_dict in test_list:
52 test = test_dict["test"] 54 test = test_dict["test"]
53 test_name = test_dict.get("name", test) 55 test_name = test_dict.get("name", test)
54 test_type = test_dict.get("type", "gtest") 56 test_type = test_dict.get("type", "gtest")
55 test_args = test_dict.get("args", []) + extra_args 57 test_args = test_dict.get("args", [])
56 58
57 print "Running %s...%s" % (test_name, ("\n" if args.verbose else "")), 59 print "Running %s...%s" % (test_name, ("\n" if args.verbose else "")),
58 sys.stdout.flush() 60 sys.stdout.flush()
59 61
60 tests.append(test_name) 62 tests.append(test_name)
61 assert test_type in ("gtest", "gtest_isolated") 63 assert test_type in ("gtest", "gtest_isolated")
62 isolate = test_type == "gtest_isolated" 64 isolate = test_type == "gtest_isolated"
63 result = gtest.run_apptest(config, shell, test_args, test, isolate) 65 result = gtest.run_apptest(config, shell, test_args, test, isolate)
64 passed.extend([test_name] if result else []) 66 passed.extend([test_name] if result else [])
65 failed.extend([] if result else [test_name]) 67 failed.extend([] if result else [test_name])
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 trie[path] = value 118 trie[path] = value
117 return 119 return
118 directory, rest = path.split('.', 1) 120 directory, rest = path.split('.', 1)
119 if directory not in trie: 121 if directory not in trie:
120 trie[directory] = {} 122 trie[directory] = {}
121 _AddPathToTrie(trie[directory], rest, value) 123 _AddPathToTrie(trie[directory], rest, value)
122 124
123 125
124 if __name__ == '__main__': 126 if __name__ == '__main__':
125 sys.exit(main()) 127 sys.exit(main())
OLDNEW
« no previous file with comments | « mojo/tools/android_mojo_shell.py ('k') | mojo/tools/mopy/android.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698