| 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 | 5 |
| 6 import os | 6 import os |
| 7 from os.path import join, exists | 7 from os.path import join, exists |
| 8 import re | 8 import re |
| 9 | 9 |
| 10 import test | 10 import test |
| 11 import utils | 11 import utils |
| 12 | 12 |
| 13 | 13 |
| 14 class Error(Exception): | 14 class Error(Exception): |
| 15 pass | 15 pass |
| 16 | 16 |
| 17 | 17 |
| 18 class Co19TestCase(test.TestCase): | 18 class Co19TestCase(test.TestCase): |
| 19 def __init__(self, path, context, filename, mode, arch, component): | 19 def __init__(self, path, context, filename, mode, arch, component): |
| 20 super(Co19TestCase, self).__init__(context, path) | 20 super(Co19TestCase, self).__init__(context, path) |
| 21 self.filename = filename | 21 self.filename = filename |
| 22 self.mode = mode | 22 self.mode = mode |
| 23 self.arch = arch | 23 self.arch = arch |
| 24 self.component = component | 24 self.component = component |
| 25 self._is_negative = None | 25 self._is_negative = None |
| 26 | 26 |
| 27 def IsNegative(self): | 27 def IsNegative(self): |
| 28 if self._is_negative is None : | 28 if self._is_negative is None : |
| 29 contents = self.GetSource() | 29 contents = self.GetSource() |
| 30 for tag in ('@compile-error','@static-type-error', | 30 for tag in ('@compile-error', |
| 31 # '@static-type-error', |
| 31 '@dynamic-type-error', '@runtime-error'): | 32 '@dynamic-type-error', '@runtime-error'): |
| 32 if tag in contents: | 33 if tag in contents: |
| 33 self._is_negative = True | 34 self._is_negative = True |
| 34 break | 35 break |
| 35 else : | 36 else : |
| 36 self._is_negative = False | 37 self._is_negative = False |
| 37 | 38 |
| 38 return self._is_negative | 39 return self._is_negative |
| 39 | 40 |
| 40 def GetLabel(self): | 41 def GetLabel(self): |
| 41 return "%s%s %s %s" % (self.mode, self.arch, self.component, "/".join(self.p
ath)) | 42 return "%s%s %s %s" % (self.mode, self.arch, self.component, |
| 43 "/".join(self.path)) |
| 42 | 44 |
| 43 def GetCommand(self): | 45 def GetCommand(self): |
| 44 # Parse the options by reading the .dart source file. | 46 # Parse the options by reading the .dart source file. |
| 45 source = self.GetSource() | 47 source = self.GetSource() |
| 46 vm_options = utils.ParseTestOptions(test.VM_OPTIONS_PATTERN, source, | 48 vm_options = utils.ParseTestOptions(test.VM_OPTIONS_PATTERN, source, |
| 47 self.context.workspace) | 49 self.context.workspace) |
| 48 dart_options = utils.ParseTestOptions(test.DART_OPTIONS_PATTERN, source, | 50 dart_options = utils.ParseTestOptions(test.DART_OPTIONS_PATTERN, source, |
| 49 self.context.workspace) | 51 self.context.workspace) |
| 50 | 52 |
| 51 # Combine everything into a command array and return it. | 53 # Combine everything into a command array and return it. |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 patterns[idx : idx] = ['*'] * (len(file) - len(path)) | 148 patterns[idx : idx] = ['*'] * (len(file) - len(path)) |
| 147 path = [test.Pattern(p) for p in patterns] | 149 path = [test.Pattern(p) for p in patterns] |
| 148 | 150 |
| 149 for i in xrange(len(path)): | 151 for i in xrange(len(path)): |
| 150 if not path[i].match(file[i]): | 152 if not path[i].match(file[i]): |
| 151 return False | 153 return False |
| 152 return True | 154 return True |
| 153 | 155 |
| 154 def GetConfiguration(context, root): | 156 def GetConfiguration(context, root): |
| 155 return Co19TestConfiguration(context, root) | 157 return Co19TestConfiguration(context, root) |
| OLD | NEW |