Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(96)

Side by Side Diff: tools/testing/test_case.py

Issue 8566021: Made changes to the test architecture so that we can run frameworks other than (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« tools/testing/architecture.py ('K') | « tools/testing/run_selenium.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 TestCase subclasses used to define a single test.""" 5 """Common TestCase subclasses used to define a single test."""
6 6
7 import os 7 import os
8 import tempfile 8 import tempfile
9 9
10 import test 10 import test
11 from testing import architecture 11 from testing import architecture
12 12
13 13
14 class Error(Exception): 14 class Error(Exception):
15 pass 15 pass
16 16
17 17
18 class StandardTestCase(test.TestCase): 18 class StandardTestCase(test.TestCase):
19 """A test case defined by a *Test.dart file.""" 19 """A test case defined by a *Test.dart file."""
20 20
21 def __init__(self, context, path, filename, mode, arch, component, 21 def __init__(self, context, path, filename, mode, arch, component,
22 vm_options=None): 22 vm_options=None):
23 super(StandardTestCase, self).__init__(context, path) 23 super(StandardTestCase, self).__init__(context, path)
24 self.filename = filename 24 self.filename = filename
25 self.mode = mode 25 self.mode = mode
26 self.arch = arch 26 self.arch = arch
27 self.component = component 27 self.component = component
28 self.run_arch = architecture.GetArchitecture(self.arch, self.mode, 28 self.run_arch = architecture.GetArchitecture(self.arch, self.mode,
29 self.component, 29 self.component,
30 self.filename) 30 self.filename,
31 self.context.flags)
31 for flag in context.flags: 32 for flag in context.flags:
32 self.run_arch.vm_options.append(flag) 33 self.run_arch.vm_options.append(flag)
33 34
34 if vm_options: 35 if vm_options:
35 for flag in vm_options: 36 for flag in vm_options:
36 self.run_arch.vm_options.append(flag) 37 self.run_arch.vm_options.append(flag)
37 38
38 def IsNegative(self): 39 def IsNegative(self):
39 return self.GetName().endswith('NegativeTest') 40 return self.GetName().endswith('NegativeTest')
40 41
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 if self.kind == 'compile-time error': 87 if self.kind == 'compile-time error':
87 return True 88 return True
88 if self.kind == 'runtime error': 89 if self.kind == 'runtime error':
89 return True 90 return True
90 if self.kind == 'static type error': 91 if self.kind == 'static type error':
91 return self.run_arch.HasFatalTypeErrors() 92 return self.run_arch.HasFatalTypeErrors()
92 return False 93 return False
93 94
94 95
95 class BrowserTestCase(StandardTestCase): 96 class BrowserTestCase(StandardTestCase):
96 """A test case that executes inside DumpRenderTree.""" 97 """A test case that executes inside DumpRenderTree or a browser."""
97 98
98 def __init__(self, context, path, filename, 99 def __init__(self, context, path, filename,
99 fatal_static_type_errors, mode, arch, component, vm_options=None) : 100 fatal_static_type_errors, mode, arch, component, vm_options=None) :
100 super(BrowserTestCase, self).__init__( 101 super(BrowserTestCase, self).__init__(
101 context, path, filename, mode, arch, component, vm_options) 102 context, path, filename, mode, arch, component, vm_options)
102 self.fatal_static_type_errors = fatal_static_type_errors 103 self.fatal_static_type_errors = fatal_static_type_errors
103 104
104 def Run(self): 105 def Run(self):
105 """Optionally compiles and then runs the specified test.""" 106 """Optionally compiles and then runs the specified test."""
106 command = self.run_arch.GetCompileCommand(self.fatal_static_type_errors) 107 command = self.run_arch.GetCompileCommand(self.fatal_static_type_errors)
(...skipping 26 matching lines...) Expand all
133 134
134 def __init__(self, path, context, filename, mode, arch, component): 135 def __init__(self, path, context, filename, mode, arch, component):
135 super(CompilationTestCase, self).__init__(context, path) 136 super(CompilationTestCase, self).__init__(context, path)
136 self.filename = filename 137 self.filename = filename
137 self.mode = mode 138 self.mode = mode
138 self.arch = arch 139 self.arch = arch
139 self.component = component 140 self.component = component
140 self.run_arch = architecture.GetArchitecture(self.arch, 141 self.run_arch = architecture.GetArchitecture(self.arch,
141 self.mode, 142 self.mode,
142 self.component, 143 self.component,
143 self.filename) 144 self.filename,
145 self.context.flags)
144 self.temp_dir = tempfile.mkdtemp(prefix='dartc-output-') 146 self.temp_dir = tempfile.mkdtemp(prefix='dartc-output-')
145 147
146 def IsNegative(self): 148 def IsNegative(self):
147 return False 149 return False
148 150
149 def GetLabel(self): 151 def GetLabel(self):
150 return '%s/%s %s %s' % (self.mode, self.arch, self.component, 152 return '%s/%s %s %s' % (self.mode, self.arch, self.component,
151 '/'.join(self.path)) 153 '/'.join(self.path))
152 154
153 def GetCommand(self): 155 def GetCommand(self):
154 """Returns a command line to run the test.""" 156 """Returns a command line to run the test."""
155 cmd = self.context.GetDartC(self.mode, self.arch) 157 cmd = self.context.GetDartC(self.mode, self.arch)
156 cmd += self.context.flags 158 cmd += self.context.flags
157 cmd += ['-check-only', 159 cmd += ['-check-only',
158 '-fatal-type-errors', 160 '-fatal-type-errors',
159 '-Werror', 161 '-Werror',
160 '-out', self.temp_dir, 162 '-out', self.temp_dir,
161 self.filename] 163 self.filename]
162 164
163 return cmd 165 return cmd
164 166
165 def GetName(self): 167 def GetName(self):
166 return self.path[-1] 168 return self.path[-1]
167 169
168 def Cleanup(self): 170 def Cleanup(self):
169 if not self.context.keep_temporary_files: 171 if not self.context.keep_temporary_files:
170 self.run_arch.Cleanup() 172 self.run_arch.Cleanup()
OLDNEW
« tools/testing/architecture.py ('K') | « tools/testing/run_selenium.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698