Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # | 2 # |
| 3 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 3 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 4 # for details. All rights reserved. Use of this source code is governed by a | 4 # for details. All rights reserved. Use of this source code is governed by a |
| 5 # BSD-style license that can be found in the LICENSE file. | 5 # BSD-style license that can be found in the LICENSE file. |
| 6 | 6 |
| 7 import glob | 7 import glob |
| 8 import optparse | 8 import optparse |
| 9 import os | 9 import os |
| 10 import re | 10 import re |
| (...skipping 748 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 759 | 759 |
| 760 with open(checksum_filename, 'w') as f: | 760 with open(checksum_filename, 'w') as f: |
| 761 f.write('%s *%s' % (checksum, os.path.basename(filename))) | 761 f.write('%s *%s' % (checksum, os.path.basename(filename))) |
| 762 | 762 |
| 763 return checksum_filename | 763 return checksum_filename |
| 764 | 764 |
| 765 | 765 |
| 766 def RunEditorTests(buildout, buildos): | 766 def RunEditorTests(buildout, buildos): |
| 767 StartBuildStep('run_tests') | 767 StartBuildStep('run_tests') |
| 768 | 768 |
| 769 for editorArchive in _FindRcpZipFiles(buildout): | 769 for editorArchive in _GetTestableRcpArchives(buildout): |
| 770 if (editorArchive.endswith('_64.zip')): | 770 with utils.TempDir('editor_') as tempDir: |
| 771 with utils.TempDir('editor_') as tempDir: | 771 print 'Running tests for %s...' % editorArchive |
| 772 print 'Running tests for %s...' % editorArchive | |
| 773 | 772 |
| 774 zipper = ziputils.ZipUtil(join(buildout, editorArchive), buildos) | 773 zipper = ziputils.ZipUtil(join(buildout, editorArchive), buildos) |
| 775 zipper.UnZip(tempDir) | 774 zipper.UnZip(tempDir) |
| 776 | 775 |
| 777 editorExecutable = GetEditorExecutable(join(tempDir, 'dart')) | 776 editorExecutable = GetEditorExecutable(join(tempDir, 'dart')) |
| 778 args = [editorExecutable, '-consoleLog', '--test', '--auto-exit', | 777 args = [editorExecutable, '--test', '--auto-exit', |
| 779 '-data', join(tempDir, 'workspace')] | 778 '-data', join(tempDir, 'workspace')] |
| 780 if sys.platform == 'linux': | 779 if sys.platform == 'linux': |
| 781 args = ['xvfb-run', '-a'] + args | 780 args = ['xvfb-run', '-a'] + args |
| 782 if (subprocess.call(args, shell=IsWindows())): | 781 # this can hang if a 32 bit jvm is not available on windows... |
| 783 BuildStepFailure() | 782 if (subprocess.call(args, shell=IsWindows())): |
|
kustermann
2013/07/17 13:47:06
No need for outermost '(', ')'.
devoncarew
2013/07/17 16:29:49
Done.
| |
| 783 BuildStepFailure() | |
| 784 | |
| 785 | |
| 786 # Return x86_64.zip (64 bit) on mac and linux; x86.zip (32 bit) on windows | |
| 787 def _GetTestableRcpArchives(buildout): | |
| 788 result = [] | |
| 789 | |
| 790 for archive in _FindRcpZipFiles(buildout): | |
| 791 if IsWindows() and archive.endswith('x86.zip'): | |
| 792 result.append(archive) | |
| 793 elif not IsWindows() and archive.endswith('x86_64.zip'): | |
| 794 result.append(archive) | |
| 795 | |
| 796 return result | |
| 784 | 797 |
| 785 | 798 |
| 786 def GetEditorExecutable(editorDir): | 799 def GetEditorExecutable(editorDir): |
| 787 if sys.platform == 'darwin': | 800 if sys.platform == 'darwin': |
| 788 executable = join('DartEditor.app', 'Contents', 'MacOS', 'DartEditor') | 801 executable = join('DartEditor.app', 'Contents', 'MacOS', 'DartEditor') |
| 789 elif sys.platform == 'win32': | 802 elif sys.platform == 'win32': |
| 790 executable = 'DartEditor.exe' | 803 executable = 'DartEditor.exe' |
| 791 else: | 804 else: |
| 792 executable = 'DartEditor' | 805 executable = 'DartEditor' |
| 793 return join(editorDir, executable) | 806 return join(editorDir, executable) |
| (...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1074 """delete the given file - do not re-throw any exceptions that occur""" | 1087 """delete the given file - do not re-throw any exceptions that occur""" |
| 1075 if os.path.exists(f): | 1088 if os.path.exists(f): |
| 1076 try: | 1089 try: |
| 1077 os.remove(f) | 1090 os.remove(f) |
| 1078 except OSError: | 1091 except OSError: |
| 1079 print 'error deleting %s' % f | 1092 print 'error deleting %s' % f |
| 1080 | 1093 |
| 1081 | 1094 |
| 1082 if __name__ == '__main__': | 1095 if __name__ == '__main__': |
| 1083 sys.exit(main()) | 1096 sys.exit(main()) |
| OLD | NEW |