OLD | NEW |
---|---|
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 |
kustermann
2013/05/28 08:17:45
We should be able to remove this file. test.py no
Anton Muhin
2013/05/28 16:07:58
Agree, I thought about it as well, let me create a
| |
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 # For now we have to use this trampoline to turn --dart-flags command line | 5 # For now we have to use this trampoline to turn --dart-flags command line |
6 # switch into env variable DART_FLAGS. Eventually, DumpRenderTree should | 6 # switch into env variable DART_FLAGS. Eventually, Content shell should |
7 # support --dart-flags and this hack may go away. | 7 # support --dart-flags and this hack may go away. |
8 # | 8 # |
9 # Expected invocation: python drt-trampoline.py <path to DRT> <DRT command line> | 9 # Expected invocation: python drt-trampoline.py <path to DRT> <DRT command line> |
10 | 10 |
11 import optparse | 11 import optparse |
12 import os | 12 import os |
13 import signal | 13 import signal |
14 import subprocess | 14 import subprocess |
15 import sys | 15 import sys |
16 | 16 |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
125 print 'PASS' | 125 print 'PASS' |
126 print 'Expectation matches' | 126 print 'Expectation matches' |
127 else: | 127 else: |
128 # Generate a temporary file in the same place as the .html file: | 128 # Generate a temporary file in the same place as the .html file: |
129 out_file = test_file[:test_file.rfind('.html')] + out_expected_file[-4:] | 129 out_file = test_file[:test_file.rfind('.html')] + out_expected_file[-4:] |
130 with open(out_file, 'w') as f: | 130 with open(out_file, 'w') as f: |
131 f.write(output) | 131 f.write(output) |
132 print 'FAIL' | 132 print 'FAIL' |
133 print 'Expectation didn\'t match.\n' | 133 print 'Expectation didn\'t match.\n' |
134 if len(output) == 0: | 134 if len(output) == 0: |
135 print ('\033[31mERROR\033[0m: DumpRenderTree generated an empty pixel ' | 135 print ('\033[31mERROR\033[0m: Content shell generated an empty pixel ' |
136 'output! This is commonly an error in executing DumpRenderTree, and' | 136 'output! This is commonly an error in executing content shell, and' |
137 ' not that expectations are out of date.\n') | 137 ' not that expectations are out of date.\n') |
138 print 'You can update expectations by running:\n' | 138 print 'You can update expectations by running:\n' |
139 print 'cp %s %s\n' % (out_file, out_expected_file) | 139 print 'cp %s %s\n' % (out_file, out_expected_file) |
140 print '#EOF' | 140 print '#EOF' |
141 | 141 |
142 if __name__ == '__main__': | 142 if __name__ == '__main__': |
143 try: | 143 try: |
144 sys.exit(main(sys.argv)) | 144 sys.exit(main(sys.argv)) |
145 except StandardError as e: | 145 except StandardError as e: |
146 print 'Fail: ' + str(e) | 146 print 'Fail: ' + str(e) |
147 sys.exit(1) | 147 sys.exit(1) |
OLD | NEW |