OLD | NEW |
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 """A test runner for gtest application tests.""" | 6 """A test runner for gtest application tests.""" |
7 | 7 |
8 import argparse | 8 import argparse |
9 import ast | 9 import ast |
10 import logging | 10 import logging |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 # TODO(msw): Run some apptests without fixture isolation? | 52 # TODO(msw): Run some apptests without fixture isolation? |
53 fixtures = gtest.get_fixtures(mojo_shell_path, apptest) | 53 fixtures = gtest.get_fixtures(mojo_shell_path, apptest) |
54 | 54 |
55 if not fixtures: | 55 if not fixtures: |
56 print "Failed with no tests found." | 56 print "Failed with no tests found." |
57 exit_code = 1 | 57 exit_code = 1 |
58 continue | 58 continue |
59 | 59 |
60 apptest_result = "Succeeded" | 60 apptest_result = "Succeeded" |
61 for fixture in fixtures: | 61 for fixture in fixtures: |
62 args_for_apptest = " ".join(["--args-for=" + apptest, | 62 args_for_apptest = " ".join(["--gtest_filter=" + fixture] + apptest_args) |
63 "--gtest_filter=" + fixture] + apptest_args) | |
64 | 63 |
65 success = RunApptestInShell(mojo_shell_path, apptest, | 64 success = RunApptestInShell(mojo_shell_path, apptest, |
66 shell_args + [args_for_apptest]) | 65 shell_args + [args_for_apptest]) |
67 | 66 |
68 if not success: | 67 if not success: |
69 apptest_result = "Failed test(s) in %r" % apptest_dict | 68 apptest_result = "Failed test(s) in %r" % apptest_dict |
70 exit_code = 1 | 69 exit_code = 1 |
71 | 70 |
72 print apptest_result | 71 print apptest_result |
73 | 72 |
74 return exit_code | 73 return exit_code |
75 | 74 |
76 | 75 |
77 def RunApptestInShell(mojo_shell_path, apptest, shell_args): | 76 def RunApptestInShell(mojo_shell_path, apptest, shell_args): |
78 return gtest.run_test([mojo_shell_path, apptest] + shell_args) | 77 return gtest.run_test([mojo_shell_path, apptest] + shell_args) |
79 | 78 |
80 | 79 |
81 if __name__ == '__main__': | 80 if __name__ == '__main__': |
82 sys.exit(main()) | 81 sys.exit(main()) |
OLD | NEW |