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 | |
7 _logging = logging.getLogger() | |
8 | |
9 from mopy import test_util | |
10 from mopy.print_process_error import print_process_error | |
11 | |
12 | |
13 # TODO(erg): Support android, launched services and fixture isolation. | |
14 def run_test(config, shell, apptest_dict, shell_args, apps_and_args=None): | |
15 """Runs a command line and checks the output for signs of gtest failure. | |
16 | |
17 Args: | |
18 config: The mopy.config.Config object for the build. | |
19 shell_args: The arguments for mojo_shell. | |
20 apps_and_args: A Dict keyed by application URL associated to the | |
21 application's specific arguments. | |
22 """ | |
23 apps_and_args = apps_and_args or {} | |
24 output = test_util.try_run_test(config, shell, shell_args, apps_and_args) | |
25 # Fail on output with dart unittests' "FAIL:"/"ERROR:" or a lack of "PASS:". | |
26 # The latter condition ensures failure on broken command lines or output. | |
27 # Check output instead of exit codes because mojo_shell always exits with 0. | |
28 if (not output or | |
29 '\nFAIL: ' in output or | |
30 '\nERROR: ' in output or | |
31 '\nPASS: ' not in output): | |
32 print "Failed test:" | |
33 print_process_error( | |
34 test_util.build_command_line(config, shell_args, apps_and_args), | |
35 output) | |
36 return "Failed test(s) in %r" % apptest_dict | |
37 _logging.debug("Succeeded with output:\n%s" % output) | |
38 return "Succeeded" | |
OLD | NEW |