OLD | NEW |
---|---|
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # | 2 # |
3 # Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 3 # Copyright (c) 2014, 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 | 7 |
8 # A script that copies a core file and binary to GCS | 8 # A script that copies a core file and binary to GCS |
9 # We expect the dumps to be located in /tmp/coredump_PID directory | 9 # We expect the dumps to be located in /tmp/coredump_PID directory |
10 # After we copy out the core files we delete the dumps localy | 10 # After we copy out the core files we delete the dumps localy |
(...skipping 17 matching lines...) Expand all Loading... | |
28 | 28 |
29 def CopyToGCS(filename): | 29 def CopyToGCS(filename): |
30 gs_location = 'gs://%s/%s/' % (GCS_FOLDER, uuid.uuid4()) | 30 gs_location = 'gs://%s/%s/' % (GCS_FOLDER, uuid.uuid4()) |
31 cmd = [GSUTIL, 'cp', filename, gs_location] | 31 cmd = [GSUTIL, 'cp', filename, gs_location] |
32 print 'Running command: %s' % cmd | 32 print 'Running command: %s' % cmd |
33 subprocess.check_call(cmd) | 33 subprocess.check_call(cmd) |
34 archived_filename = '%s%s' % (gs_location, filename.split('/').pop()) | 34 archived_filename = '%s%s' % (gs_location, filename.split('/').pop()) |
35 print 'Dump now available in %s' % archived_filename | 35 print 'Dump now available in %s' % archived_filename |
36 | 36 |
37 def TEMPArchiveBuild(): | 37 def TEMPArchiveBuild(): |
38 d = '/b/build/slave/vm-linux-debug-x64-asan-be/build/dart/out/DebugX64/dart' | 38 if not 'PWD' in os.environ: |
39 CopyToGCS(d) | 39 return |
40 pwd = os.environ['PWD'] | |
41 if not 'vm-' in pwd: | |
42 return | |
43 if 'win' in pwd or 'release' in pwd: | |
44 return | |
45 CopyToGCS('%s/out/DebugX64/dart' % pwd) | |
ricow1
2015/02/12 06:54:59
fixing this, clearly wrong
| |
40 | 46 |
41 def Main(): | 47 def Main(): |
42 if 'PWD' in os.environ and 'x64-asan' in os.environ['PWD']: | 48 TEMPArchiveBuild() |
43 TEMPArchiveBuild() | |
44 if utils.GuessOS() != 'linux': | 49 if utils.GuessOS() != 'linux': |
45 print 'Currently only archiving crash dumps on linux' | 50 print 'Currently only archiving crash dumps on linux' |
46 return 0 | 51 return 0 |
47 print 'Looking for crash dumps' | 52 print 'Looking for crash dumps' |
48 num_dumps = 0 | 53 num_dumps = 0 |
49 for v in os.listdir('/tmp'): | 54 for v in os.listdir('/tmp'): |
50 if v.startswith('coredump'): | 55 if v.startswith('coredump'): |
51 fullpath = '/tmp/%s' % v | 56 fullpath = '/tmp/%s' % v |
52 if os.path.isdir(fullpath): | 57 if os.path.isdir(fullpath): |
53 num_dumps += 1 | 58 num_dumps += 1 |
54 tarname = '%s.tar.gz' % fullpath | 59 tarname = '%s.tar.gz' % fullpath |
55 CreateTarball(fullpath, tarname) | 60 CreateTarball(fullpath, tarname) |
56 CopyToGCS(tarname) | 61 CopyToGCS(tarname) |
57 os.unlink(tarname) | 62 os.unlink(tarname) |
58 shutil.rmtree(fullpath) | 63 shutil.rmtree(fullpath) |
59 print 'Found %s core dumps' % num_dumps | 64 print 'Found %s core dumps' % num_dumps |
60 | 65 |
61 if __name__ == '__main__': | 66 if __name__ == '__main__': |
62 sys.exit(Main()) | 67 sys.exit(Main()) |
OLD | NEW |