| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 # Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 2 # Copyright (c) 2013, 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 shutil |
| 7 import sys | 8 import sys |
| 9 import tempfile |
| 8 | 10 |
| 9 import bot | 11 import bot |
| 10 | 12 |
| 13 class TempDir(object): |
| 14 def __enter__(self): |
| 15 self._temp_dir = tempfile.mkdtemp('eclipse-workspace') |
| 16 return self._temp_dir |
| 17 |
| 18 def __exit__(self, *_): |
| 19 shutil.rmtree(self._temp_dir, ignore_errors = True) |
| 20 |
| 11 def GetEditorExecutable(mode, arch): | 21 def GetEditorExecutable(mode, arch): |
| 12 configuration_dir = mode + arch.upper() | 22 configuration_dir = mode + arch.upper() |
| 13 linux_path = os.path.join('out', configuration_dir, 'editor') | 23 linux_path = os.path.join('out', configuration_dir, 'editor') |
| 14 win_path = os.path.join('build', configuration_dir, 'editor') | 24 win_path = os.path.join('build', configuration_dir, 'editor') |
| 15 mac_path = os.path.join('xcodebuild', configuration_dir, 'editor') | 25 mac_path = os.path.join('xcodebuild', configuration_dir, 'editor') |
| 16 | 26 |
| 17 if sys.platform == 'darwin': | 27 if sys.platform == 'darwin': |
| 18 executable = os.path.join('DartEditor.app', 'Contents', 'MacOS', | 28 executable = os.path.join('DartEditor.app', 'Contents', 'MacOS', |
| 19 'DartEditor') | 29 'DartEditor') |
| 20 # TODO(kustermann,ricow): Maybe we're able to get rid of this in the future. | 30 # TODO(kustermann,ricow): Maybe we're able to get rid of this in the future. |
| (...skipping 22 matching lines...) Expand all Loading... |
| 43 with bot.BuildStep('Build Editor %s' % arch): | 53 with bot.BuildStep('Build Editor %s' % arch): |
| 44 args = [sys.executable, build_py, | 54 args = [sys.executable, build_py, |
| 45 '-mrelease', '--arch=%s' % arch, 'editor'] | 55 '-mrelease', '--arch=%s' % arch, 'editor'] |
| 46 print 'Running: %s' % (' '.join(args)) | 56 print 'Running: %s' % (' '.join(args)) |
| 47 sys.stdout.flush() | 57 sys.stdout.flush() |
| 48 bot.RunProcess(args) | 58 bot.RunProcess(args) |
| 49 | 59 |
| 50 for arch in test_architectures: | 60 for arch in test_architectures: |
| 51 editor_executable = GetEditorExecutable('Release', arch) | 61 editor_executable = GetEditorExecutable('Release', arch) |
| 52 with bot.BuildStep('Test Editor %s' % arch): | 62 with bot.BuildStep('Test Editor %s' % arch): |
| 53 args = [editor_executable, '--test', '--auto-exit'] | 63 with TempDir() as temp_dir: |
| 54 print 'Running: %s' % (' '.join(args)) | 64 args = [editor_executable, '--test', '--auto-exit', '-data', temp_dir] |
| 55 sys.stdout.flush() | 65 print 'Running: %s' % (' '.join(args)) |
| 56 bot.RunProcess(args) | 66 sys.stdout.flush() |
| 67 bot.RunProcess(args) |
| 57 return 0 | 68 return 0 |
| 58 | 69 |
| 59 if __name__ == '__main__': | 70 if __name__ == '__main__': |
| 60 try: | 71 try: |
| 61 sys.exit(main()) | 72 sys.exit(main()) |
| 62 except OSError as e: | 73 except OSError as e: |
| 63 sys.exit(e.errno) | 74 sys.exit(e.errno) |
| OLD | NEW |