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 16 matching lines...) Expand all Loading... |
27 pass | 27 pass |
28 | 28 |
29 | 29 |
30 class StandardTestConfiguration(test.TestConfiguration): | 30 class StandardTestConfiguration(test.TestConfiguration): |
31 """Configuration that looks for .dart files in the tests/*/src dirs.""" | 31 """Configuration that looks for .dart files in the tests/*/src dirs.""" |
32 LEGAL_KINDS = set(['compile-time error', | 32 LEGAL_KINDS = set(['compile-time error', |
33 'runtime error', | 33 'runtime error', |
34 'static type error', | 34 'static type error', |
35 'dynamic type error']) | 35 'dynamic type error']) |
36 | 36 |
37 def __init__(self, context, root): | 37 def __init__(self, context, root, flags = []): |
38 super(StandardTestConfiguration, self).__init__(context, root) | 38 super(StandardTestConfiguration, self).__init__(context, root, flags) |
39 | 39 |
40 def _Cleanup(self, tests): | 40 def _Cleanup(self, tests): |
41 """Remove any temporary files created by running the test.""" | 41 """Remove any temporary files created by running the test.""" |
42 if self.context.keep_temporary_files: | 42 if self.context.keep_temporary_files: |
43 return | 43 return |
44 | 44 |
45 dirs = [] | 45 dirs = [] |
46 for t in tests: | 46 for t in tests: |
47 if t.run_arch: | 47 if t.run_arch: |
48 temp_dir = t.run_arch.temp_dir | 48 temp_dir = t.run_arch.temp_dir |
(...skipping 19 matching lines...) Expand all Loading... |
68 tags = self.SplitMultiTest(test_path, filename) | 68 tags = self.SplitMultiTest(test_path, filename) |
69 if component in ['dartium', 'chromium']: | 69 if component in ['dartium', 'chromium']: |
70 if tags: | 70 if tags: |
71 return [] | 71 return [] |
72 else: | 72 else: |
73 if vm_options_list: | 73 if vm_options_list: |
74 tests = [] | 74 tests = [] |
75 for options in vm_options_list: | 75 for options in vm_options_list: |
76 tests.append(test_case.BrowserTestCase( | 76 tests.append(test_case.BrowserTestCase( |
77 self.context, test_path, filename, False, mode, arch, component, | 77 self.context, test_path, filename, False, mode, arch, component, |
78 options)) | 78 options + self.flags)) |
79 return tests | 79 return tests |
80 else: | 80 else: |
81 return [test_case.BrowserTestCase( | 81 return [test_case.BrowserTestCase( |
82 self.context, test_path, filename, False, mode, arch, component)] | 82 self.context, test_path, filename, False, mode, arch, component, |
| 83 options)] |
83 else: | 84 else: |
84 tests = [] | 85 tests = [] |
85 if tags: | 86 if tags: |
86 for tag in sorted(tags): | 87 for tag in sorted(tags): |
87 kind, test_source = tags[tag] | 88 kind, test_source = tags[tag] |
88 if not self.Contains(path, test_path + [tag]): | 89 if not self.Contains(path, test_path + [tag]): |
89 continue | 90 continue |
90 tests.append(test_case.MultiTestCase(self.context, | 91 tests.append(test_case.MultiTestCase(self.context, |
91 test_path + [tag], | 92 test_path + [tag], |
92 test_source, | 93 test_source, |
93 kind, | 94 kind, |
94 mode, arch, component)) | 95 mode, arch, component)) |
95 else: | 96 else: |
96 if vm_options_list: | 97 if vm_options_list: |
97 for options in vm_options_list: | 98 for options in vm_options_list: |
98 tests.append(test_case.StandardTestCase(self.context, | 99 tests.append(test_case.StandardTestCase(self.context, |
99 test_path, filename, mode, arch, component, options)) | 100 test_path, filename, mode, arch, component, |
| 101 options + self.flags)) |
100 else: | 102 else: |
101 tests.append(test_case.StandardTestCase(self.context, | 103 tests.append(test_case.StandardTestCase(self.context, |
102 test_path, filename, mode, arch, component)) | 104 test_path, filename, mode, arch, component, self.flags)) |
103 return tests | 105 return tests |
104 | 106 |
105 def ListTests(self, current_path, path, mode, arch, component): | 107 def ListTests(self, current_path, path, mode, arch, component): |
106 """Searches for *Test.dart files and returns list of TestCases.""" | 108 """Searches for *Test.dart files and returns list of TestCases.""" |
107 tests = [] | 109 tests = [] |
108 for root, unused_dirs, files in os.walk(os.path.join(self.root, 'src')): | 110 for root, unused_dirs, files in os.walk(os.path.join(self.root, 'src')): |
109 for f in [x for x in files if self.IsTest(x)]: | 111 for f in [x for x in files if self.IsTest(x)]: |
110 if f.endswith('.dart'): | 112 if f.endswith('.dart'): |
111 test_path = current_path + [f[:-5]] # Remove .dart suffix. | 113 test_path = current_path + [f[:-5]] # Remove .dart suffix. |
112 elif f.endswith('.app'): | 114 elif f.endswith('.app'): |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 | 304 |
303 def GetTestStatus(self, sections, defs): | 305 def GetTestStatus(self, sections, defs): |
304 status = os.path.join(self.root, 'dartc.status') | 306 status = os.path.join(self.root, 'dartc.status') |
305 if os.path.exists(status): | 307 if os.path.exists(status): |
306 test.ReadConfigurationInto(status, sections, defs) | 308 test.ReadConfigurationInto(status, sections, defs) |
307 | 309 |
308 def _Cleanup(self, tests): | 310 def _Cleanup(self, tests): |
309 if not utils.Daemonize(): return | 311 if not utils.Daemonize(): return |
310 os.execlp('rm', *(['rm', '-rf'] + [t.temp_dir for t in tests])) | 312 os.execlp('rm', *(['rm', '-rf'] + [t.temp_dir for t in tests])) |
311 raise | 313 raise |
OLD | NEW |