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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 if temp_dir: | 49 if temp_dir: |
50 dirs.append(temp_dir) | 50 dirs.append(temp_dir) |
51 if not dirs: | 51 if not dirs: |
52 return | 52 return |
53 if not utils.Daemonize(): | 53 if not utils.Daemonize(): |
54 return | 54 return |
55 os.execlp('rm', *(['rm', '-rf'] + dirs)) | 55 os.execlp('rm', *(['rm', '-rf'] + dirs)) |
56 | 56 |
57 def CreateTestCases(self, test_path, path, filename, mode, arch): | 57 def CreateTestCases(self, test_path, path, filename, mode, arch): |
58 """Given a .dart filename, create a StandardTestCase from it.""" | 58 """Given a .dart filename, create a StandardTestCase from it.""" |
| 59 # Look for VM specified as comments in the source file. If |
| 60 # several sets of VM options are specified create a separate |
| 61 # test for each set. |
| 62 source = file(filename).read() |
| 63 vm_options_list = utils.ParseTestOptionsMultiple(VM_OPTIONS_PATTERN, |
| 64 source, |
| 65 test_path) |
59 tags = {} | 66 tags = {} |
60 if filename.endswith('.dart'): | 67 if filename.endswith('.dart'): |
61 tags = self.SplitMultiTest(test_path, filename) | 68 tags = self.SplitMultiTest(test_path, filename) |
62 if arch in ['dartium', 'chromium']: | 69 if arch in ['dartium', 'chromium']: |
63 if tags: | 70 if tags: |
64 return [] | 71 return [] |
65 else: | 72 else: |
66 return [test_case.BrowserTestCase( | 73 if vm_options_list: |
67 self.context, test_path, filename, False, mode, arch)] | 74 tests = [] |
| 75 for options in vm_options_list: |
| 76 tests.append(test_case.BrowserTestCase( |
| 77 self.context, test_path, filename, False, mode, arch, options)) |
| 78 return tests |
| 79 else: |
| 80 return [test_case.BrowserTestCase( |
| 81 self.context, test_path, filename, False, mode, arch)] |
68 else: | 82 else: |
69 tests = [] | 83 tests = [] |
70 if tags: | 84 if tags: |
71 for tag in sorted(tags): | 85 for tag in sorted(tags): |
72 kind, test_source = tags[tag] | 86 kind, test_source = tags[tag] |
73 if not self.Contains(path, test_path + [tag]): | 87 if not self.Contains(path, test_path + [tag]): |
74 continue | 88 continue |
75 tests.append(test_case.MultiTestCase(self.context, | 89 tests.append(test_case.MultiTestCase(self.context, |
76 test_path + [tag], | 90 test_path + [tag], |
77 test_source, | 91 test_source, |
78 kind, | 92 kind, |
79 mode, arch)) | 93 mode, arch)) |
80 else: | 94 else: |
81 # Look for VM specified as comments in the source file. If | |
82 # several sets of VM options are specified create a separate | |
83 # test for each set. | |
84 source = file(filename).read() | |
85 vm_options_list = utils.ParseTestOptionsMultiple(VM_OPTIONS_PATTERN, | |
86 source, | |
87 test_path) | |
88 if vm_options_list: | 95 if vm_options_list: |
89 for options in vm_options_list: | 96 for options in vm_options_list: |
90 tests.append(test_case.StandardTestCase(self.context, | 97 tests.append(test_case.StandardTestCase(self.context, |
91 test_path, filename, mode, arch, options)) | 98 test_path, filename, mode, arch, options)) |
92 else: | 99 else: |
93 tests.append(test_case.StandardTestCase(self.context, | 100 tests.append(test_case.StandardTestCase(self.context, |
94 test_path, filename, mode, arch)) | 101 test_path, filename, mode, arch)) |
95 return tests | 102 return tests |
96 | 103 |
97 def ListTests(self, current_path, path, mode, arch): | 104 def ListTests(self, current_path, path, mode, arch): |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 | 296 |
290 def GetTestStatus(self, sections, defs): | 297 def GetTestStatus(self, sections, defs): |
291 status = os.path.join(self.root, 'dartc.status') | 298 status = os.path.join(self.root, 'dartc.status') |
292 if os.path.exists(status): | 299 if os.path.exists(status): |
293 test.ReadConfigurationInto(status, sections, defs) | 300 test.ReadConfigurationInto(status, sections, defs) |
294 | 301 |
295 def _Cleanup(self, tests): | 302 def _Cleanup(self, tests): |
296 if not utils.Daemonize(): return | 303 if not utils.Daemonize(): return |
297 os.execlp('rm', *(['rm', '-rf'] + [t.temp_dir for t in tests])) | 304 os.execlp('rm', *(['rm', '-rf'] + [t.temp_dir for t in tests])) |
298 raise | 305 raise |
OLD | NEW |