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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 (name, extension) = os.path.splitext(os.path.basename(filename)) | 161 (name, extension) = os.path.splitext(os.path.basename(filename)) |
162 with open(filename, 'r') as s: | 162 with open(filename, 'r') as s: |
163 source = s.read() | 163 source = s.read() |
164 lines = source.splitlines() | 164 lines = source.splitlines() |
165 tags = {} | 165 tags = {} |
166 for line in lines: | 166 for line in lines: |
167 (unused_code, sep, info) = line.partition(' /// ') | 167 (unused_code, sep, info) = line.partition(' /// ') |
168 if sep: | 168 if sep: |
169 (tag, sep, kind) = info.partition(': ') | 169 (tag, sep, kind) = info.partition(': ') |
170 if tag in tags: | 170 if tag in tags: |
171 raise TestConfigurationError('duplicated tag %s' % tag) | 171 if kind != 'continued': |
172 if kind not in StandardTestConfiguration.LEGAL_KINDS: | 172 raise TestConfigurationError('duplicated tag %s' % tag) |
| 173 elif kind not in StandardTestConfiguration.LEGAL_KINDS: |
173 raise TestConfigurationError('unrecognized kind %s' % kind) | 174 raise TestConfigurationError('unrecognized kind %s' % kind) |
174 tags[tag] = kind | 175 else: |
| 176 tags[tag] = kind |
175 if not tags: | 177 if not tags: |
176 return {} | 178 return {} |
177 # Prepare directory for generated tests. | 179 # Prepare directory for generated tests. |
178 tests = {} | 180 tests = {} |
179 generated_test_dir = os.path.join(self.context.workspace, 'generated_tests') | 181 generated_test_dir = os.path.join(self.context.workspace, 'generated_tests') |
180 generated_test_dir = os.path.join(generated_test_dir, *test_path[:-1]) | 182 generated_test_dir = os.path.join(generated_test_dir, *test_path[:-1]) |
181 if not os.path.exists(generated_test_dir): | 183 if not os.path.exists(generated_test_dir): |
182 os.makedirs(generated_test_dir) | 184 os.makedirs(generated_test_dir) |
183 # Copy referenced files to generated tests directory. | 185 # Copy referenced files to generated tests directory. |
184 referenced_files = self.FindReferencedFiles(lines) | 186 referenced_files = self.FindReferencedFiles(lines) |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
300 | 302 |
301 def GetTestStatus(self, sections, defs): | 303 def GetTestStatus(self, sections, defs): |
302 status = os.path.join(self.root, 'dartc.status') | 304 status = os.path.join(self.root, 'dartc.status') |
303 if os.path.exists(status): | 305 if os.path.exists(status): |
304 test.ReadConfigurationInto(status, sections, defs) | 306 test.ReadConfigurationInto(status, sections, defs) |
305 | 307 |
306 def _Cleanup(self, tests): | 308 def _Cleanup(self, tests): |
307 if not utils.Daemonize(): return | 309 if not utils.Daemonize(): return |
308 os.execlp('rm', *(['rm', '-rf'] + [t.temp_dir for t in tests])) | 310 os.execlp('rm', *(['rm', '-rf'] + [t.temp_dir for t in tests])) |
309 raise | 311 raise |
OLD | NEW |