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

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

Issue 1259243003: Allow to pass additional shell arguments in `mojo_test`. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 4 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/devtools/common/mojo_run ('k') | 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 The file describing the list of tests has to be a valid Python program that sets 8 The file describing the list of tests has to be a valid Python program that sets
9 a |tests| global variable, containing entries of the following form: 9 a |tests| global variable, containing entries of the following form:
10 10
(...skipping 13 matching lines...) Expand all
24 # Optional arguments for the shell. 24 # Optional arguments for the shell.
25 "shell-args": ["--some-flag-for-the-shell", "--another-flag"], 25 "shell-args": ["--some-flag-for-the-shell", "--another-flag"],
26 } 26 }
27 27
28 The program may use the |target_os| global that will be any of ['android', 28 The program may use the |target_os| global that will be any of ['android',
29 'linux'], indicating the system on which the tests are to be run. 29 'linux'], indicating the system on which the tests are to be run.
30 30
31 TODO(vtl|msw): Add a way of specifying data dependencies. 31 TODO(vtl|msw): Add a way of specifying data dependencies.
32 """ 32 """
33 33
34 _DESCRIPTION = """Runner for Mojo application tests.
35
36 Any arguments not recognized by the script will be passed on as shell arguments.
37 """
38
34 import argparse 39 import argparse
35 import sys 40 import sys
36 41
37 from devtoolslib.apptest_runner import run_apptests 42 from devtoolslib.apptest_runner import run_apptests
38 from devtoolslib import shell_arguments 43 from devtoolslib import shell_arguments
39 44
40 45
41 def main(): 46 def main():
42 parser = argparse.ArgumentParser(description="Test runner for Mojo " 47 parser = argparse.ArgumentParser(description=_DESCRIPTION)
43 "application tests.")
44 parser.add_argument("test_list_file", type=file, 48 parser.add_argument("test_list_file", type=file,
45 help="a file listing apptests to run") 49 help="a file listing apptests to run")
46 50
47 # Common shell configuration arguments. 51 # Common shell configuration arguments.
48 shell_arguments.AddShellArguments(parser) 52 shell_arguments.AddShellArguments(parser)
49 script_args = parser.parse_args() 53 script_args, shell_args = parser.parse_known_args()
50 54
51 try: 55 try:
52 shell, shell_args = shell_arguments.ConfigureShell(script_args, []) 56 shell, shell_args = shell_arguments.ConfigureShell(script_args, shell_args)
53 except shell_arguments.ShellConfigurationException as e: 57 except shell_arguments.ShellConfigurationException as e:
54 print e 58 print e
55 return 1 59 return 1
56 60
57 target_os = 'android' if script_args.android else 'linux' 61 target_os = 'android' if script_args.android else 'linux'
58 test_list_globals = {"target_os": target_os} 62 test_list_globals = {"target_os": target_os}
59 exec script_args.test_list_file in test_list_globals 63 exec script_args.test_list_file in test_list_globals
60 apptests_result = run_apptests(shell, shell_args, 64 apptests_result = run_apptests(shell, shell_args,
61 test_list_globals["tests"]) 65 test_list_globals["tests"])
62 return 0 if apptests_result else 1 66 return 0 if apptests_result else 1
63 67
64 if __name__ == '__main__': 68 if __name__ == '__main__':
65 sys.exit(main()) 69 sys.exit(main())
OLDNEW
« no previous file with comments | « mojo/devtools/common/mojo_run ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698