| OLD | NEW |
| 1 # Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 # Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
| 2 # for details. All rights reserved. Use of this source code is governed by a | 2 # for details. All rights reserved. Use of this source code is governed by a |
| 3 # BSD-style license that can be found in the LICENSE file. | 3 # BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 """Common TestCase subclasses used to define a single test.""" | 5 """Common TestCase subclasses used to define a single test.""" |
| 6 | 6 |
| 7 import os | 7 import os |
| 8 import tempfile | 8 import tempfile |
| 9 | 9 |
| 10 import test | 10 import test |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 cwd = None | 112 cwd = None |
| 113 if self.run_arch.is_web_test: cwd = self.run_arch.temp_dir | 113 if self.run_arch.is_web_test: cwd = self.run_arch.temp_dir |
| 114 command = command[:1] + self.context.flags + command[1:] | 114 command = command[:1] + self.context.flags + command[1:] |
| 115 test_output = self.RunCommand(command, cwd=cwd, cleanup=False) | 115 test_output = self.RunCommand(command, cwd=cwd, cleanup=False) |
| 116 | 116 |
| 117 # If errors were found, fail fast and show compile errors: | 117 # If errors were found, fail fast and show compile errors: |
| 118 if test_output.output.exit_code != 0: | 118 if test_output.output.exit_code != 0: |
| 119 return test_output | 119 return test_output |
| 120 | 120 |
| 121 command = self.run_arch.GetRunCommand() | 121 command = self.run_arch.GetRunCommand() |
| 122 test_output = self.RunCommand(command) | 122 # Don't clean up just in case test turned out flaky and we want to retry. |
| 123 test_output = self.RunCommand(command, cleanup=False) |
| 123 # The return value of DumpRenderedTree does not indicate test failing, but | 124 # The return value of DumpRenderedTree does not indicate test failing, but |
| 124 # the output does. | 125 # the output does. |
| 125 if self.run_arch.HasFailed(test_output.output.stdout): | 126 if self.run_arch.HasFailed(test_output.output.stdout): |
| 126 test_output.output.exit_code = 1 | 127 test_output.output.exit_code = 1 |
| 127 # DumpRenderTree is sometimes flaky in xvfb-run, try again in that case. | 128 # DumpRenderTree is sometimes flaky in xvfb-run, try again in that case. |
| 128 if (self.run_arch.WasFlakyDrt(test_output.output.stderr)): | 129 if (self.run_arch.WasFlakyDrt(test_output.output.stderr)): |
| 129 print "\nFlaky Gtw-WARNING error found, trying again..." | 130 print "\nFlaky Gtw-WARNING error found, trying again..." |
| 130 test_output = self.RunCommand(command) | 131 test_output = self.RunCommand(command, cleanup=False) |
| 131 if self.run_arch.HasFailed(test_output.output.stdout): | 132 if self.run_arch.HasFailed(test_output.output.stdout): |
| 132 test_output.output.exit_code = 1 | 133 test_output.output.exit_code = 1 |
| 134 self.Cleanup(); |
| 133 | 135 |
| 134 return test_output | 136 return test_output |
| 135 | 137 |
| 136 | 138 |
| 137 class CompilationTestCase(test.TestCase): | 139 class CompilationTestCase(test.TestCase): |
| 138 """Run the dartc compiler on a given top level .dart file.""" | 140 """Run the dartc compiler on a given top level .dart file.""" |
| 139 | 141 |
| 140 def __init__(self, path, context, filename, mode, arch, component): | 142 def __init__(self, path, context, filename, mode, arch, component): |
| 141 super(CompilationTestCase, self).__init__(context, path) | 143 super(CompilationTestCase, self).__init__(context, path) |
| 142 self.filename = filename | 144 self.filename = filename |
| (...skipping 24 matching lines...) Expand all Loading... |
| 167 self.filename] | 169 self.filename] |
| 168 | 170 |
| 169 return cmd | 171 return cmd |
| 170 | 172 |
| 171 def GetName(self): | 173 def GetName(self): |
| 172 return self.path[-1] | 174 return self.path[-1] |
| 173 | 175 |
| 174 def Cleanup(self): | 176 def Cleanup(self): |
| 175 if not self.context.keep_temporary_files: | 177 if not self.context.keep_temporary_files: |
| 176 self.run_arch.Cleanup() | 178 self.run_arch.Cleanup() |
| OLD | NEW |