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, apptest_dict, shell_args, apps_and_args=None, |
| 15 run_launcher=False): |
| 16 """Runs a command line and checks the output for signs of gtest failure. |
| 17 |
| 18 Args: |
| 19 config: The mopy.config.Config object for the build. |
| 20 shell_args: The arguments for mojo_shell. |
| 21 apps_and_args: A Dict keyed by application URL associated to the |
| 22 application's specific arguments. |
| 23 run_launcher: |True| is mojo_launcher must be used instead of mojo_shell. |
| 24 """ |
| 25 apps_and_args = apps_and_args or {} |
| 26 output = test_util.try_run_test(config, shell_args, apps_and_args, |
| 27 run_launcher) |
| 28 # Fail on output with dart unittests' "FAIL:" or a lack of "PASS:". |
| 29 # The latter condition ensures failure on broken command lines or output. |
| 30 # Check output instead of exit codes because mojo_shell always exits with 0. |
| 31 if (output is None or |
| 32 output.find("FAIL:") != -1 or |
| 33 output.find("PASS:") == -1): |
| 34 print "Failed test:" |
| 35 print_process_error( |
| 36 test_util.build_command_line(config, shell_args, apps_and_args, |
| 37 run_launcher), |
| 38 output) |
| 39 return "Failed test(s) in %r" % apptest_dict |
| 40 _logging.debug("Succeeded with output:\n%s" % output) |
| 41 return "Succeeded" |
| 42 |
OLD | NEW |