| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2014 The Chromium Authors. All rights reserved. | 2 # Copyright 2014 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 """A test runner for gtest application tests.""" | 6 """A test runner for gtest application tests.""" |
| 7 | 7 |
| 8 import logging | 8 import logging |
| 9 import os | 9 import os |
| 10 import platform | 10 import platform |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 print 72 * '-' | 57 print 72 * '-' |
| 58 print e.output | 58 print e.output |
| 59 print 72 * '-' | 59 print 72 * '-' |
| 60 return 1 | 60 return 1 |
| 61 except OSError as e: | 61 except OSError as e: |
| 62 print " Failed to start test" | 62 print " Failed to start test" |
| 63 return 1 | 63 return 1 |
| 64 | 64 |
| 65 test_list = gtest_list_tests(list_output) | 65 test_list = gtest_list_tests(list_output) |
| 66 for test in test_list: | 66 for test in test_list: |
| 67 command_line = [mojo_shell, apptest + " --gtest_filter=" + test] | 67 # TODO(msw): enable passing arguments to tests down from the test harness. |
| 68 command_line = [ |
| 69 mojo_shell, |
| 70 "--args-for={0} --example_apptest_arg --gtest_filter={1}".format( |
| 71 apptest, test), |
| 72 apptest] |
| 68 | 73 |
| 69 _logging.debug("Running %s..." % command_line) | 74 _logging.debug("Running %s..." % command_line) |
| 70 try: | 75 try: |
| 71 # TODO(msw): Need to fail on errors! mojo_shell always exits with 0! | 76 # TODO(msw): Need to fail on errors! mojo_shell always exits with 0! |
| 72 subprocess.check_output(command_line, stderr=subprocess.STDOUT) | 77 subprocess.check_output(command_line, stderr=subprocess.STDOUT) |
| 73 _logging.debug("Succeeded") | 78 _logging.debug("Succeeded") |
| 74 except subprocess.CalledProcessError as e: | 79 except subprocess.CalledProcessError as e: |
| 75 print "Failed with exit code %d and output:" % e.returncode | 80 print "Failed with exit code %d and output:" % e.returncode |
| 76 print 72 * '-' | 81 print 72 * '-' |
| 77 print e.output | 82 print e.output |
| 78 print 72 * '-' | 83 print 72 * '-' |
| 79 return 1 | 84 return 1 |
| 80 except OSError as e: | 85 except OSError as e: |
| 81 print " Failed to start test" | 86 print " Failed to start test" |
| 82 return 1 | 87 return 1 |
| 83 print "Succeeded" | 88 print "Succeeded" |
| 84 | 89 |
| 85 return 0 | 90 return 0 |
| 86 | 91 |
| 87 if __name__ == '__main__': | 92 if __name__ == '__main__': |
| 88 sys.exit(main(sys.argv)) | 93 sys.exit(main(sys.argv)) |
| OLD | NEW |