| 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 Testconfiguration subclasses used to define a class of tests.""" | 5 """Common Testconfiguration subclasses used to define a class of tests.""" |
| 6 | 6 |
| 7 import atexit | 7 import atexit |
| 8 import fileinput | 8 import fileinput |
| 9 import os | 9 import os |
| 10 import re | 10 import re |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 if kind != 'continued': | 174 if kind != 'continued': |
| 175 raise TestConfigurationError('duplicated tag %s' % tag) | 175 raise TestConfigurationError('duplicated tag %s' % tag) |
| 176 elif kind not in StandardTestConfiguration.LEGAL_KINDS: | 176 elif kind not in StandardTestConfiguration.LEGAL_KINDS: |
| 177 raise TestConfigurationError('unrecognized kind %s' % kind) | 177 raise TestConfigurationError('unrecognized kind %s' % kind) |
| 178 else: | 178 else: |
| 179 tags[tag] = kind | 179 tags[tag] = kind |
| 180 if not tags: | 180 if not tags: |
| 181 return {} | 181 return {} |
| 182 # Prepare directory for generated tests. | 182 # Prepare directory for generated tests. |
| 183 tests = {} | 183 tests = {} |
| 184 generated_test_dir = os.path.join(self.context.workspace, 'generated_tests') | 184 generated_test_dir = os.path.join(utils.GetBuildRoot(utils.GuessOS()), |
| 185 'generated_tests') |
| 185 generated_test_dir = os.path.join(generated_test_dir, *test_path[:-1]) | 186 generated_test_dir = os.path.join(generated_test_dir, *test_path[:-1]) |
| 186 if not os.path.exists(generated_test_dir): | 187 if not os.path.exists(generated_test_dir): |
| 187 os.makedirs(generated_test_dir) | 188 os.makedirs(generated_test_dir) |
| 188 # Copy referenced files to generated tests directory. | 189 # Copy referenced files to generated tests directory. |
| 189 referenced_files = self.FindReferencedFiles(lines) | 190 referenced_files = self.FindReferencedFiles(lines) |
| 190 for referenced_file in referenced_files: | 191 for referenced_file in referenced_files: |
| 191 shutil.copy(os.path.join(os.path.dirname(filename), referenced_file), | 192 shutil.copy(os.path.join(os.path.dirname(filename), referenced_file), |
| 192 os.path.join(generated_test_dir, referenced_file)) | 193 os.path.join(generated_test_dir, referenced_file)) |
| 193 # Generate test for each tag found in the main test file. | 194 # Generate test for each tag found in the main test file. |
| 194 for tag in tags: | 195 for tag in tags: |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 | 306 |
| 306 def GetTestStatus(self, sections, defs): | 307 def GetTestStatus(self, sections, defs): |
| 307 status = os.path.join(self.root, 'dartc.status') | 308 status = os.path.join(self.root, 'dartc.status') |
| 308 if os.path.exists(status): | 309 if os.path.exists(status): |
| 309 test.ReadConfigurationInto(status, sections, defs) | 310 test.ReadConfigurationInto(status, sections, defs) |
| 310 | 311 |
| 311 def _Cleanup(self, tests): | 312 def _Cleanup(self, tests): |
| 312 if not utils.Daemonize(): return | 313 if not utils.Daemonize(): return |
| 313 os.execlp('rm', *(['rm', '-rf'] + [t.temp_dir for t in tests])) | 314 os.execlp('rm', *(['rm', '-rf'] + [t.temp_dir for t in tests])) |
| 314 raise | 315 raise |
| OLD | NEW |