OLD | NEW |
---|---|
(Empty) | |
1 # Copyright 2014 The Chromium Authors. All rights reserved. | |
2 # Use of this source code is governed by a BSD-style license that can be | |
3 # found in the LICENSE file. | |
4 | |
5 import logging | |
6 import os | |
msw
2015/03/04 21:04:32
nit: not needed
| |
7 import re | |
msw
2015/03/04 21:04:32
nit: not needed
| |
8 import subprocess | |
msw
2015/03/04 21:04:32
nit: not needed
| |
9 import sys | |
msw
2015/03/04 21:04:32
nit: not needed
| |
10 | |
11 _logging = logging.getLogger() | |
12 | |
13 from mopy import test_util | |
14 from mopy.config import Config | |
15 from mopy.paths import Paths | |
msw
2015/03/04 21:04:32
nit: not needed
| |
16 from mopy.print_process_error import print_process_error | |
17 | |
18 | |
19 def run_test(config, shell_args, apps_and_args=None, run_launcher=False): | |
20 """Runs a command line and checks the output for signs of gtest failure. | |
21 | |
22 Args: | |
23 config: The mopy.config.Config object for the build. | |
24 shell_args: The arguments for mojo_shell. | |
25 apps_and_args: A Dict keyed by application URL associated to the | |
26 application's specific arguments. | |
27 run_launcher: |True| is mojo_launcher must be used instead of mojo_shell. | |
28 """ | |
29 apps_and_args = apps_and_args or {} | |
30 output = test_util.try_run_test(config, shell_args, apps_and_args, | |
31 run_launcher) | |
32 # Fail on output with dart unittests' "FAIL:" or a lack of "PASS:". | |
33 # The latter condition ensures failure on broken command lines or output. | |
34 # Check output instead of exit codes because mojo_shell always exits with 0. | |
35 if (output is None or | |
36 output.find("FAIL:") != -1 or | |
msw
2015/03/04 21:04:32
nit: maybe test_util could just have pass and fail
| |
37 output.find("PASS:") == -1): | |
38 print "Failed test:" | |
39 print_process_error( | |
40 test_util.build_command_line(config, shell_args, apps_and_args, | |
41 run_launcher), | |
42 output) | |
43 return False | |
44 _logging.debug("Succeeded with output:\n%s" % output) | |
45 return True | |
46 | |
OLD | NEW |