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

Side by Side Diff: tools/dartium/test.py

Issue 2976303002: Remove Dartium for TIP of origin/master (Closed)
Patch Set: Updated Created 3 years, 5 months 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
« no previous file with comments | « tools/dartium/start_dartium_roll.sh ('k') | tools/dartium/update_deps.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #!/usr/bin/env python
2 #
3 # Copyright 2011 Google Inc. All Rights Reserved.
4
5 import fnmatch
6 import optparse
7 import os
8 import re
9 import shutil
10 import subprocess
11 import sys
12 import urllib
13 import utils
14
15 SCRIPT_TAG = '<script type="application/%s" src="%s"></script>\n'
16
17 DART_TEST_DIR = os.path.join('dart')
18
19 DART_VM_FLAGS = [
20 ]
21 DART_VM_CHECKED_FLAGS = DART_VM_FLAGS + [
22 '--enable_type_checks',
23 '--warning_as_error',
24 ]
25
26 TEST_DRT_FLAGS = [
27 '--compiler=none',
28 '--runtime=drt',
29 '--drt=%(drt)s',
30 '--mode=%(mode)s',
31 '--arch=%(arch)s',
32 '--build-directory=%(build_dir)s',
33 '--report',
34 '--time',
35 ]
36
37 TEST_DRT_CHECKED_FLAGS = TEST_DRT_FLAGS + [
38 '--checked',
39 ]
40
41 TEST_DARTIUM_FLAGS = [
42 '--compiler=none',
43 '--runtime=dartium',
44 '--dartium=%(dartium)s',
45 '--mode=%(mode)s',
46 '--build-directory=%(build_dir)s',
47 '--report',
48 '--time',
49 ]
50
51 TEST_DARTIUM_CHECKED_FLAGS = TEST_DARTIUM_FLAGS + [
52 '--checked',
53 ]
54
55 TEST_INFO = {
56 'dartium': {
57 'core': {
58 'checked': TEST_DARTIUM_CHECKED_FLAGS,
59 'unchecked': TEST_DARTIUM_FLAGS,
60 },
61 },
62 'drt': {
63 'layout': {
64 'checked': DART_VM_CHECKED_FLAGS,
65 'unchecked': DART_VM_FLAGS,
66 },
67 'core': {
68 'checked': TEST_DRT_CHECKED_FLAGS,
69 'unchecked': TEST_DRT_FLAGS,
70 },
71 },
72 }
73
74 COMPONENTS = TEST_INFO.keys()
75 SUITES = [ 'layout', 'core' ]
76
77 def main():
78 parser = optparse.OptionParser()
79 parser.add_option('--mode', dest='mode',
80 action='store', type='string',
81 help='Test mode (Debug or Release)')
82 parser.add_option('--component', dest='component',
83 default='drt',
84 action='store', type='string',
85 help='Execution mode (dartium, drt or all)')
86 parser.add_option('--suite', dest='suite',
87 default='all',
88 action='store', type='string',
89 help='Test suite (layout, core, or all)')
90 parser.add_option('--arch', dest='arch',
91 default='ia32',
92 action='store', type='string',
93 help='Target architecture')
94 parser.add_option('--no-show-results', action='store_false',
95 default=True, dest='show_results',
96 help='Don\'t launch a browser with results '
97 'after the tests are done')
98 parser.add_option('--checked', action='store_true',
99 default=False, dest='checked',
100 help='Run Dart code in checked mode')
101 parser.add_option('--unchecked', action='store_true',
102 default=False, dest='unchecked',
103 help='Run Dart code in unchecked mode')
104 parser.add_option('--buildbot', action='store_true',
105 default=False, dest='buildbot',
106 help='Print results in buildbot format')
107 parser.add_option('--layout-test', dest='layout_test',
108 default=None,
109 action='store', type='string',
110 help='Single layout test to run if set')
111 parser.add_option('--test-filter', dest='test_filter',
112 default=None,
113 action='store', type='string',
114 help='Test filter for core tests')
115
116 (options, args) = parser.parse_args()
117 mode = options.mode
118 if not (mode in ['Debug', 'Release']):
119 raise Exception('Invalid test mode')
120
121 if options.component == 'all':
122 components = COMPONENTS
123 elif not (options.component in COMPONENTS):
124 raise Exception('Invalid component %s' % options.component)
125 else:
126 components = [ options.component ]
127
128 if options.suite == 'all':
129 suites = SUITES
130 elif not (options.suite in SUITES):
131 raise Exception('Invalid suite %s' % options.suite)
132 else:
133 suites = [ options.suite ]
134
135 # If --checked or --unchecked not present, run with both.
136 checkmodes = ['unchecked', 'checked']
137 if options.checked or options.unchecked:
138 checkmodes = []
139 if options.unchecked: checkmodes.append('unchecked')
140 if options.checked: checkmodes.append('checked')
141
142 # We are in src/dart/tools/dartium/test.py.
143 pathname = os.path.dirname(sys.argv[0])
144 fullpath = os.path.abspath(pathname)
145 srcpath = os.path.normpath(os.path.join(fullpath, '..', '..', '..'))
146
147 test_mode = ''
148 timeout = 30000
149 if mode == 'Debug':
150 test_mode = '--debug'
151 timeout = 60000
152
153 show_results = ''
154 if not options.show_results:
155 show_results = '--no-show-results'
156
157 host_os = utils.guessOS()
158 build_root, drt_path, dartium_path, dart_path = {
159 'mac': (
160 'out',
161 os.path.join('Content Shell.app', 'Contents', 'MacOS', 'Content Shell'),
162 os.path.join('Chromium.app', 'Contents', 'MacOS', 'Chromium'),
163 'dart',
164 ),
165 'linux': ('out', 'content_shell', 'chrome', 'dart'),
166 'win': ('out', 'content_shell.exe', 'chrome.exe', 'dart.exe'),
167 }[host_os]
168
169 build_dir = os.path.join(srcpath, build_root, mode)
170
171 executable_map = {
172 'mode': mode.lower(),
173 'build_dir': os.path.relpath(build_dir),
174 'drt': os.path.join(build_dir, drt_path),
175 'dartium': os.path.join(build_dir, dartium_path),
176 'dart': os.path.join(build_dir, dart_path),
177 'arch': options.arch,
178 }
179
180 test_script = os.path.join(srcpath, 'third_party', 'WebKit', 'Tools', 'Scripts ', 'run-webkit-tests')
181
182 errors = False
183 for component in components:
184 for checkmode in checkmodes:
185 # Capture errors and report at the end.
186 try:
187 if ('layout' in suites and
188 'layout' in TEST_INFO[component] and
189 checkmode in TEST_INFO[component]['layout']):
190 # Run layout tests in this mode
191 dart_flags = ' '.join(TEST_INFO[component]['layout'][checkmode])
192
193 if options.layout_test:
194 test = os.path.join(DART_TEST_DIR, options.layout_test)
195 else:
196 test = DART_TEST_DIR
197
198 utils.runCommand(['python',
199 test_script,
200 test_mode,
201 show_results,
202 '--time-out-ms', str(timeout),
203 # Temporary hack to fix issue with svn vs. svn.bat.
204 '--builder-name', 'BuildBot',
205 '--additional-env-var',
206 'DART_FLAGS=%s' % dart_flags,
207 test])
208
209 # Run core dart tests
210 if ('core' in suites and
211 'core' in TEST_INFO[component] and
212 checkmode in TEST_INFO[component]['core']):
213 core_flags = TEST_INFO[component]['core'][checkmode]
214 core_flags = map(lambda flag: flag % executable_map, core_flags)
215 if options.buildbot:
216 core_flags = ['--progress=buildbot'] + core_flags
217 tester = os.path.join(srcpath, 'dart', 'tools', 'test.py')
218 test_filter = [options.test_filter] if options.test_filter else []
219 utils.runCommand(['python', tester] + core_flags + test_filter)
220 except (StandardError, Exception) as e:
221 print 'Fail: ' + str(e)
222 errors = True
223
224 if errors:
225 return 1
226 else:
227 return 0
228
229 if __name__ == '__main__':
230 try:
231 sys.exit(main())
232 except StandardError as e:
233 print 'Fail: ' + str(e)
234 sys.exit(1)
OLDNEW
« no previous file with comments | « tools/dartium/start_dartium_roll.sh ('k') | tools/dartium/update_deps.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698