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

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

Issue 874273002: Add mojo apptest runner. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Strip the runner down. Created 5 years, 10 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 | mojo/tools/data/apptests » ('j') | mojo/tools/gtest.py » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #!/usr/bin/env python
2 # Copyright 2014 The Chromium Authors. All rights reserved.
jamesr 2015/01/29 20:12:08 2015
ppi 2015/01/29 23:41:24 Done.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
5
6 """A test runner for gtest application tests."""
7
8 import argparse
9 import ast
10 import logging
11 import os
12 import sys
13
14 _logging = logging.getLogger()
15
16 import gtest
17
18
19 def main():
20 logging.basicConfig()
21 # Uncomment to debug:
22 #_logging.setLevel(logging.DEBUG)
23
24 parser = argparse.ArgumentParser(description='A test runner for gtest '
25 'application tests.')
26
27 parser.add_argument('apptest_list_file', type=file,
28 help='A file listing apptests to run.')
29 parser.add_argument('build_dir', type=str,
30 help='The build output directory.')
31 args = parser.parse_args()
32
33 apptest_list = ast.literal_eval(args.apptest_list_file.read())
34 _logging.debug("Test list: %s" % apptest_list)
35
36 gtest.set_color()
37 mojo_shell_path = os.path.join(args.build_dir, "mojo_shell")
38
39 exit_code = 0
40 for apptest_dict in apptest_list:
41 if apptest_dict.get("disabled"):
42 continue
43
44 apptest = apptest_dict["test"]
45 apptest_args = apptest_dict.get("test-args", [])
46 shell_args = apptest_dict.get("shell-args", [])
47
48 print "Running " + apptest + "...",
49 sys.stdout.flush()
50
51 # List the apptest fixtures so they can be run independently for isolation.
52 # TODO(msw): Run some apptests without fixture isolation?
53 fixtures = gtest.get_fixtures(mojo_shell_path, apptest)
54
55 if not fixtures:
56 print "Failed with no tests found."
57 exit_code = 1
58 continue
59
60 apptest_result = "Succeeded"
61 for fixture in fixtures:
62 args_for_apptest = " ".join(["--args-for=" + apptest,
63 "--gtest_filter=" + fixture] + apptest_args)
64
65 success = RunApptestInShell(mojo_shell_path, apptest,
66 shell_args + [args_for_apptest])
67
68 if not success:
69 apptest_result = "Failed test(s) in %r" % apptest_dict
70 exit_code = 1
71
72 print apptest_result
73
74 return exit_code
75
76
77 def RunApptestInShell(mojo_shell_path, apptest, shell_args):
78 return gtest.run_test([mojo_shell_path, apptest] + shell_args)
79
80
81 if __name__ == '__main__':
82 sys.exit(main())
OLDNEW
« no previous file with comments | « no previous file | mojo/tools/data/apptests » ('j') | mojo/tools/gtest.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698