OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 2 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
3 # for details. All rights reserved. Use of this source code is governed by a | 3 # for details. All rights reserved. Use of this source code is governed by a |
4 # BSD-style license that can be found in the LICENSE file. | 4 # BSD-style license that can be found in the LICENSE file. |
5 | 5 |
6 import optparse | 6 import optparse |
7 import os | 7 import os |
8 import stat | 8 import stat |
9 import subprocess | 9 import subprocess |
10 import sys | 10 import sys |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 quoted_arguments = ' '.join([repr(s) for s in arguments]) | 62 quoted_arguments = ' '.join([repr(s) for s in arguments]) |
63 sys.stderr.write('Command failed:\n%s\n' % quoted_arguments) | 63 sys.stderr.write('Command failed:\n%s\n' % quoted_arguments) |
64 if stdout: | 64 if stdout: |
65 sys.stderr.write(stdout) | 65 sys.stderr.write(stdout) |
66 | 66 |
67 | 67 |
68 EXECUTABLE = (stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR | | 68 EXECUTABLE = (stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR | |
69 stat.S_IRGRP | stat.S_IXGRP | | 69 stat.S_IRGRP | stat.S_IXGRP | |
70 stat.S_IROTH | stat.S_IXOTH) | 70 stat.S_IROTH | stat.S_IXOTH) |
71 | 71 |
72 def SelfHost(): | |
73 def b(s): | |
74 """Adds ANSI escape-code for bold-face""" | |
75 return "\033[1m%s\033[0m" % s | |
76 | |
77 # VM Checked/CompileAll, produces checked | |
78 print 'Started' | |
79 start = time.time() | |
80 RunCommand('./frog/frog.py', | |
81 '--vm_flags=--compile_all --enable_type_checks --enable_asserts', | |
82 '--', '--compile_all', '--enable_type_checks', | |
83 '--out=frog/minfrog', 'frog/minfrog.dart') | |
84 elapsed = time.time() - start | |
85 mode = 'in checked mode + compile all' | |
86 print 'Compiling minfrog on Dart VM took %s seconds %s' % ( | |
87 b('%.1f' % elapsed), b(mode)) | |
88 os.chmod('./frog/minfrog', EXECUTABLE) | |
89 | |
90 # VM Production | |
91 start = time.time() | |
92 RunCommand('./frog/frog.py', '--', '--out=frog/minfrog', 'frog/minfrog.dart') | |
93 elapsed = time.time() - start | |
94 mode = 'in production mode' | |
95 print 'Compiling minfrog on Dart VM took %s seconds %s' % ( | |
96 b('%.1f' % elapsed), b(mode)) | |
97 os.chmod('./frog/minfrog', EXECUTABLE) | |
98 | |
99 # Selfhost Production | |
100 start = time.time() | |
101 # TODO(jmesserly): --warnings_as_errors disabled until corelib is moved to | |
102 # new factory syntax. | |
103 RunCommand('./frog/minfrog', '--out=frog/minfrog', # '--warnings_as_errors', | |
104 'frog/minfrog.dart', 'frog/tests/hello.dart', verbose=True) | |
105 elapsed = time.time() - start | |
106 size = os.path.getsize('./frog/minfrog') / 1024 | |
107 print 'Bootstrapping minfrog took %s seconds %s' % (b('%.1f' % elapsed), | |
108 b('in production mode')) | |
109 print 'Generated %s minfrog is %s kB' % (b('production'), b(size)) | |
110 | |
111 | |
112 def main(): | 72 def main(): |
113 dart_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) | 73 dart_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) |
114 os.chdir(dart_dir) | 74 os.chdir(dart_dir) |
115 | 75 |
116 (options, args) = BuildOptions().parse_args() | 76 (options, args) = BuildOptions().parse_args() |
117 | 77 |
118 RunCommand('./tools/build.py', '--mode=release', 'dart2js') | 78 RunCommand('./tools/build.py', '--mode=release', 'dart2js') |
119 | 79 |
120 if not options.leg_only: | |
121 SelfHost() | |
122 | |
123 test_cmd = ['./tools/test.py', '--report', '--timeout=30', | 80 test_cmd = ['./tools/test.py', '--report', '--timeout=30', |
124 '--progress=color', '--mode=release', '--checked'] | 81 '--progress=color', '--mode=release', '--checked'] |
125 | 82 |
126 if options.notest: return | 83 if options.notest: return |
127 | 84 |
128 if args: | 85 if args: |
129 if options.leg_only: | 86 if options.leg_only: |
130 test_cmd.extend('--compiler=dart2js', '--runtime=d8') | 87 test_cmd.extend('--compiler=dart2js', '--runtime=d8') |
131 else: | 88 else: |
132 test_cmd.append('--component=frogsh,dart2js') | 89 test_cmd.extend('--compiler=frog,dart2js', '--runtime=d8') |
133 test_cmd.extend(args) | 90 test_cmd.extend(args) |
134 RunCommand(*test_cmd, verbose=True) | 91 RunCommand(*test_cmd, verbose=True) |
135 else: | 92 else: |
136 if not options.leg_only: | 93 if not options.leg_only: |
137 # Run frog.py on the corelib tests, so we get some frog.py coverage. | 94 # Run frog.py on the corelib tests, so we get some frog.py coverage. |
138 cmd = test_cmd + ['--compiler=frog', '--runtime=d8', 'corelib'] | 95 cmd = test_cmd + ['--compiler=frog', '--runtime=d8', 'corelib'] |
139 RunCommand(*cmd, verbose=True) | 96 RunCommand(*cmd, verbose=True) |
140 | 97 |
141 # Run frogium client tests. This is a pretty quick test but | 98 # Run frogium client tests. This is a pretty quick test but |
142 # tends to uncover different issues due to the size/complexity | 99 # tends to uncover different issues due to the size/complexity |
143 # of the DOM APIs. | 100 # of the DOM APIs. |
144 cmd = test_cmd + ['--compiler=frog', '--runtime=drt', 'client'] | 101 cmd = test_cmd + ['--compiler=frog', '--runtime=drt', 'client'] |
145 RunCommand(*cmd, verbose=True) | 102 RunCommand(*cmd, verbose=True) |
146 | 103 |
147 # TODO(jimhug): Consider adding co19 back when it delivers more value | 104 # Run frog on most of the tests. |
148 # than pain. | 105 cmd = test_cmd + ['--compiler=frog', '--runtime=d8', |
149 # Run frogsh on most of the tests. | |
150 cmd = test_cmd + ['--compiler=frogsh', '--runtime=d8', | |
151 'language', 'corelib', | 106 'language', 'corelib', |
152 'isolate', 'peg', 'frog', 'css', 'frog_native'] | 107 'isolate', 'peg', 'frog', 'css', 'frog_native'] |
153 RunCommand(*cmd, verbose=True) | 108 RunCommand(*cmd, verbose=True) |
154 | 109 |
155 # Run the "utils" tests which includes dartdoc. Frog/leg changes often | 110 # Run the "utils" tests which includes dartdoc. Frog/leg changes often |
156 # break dartdoc and this tries to catch those. | 111 # break dartdoc and this tries to catch those. |
157 cmd = test_cmd + ['--compiler=none', '--runtime=vm', 'utils'] | 112 cmd = test_cmd + ['--compiler=none', '--runtime=vm', 'utils'] |
158 RunCommand(*cmd, verbose=True) | 113 RunCommand(*cmd, verbose=True) |
159 | 114 |
160 # Run leg unit tests. | 115 # Run leg unit tests. |
(...skipping 11 matching lines...) Expand all Loading... |
172 cmd = test_cmd + ['--compiler=dart2js', '--runtime=d8,drt'] | 127 cmd = test_cmd + ['--compiler=dart2js', '--runtime=d8,drt'] |
173 RunCommand(*cmd, verbose=True) | 128 RunCommand(*cmd, verbose=True) |
174 | 129 |
175 | 130 |
176 if __name__ == '__main__': | 131 if __name__ == '__main__': |
177 try: | 132 try: |
178 sys.exit(main()) | 133 sys.exit(main()) |
179 except Error as e: | 134 except Error as e: |
180 sys.stderr.write('%s\n' % e) | 135 sys.stderr.write('%s\n' % e) |
181 sys.exit(1) | 136 sys.exit(1) |
OLD | NEW |