OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 | 2 |
3 import glob | 3 import glob |
4 import os | 4 import os |
5 import os.path | 5 import os.path |
6 import platform | 6 import platform |
7 import re | 7 import re |
8 import subprocess | 8 import subprocess |
9 import sys | 9 import sys |
10 | 10 |
| 11 # Compile the Dart dromaeo test down to JavaScript, and also insert two scripts |
| 12 # that enable us to run this test as a browser test with the Dart browser |
| 13 # controller. |
| 14 |
11 SAMPLES_PATH = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(_
_file__)))) | 15 SAMPLES_PATH = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(_
_file__)))) |
12 DART_PATH = os.path.dirname(SAMPLES_PATH) | 16 DART_PATH = os.path.dirname(SAMPLES_PATH) |
13 TOOLS_PATH = os.path.join(DART_PATH, 'tools') | 17 TOOLS_PATH = os.path.join(DART_PATH, 'tools') |
14 | 18 |
15 sys.path.append(TOOLS_PATH) | 19 sys.path.append(TOOLS_PATH) |
16 import utils | 20 import utils |
17 | 21 |
18 EXECUTABLE_MAP = { | |
19 'frog': 'frogc', | |
20 'dart2js': 'dart2js' | |
21 } | |
22 | |
23 def Compile(source, target, compiler): | 22 def Compile(source, target, compiler): |
24 executable = EXECUTABLE_MAP[compiler] | 23 executable = 'dart2js' |
25 binary = os.path.abspath(os.path.join(DART_PATH, | 24 binary = os.path.abspath(os.path.join(DART_PATH, |
26 utils.GetBuildRoot(utils.GuessOS(), | 25 utils.GetBuildRoot(utils.GuessOS(), |
27 'release', 'ia32'), | 26 'release', 'ia32'), |
28 'dart-sdk', 'bin', executable)) | 27 'dart-sdk', 'bin', executable)) |
29 | 28 |
30 cmd = [binary, '--out=' + target] | 29 cmd = [binary, '--out=' + target] |
31 cmd.append(source) | 30 cmd.append(source) |
32 print 'Executing: ' + ' '.join(cmd) | 31 print 'Executing: ' + ' '.join(cmd) |
33 if platform.system() == "Windows": | 32 if platform.system() == "Windows": |
34 subprocess.call(cmd, shell=True) | 33 subprocess.call(cmd, shell=True) |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 | 68 |
70 if head == 'tests': | 69 if head == 'tests': |
71 os.chdir('..') | 70 os.chdir('..') |
72 | 71 |
73 # Compile individual html tests. | 72 # Compile individual html tests. |
74 tests = glob.glob('tests/dom-*-html.html') | 73 tests = glob.glob('tests/dom-*-html.html') |
75 | 74 |
76 for test in tests: | 75 for test in tests: |
77 HtmlConvert(test, 'dart2js') | 76 HtmlConvert(test, 'dart2js') |
78 | 77 |
| 78 # Update index.html to run as a performance test with the dart browser |
| 79 # controller. Output the result as index-dart.html. |
| 80 with open('index.html', 'r') as infile: |
| 81 with open('index-dart.html', 'w') as outfile: |
| 82 for line in infile: |
| 83 if re.search('<script src="../../../pkg/browser/lib/dart.js">', line): |
| 84 line += (' <script src="../../../tools/testing/dart/test_controller' + |
| 85 '.js"></script>\n <script src="../../../tools/testing/dart/' + |
| 86 'perf_test_controller.js"></script>\n') |
| 87 outfile.write(line) |
| 88 |
79 # Compile driver to index-js.html. | 89 # Compile driver to index-js.html. |
80 HtmlConvert('index.html', 'dart2js') | 90 HtmlConvert('index-dart.html', 'dart2js') |
| 91 os.rename('index-dart-js.html', 'index-js.html') |
OLD | NEW |