OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 2 # Copyright (c) 2011, 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 os | 6 import os |
7 import subprocess | 7 import subprocess |
8 import sys | 8 import sys |
9 import time | 9 import time |
10 | 10 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 vmdone = time.time() | 55 vmdone = time.time() |
56 elapsed = vmdone - start | 56 elapsed = vmdone - start |
57 print 'Compiling on Dart VM took \033[1m%s\033[0m seconds' % elapsed | 57 print 'Compiling on Dart VM took \033[1m%s\033[0m seconds' % elapsed |
58 RunCommand('./frogsh', '--out=frogsh', 'frog.dart', 'tests/hello.dart') | 58 RunCommand('./frogsh', '--out=frogsh', 'frog.dart', 'tests/hello.dart') |
59 elapsed = time.time() - vmdone | 59 elapsed = time.time() - vmdone |
60 size = os.path.getsize('./frogsh') / 1024 | 60 size = os.path.getsize('./frogsh') / 1024 |
61 print 'Bootstrapping took \033[1m%s\033[0m seconds' % elapsed | 61 print 'Bootstrapping took \033[1m%s\033[0m seconds' % elapsed |
62 print 'Generated frogsh is \033[1m%d\033[0m kB' % size | 62 print 'Generated frogsh is \033[1m%d\033[0m kB' % size |
63 | 63 |
64 RunCommand('../tools/build.py', '--mode=release') | 64 RunCommand('../tools/build.py', '--mode=release') |
65 test_cmd = ['../tools/test.py', '--component=frog,frogsh', | 65 test_cmd = ['../tools/test.py', '--component=frog,frogsh,leg', |
66 '--report', '--timeout=5', '--progress=color', | 66 '--report', '--timeout=5', '--progress=color', |
67 '--mode=release'] | 67 '--mode=release'] |
68 if args[1:]: | 68 if args[1:]: |
69 test_cmd.extend(args[1:]) | 69 test_cmd.extend(args[1:]) |
70 else: | 70 else: |
71 test_cmd.extend(['language', 'corelib', 'leg', 'peg']) | 71 test_cmd.extend(['language', 'corelib', 'leg', 'peg']) |
72 RunCommand(*test_cmd, verbose=True) | 72 RunCommand(*test_cmd, verbose=True) |
| 73 |
73 leg_test_dir = os.path.join('leg', 'tests') | 74 leg_test_dir = os.path.join('leg', 'tests') |
74 for current_dir, directories, filenames in os.walk(leg_test_dir): | 75 for current_dir, directories, filenames in os.walk(leg_test_dir): |
75 for filename in filenames: | 76 for filename in filenames: |
76 if filename.endswith('.dart'): | 77 if filename.endswith('.dart'): |
77 pattern = 'info: [leg] compilation succeeded' | 78 pattern = 'info: [leg] compilation succeeded' |
78 node_exit_code = 0 | 79 node_exit_code = 0 |
79 vm_exit_code = 0 | 80 vm_exit_code = 0 |
80 if filename == 'empty.dart': | 81 if filename == 'empty.dart': |
81 pattern = 'info: [leg] compiler cancelled: Could not find main' | 82 pattern = 'info: [leg] compiler cancelled: Could not find main' |
82 node_exit_code = 1 | 83 node_exit_code = 1 |
83 vm_exit_code = 255 # Sigh. | 84 vm_exit_code = 255 # Sigh. |
84 filename = os.path.join(current_dir, filename) | 85 filename = os.path.join(current_dir, filename) |
85 frog_bin = os.path.join('.', 'frogsh') | 86 frog_bin = os.path.join('.', 'frogsh') |
86 RunCommand(frog_bin, '--enable_leg', '--verbose', '--throw_on_errors', | 87 RunCommand(frog_bin, '--enable_leg', '--verbose', '--throw_on_errors', |
87 filename, pattern=pattern, exit_code=node_exit_code) | 88 filename, pattern=pattern, exit_code=node_exit_code) |
88 frog_bin = os.path.join('.', 'frog.py') | 89 frog_bin = os.path.join('.', 'frog.py') |
89 RunCommand(frog_bin, | 90 RunCommand(frog_bin, |
90 '--vm_flags=--enable_type_checks --enable_asserts', | 91 '--vm_flags=--enable_type_checks --enable_asserts', |
91 '--', '--enable_leg', '--verbose', '--throw_on_errors', | 92 '--', '--enable_leg', '--verbose', '--throw_on_errors', |
92 filename, pattern=pattern, exit_code=vm_exit_code) | 93 filename, pattern=pattern, exit_code=vm_exit_code) |
93 | 94 |
94 if __name__ == '__main__': | 95 if __name__ == '__main__': |
95 try: | 96 try: |
96 sys.exit(main(sys.argv)) | 97 sys.exit(main(sys.argv)) |
97 except Error as e: | 98 except Error as e: |
98 sys.stderr.write('%s\n' % e) | 99 sys.stderr.write('%s\n' % e) |
99 sys.exit(1) | 100 sys.exit(1) |
OLD | NEW |