| 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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 mode, arch, component)) | 132 mode, arch, component)) |
| 133 atexit.register(lambda: self._Cleanup(tests)) | 133 atexit.register(lambda: self._Cleanup(tests)) |
| 134 return tests | 134 return tests |
| 135 | 135 |
| 136 def IsTest(self, name): | 136 def IsTest(self, name): |
| 137 """Returns True if the file name is a test file.""" | 137 """Returns True if the file name is a test file.""" |
| 138 return name.endswith('Test.dart') or name.endswith('Test.app') | 138 return name.endswith('Test.dart') or name.endswith('Test.app') |
| 139 | 139 |
| 140 def GetTestStatus(self, sections, defs): | 140 def GetTestStatus(self, sections, defs): |
| 141 """Reads the .status file of the TestSuite.""" | 141 """Reads the .status file of the TestSuite.""" |
| 142 status = os.path.join(self.root, os.path.basename(self.root) + '.status') | 142 basename = os.path.basename(self.root) |
| 143 if os.path.exists(status): | 143 for component in ['%s.status', '%s-leg.status']: |
| 144 test.ReadConfigurationInto(status, sections, defs) | 144 status = os.path.join(self.root, component % basename) |
| 145 if os.path.exists(status): |
| 146 test.ReadConfigurationInto(status, sections, defs) |
| 145 | 147 |
| 146 def FindReferencedFiles(self, lines): | 148 def FindReferencedFiles(self, lines): |
| 147 """Scours the lines containing source code for include directives.""" | 149 """Scours the lines containing source code for include directives.""" |
| 148 referenced_files = [] | 150 referenced_files = [] |
| 149 for line in lines: | 151 for line in lines: |
| 150 m = re.match("#(source|import)\(['\"](.*)['\"]\);", line) | 152 m = re.match("#(source|import)\(['\"](.*)['\"]\);", line) |
| 151 if m: | 153 if m: |
| 152 file_name = m.group(2) | 154 file_name = m.group(2) |
| 153 if not file_name.startswith('dart:'): | 155 if not file_name.startswith('dart:'): |
| 154 referenced_files.append(file_name) | 156 referenced_files.append(file_name) |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 315 | 317 |
| 316 def GetTestStatus(self, sections, defs): | 318 def GetTestStatus(self, sections, defs): |
| 317 status = os.path.join(self.root, 'dartc.status') | 319 status = os.path.join(self.root, 'dartc.status') |
| 318 if os.path.exists(status): | 320 if os.path.exists(status): |
| 319 test.ReadConfigurationInto(status, sections, defs) | 321 test.ReadConfigurationInto(status, sections, defs) |
| 320 | 322 |
| 321 def _Cleanup(self, tests): | 323 def _Cleanup(self, tests): |
| 322 if not utils.Daemonize(): return | 324 if not utils.Daemonize(): return |
| 323 os.execlp('rm', *(['rm', '-rf'] + [t.temp_dir for t in tests])) | 325 os.execlp('rm', *(['rm', '-rf'] + [t.temp_dir for t in tests])) |
| 324 raise | 326 raise |
| OLD | NEW |