| OLD | NEW |
| 1 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 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 # This file contains a set of utilities functions used by other Python-based | 5 # This file contains a set of utilities functions used by other Python-based |
| 6 # scripts. | 6 # scripts. |
| 7 | 7 |
| 8 import commands | 8 import commands |
| 9 import contextlib | 9 import contextlib |
| 10 import datetime | 10 import datetime |
| (...skipping 678 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 689 os.chdir(self._working_directory) | 689 os.chdir(self._working_directory) |
| 690 | 690 |
| 691 def __exit__(self, *_): | 691 def __exit__(self, *_): |
| 692 print "Enter directory = ", self._old_cwd | 692 print "Enter directory = ", self._old_cwd |
| 693 os.chdir(self._old_cwd) | 693 os.chdir(self._old_cwd) |
| 694 | 694 |
| 695 | 695 |
| 696 class UnexpectedCrash(object): | 696 class UnexpectedCrash(object): |
| 697 def __init__(self, test, pid, binary): | 697 def __init__(self, test, pid, binary): |
| 698 self.test = test | 698 self.test = test |
| 699 self.pid = pid | 699 self.pid = pid |
| 700 self.binary = binary | 700 self.binary = binary |
| 701 | 701 |
| 702 def __str__(self): | 702 def __str__(self): |
| 703 return "%s: %s %s" % (self.test, self.binary, self.pid) | 703 return "%s: %s %s" % (self.test, self.binary, self.pid) |
| 704 | 704 |
| 705 | 705 |
| 706 class PosixCoredumpEnabler(object): | 706 class PosixCoredumpEnabler(object): |
| 707 def __init__(self): | 707 def __init__(self): |
| 708 self._old_limits = None | 708 self._old_limits = None |
| 709 | 709 |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 842 missing = [] | 842 missing = [] |
| 843 for crash in crashes: | 843 for crash in crashes: |
| 844 files.add(crash.binary) | 844 files.add(crash.binary) |
| 845 core = self._find_coredump_file(crash) | 845 core = self._find_coredump_file(crash) |
| 846 if core: | 846 if core: |
| 847 files.add(core) | 847 files.add(core) |
| 848 else: | 848 else: |
| 849 missing.append(crash) | 849 missing.append(crash) |
| 850 self._upload(files) | 850 self._upload(files) |
| 851 if missing: | 851 if missing: |
| 852 raise Exception('Missing crash dumps for: %s' % ', '.join(missing)) | 852 raise Exception('Missing crash dumps for: %s' % ', '.join( |
| 853 [str(c) for c in missing])) |
| 853 | 854 |
| 854 def _upload(self, files): | 855 def _upload(self, files): |
| 855 bot_utils = GetBotUtils() | 856 bot_utils = GetBotUtils() |
| 856 gsutil = bot_utils.GSUtil() | 857 gsutil = bot_utils.GSUtil() |
| 857 storage_path = '%s/%s/' % (self._bucket, uuid.uuid4()) | 858 storage_path = '%s/%s/' % (self._bucket, uuid.uuid4()) |
| 858 gs_prefix = 'gs://%s' % storage_path | 859 gs_prefix = 'gs://%s' % storage_path |
| 859 http_prefix = 'https://storage.cloud.google.com/%s' % storage_path | 860 http_prefix = 'https://storage.cloud.google.com/%s' % storage_path |
| 860 | 861 |
| 861 print '\n--- Uploading into %s (%s) ---' % (gs_prefix, http_prefix) | 862 print '\n--- Uploading into %s (%s) ---' % (gs_prefix, http_prefix) |
| 862 for file in files: | 863 for file in files: |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 962 return contextlib.nested(WindowsCoredumpEnabler(), | 963 return contextlib.nested(WindowsCoredumpEnabler(), |
| 963 WindowsCoreDumpArchiver()) | 964 WindowsCoreDumpArchiver()) |
| 964 else: | 965 else: |
| 965 # We don't have support for MacOS yet. | 966 # We don't have support for MacOS yet. |
| 966 assert osname == 'macos' | 967 assert osname == 'macos' |
| 967 return NooptCoreDumpArchiver() | 968 return NooptCoreDumpArchiver() |
| 968 | 969 |
| 969 if __name__ == "__main__": | 970 if __name__ == "__main__": |
| 970 import sys | 971 import sys |
| 971 Main() | 972 Main() |
| OLD | NEW |